High level Flutter Code snippet | Learn Flutter with real-time App

0

 Create EVM Pad Application:

import 'package:flutter/material.dart';


void main() {

  runApp(EVMPadApp());

}


class EVMPadApp extends StatelessWidget {

  @override

  Widget build(BuildContext context) {

    return MaterialApp(

      title: 'EVM Pad',

      home: EVMHomePage(),

    );

  }

}


class EVMHomePage extends StatefulWidget {

  @override

  _EVMHomePageState createState() => _EVMHomePageState();

}


class _EVMHomePageState extends State<EVMHomePage> {

  final List<Candidate> candidates = [

    Candidate('Indian National Congress', 'assets/images/congress.png'),

    Candidate('Bjp', 'assets/images/bjp.png'),

    Candidate('Aap', 'assets/images/aap.png'),

    Candidate('Bsp', 'assets/images/bsp.png'),

  ];


  void showResultsDialog(BuildContext context) {

    int totalVotes =

    candidates.fold(0, (sum, candidate) => sum + candidate.voteCount);

    Candidate winner = candidates.fold(

      candidates.first,

          (prev, current) => current.voteCount > prev.voteCount ? current : prev,

    );

    showDialog(

      context: context,

      builder: (context) => AlertDialog(

        title: Text('Results'),

        content: Column(

          mainAxisSize: MainAxisSize.min,

          children: [

            ...candidates.map((candidate) {

              return ListTile(

                leading: Image.asset(candidate.imagePath, height: 50.0),

                title: Text(candidate.name),

                trailing: Text('Votes: ${candidate.voteCount}'),

              );

            }),

            ListTile(

              title: Text('lead '),

              trailing: Text('${winner.name} with ${winner.voteCount} votes'),

            ),

          ],

        ),

        actions: [

          ElevatedButton(

            onPressed: () {

              Navigator.pop(context);

            },

            child: Text('Close'),

          ),


        ],

      ),

    );

  }


  @override

  Widget build(BuildContext context) {

    return Scaffold(

      appBar: AppBar(

        title: Text('EVM Pad'),

      ),

      body: Column(

        children: [

          Expanded(

            child: GridView.count(

              crossAxisCount: 2,

              children: candidates.map((candidate) {

                return GestureDetector(

                  onTap: () {

                    // Increment the vote count when a candidate is tapped

                    setState(() {

                      candidate.incrementVoteCount();

                    });

                  },

                  child: Container(

                    child: Column(

                      children: [

                        Image.asset(candidate.imagePath, height: 100.0),

                        SizedBox(height: 16.0),

                        Text(candidate.name),

                        SizedBox(height: 8.0),

                        Text('Votes: ${candidate.voteCount}'),

                      ],

                    ),

                  ),

                );

              }).toList(),

            ),

          ),

          ElevatedButton(

            onPressed: () {

              // Show the results when the 'Results' button is tapped

              showResultsDialog(context);

            },

            child: Text('Results'),

          ),

        ],

      ),

    );

  }

}


class Candidate {

  final String name;

  final String imagePath;

  int voteCount;


  Candidate(this.name, this.imagePath, {this.voteCount =0});


  void incrementVoteCount() {

    voteCount++;

  }


}

Create Drawer in Live Application complete code:


import 'package:flutter/cupertino.dart';

import 'package:flutter/material.dart';


class gmailDrawer extends StatelessWidget {

  @override

  Widget build(BuildContext context) {

    return MaterialApp(

      title: 'Gmail Drawer',

      home: HomeScreen(),

    );

  }

}


class HomeScreen extends StatelessWidget {

  @override

