Facebook Twitter Instagram
    DeepCrazyWorld
    Facebook Twitter Instagram Pinterest YouTube
    • FLUTTER
      • FLUTTER APP
        • QRCode
        • Quiz App
        • Chat GPT
        • PDF App
        • News App
        • Fitness App
        • Weather App
        • BMI Calculator
        • GAME APP
        • Ecommerce App
        • wallpaper App
        • Finance app
        • Chat App
        • Wallet App
        • Taxi App
        • Quran app
        • Music player app
      • FLUTTER UI
        • Splash Screen
        • Onboarding Screen
        • Login Screen
        • Card Design
        • Drawer
    • PROJECT
      • Android Projects
      • College Projects
      • FLUTTER APP
      • Project Ideas
      • PHP Projects
      • Python Projects
    • SOURCE CODE
    • ANDROID
      • ANDROID APP
      • GAME APP
      • ANDROID STUDIO
    • MCQ
      • AKTU MCQ
        • RPA MCQ
        • COA MCQ
        • HPC MCQ
        • SPM MCQ
        • Renewable Energy All MCQ
        • Data Compression MCQ
        • Data Structure MCQ
        • Digital Image Processing MCQ
        • Software Engineering MCQ
        • Machine Learning MCQ
        • Artificial Intelligence MCQ
      • D PHARMA MCQ
        • Pharmaceutics – I MCQ
        • Pharmacognosy MCQ
        • Pharmaceutical Chemistry MCQ
        • Biochemistry and Clinical Pathology MCQ
        • Human Anatomy and Physiology MCQ
        • Heath Education and Community Pharmacy MCQ
    • INTERVIEW QUESTIONS
      • Flutter Interview Questions
      • INTERVIEW QUESTIONS
      • Python Interview Questions
      • Coding ninjas solution
    • MORE
      • WORDPRESS
        • SEO
        • TOP 10 WORDPRESS THEME
      • PRODUCTIVITY
      • Program
      • QUOTES
    DeepCrazyWorld
    Home»Card Design»Flutter Card Widget with Example Tutorial 2023
    Card Design

    Flutter Card Widget with Example Tutorial 2023

    DeepikaBy DeepikaJune 16, 2022Updated:February 19, 2023No Comments5 Mins Read

    Flutter Card Widget with Example – In this tutorial we will learn how to use card in flutter with example. Learn how to customize it’s look by styling it with different properties.

    Table of Contents

    Toggle
    • Flutter Card Widget
    • Creating And Showing Card In Flutter
      • Flutter Card Properties
      • color / backgroundColor
      • elevation
      • shadowColor
      • shape
      • margin
      • rounded corners
      • border and border color
      • circular card
    • Flutter Card Example
    • Additional Reading
    • Related Articles:
    • READ MORE

    Flutter Card Widget

    Card widget in flutter is a sheet of Material used to represent all the similar information in a single block. For example, a card can be used to design an album cover as it will represent all the songs that belong to that album. A card will have rounded corners and is elevated by default. We can change the value of elevation as per our requirement. While designing a card we can use elements like text, images, videos, text buttons etc. Cards make the application UI more beautiful and eye-catching to the user.

    Creating And Showing Card In Flutter

    <img decoding=

    To create and display a card in flutter we have to call the constructor of the card class provided by flutter. There are no required properties for a card widget but to show the card we have to provide the child property with a widget. Without providing the child with a widget we cannot see the card.

    Flutter Card Constructor :

    Card(
        {Key? key,
        Color? color,
        Color? shadowColor,
        double? elevation,
        ShapeBorder? shape,
        bool borderOnForeground,
        EdgeInsetsGeometry? margin,
        Clip? clipBehavior,
        Widget? child,
        bool semanticContainer}
    ) 

    Below is the example code to add a card to our flutter application.

    Card(
            child: ListTile(
              title: Text("Codesinsider.com"),
            ),
         )

    Flutter Card Properties

    The properties of the card widget are:

    • color
    • elevation
    • shadowColor
    • shape
    • margin

    color / backgroundColor

    We will use this property to change the background color of the card. It takes Color as value.

    Card(
              child: ListTile(
                title: Text("Codesinsider.com", style: TextStyle(color: Colors.white),),
              ),
              color: Colors.green,
            )

    elevation

    We will use this property to add or change elevation of the card. It takes double as value.

    Card(
              child: ListTile(
                title: Text("Codesinsider.com"),
              ),
              elevation: 8,
            )

    shadowColor

    To change the color of the shadow that appears when the card is elevated we will use shadow color property. It takes color as value.

    Card(
              child: ListTile(
                title: Text("Codesinsider.com"),
              ),
              elevation: 8,
              shadowColor: Colors.green,
            )

    shape

    To change the shape of the card we will use this property. By using shape property we can add border, change border color, make rounded corners, circular card etc. In the below example i’ m using BeveledRectangleBorder shape. If you want to try other shapes.

    Card(
              child: ListTile(
                title: Text("Codesinsider.com"),
              ),
              elevation: 8,
              shadowColor: Colors.green,
              shape: BeveledRectangleBorder(
                  borderRadius: BorderRadius.circular(15)
              ),
            )

    margin

    To provide margin to card we will use this property. It takes Edge Insets Geometry as value.

    Card(
              child: ListTile(
                //leading: Icon(Icons.music_note),
                title: Text("Codesinsider.com"),
              ),
              elevation: 8,
              shadowColor: Colors.green,
              margin: EdgeInsets.all(20),
            )

    Container(
              height: 200,
              width: 200,
              child: Card(
                child: ListTile(
                  title: Text("Codesinsider.com"),
                ),
                elevation: 8,
                shadowColor: Colors.green,
                margin: EdgeInsets.all(20),
              ),
            )

    rounded corners

    There is no property available for making rounded corners so we will use shape property to make rounded corners.

    Card(
              child: ListTile(
                title: Text("Codesinsider.com"),
              ),
              elevation: 8,
              shadowColor: Colors.green,
              margin: EdgeInsets.all(20),
              shape:  OutlineInputBorder(
                  borderRadius: BorderRadius.circular(10), 
                  borderSide: BorderSide(color: Colors.white)
              ),
            )

    border and border color

    To add border and border color i’ ve used outlineInputBorder since there is no property in card widget to add border and border color. To try other shapes and borders for refere

    Card(
              child: ListTile(
                title: Text("Codesinsider.com"),
              ),
              elevation: 8,
              shadowColor: Colors.green,
              margin: EdgeInsets.all(20),
              shape:  OutlineInputBorder(
                  borderRadius: BorderRadius.circular(10),
                  borderSide: BorderSide(color: Colors.green, width: 1)
              ),
            )

    circular card

    To make a circular card we will use CircleBorder shape.

    Card(
              child: Container(
                height: 160,
                width: 160,
                child: Center(
                  child: ListTile(
                    title: Text("Codesinsider.com"),
                  ),
                ),
              ),
              elevation: 8,
              shadowColor: Colors.green,
              margin: EdgeInsets.all(20),
              shape: CircleBorder(side: BorderSide(width: 1, color: Colors.white),
              ),
            )

    Flutter Card Example

    Let’s see an example where we design a music album card with white background color, an image to left and some text in the right. Below the text we will add two Text buttons play and add to queue.

    import 'package:flutter/cupertino.dart';
    import 'package:flutter/material.dart';
    import 'package:flutter/widgets.dart';
    import 'package:flutter_app_learning/NavDrawer.dart';
    import 'package:flutter_app_learning/contact.dart';
    void main()
    {
      runApp(MyApp());
    }
     
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Learning',
          theme: ThemeData(
            primarySwatch: Colors.green,
          ),
          home: MyHomePage(),
        );
      }
    }
     
    class MyHomePage extends StatefulWidget {
      @override
      _MyHomePageState createState()
      {
        return _MyHomePageState();
      }
    }
     
    class _MyHomePageState extends State<MyHomePage> {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text("Flutter Card"),
          ),
            body:Card(
              child:Container(
                height: 100,
                color: Colors.white,
                child: Row(
                  children: [
                    Center(
                      child: Padding(
                        padding: EdgeInsets.all(10),
                        child: Expanded(
                          child:Image.asset("assets/images/shape_of_you.png"),
                          flex:2 ,
                        ),
                      ),
                    ),
                    Expanded(
                      child:Container(
                        alignment: Alignment.topLeft,
                        child: Column(
                          children: [
                            Expanded(
                              flex: 5,
                              child: ListTile(
                                title: Text("Shape Of You"),
                                subtitle: Text("Ed Sheeran"),
                              ),
                            ),
                            Expanded(
                              flex: 5,
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.end,
                                children: [
                                  TextButton(
                                    child:Text("PLAY"),
                                    onPressed: ()
                                    {},
                                  ),
                                  SizedBox(width: 8,),
                                  TextButton(
                                    child: Text("ADD TO QUEUE"),
                                    onPressed: (){},
                                  ),
                                  SizedBox(width: 8,)
                                ],
                              ),
                            )
                          ],
                        ),
                      ),
                      flex:8 ,
                    ),
                  ],
                ),
              ),
              elevation: 8,
              margin: EdgeInsets.all(10),
            ),
        );
      }
    }

    Output :

    That brings an end to the tutorial on how to create and display or show Card in flutter. We have also seen an example where we’ve used Card widget and customized it. Let’s catch up with some other widget in the next post. Have a great day!!

    Do like & share my Facebook page. Subscribe to newsletter if you find this post helpful. Thank you!!

    How to Setup Space Between Elements In Flutter 2023

    Additional Reading

    Do like & share my Facebook page. if you find this post helpful. Thank you!!

    Related Articles:

    • How to Install Flutter in windows 10 | With videos guide
    • How to Setup Space Between Elements In Flutter 
    • Integrating an API into a Flutter – Working with REST APIs
    • Create a simple splash screen in Flutter
    • Android Projects with Source Code
    • Flutter Interview Questions
    • School Database Management System Project 

    READ MORE

    If you found this post useful, don’t forget to share this with your friends, and if you have any query feel free to comment it in the comment section.

    Thank you 🙂 Keep Learning !

    Share. Facebook Twitter LinkedIn WhatsApp Telegram Pinterest Reddit Email
    Previous ArticleTop ways to improve Google PageSpeed on WordPress
    Next Article How to create a simple splash screen in Flutter 2023

    Related Posts

    Implementing a Dynamic FAQ Screen UI in Flutter Using ExpansionTile

    FLUTTER 5 Mins Read

    Creating an Instruction UI Screen in Flutter Application

    FLUTTER UI 7 Mins Read

    Animated Backgrounds in Flutter: A Complete Guide

    FLUTTER 4 Mins Read

    How to make ListView Builder Ui in flutter with Source Code

    FLUTTER UI 5 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • Implementing a Dynamic FAQ Screen UI in Flutter Using ExpansionTile March 29, 2025
    • Creating an Instruction UI Screen in Flutter Application March 29, 2025
    • Animated Backgrounds in Flutter: A Complete Guide March 15, 2025
    • How to make Diary App using flutter stepwise using getx August 31, 2024
    • How to Create Music Player UI screen with fully functional in flutter August 30, 2024
    • How to make ListView Builder Ui in flutter with Source Code August 29, 2024
    • Create a TabBar View in flutter with fully functional stepwise August 28, 2024
    • How to create TabBar view in flutter with source code step wise August 27, 2024
    • How to make Heart rate measure app with Flutter stepwise August 26, 2024
    • How to make ChatGpt App in flutter with source code Stepwise August 25, 2024
    Facebook Twitter Instagram Pinterest YouTube
    • About
    • Contact
    • Disclaimer
    • Privacy Policy
    Copyright by DeepCrazyWorld © 2025

    Type above and press Enter to search. Press Esc to cancel.