Sunday, June 19, 2022

MaterialApp using in runApp

  MaterialApp with Stateless Widget


import 'package:flutter/material.dart';

void main(){
   runApp(MaterialApp(
  debugShowCheckedModeBanner: false,
initialRoute: '/',
routes: {
'/':(context)=> MyApp(),
},
));     ðŸ’ª // MaterialApp
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
      appBar: AppBar(
title: Text("Firebase Messaging"),
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.green,Colors.lightGreenAccent],
begin: Alignment.bottomRight,
end: Alignment.topLeft,
),
),
),
),
      body: SafeArea(
child: Container(
child: ListView(
children: [
              Container(
padding: EdgeInsets.symmetric(vertical: 10,horizontal: 10),
margin: EdgeInsets.all(10.0),
width: 100,
height: 200,
color: Colors.blue,
child: Text("Raj"),
),
],
          ),
),
),
);     ðŸ’ª // Scaffold
}
}

No comments:

Post a Comment

Featured post

Compress Image With Show File Size & Resolution in Flutter

 Compress Image With Show File Size & Resolution  1.Multiple File Image Compress with file Size import 'dart:io' ; import 'p...

LightBlog