I have done this using scaffold drawer. Please see and try this
class _Dashbord extends State<Dashbord> {
Widget bodyWidget = DashboardInitialContent();
@override
Widget build(BuildContext context) {
final bool displayMobileLayout = MediaQuery.of(context).size.width < 500;
return Row(
children: [
if (!displayMobileLayout)
Drawer(
// Add a ListView to the drawer. This ensures the user can scroll
// through the options in the drawer if there isn't enough vertical
// space to fit everything.
child: ListView(
// Important: Remove any padding from the ListView.
// padding: EdgeInsets.zero,
children: [
DrawerHeader(
// decoration: const BoxDecoration(
// color: Colors.white,
// ),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
child: Image.asset(
"assets/images/3c98d8a48cfed2f87f377ec2b30130b4b9195af4.png"),
),
],
),
),
ListTile(
hoverColor: Colors.grey,
leading: const Icon(
Icons.dashboard,
color: Colors.deepOrange,
),
title: const Text(
'Dashboard',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
color: Colors.deepOrange,
),
),
onTap: () {
// Update the state of the app
// ...
// Then close the drawer
setState(() {
bodyWidget = DashboardInitialContent();
});
},
)
],
),
),
Expanded(
child: Scaffold(
appBar: AppBar(
automaticallyImplyLeading: displayMobileLayout ? true : false,
backgroundColor: Colors.deepOrange,
actions: [
IconButton(
icon: const Icon(Icons.notification_important_rounded),
tooltip: 'Notification',
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('This is a snackbar')));
},
),
PopupMenuButton(
icon: const Icon(Icons.person_rounded),
tooltip: 'Profile',
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
PopupMenuItem(
child: ListTile(
leading: Icon(Icons.edit),
title: Text('Edit Profile'),
onTap: () {
setState(() {
bodyWidget = UserProfile();
Navigator.pop(context);
});
},
),
),
PopupMenuItem(
child: ListTile(
leading: Icon(Icons.lock),
title: Text('Change Password'),
onTap: () {
setState(() {
bodyWidget = ChangePassword();
Navigator.pop(context);
});
},
),
),
const PopupMenuItem(
child: ListTile(
leading: Icon(Icons.logout),
title: Text('Sign out'),
),
),
],
),
],
),
drawer: displayMobileLayout
? Drawer(
// Add a ListView to the drawer. This ensures the user can scroll
// through the options in the drawer if there isn't enough vertical
// space to fit everything.
child: ListView(
// Important: Remove any padding from the ListView.
// padding: EdgeInsets.zero,
children: [
DrawerHeader(
// decoration: const BoxDecoration(
// color: Colors.white,
// ),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
child: Image.asset(
"assets/images/3c98d8a48cfed2f87f377ec2b30130b4b9195af4.png"),
),
],
),
),
ListTile(
hoverColor: Colors.grey,
leading: const Icon(
Icons.dashboard,
color: Colors.deepOrange,
),
title: const Text(
'Dashboard',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
color: Colors.deepOrange,
),
),
onTap: () {
// Update the state of the app
// ...
// Then close the drawer
setState(() {
bodyWidget = DashboardInitialContent();
});
Navigator.pop(context);
},
)
],
),
)
: null,
body: bodyWidget,
),
)
],
);
}
}