OpenMediacenterMobileFlutter/lib/drawer/my_drawer.dart

39 lines
1.2 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'drawer_context.dart';
import 'drawer_page.dart';
class MyDrawer extends StatelessWidget {
const MyDrawer({Key? key}) : super(key: key);
@override
2022-11-01 23:36:21 +00:00
Widget build(BuildContext context) => Drawer(
backgroundColor: Color(0xff3f3f3f),
child: ListView(children: [
SizedBox(
height: 75,
),
_listelement('Home', Icons.home, Section.HOME, context),
_listelement('Shuffle', Icons.update, Section.SHUFFLE, context),
_listelement(
'Categories', Icons.category, Section.CATEGORIE, context),
_listelement('Actors', Icons.people, Section.ACTOR, context),
_listelement('Settings', Icons.settings, Section.SETTING, context),
]),
);
Widget _listelement(
String text, IconData icon, Section section, BuildContext context) {
final ctx = DrawerContext.of(context);
2022-11-01 23:36:21 +00:00
return ListTile(
title: Text(text, style: TextStyle(color: Color(0xffe9e9e9))),
leading: Icon(icon, color: Color(0xffe9e9e9)),
onTap: () {
ctx.onChangePage(section);
Navigator.pop(context);
},
);
}
}