lukas-heiligenbrunner
bf070ff99a
update dependencies try to infer the prefix of the server url display display size dependent amount on shuffle page
93 lines
2.2 KiB
Dart
93 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:openmediacentermobile/shufflescreen.dart';
|
|
import 'package:openmediacentermobile/video_feed.dart';
|
|
|
|
import 'api/token.dart';
|
|
import 'login/logincontext.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, LOGOUT }
|
|
|
|
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.LOGOUT:
|
|
body = const Text("also todo");
|
|
title = "Settings";
|
|
break;
|
|
}
|
|
|
|
final loginCtx = LoginContext.of(context);
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text(title), actions: [
|
|
IconButton(
|
|
onPressed: () {
|
|
loginCtx.onLoggin(false);
|
|
Token.getInstance().setToken("", "");
|
|
},
|
|
icon: const Icon(Icons.logout))
|
|
],),
|
|
body: body,
|
|
drawer: Drawer(
|
|
child: ListView(children: [
|
|
ListTile(
|
|
title: const Text('Home'),
|
|
leading: const Icon(Icons.home),
|
|
onTap: () {
|
|
setState(() {
|
|
_sec = Section.HOME;
|
|
});
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
ListTile(
|
|
title: const Text('Shuffle'),
|
|
leading: const Icon(Icons.update),
|
|
onTap: () {
|
|
setState(() {
|
|
_sec = Section.SHUFFLE;
|
|
});
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
ListTile(
|
|
title: const Text('Settings'),
|
|
leading: const Icon(Icons.settings),
|
|
onTap: () {
|
|
setState(() {
|
|
_sec = Section.LOGOUT;
|
|
});
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
]),
|
|
),
|
|
);
|
|
}
|
|
}
|