How to create list of buttons in popup window flutter
You can perform them by adding a Basic AppBar
. An AppBar
is basically a toolbar that contains widgets within themselves for which action and IconButton
can be assigned.
The below example will demonstrate the usage of AppBar
in Flutter.
Example
import 'package:flutter/material.dart';
import '../my_route.dart';
class BasicAppbarExample extends MyRoute {
const BasicAppbarExample(
[String sourceFile ='lib/routes/appbar_basic_appbar_ex.dart'])
: super(sourceFile);
@override
get title => 'Basic AppBar';
@override
get links => {
'Doc': 'https://docs.flutter.io/flutter/material/AppBar-class.html',
};
@override
Widget buildMyRouteContent(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.redAccent,
leading: Icon(Icons.tag_faces),
title: Text("Sample title"),
// TODO: add actions when items are clicked.
actions: <Widget>[
IconButton(
icon: Icon(Icons.directions_bike),
onPressed: () {},
),
IconButton(
icon: Icon(Icons.directions_bus),
onPressed: () {},
),
PopupMenuButton(
itemBuilder: (BuildContext context) {
return [
PopupMenultem(child: Text('Boat')),
PopupMenultem(child: Text('Train'))
];
},
)
],
),
body: Center(child: Text("Hello")),
);
}
How it'll look like?
Reference
Edit: You can also other widgets to include images and login information (Pretty much anything you want)
Kavin-K
I am a highly competent mobile application developer with 4+ years of experience developing a wide range of applications in iOS and Android for a range of clients. I have proven expertise in building eCommerce apps. I am enthusiastic, committed to professional growth, work well under stress, and can meet deadlines. I am also self-motivated, a team player, and can think on my feet, able to adapt and change as situation warrants.
Updated on December 11, 2022