Created
April 29, 2024 10:11
-
-
Save sagar2093/222c98063fe70b472972966e521c41b9 to your computer and use it in GitHub Desktop.
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, | |
home: Scaffold( | |
body: Container( | |
// grey box | |
width: 320, | |
height: 240, | |
color: Colors.grey[300], | |
child: Center( | |
child: Container( | |
// red box | |
decoration: BoxDecoration( | |
color: Colors.red[400], | |
), | |
padding: const EdgeInsets.all(16), | |
child: Text( | |
'Hey, I am learning Flutter.', | |
style: bold24Roboto, | |
overflow: TextOverflow.ellipsis, | |
maxLines: 1, | |
), | |
), | |
), | |
), | |
), | |
); | |
} | |
} | |
TextStyle bold24Roboto = const TextStyle( | |
color: Colors.white, | |
fontSize: 24, | |
fontWeight: FontWeight.bold, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment