Created
February 4, 2025 10:10
-
-
Save prakhart111/0065ffdad01e3b9b4ba9f71d10ba94e5 to your computer and use it in GitHub Desktop.
Snippet created via Next.js API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| const MyApp({Key? key}) : super(key: key); | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Card Demo', | |
| theme: ThemeData( | |
| primarySwatch: Colors.blue, | |
| ), | |
| home: const MyHomePage(), | |
| ); | |
| } | |
| } | |
| class MyHomePage extends StatelessWidget { | |
| const MyHomePage({Key? key}) : super(key: key); | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar( | |
| title: const Text('Card Demo'), | |
| ), | |
| body: Center( | |
| child: Card( | |
| elevation: 4, | |
| child: Container( | |
| width: 300, | |
| padding: const EdgeInsets.all(16), | |
| child: Column( | |
| mainAxisSize: MainAxisSize.min, | |
| children: const [ | |
| Icon( | |
| Icons.favorite, | |
| size: 50, | |
| color: Colors.red, | |
| ), | |
| SizedBox(height: 16), | |
| Text( | |
| 'Sample Card', | |
| style: TextStyle( | |
| fontSize: 24, | |
| fontWeight: FontWeight.bold, | |
| ), | |
| ), | |
| SizedBox(height: 8), | |
| Text( | |
| 'This is a basic card widget with some content.', | |
| textAlign: TextAlign.center, | |
| ), | |
| ], | |
| ), | |
| ), | |
| ), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment