How to Make App Bar Flutter With Source Code | Mobile App Development

AppBar
App Bar

The App bar provides content and actions related to the current screen. it's used for branding, screen titles, navigation, and action.



Source Code


                        
 import 'package:flutter/material.dart';

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

class AppBarDemo extends StatelessWidget {


  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      debugShowCheckedModeBanner: false,

      title: "AppBar",
      home:
      Scaffold(
        appBar: AppBar(
          leading: IconButton(

            icon: const Icon(Icons.menu),
            onPressed: () {},
          ),
          title: Text("Title 1",
          ),
          actions: [
            IconButton(

              icon: const Icon(
                Icons.favorite,
              ),
              onPressed: () {},
            ),
            IconButton(

              icon: const Icon(
                Icons.search,
              ),
              onPressed: () {},
            ),
            PopupMenuButton<Text>(
              itemBuilder: (context) {
                return [
                  PopupMenuItem(
                    child: Text(
                      "Menu1",
                    ),
                  ),
                  PopupMenuItem(
                    child: Text(
                      "Menu2",
                    ),
                  ),
                  PopupMenuItem(
                    child: Text(
                      "Menu3",
                    ),
                  ),
                ];
              },
            )
          ],
        ),
        body: Center(
          child: Text(
            "Text-Write Something...",
          ),
        ),
      ) ,

    );

  }
}
                        
                     

Comments