  Widget build(BuildContext context){

    return Scaffold(

      appBar: AppBar(

        title: Text('Gmail Drawer'),

      ),

      body: Center(

        child: Text('Main Content'),

      ),

      drawer: Drawer(

        child: ListView(

          padding: EdgeInsets.only(top: 50,left: 35),

          children: [

            Container(

              padding: EdgeInsets.only(bottom: 15),

              child:  Text('Gmail',style: TextStyle(fontSize: 20,fontWeight: FontWeight.w500),),

              decoration: BoxDecoration(

                border: Border(

                  bottom: BorderSide(width: 1.5, color: Colors.grey),

                ),

              ),

            ),

            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  Icon(Icons.stay_primary_landscape),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Primary',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),)

                ],

              ),),

            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/promotions.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Promotions',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),) ,

            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/social.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Social',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  Text('All Labels',style: TextStyle(fontSize: 12,fontWeight: FontWeight.w500),),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/starred.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Starred',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/snoozed.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Snoozed',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/important.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Important',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/sent.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Sent',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/scheduled.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Scheduled',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/outbox.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Outbox',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/drafts.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Drafts',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/allmails.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('All mails',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/spam.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Spam',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/bin.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Bin',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/unsubscribedemails.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Unsubscribed Emails',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  Text('Google apps',style: TextStyle(fontSize: 12,fontWeight: FontWeight.w500),),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/calendar.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Calendar',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Padding(padding: EdgeInsets.only(top: 25,bottom: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/contacts.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Contacts',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),


            Container(

              padding: EdgeInsets.only(top: 25),

              child: Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/settings.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Settings',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),

              decoration: BoxDecoration(

                border: Border(

                  top: BorderSide(width: 1.5, color: Colors.grey),

                ),

              ),

            ),


            Padding(padding: EdgeInsets.only(top: 25,bottom: 25),

              child:  Row(

                children: [

                  ImageIcon(

                    AssetImage("assets/images/help.png"),

                  ),

                  Padding(padding: EdgeInsets.only(left: 20),

                    child:Text('Help and feedback',style: TextStyle(fontSize: 15,fontWeight: FontWeight.w500),),

                  ),

                ],

              ),),

          ],

        ),

      ),

    );

  }

}


Create Gridview in dart:-

import 'package:flutter/material.dart';


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


class Grid extends StatelessWidget {

  @override

  Widget build(BuildContext context) {

    final title = 'Flutter Horizontal Demo List';


    return MaterialApp(

      title: title,

      home: Scaffold(

        appBar: AppBar(

          title: Text(title),

        ),

        body: Container(

          margin: EdgeInsets.symmetric(vertical: 25.0),

          height: 150.0,

          child: ListView(

            scrollDirection: Axis.horizontal,

            children: <Widget>[

              Container(

                width: 150.0,

                color: Colors.blue,

                child: new Stack(

                  children: <Widget>[

                    ListTile(

                      leading: Icon(Icons.home),

                      title: Text('Home'),

                    ),

                  ],

                ),

              ),

              Container(

                width: 148.0,

                color: Colors.green,

                child: new Stack(

                  children: <Widget>[

                    ListTile(

                      leading: Icon(Icons.camera_alt),

                      title: Text('Camera'),

                    ),

                  ],

                ),

              ),

              Container(

                width: 148.0,

                color: Colors.yellow,

                child: new Stack(

                  children: <Widget>[

                    ListTile(

                      leading: Icon(Icons.phone),

                      title: Text('Phone'),

                    ),

                  ],

                ),

              ),

              Container(

                width: 148.0,

                color: Colors.red,

                child: new Stack(

                  children: <Widget>[

                    ListTile(

                      leading: Icon(Icons.map),

                      title: Text('Map'),

                    ),

                  ],

                ),

              ),

              Container(

                width: 148.0,

                color: Colors.greenAccent,

                child: new Stack(

                  children: <Widget>[

                    ListTile(

                      leading: Icon(Icons.settings),

                      title: Text('Setting'),

                    ),

                  ],

                ),

              ),

            ],

          ),

        ),

      ),

    );

  }

}


Create Card Layout Real-time application to show indian team player :


import 'package:flutter/cupertino.dart';

import 'package:flutter/material.dart';


class indiaTeamCards extends StatelessWidget{

  @override

