Flutter Card Widget – Card UI Design Example



The Card widget has a simple constructor that takes a child widget, an optional elevation, margin, shape, and color as parameters. The child widget can be any widget that you want to display inside the card, such as an image, text, or column.

The elevation parameter controls the height of the card relative to its parent and affects the size of the shadow. The margin parameter sets the empty space around the card. The shape parameter allows you to customize the border radius of the card by providing a ShapeBorder object. The color parameter sets the background color of the card.

To use the Card widget in your Flutter app, you need to import the material library:

import 'package:flutter/material.dart';

Then, you can create a Card widget and place it inside your widget tree. For example, if you want to display some information about a car model inside a card, you can write something like this:

Card(
  elevation: 5,
  margin: EdgeInsets.all(10),
  shape: RoundedRectangleBorder(
    borderRadius: BorderRadius.circular(15),
  ),
  color: Colors.white,
  child: Column(
    children: [
      Image.network(
        'https://example.com/car.jpg',
        width: double.infinity,
        height: 200,
        fit: BoxFit.cover,
      ),
      Padding(
        padding: EdgeInsets.all(10),
        child: Text(
          'Tesla Model S',
          style: TextStyle(
            fontSize: 24,
            fontWeight: FontWeight.bold,
          ),
        ),
      ),
      Padding(
        padding: EdgeInsets.all(10),
        child: Text(
          'The is Card Ui Design Example Text',
          style: TextStyle(
            fontSize: 16,
            color: Colors.grey[800],
          ),
        ),
      ),
    ],
  ),
)

This will create a card with an image of a car at the top, followed by its name and description at the bottom.

Flutter Card Example

Flutter Card Widget

Flutter Card widget using create a flutter card UI Design.

Flutter Card UI Design

Card UI

Tutorial source code:

import 'package:flutter/material.dart';

main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(body: HomePage()),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(18.0),
      // welcome to my channel...
      // product card design with flutter... let's started...
      child: Wrap(
        children: [
          Card(
            color: Colors.white,
            elevation: 10,
            child: Container(
              width: 400,
              height: 540,
              child: Column(
                children: [
                  // here place your image link..
                  Image.network(
                    "https://cdn.pixabay.com/photo/2016/10/22/20/55/makeup-brushes-1761648_960_720.jpg",
                    fit: BoxFit.fitHeight,
                  ),
                  const SizedBox(
                    height: 15,
                  ),
                  const Text(
                    "COSMETICS EQUIPMENTS",
                    style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold),
                  ),
                  const SizedBox(
                    height: 15,
                  ),
                  const Text(
                    "\$15",
                    style: TextStyle(fontSize: 70, fontWeight: FontWeight.w800),
                  ),
                  const SizedBox(
                    height: 10,
                  ),
                  ElevatedButton(
                      style: ElevatedButton.styleFrom(
                        backgroundColor: Colors.amber,
                      ),
                      onPressed: () {},
                      child: const Padding(
                        padding: EdgeInsets.all(8.0),
                        child: Text(
                          "BUY NOW",
                          style: TextStyle(fontSize: 25),
                        ),
                      ))
                      // Thanks for watching... code link in the description...
                      
                ],
              ),
            ),
          )
        ],
      ),
    );
  }
}
  • How to Conduct YouTube Keyword Research Easily?
    Introduction YouTube is the second largest search engine in the world, making it a valuable platform for content creators and businesses alike. To maximize your visibility and reach on YouTube, it is crucial to conduct proper keyword research. By identifying the right keywords, you can optimize your videos for search and increase your chances of …

    Read more …

  • How to upgrade the Dart SDK version in flutter
    If you’re a Flutter developer, you know how important it is to stay up-to-date with the latest version of the Dart SDK. Upgrading the Dart SDK ensures that you have access to the latest features, bug fixes, and performance improvements. Step 1: Check Your Current Dart SDK Version Before you begin the upgrade process, it’s …

    Read more …

  • Why Do Advertisers Use Testimonials?
    In the ever-competitive business landscape, nurturing strong connections with your customers remains paramount for enhancing your credibility and positioning yourself as an industry authority. Establishing credibility is the bedrock upon which trust is built, ultimately translating into increased sales. To bolster your company’s credibility, integrating testimonial advertising into your marketing strategy is essential. So, what …

    Read more …

  • How To Earn $5 Fast Method!
    Looking to boost your income by $25 in less than an hour? This isn’t the start of a clichéd sales pitch; it’s about discovering several quick and simple ways to earn $5 online within minutes. For instance, you can make five bucks by completing tasks such as taking brief surveys, participating in short website usability …

    Read more …

  • What Does BMF Mean On TikTok? Latest Social Media Acronyms
    In the fast-paced world of social media, acronyms are the language of choice, enabling users to communicate swiftly without the need for lengthy phrases. While classics like LOL and OMG are still in use, the younger generation on TikTok has introduced a new acronym into the mix: BMF. So, what exactly does BMF mean, and …

    Read more …

Read also, the Flutter Clipoval widget.

The Card widget is useful for creating simple and elegant layouts with minimal code.

Leave a Comment