Skip to content

Instantly share code, notes, and snippets.

@sagar2093
Created April 29, 2024 10:11
Show Gist options
  • Save sagar2093/222c98063fe70b472972966e521c41b9 to your computer and use it in GitHub Desktop.
Save sagar2093/222c98063fe70b472972966e521c41b9 to your computer and use it in GitHub Desktop.
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