  Widget build(BuildContext context){

    return MaterialApp(

        home: Scaffold(

            appBar: AppBar(

              title: Text('Indian Cricket Team '),

            ),

            body:SingleChildScrollView(

                child:Column(


                  children: [

                    Padding(

                      padding: EdgeInsets.only(left: 13),

                      child: SingleChildScrollView(

                        scrollDirection: Axis.horizontal,

                        child:Row(

                          children: [

                            Container(

                              height: 150,

                              width: 178,

                              child: Card(

                                shape: RoundedRectangleBorder(

                                  borderRadius: BorderRadius.circular(15),

                                ),

                                color: Colors.white,

                                elevation: 10,

                                child: Column(

                                  children: [

                                    Row(

                                      children: [

                                        Container(

                                          child:ClipOval(

                                            child: SizedBox.fromSize(

                                              size: Size.fromRadius(25), // Image radius

                                              child: Image.asset("assets/images/img_0.png", fit: BoxFit.cover),

                                            ),

                                          ),

                                        ),


                                        Container(

                                          margin: EdgeInsets.only(left: 7,bottom: 9),

                                          child: Column(

                                            children: [

                                              Text("Rohit Sharma",

                                                style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                              ),

                                              Padding(padding: EdgeInsets.only(right: 38),

                                                child:Text("Captain",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                                ),)

                                            ],

                                          ),

                                        ),

                                      ],

                                    ),


                                    Column(

                                      children: [

                                        Padding(

                                          padding: EdgeInsets.only(right: 88,top: 5),

                                          child: Text("ODI Career:",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 75,top: 5),

                                          child: Text("Total runs: 10709",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 71,top: 5),

                                          child: Text("Total hundreds: 31",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),

                                        Padding(

                                          padding: EdgeInsets.only(right: 84,top: 5),

                                          child: Text("Total fifties: 55",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                      ],

                                    )

                                  ],

                                ),

                              ),

                            ),

                            Container(

                              height: 150,

                              width: 178,

                              child: Card(

                                shape: RoundedRectangleBorder(

                                  borderRadius: BorderRadius.circular(15),

                                ),

                                color: Colors.white,

                                elevation: 10,

                                child: Column(

                                  children: [

                                    Row(

                                      children: [

                                        Container(

                                          child:ClipOval(

                                            child: SizedBox.fromSize(

                                              size: Size.fromRadius(25), // age radius

                                              child: Image.asset("assets/images/img_1.png", fit: BoxFit.cover),

                                            ),

                                          ),

                                        ),


                                        Container(

                                          margin: EdgeInsets.only(left: 7,bottom: 9),

                                          child: Column(

                                            children: [

                                              Padding(padding: EdgeInsets.only(right: 25),

                                                child: Text("Shubman Gill",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                                ),),

                                              Padding(padding: EdgeInsets.only(right: 30),

                                                child:Text("opening batter",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                                ),)

                                            ],

                                          ),

                                        ),

                                      ],

                                    ),


                                    Column(

                                      children: [

                                        Padding(

                                          padding: EdgeInsets.only(right: 88,top: 5),

                                          child: Text("ODI Career:",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 75,top: 5),

                                          child: Text("Total runs: 2271",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 71,top: 5),

                                          child: Text("Total hundreds: 6",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),

                                        Padding(

                                          padding: EdgeInsets.only(right: 84,top: 5),

                                          child: Text("Total fifties: 13",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                      ],

                                    )

                                  ],

                                ),

                              ),

                            ),

                          ],

                        ),

                      ),

                    ),

                    Padding(

                      padding: EdgeInsets.only(left: 12),

                      child: SingleChildScrollView(

                        scrollDirection: Axis.horizontal,

                        child:Row(

                          children: [

                            Container(

                              height: 150,

                              width: 177,

                              child: Card(

                                shape: RoundedRectangleBorder(

                                  borderRadius: BorderRadius.circular(15),

                                ),

                                color: Colors.white,

                                elevation: 10,

                                child: Column(

                                  children: [

                                    Row(

                                      children: [

                                        Container(

                                          child:ClipOval(

                                            child: SizedBox.fromSize(

                                              size: Size.fromRadius(25), // Image radius

                                              child: Image.asset("assets/images/img_2.png", fit: BoxFit.cover),

                                            ),

                                          ),

                                        ),


                                        Container(

                                          margin: EdgeInsets.only(left: 9,bottom: 9),

                                          child: Column(

                                            children: [

                                              Padding(padding: EdgeInsets.only(right: 48),

                                                child: Text("Virat Kohli",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                                ),),

                                              Padding(padding: EdgeInsets.only(right: 38),

                                                child:Text("top-order batter",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                                ),)

                                            ],

                                          ),

                                        ),

                                      ],

                                    ),


                                    Column(

                                      children: [

                                        Padding(

                                          padding: EdgeInsets.only(right: 88,top: 5),

                                          child: Text("ODI Career:",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 75,top: 5),

                                          child: Text("Total runs: 13868",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 71,top: 5),

                                          child: Text("Total hundreds: 50",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),

                                        Padding(

                                          padding: EdgeInsets.only(right: 84,top: 5),

                                          child: Text("Total fifties: 72",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                      ],

                                    )

                                  ],

                                ),

                              ),

                            ),

                            Container(

                              height: 150,

                              width: 175,

                              child: Card(

                                shape: RoundedRectangleBorder(

                                  borderRadius: BorderRadius.circular(15),

                                ),

                                color: Colors.white,

                                elevation: 10,

                                child: Column(

                                  children: [

                                    Row(

                                      children: [

                                        Container(

                                          child:ClipOval(

                                            child: SizedBox.fromSize(

                                              size: Size.fromRadius(25), // Image radius

                                              child: Image.asset("assets/images/img_3.png", fit: BoxFit.cover),

                                            ),

                                          ),

                                        ),


                                        Container(

                                          margin: EdgeInsets.only(left: 7,bottom: 9),

                                          child: Column(

                                            children: [

                                              Padding(padding: EdgeInsets.only(right: 40),

                                                child:  Text("Shreyas Iyer",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                                ),),

                                              Padding(padding: EdgeInsets.only(right: 38),

                                                child:Text("top-order batter",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                                ),)

                                            ],

                                          ),

                                        ),

                                      ],

                                    ),


                                    Column(

                                      children: [

                                        Padding(

                                          padding: EdgeInsets.only(right: 88,top: 5),

                                          child: Text("ODI Career:",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 75,top: 5),

                                          child: Text("Total runs: 2383",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 71,top: 5),

                                          child: Text("Total hundreds: 5",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),

                                        Padding(

                                          padding: EdgeInsets.only(right: 84,top: 5),

                                          child: Text("Total fifties: 18",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                      ],

                                    )

                                  ],

                                ),

                              ),

                            ),

                          ],

                        ),

                      ),

                    ),

                    Padding(

                      padding: EdgeInsets.only(left: 18),

                      child: SingleChildScrollView(

                        scrollDirection: Axis.horizontal,

                        child:Row(

                          children: [

                            Container(

                              height: 150,

                              width: 170,

                              child: Card(

                                shape: RoundedRectangleBorder(

                                  borderRadius: BorderRadius.circular(15),

                                ),

                                color: Colors.white,

                                elevation: 10,

                                child: Column(

                                  children: [

                                    Row(

                                      children: [

                                        Container(

                                          child:ClipOval(

                                            child: SizedBox.fromSize(

                                              size: Size.fromRadius(25), // Image radius

                                              child: Image.asset("assets/images/img_4.png", fit: BoxFit.cover),

                                            ),

                                          ),

                                        ),


                                        Container(

                                          margin: EdgeInsets.only(left: 7,bottom: 9),

                                          child: Column(

                                            children: [

                                              Padding(padding: EdgeInsets.only(right: 40),

                                                child:  Text("KL Rahul",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                                ),),

                                              Padding(padding: EdgeInsets.only(right: 38),

                                                child:Text("Vice Captain",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                                ),)

                                            ],

                                          ),

                                        ),

                                      ],

                                    ),


                                    Column(

                                      children: [

                                        Padding(

                                          padding: EdgeInsets.only(right: 88,top: 5),

                                          child: Text("ODI Career:",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 75,top: 5),

                                          child: Text("Total runs: 2863",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 71,top: 5),

                                          child: Text("Total hundreds: 8",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),

                                        Padding(

                                          padding: EdgeInsets.only(right: 84,top: 5),

                                          child: Text("Total fifties: 14",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                      ],

                                    )

                                  ],

                                ),

                              ),

                            ),

                            Container(

                              height: 150,

                              width: 170,

                              child: Card(

                                shape: RoundedRectangleBorder(

                                  borderRadius: BorderRadius.circular(15),

                                ),

                                color: Colors.white,

                                elevation: 10,

                                child: Column(

                                  children: [

                                    Row(

                                      children: [

                                        Container(

                                          child:ClipOval(

                                            child: SizedBox.fromSize(

                                              size: Size.fromRadius(25), // Image radius

                                              child: Image.asset("assets/images/img_5.png", fit: BoxFit.cover),

                                            ),

                                          ),

                                        ),


                                        Container(

                                          margin: EdgeInsets.only(left: 7,bottom: 9),

                                          child: Column(

                                            children: [

                                              Text("Ravindra Jadeja",

                                                style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                              ),

                                              Padding(padding: EdgeInsets.only(right: 38),

                                                child:Text("Allrounder",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                                ),)

                                            ],

                                          ),

                                        ),

                                      ],

                                    ),


                                    Column(

                                      children: [

                                        Padding(

                                          padding: EdgeInsets.only(right: 88,top: 5),

                                          child: Text("ODI Career:",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 75,top: 5),

                                          child: Text("Total runs: 2820",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 71,top: 5),

                                          child: Text("Total wickets: 220",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),

                                        Padding(

                                          padding: EdgeInsets.only(right: 84,top: 5),

                                          child: Text("Total fifties: 13",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                      ],

                                    )

                                  ],

                                ),

                              ),

                            ),

                          ],

                        ),

                      ),

                    ),

                    Padding(

                      padding: EdgeInsets.only(left: 18),

                      child: SingleChildScrollView(

                        scrollDirection: Axis.horizontal,

                        child:Row(

                          children: [

                            Container(

                              height: 150,

                              width: 170,

                              child: Card(

                                shape: RoundedRectangleBorder(

                                  borderRadius: BorderRadius.circular(15),

                                ),

                                color: Colors.white,

                                elevation: 10,

                                child: Column(

                                  children: [

                                    Row(

                                      children: [

                                        Container(

                                          child:ClipOval(

                                            child: SizedBox.fromSize(

                                              size: Size.fromRadius(25), // Image radius

                                              child: Image.asset("assets/images/img_6.png", fit: BoxFit.cover),

                                            ),

                                          ),

                                        ),


                                        Container(

                                          margin: EdgeInsets.only(left: 7,bottom: 9),

                                          child: Column(

                                            children: [

                                              Text("SuryaKumar Yadav",

                                                style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                              ),

                                              Padding(padding: EdgeInsets.only(right: 70),

                                                child:Text("Batter",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                                ),)

                                            ],

                                          ),

                                        ),

                                      ],

                                    ),


                                    Column(

                                      children: [

                                        Padding(

                                          padding: EdgeInsets.only(right: 88,top: 5),

                                          child: Text("ODI Career:",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 75,top: 5),

                                          child: Text("Total runs: 773",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 71,top: 5),

                                          child: Text("Total hundreds: 0",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),

                                        Padding(

                                          padding: EdgeInsets.only(right: 84,top: 5),

                                          child: Text("Total fifties: 4",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                      ],

                                    )

                                  ],

                                ),

                              ),

                            ),

                            Container(

                              height: 150,

                              width: 170,

                              child: Card(

                                shape: RoundedRectangleBorder(

                                  borderRadius: BorderRadius.circular(15),

                                ),

                                color: Colors.white,

                                elevation: 10,

                                child: Column(

                                  children: [

                                    Row(

                                      children: [

                                        Container(

                                          child:ClipOval(

                                            child: SizedBox.fromSize(

                                              size: Size.fromRadius(25), // Image radius

                                              child: Image.asset("assets/images/img_7.png", fit: BoxFit.cover),

                                            ),

                                          ),

                                        ),


                                        Container(

                                          margin: EdgeInsets.only(left: 7,bottom: 9),

                                          child: Column(

                                            children: [

                                              Text("Mohammed Shami",

                                                style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                              ),

                                              Padding(padding: EdgeInsets.only(right: 70),

                                                child:Text("Bowler",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                                ),)

                                            ],

                                          ),

                                        ),

                                      ],

                                    ),


                                    Column(

                                      children: [

                                        Padding(

                                          padding: EdgeInsets.only(right: 88,top: 5),

                                          child: Text("ODI Career:",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 75,top: 5),

                                          child: Text("Total wickets: 195",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 71,top: 5),

                                          child: Text("Total matches: 101",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),

                                        Padding(

                                          padding: EdgeInsets.only(right: 84,top: 5),

                                          child: Text("Average: 23.7",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                      ],

                                    )

                                  ],

                                ),

                              ),

                            ),

                          ],

                        ),

                      ),

                    ),

                    Padding(

                      padding: EdgeInsets.only(left: 18),

                      child: SingleChildScrollView(

                        scrollDirection: Axis.horizontal,

                        child:Row(

                          children: [

                            Container(

                              height: 150,

                              width: 170,

                              child: Card(

                                shape: RoundedRectangleBorder(

                                  borderRadius: BorderRadius.circular(15),

                                ),

                                color: Colors.white,

                                elevation: 10,

                                child: Column(

                                  children: [

                                    Row(

                                      children: [

                                        Container(

                                          child:ClipOval(

                                            child: SizedBox.fromSize(

                                              size: Size.fromRadius(25), // Image radius

                                              child: Image.asset("assets/images/img_8.png", fit: BoxFit.cover),

                                            ),

                                          ),

                                        ),


                                        Container(

                                          margin: EdgeInsets.only(left: 7,bottom: 9),

                                          child: Column(

                                            children: [

                                              Text("Jasprit Bumrah",

                                                style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                              ),

                                              Padding(padding: EdgeInsets.only(right: 45),

                                                child:Text("Bowler",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                                ),)

                                            ],

                                          ),

                                        ),

                                      ],

                                    ),


                                    Column(

                                      children: [

                                        Padding(

                                          padding: EdgeInsets.only(right: 88,top: 5),

                                          child: Text("ODI Career:",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 75,top: 5),

                                          child: Text("Total wickets: 149",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 71,top: 5),

                                          child: Text("Total matches: 89",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),

                                        Padding(

                                          padding: EdgeInsets.only(right: 84,top: 5),

                                          child: Text("Average: 23.6",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                      ],

                                    )

                                  ],

                                ),

                              ),

                            ),

                            Container(

                              height: 150,

                              width: 170,

                              child: Card(

                                shape: RoundedRectangleBorder(

                                  borderRadius: BorderRadius.circular(15),

                                ),

                                color: Colors.white,

                                elevation: 10,

                                child: Column(

                                  children: [

                                    Row(

                                      children: [

                                        Container(

                                          child:ClipOval(

                                            child: SizedBox.fromSize(

                                              size: Size.fromRadius(25), // Image radius

                                              child: Image.asset("assets/images/img_9.png", fit: BoxFit.cover),

                                            ),

                                          ),

                                        ),


                                        Container(

                                          margin: EdgeInsets.only(left: 7,bottom: 9),

                                          child: Column(

                                            children: [

                                              Text("Kuldeep Yadav",

                                                style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                              ),

                                              Padding(padding: EdgeInsets.only(right: 45),

                                                child:Text("Bowler",

                                                  style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                                ),)

                                            ],

                                          ),

                                        ),

                                      ],

                                    ),


                                    Column(

                                      children: [

                                        Padding(

                                          padding: EdgeInsets.only(right: 88,top: 5),

                                          child: Text("ODI Career:",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 75,top: 5),

                                          child: Text("Total wickets: 168",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                        Padding(

                                          padding: EdgeInsets.only(right: 71,top: 5),

                                          child: Text("Total matches: 103",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),

                                        Padding(

                                          padding: EdgeInsets.only(right: 84,top: 5),

                                          child: Text("Average: 26.0",

                                            style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                        ),


                                      ],

                                    )

                                  ],

                                ),

                              ),

                            ),

                          ],

                        ),

                      ),

                    ),

                    Padding(

                      padding: EdgeInsets.only(left: 18),

                      child:Row(

                        children: [

                          Container(

                            height: 150,

                            width: 170,

                            child: Card(

                              shape: RoundedRectangleBorder(

                                borderRadius: BorderRadius.circular(15),

                              ),

                              color: Colors.white,

                              elevation: 10,

                              child: Column(

                                children: [

                                  Row(

                                    children: [

                                      Container(

                                        child:ClipOval(

                                          child: SizedBox.fromSize(

                                            size: Size.fromRadius(25), // Image radius

                                            child: Image.asset("assets/images/img_10.png", fit: BoxFit.cover),

                                          ),

                                        ),

                                      ),


                                      Container(

                                        margin: EdgeInsets.only(left: 7,bottom: 9),

                                        child: Column(

                                          children: [

                                            Text("Mohammed Siraj",

                                              style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.bold),

                                            ),

                                            Padding(padding: EdgeInsets.only(right: 50),

                                              child:Text("Bowler",

                                                style: TextStyle(fontStyle: FontStyle.italic,fontSize: 10),

                                              ),)

                                          ],

                                        ),

                                      ),

                                    ],

                                  ),


                                  Column(

                                    children: [

                                      Padding(

                                        padding: EdgeInsets.only(right: 88,top: 5),

                                        child: Text("ODI Career:",

                                          style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12,fontWeight: FontWeight.w600),),

                                      ),


                                      Padding(

                                        padding: EdgeInsets.only(right: 75,top: 5),

                                        child: Text("Total wickets: 68",

                                          style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                      ),


                                      Padding(

                                        padding: EdgeInsets.only(right: 71,top: 5),

                                        child: Text("Total matches: 41",

                                          style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                      ),

                                      Padding(

                                        padding: EdgeInsets.only(right: 84,top: 5),

                                        child: Text("Average: 22.79",

                                          style: TextStyle(fontStyle: FontStyle.italic,fontSize: 9,fontWeight: FontWeight.w600),),

                                      ),


                                    ],

                                  )

                                ],

                              ),

                            ),

                          ),

                        ],

                      ),

                    ),

                  ],

                )

            ),

        ),

        );

    }

}

Create Login Form of any application:

import 'package:flutter/material.dart';

class Login extends StatelessWidget {

  @override

  Widget build(BuildContext context) {

    return Scaffold(

      appBar: AppBar(

          title:Text("login")

      ),

      body: Padding(

        padding: EdgeInsets.all(15),

    child: Column(

        children: <Widget>[

          Padding(padding: EdgeInsets.all(15),child: TextField(decoration: InputDecoration(border: OutlineInputBorder(),

            labelText: 'User Name',

            hintText: 'Enter Your Name', )),),

          Padding(padding: EdgeInsets.all(15),child: TextField(obscureText: true,decoration: InputDecoration(border: OutlineInputBorder(),

            labelText: 'Password',

            hintText: 'Enter Your Password', )),),

          ElevatedButton(

            style: ButtonStyle(

              foregroundColor: MaterialStateProperty.all<Color>(Colors.blue),

            ),

            onPressed: () {  AlertDialog(

              title: Text('Alert Dialog'),

              content: Column(

                mainAxisSize: MainAxisSize.min,

                children: [

                  Text('Hey You! I love flutter!'),

                ],

              ),


            );

    },

            child: Text('Submit'),

          )


        ]

    ),

    ),

    );

  }

}


Create Messagealert box in flutter:-

import 'package:flutter/material.dart';




class MessageAlert extends StatelessWidget {

  @override

  Widget build(BuildContext context) {

    return MaterialApp(

      title: 'Sum Program',

      home: Scaffold(

        appBar: AppBar(title: const Text("Sum Program")),

        body: const SumWidget(),

      ),

    );

  }

}


class SumWidget extends StatefulWidget {

  const SumWidget({super.key});


  @override

  State<SumWidget> createState() => _SumWidgetState();

}


class _SumWidgetState extends State<SumWidget> {

  TextEditingController num1 = TextEditingController();

  TextEditingController num2 = TextEditingController();

  String result = '';


  @override

  Widget build(BuildContext context) {

    return Column(

      mainAxisAlignment: MainAxisAlignment.center,

      children: [

        Padding(

          padding: const EdgeInsets.all(15),

          child: TextField(

            controller: num1,

            keyboardType: TextInputType.number,

            decoration: const InputDecoration(labelText: "Enter First Number"),

          ),

        ),

        Padding(

          padding: const EdgeInsets.all(15),

          child: TextField(

            controller: num2,

            keyboardType: TextInputType.number,

            decoration: const InputDecoration(labelText: "Enter Second Number"),

          ),

        ),

        ElevatedButton(

          onPressed: () {

            setState(() {

              result = (int.parse(num1.text) + int.parse(num2.text)).toString();

            });

            showDialog(

                context: context,

                builder: (context) {

                  return AlertDialog(

                      title: Text("Alert Message"),

                      // Retrieve the text which the user has entered by

                      // using the TextEditingController.

                      content: Text('sum is ='+result),

                      actions: <Widget>[

                  new TextButton(

                  child: new Text('OK'),

                  onPressed: () {

                  Navigator.of(context).pop();

                  },

                  )

                  ],

                  );

                }

            );

          },


          child: Text('Calculate Sum'),

        ),


        Text(result)

      ],

    );

  }

}


Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)