Basic structure MaterialApp

 import "package:flutter/material.dart";


/// 1st way Implementation
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: SampleCheck(),
),
),
),
);
}
class SampleCheck extends StatelessWidget {
const SampleCheck({super.key});

@override
Widget build(BuildContext context) {
return Container(
child: Center(
child: Text("Hello World!!",
style: TextStyle(fontWeight: FontWeight.bold,
fontSize: 50,
color: Colors.brown),),),
);
}
}

/// 2nd Way Implementation
// void main() {
// runApp(FlutterApp(),);
// }
// class FlutterApp extends StatelessWidget {
// const FlutterApp({super.key});
//
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// title: "Sample Flutter MaterialApp",
// debugShowCheckedModeBanner: false,
// theme: ThemeData(
// primarySwatch: Colors.brown,
// ),
// home: SampleMaterial(),
// );
// }
// }
// class SampleMaterial extends StatelessWidget {
// const SampleMaterial({super.key});
//
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: const Text("Demo MaterialApp"),
// ),
// body: Container(
// child: const Center(
// child: Text("Hello World!!",
// style: TextStyle(fontWeight: FontWeight.bold,
// fontSize: 50,),),
// ),
// ),
// );
// }
// }

Comments

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter