Ozy
Ozy

Reputation: 29

How can I create a button with an icon on the top right under the appbar on Flutter

I want to create a button under the appbar (navbar) with a button not too big just normal size but I couldn't. It needs to be on top right and icon will be on the right like "Categories(List Icon)"

enter image description here

Upvotes: 0

Views: 633

Answers (2)

Shri Hari L
Shri Hari L

Reputation: 4923

I don't know how exactly you want it to be. As mentioned you can use endDrawer or else, like in the screenshot, you can do something like this,

Scaffold(
      appBar: AppBar(title: Text('Category Demo')),
      body: Column(children: [
        Row(mainAxisAlignment: MainAxisAlignment.end,
          children: [
          Container(
            width: 130.0,
            child: FlatButton(
              onPressed: () {
                Navigator.push(context,
                    MaterialPageRoute(builder: (context) => Categories()));
              },
              child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text("Categories"),
                    Icon(Icons.menu),
                  ]
               ),
            ),
          )
        ])
      ]),
    );

Output:

enter image description here

Hope that works!

Upvotes: 1

Captivity
Captivity

Reputation: 337

You can try endDrawer in Scaffold from this example: https://api.flutter.dev/flutter/material/Scaffold/endDrawer.html

Upvotes: 0

Related Questions