diff --git a/lib/navigation/actor_screen.dart b/lib/navigation/actor_screen.dart index 1fd16e4..2a2c9ac 100644 --- a/lib/navigation/actor_screen.dart +++ b/lib/navigation/actor_screen.dart @@ -36,7 +36,7 @@ class _ActorScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text("Temp"), + title: Text("Actors"), ), body: FutureBuilder( future: _categories, diff --git a/lib/navigation/categorie_screen.dart b/lib/navigation/categorie_screen.dart index a398787..7a34e55 100644 --- a/lib/navigation/categorie_screen.dart +++ b/lib/navigation/categorie_screen.dart @@ -36,7 +36,7 @@ class _CategorieScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text("Temp"), + title: Text("Categories"), ), body: FutureBuilder( future: _categories, diff --git a/lib/navigation/settings_screen.dart b/lib/navigation/settings_screen.dart index 2785eb4..731aa6c 100644 --- a/lib/navigation/settings_screen.dart +++ b/lib/navigation/settings_screen.dart @@ -29,7 +29,7 @@ class _SettingsScreenState extends State { return Scaffold( appBar: AppBar( - title: Text("Temp"), + title: Text("Settings"), ), body: Column( children: [ diff --git a/lib/navigation/shufflescreen.dart b/lib/navigation/shufflescreen.dart index a07d345..663505e 100644 --- a/lib/navigation/shufflescreen.dart +++ b/lib/navigation/shufflescreen.dart @@ -34,7 +34,7 @@ class _ShuffleScreenState extends State { return Scaffold( appBar: AppBar( - title: Text("Temp"), + title: Text("Shuffle"), ), body: PreviewGrid( videoLoader: () { diff --git a/lib/navigation/video_feed.dart b/lib/navigation/video_feed.dart index cf63a2e..3c522f6 100644 --- a/lib/navigation/video_feed.dart +++ b/lib/navigation/video_feed.dart @@ -4,11 +4,12 @@ import 'package:flutter/material.dart'; import 'package:openmediacentermobile/DrawerPage.dart'; import '../api/api.dart'; -import '../log/log.dart'; import '../preview/preview_grid.dart'; import '../types/tag.dart'; import '../types/video.dart'; +enum FilterTypes { DATE, LIKES, RANDOM, NAMES, LENGTH } + class VideoFeed extends StatefulWidget { const VideoFeed({Key? key, this.tag}) : super(key: key); final Tag? tag; @@ -20,9 +21,12 @@ class VideoFeed extends StatefulWidget { } class VideoFeedState extends State { + FilterTypes filterSelection = FilterTypes.DATE; + Key _refreshKey = UniqueKey(); + Future> loadData() async { - final data = await API.query( - "video", "getMovies", {'Tag': widget.tag?.tagId ?? 1, 'Sort': 0}); + final data = await API.query("video", "getMovies", + {'Tag': widget.tag?.tagId ?? 1, 'Sort': filterSelection.index}); final d = jsonDecode(data); @@ -34,14 +38,48 @@ class VideoFeedState extends State { @override Widget build(BuildContext context) { - double width = MediaQuery.of(context).size.width; - Log.d(width); - return Scaffold( appBar: AppBar( title: Text(widget.tag?.tagName ?? "OpenMediaCenter"), + actions: [ + PopupMenuButton( + // add icon, by default "3 dot" icon + icon: Icon(Icons.filter_alt), + initialValue: filterSelection, + itemBuilder: (context) { + return [ + PopupMenuItem( + value: FilterTypes.DATE, + child: Text("Date"), + ), + PopupMenuItem( + value: FilterTypes.LIKES, + child: Text("Likes"), + ), + PopupMenuItem( + value: FilterTypes.RANDOM, + child: Text("Random"), + ), + PopupMenuItem( + value: FilterTypes.NAMES, + child: Text("Names"), + ), + PopupMenuItem( + value: FilterTypes.LENGTH, + child: Text("Length"), + ), + ]; + }, + onSelected: (FilterTypes t) { + setState(() { + filterSelection = t; + _refreshKey = UniqueKey(); + }); + }), + ], ), body: PreviewGrid( + key: _refreshKey, videoLoader: () => loadData(), ), drawer: widget.tag == null ? MyDrawer() : null);