Whenever a new project of flutter is created, a default project is given by flutter. The number of which increases on clicking the button. Whenever I implement my code in this code, some error occurs in it. So in today's post, we are going to solve this problem. For that, we have created an empty project. That means, there will be an app bar in this code, in which there will be a back icon and a title bar.
Empty Screen
import 'package:flutter/material.dart'; void main() { runApp(MaterialApp( debugShowCheckedModeBanner: false, home: joinpro(), )); } class joinpro extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Colors.red, leading: IconButton( icon: Icon(Icons.arrow_back, color: Colors.white), onPressed: () { Navigator.pop(context); }, ), title: Text( "Settings", style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold, ), ), ), ); } }
Code Explanation
- void main This is the entry point of the Flutter app. Here the app is being launched through the runapp() method.
- Materialapp is a built-in widget for Flutter that provides material design layout.
- home:joinPro() specifies that the JoinPro widget will be loaded when the app starts.
- JoinPro is a custom stateless widget that defines the layout of the screen.
- Status: Use this when you don't want any dynamic changes to the UI.
0 Comments