top of page
Writer's pictureCodersarts AI

Introduction of flutter and its widgets


Why Flutter?

  • One code base for both iOS and Android.

  • Flutter is the only mobile SDK that provides reactive views without requiring JavaScript bridge.

  • Flutter apps look and feel great.

  • Make a change in the app and see them in the blink of an eye. All thanks to Hot-Reload.

What’s up with “Dart”!


Dart is a reactive language that talks similar to python in terms of ease of coding while keeping the power of native java under the hood.


Widgets


Flutter widgets are built using a modern framework that takes inspiration from React. The central idea is that you build your UI out of widgets. Widgets describe what their view should look like given their current configuration and state.


  • There are broadly two types of widgets in Flutter.

  • State-full Widgets and Stateless Widgets. The names are self-explanatory.

  • State-full Widgets are sensitive to what happens within its boundaries and gets rebuilt when a state change is detected. Conversely, Stateless widgets are not state sensitive and remain static throughout its life cycle.



import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
 // This widget is the root of your application.
 @override
 Widget build(BuildContext context) {
 return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
 
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Calculator'),
    );
  }
}

class MyHomePage extends StatefulWidget {
 MyHomePage({Key key, this.title}) : super(key: key);

 

 final String title;

 @override
 _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
 
 

 @override
 Widget build(BuildContext context) {
 
 return Scaffold(
      appBar: AppBar(
 
        title: Text(widget.title),
      ),
      body:  new Container(
 
        child: new Column(children: <Widget>[
 new Text("0"),
 // new Expanded(child: null),
 
 new MaterialButton(child: new Text("1"),
          onPressed: ()=> {},
          color: Colors.blueGrey,
          textColor: Colors.white,
          )
 
 
 
        ],),
      ) 
 
    );
 
  }
}





Hire an Flutter developer to get quick help for all your android |Ios app development needs. with the hands-on android assignment help and android project help by Codersarts android expert. You can contact the android programming help expert any time; we will help you overcome all the issues and find the right solution.

Want to get help right now? Or Want to know price quote





Comments


bottom of page