Created
March 11, 2025 12:16
-
-
Save prakhart111/c1cbddcbb9c76033033a6c60e4b78b00 to your computer and use it in GitHub Desktop.
Snippet created via Remix 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({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData( | |
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), | |
useMaterial3: true, | |
), | |
home: const HomePage(), | |
); | |
} | |
} | |
class HomePage extends StatelessWidget { | |
const HomePage({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: const Text('Simple App'), | |
centerTitle: true, | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
const Icon( | |
Icons.favorite, | |
size: 100, | |
color: Colors.red, | |
), | |
const SizedBox(height: 20), | |
const Text( | |
'Welcome!', | |
style: TextStyle( | |
fontSize: 24, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
const SizedBox(height: 10), | |
ElevatedButton( | |
onPressed: () { | |
ScaffoldMessenger.of(context).showSnackBar( | |
const SnackBar( | |
content: Text('Button pressed!'), | |
duration: Duration(seconds: 1), | |
), | |
); | |
}, | |
child: const Text('Click Me'), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment