0

I am making a practice app in flutter and stuck on this: How can i align widgets such that; 1. An icon stays at extreme left of appbar 2. Text widget stays in middle. 3. button stays at extreme right of appbar. here is the image for what i am talking about

3 Answers3

1

use actions property in appbar and then as a child use a row. in that row you can use MainAxisAlignment.spaceBetween or MainAxisAlignment.spaceAround for arranging items.

Hossein Vejdani
  • 961
  • 8
  • 19
1

You can do it using AppBar widget.

Note: If you want to implement drawer then use drawer property.

 @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Title"),
        centerTitle: true,
        leading: Icon(Icons.menu),
        actions: [Icon(Icons.comment)],
      ),
      body: Container(),
    );
  }
Viren V Varasadiya
  • 25,492
  • 9
  • 45
  • 61
0

AppBar(title:Text("Your Text),leading:Icon(Icons.menu),actions:[Icon(Icons.favourite)]) Try this code

Islomkhuja Akhrarov
  • 1,277
  • 9
  • 19