Reputation: 27
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
Upvotes: 0
Views: 344
Reputation: 1400
AppBar(title:Text("Your Text),leading:Icon(Icons.menu),actions:[Icon(Icons.favourite)]) Try this code
Upvotes: 0
Reputation: 27137
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(),
);
}
Upvotes: 1
Reputation: 1108
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.
Upvotes: 1