Created
March 10, 2025 13:54
-
-
Save prakhart111/748d59a01b735652819d9d540bacad1d 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