OpenMediacenterMobileFlutter/lib/drawer/drawer_page.dart

66 lines
1.5 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:openmediacentermobile/navigation/settings_screen.dart';
import '../navigation/actor_screen.dart';
import '../navigation/categorie_screen.dart';
import '../navigation/shufflescreen.dart';
import '../navigation/video_feed.dart';
import 'drawer_context.dart';
class DrawerPage extends StatefulWidget {
const DrawerPage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_DrawerPageState createState() => _DrawerPageState();
}
enum Section { HOME, SHUFFLE, SETTING, CATEGORIE, ACTOR }
class _DrawerPageState extends State<DrawerPage> {
Section _sec = Section.HOME;
@override
Widget build(BuildContext context) {
Widget body;
String title;
switch (_sec) {
case Section.HOME:
body = const VideoFeed();
title = widget.title;
break;
case Section.SHUFFLE:
body = const ShuffleScreen();
title = "Shuffle";
break;
case Section.SETTING:
body = SettingsScreen();
title = "Settings";
break;
case Section.CATEGORIE:
body = CategorieScreen();
title = "Categories";
break;
case Section.ACTOR:
body = ActorScreen();
title = "Actors";
break;
}
return DrawerContext(
child: body,
onChangePage: (newPage) {
setState(() {
_sec = newPage;
});
},
routeName: title,
);
}
}