add page for tv shows

only showing up if enabled in backend
This commit is contained in:
2022-10-15 23:15:21 +02:00
parent 9ef317f0ba
commit 6f6fbb3897
9 changed files with 123 additions and 11 deletions

View File

@ -3,6 +3,7 @@ import 'package:openmediacentermobile/navigation/settings_screen.dart';
import '../navigation/actor_screen.dart';
import '../navigation/categorie_screen.dart';
import '../navigation/shuffle_screen.dart';
import '../navigation/tv_show_screen.dart';
import '../navigation/video_feed.dart';
import 'drawer_context.dart';
@ -15,7 +16,7 @@ class DrawerPage extends StatefulWidget {
_DrawerPageState createState() => _DrawerPageState();
}
enum Section { HOME, SHUFFLE, SETTING, CATEGORIE, ACTOR }
enum Section { HOME, SHUFFLE, SETTING, CATEGORIE, ACTOR, TVSHOW }
class _DrawerPageState extends State<DrawerPage> {
Section _sec = Section.HOME;
@ -50,6 +51,11 @@ class _DrawerPageState extends State<DrawerPage> {
body = ActorScreen();
title = "Actors";
break;
case Section.TVSHOW:
body = TVShowScreen();
title = "TV Shows";
break;
}
return DrawerContext(

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:openmediacentermobile/utils/feature_context.dart';
import 'drawer_context.dart';
import 'drawer_page.dart';
@ -9,6 +10,7 @@ class MyDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ctx = DrawerContext.of(context);
final featureCtx = FeatureContext.of(context);
return Drawer(
child: ListView(children: [
@ -44,6 +46,15 @@ class MyDrawer extends StatelessWidget {
Navigator.pop(context);
},
),
if (featureCtx.tvShowEnabled)
ListTile(
title: const Text('TV Shows'),
leading: const Icon(Icons.tv),
onTap: () {
ctx.onChangePage(Section.TVSHOW);
Navigator.pop(context);
},
),
ListTile(
title: const Text('Settings'),
leading: const Icon(Icons.settings),