Popup Menu Button With Icon And Text
Complete Code For Popup Menu Button With Icon And Text In Flutter
main.dart
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
final String title;
MyHomePage({this.title});
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.lightGreen,
title: Text(" PopupMenuButton with Icon & Text"),
),
body: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
PopupMenuButton(
icon: Icon(Icons.person),
itemBuilder: (context) => [
PopupMenuItem(
child: Text("Account"),
),
PopupMenuItem(
child: Text("Change Password"),
),
PopupMenuItem(
child: Text("Sign Out"),
),
],
),
SizedBox(width: 10.0),
Text("View Account")
],
),
));
}
}