Drawer adalah sebuah Menu yang terletak disamping kiri dan tersembunyi diwakili dengan tanda strip tiga seperti terlihat dibawah ini:
import ‘package:flutter/material.dart’;
class Dashboard extends StatelessWidget {
const Dashboard({super.key});
final String judul = ‘Dashboard’;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: judul,
home: isiDashboard(judul: judul),
);
}
}
class IsiDashboard extends StatelessWidget {
final String judul;
const IsiDashboard({Key? key, required this.judul}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(judul),
foregroundColor: Colors.white,
backgroundColor: Colors.lightBlue,
),
body: Center(child: Text(“Halaman Utama”)),
drawer: Drawer(
child: ListView(
children: [
const DrawerHeader(
decoration: BoxDecoration(color: Colors.blue),
child: Text(‘Fahmi’),
),
ListTile(
title: Text(‘Tambah Data Murid’),
onTap: () {}),
ListTile(title: Text(‘Lihat Data Murid’), onTap: () {}),
ListTile(
title: Text(‘Close’),
onTap: () {
Navigator.pop(context);
},
),
],
),
),
);
}
}