Created
February 4, 2025 08:17
-
-
Save prakhart111/f066859d825a85eaa4ecbaa151d234c6 to your computer and use it in GitHub Desktop.
Snippet created via Next.js API
This file contains 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( | |
padding: const EdgeInsets.all(16), | |
width: 300, | |
child: Column( | |
mainAxisSize: MainAxisSize.min, | |
children: [ | |
const Text( | |
'Card Title', | |
style: TextStyle( | |
fontSize: 20, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
const SizedBox(height: 8), | |
const Text( | |
'This is some sample content that goes in the card. You can put any widgets here.', | |
), | |
const SizedBox(height: 16), | |
ElevatedButton( | |
onPressed: () {}, | |
child: const Text('Button'), | |
), | |
], | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment