Material
import "package:flutter/material.dart";
/// First Way
// void main() {
// runApp(
// MaterialApp(
// title: "Flutter Tutorial",
// debugShowCheckedModeBanner: false,
// home: SafeArea(
// child: TutorialHome(),
// ),
// ),
// );
// }
// class TutorialHome extends StatelessWidget {
// const TutorialHome({super.key});
//
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// leading: IconButton(
// icon: Icon(Icons.menu,),
// tooltip: "Navigation menu",
// onPressed: null,
// ),
// title: Text("Example title"),
// actions: [
// IconButton(
// icon: Icon(Icons.search,),
// tooltip: "Search",
// onPressed: null,
// ),
// ],
// ),
// body: Center(
// child: Text("Hello World!"),
// ),
// floatingActionButton: FloatingActionButton(
// tooltip: "Add",
// onPressed: null,
// child: Icon(Icons.add,),
// ),
// );
// }
// }
/// Second Way
// void main() {
// runApp(const TutorialHome());
// }
// class TutorialHome extends StatelessWidget {
// const TutorialHome({super.key});
//
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// title: "Flutter APP",
// debugShowCheckedModeBanner: false,
// theme: ThemeData(
// primarySwatch: Colors.deepOrange,
// ),
// home: checkApp(),
// );
// }
// }
// class checkApp extends StatelessWidget {
// checkApp({super.key});
//
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// leading: IconButton(
// icon: Icon(Icons.menu,),
// tooltip: "Navigation menu",
// onPressed: null,
// ),
// title: Text("Example Title"),
// actions: [
// IconButton(
// icon: Icon(Icons.search,),
// onPressed: null,
// tooltip: "Search",
// ),
// ],
// ),
// body: Container(
// child: Center(
// child: Text("Hello World!"),
// ),
// ),
// floatingActionButton: FloatingActionButton(
// tooltip: "Add",
// onPressed: null,
// child: Icon(Icons.add,),
// ),
// );
// }
// }
/// Material App
// void main() {
// runApp(const MyApp());
// }
// class MyApp extends StatelessWidget {
// const MyApp({super.key});
//
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// title: "Flutter Layout demo",
// home: Scaffold(
// appBar: AppBar(
// title: const Text("Flutter Layout demo"),
// ),
// body: const Center(
// child: Text("Hello World"),
// ),
// ),
// );
// }
// }
/// Non - Material App
void main() {
runApp(const MyApp(),);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
),
child: Center(
child: Text(
"Hello World",
textDirection: TextDirection.ltr,
style: TextStyle(fontSize: 32,
color: Colors.black87,),
),
),
);
}
}
Comments
Post a Comment