Flutter App Bar Leading Icon and Action Icon Button


import "package:flutter/material.dart";

void main() {
  runApp(
    MaterialApp(
      home: Home(),
      debugShowCheckedModeBanner: false,
    ),
  );
}

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Title Bar"),
        centerTitle: false,
        backgroundColor: Colors.black,
        leading: IconButton(
          icon: Icon(Icons.menu),
          onPressed: () {
            print("hello");
          },
        ),
        actions: [
          IconButton(
            icon: Icon(Icons.notifications_none),
            onPressed: () {
              print("Hello");
            },
          ),
          IconButton(
            icon: Icon(Icons.search),
            onPressed: () {
              print("Hello");
            },
          )
        ],
        elevation: 6,
        titleSpacing: 30,
      ),
      body: Center(
        child: Text("Hello Data"),
      ),
    );
  }
}
Output:

Share on Google Plus

About Ram Pukar

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment