From a7756da713d2edece2e1e3f091c5269c6cbf2bd8 Mon Sep 17 00:00:00 2001 From: lukas-heiligenbrunner Date: Wed, 2 Nov 2022 00:36:21 +0100 Subject: [PATCH] make theming prettier and darker --- lib/app.dart | 2 ++ lib/drawer/my_drawer.dart | 68 +++++++++++++---------------------- lib/preview/preview_grid.dart | 51 +++++++++++++------------- lib/preview/preview_tile.dart | 16 +++++++-- 4 files changed, 66 insertions(+), 71 deletions(-) diff --git a/lib/app.dart b/lib/app.dart index c60e890..550ecb6 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -29,6 +29,8 @@ class App extends StatelessWidget { return const MaterialApp(home: LoginScreen()); } else { return MaterialApp( + theme: ThemeData( + appBarTheme: AppBarTheme(backgroundColor: Color(0xff0d0d0d))), scrollBehavior: AppScrollBehavior(), home: DrawerPage( title: 'OpenMediaCenter', diff --git a/lib/drawer/my_drawer.dart b/lib/drawer/my_drawer.dart index 1544d13..54bc282 100644 --- a/lib/drawer/my_drawer.dart +++ b/lib/drawer/my_drawer.dart @@ -7,52 +7,32 @@ class MyDrawer extends StatelessWidget { const MyDrawer({Key? key}) : super(key: key); @override - Widget build(BuildContext context) { + 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); - return Drawer( - child: ListView(children: [ - ListTile( - title: const Text('Home'), - leading: const Icon(Icons.home), - onTap: () { - ctx.onChangePage(Section.HOME); - Navigator.pop(context); - }, - ), - ListTile( - title: const Text('Shuffle'), - leading: const Icon(Icons.update), - onTap: () { - ctx.onChangePage(Section.SHUFFLE); - Navigator.pop(context); - }, - ), - ListTile( - title: const Text('Categories'), - leading: const Icon(Icons.category), - onTap: () { - ctx.onChangePage(Section.CATEGORIE); - Navigator.pop(context); - }, - ), - ListTile( - title: const Text('Actors'), - leading: const Icon(Icons.people), - onTap: () { - ctx.onChangePage(Section.ACTOR); - Navigator.pop(context); - }, - ), - ListTile( - title: const Text('Settings'), - leading: const Icon(Icons.settings), - onTap: () { - ctx.onChangePage(Section.SETTING); - Navigator.pop(context); - }, - ), - ]), + return ListTile( + title: Text(text, style: TextStyle(color: Color(0xffe9e9e9))), + leading: Icon(icon, color: Color(0xffe9e9e9)), + onTap: () { + ctx.onChangePage(section); + Navigator.pop(context); + }, ); } } diff --git a/lib/preview/preview_grid.dart b/lib/preview/preview_grid.dart index 214fa7b..dc9e389 100644 --- a/lib/preview/preview_grid.dart +++ b/lib/preview/preview_grid.dart @@ -60,7 +60,7 @@ class _PreviewGridState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text("Error"), + Text("Error" + snapshot.error.toString()), TextButton( onPressed: () => loadData(), child: Text("Reload page")) ], @@ -83,29 +83,32 @@ class _PreviewGridState extends State { if (widget.headerBuilder != null) widget.headerBuilder!(this), data.length > 0 ? Expanded( - child: MasonryGridView.count( - // every tile should be at max 330 pixels long... - crossAxisCount: isTV() ? width ~/ 200 : width ~/ 275, - // crossAxisCount: isTV() ? width ~/ 200 : width ~/ 330, - itemCount: data.length, - mainAxisSpacing: 4, - crossAxisSpacing: 4, - padding: EdgeInsets.all(5), - itemBuilder: (context, index) { - return PreviewTile( - dta: data[index], - onLongPress: (img) { - setState(() { - _previewImage = img; - }); - }, - onLongPressEnd: () { - setState(() { - _previewImage = null; - }); - }, - ); - }, + child: Container( + color: Color(0xff999999), + child: MasonryGridView.count( + // every tile should be at max 330 pixels long... + crossAxisCount: isTV() ? width ~/ 200 : width ~/ 275, + // crossAxisCount: isTV() ? width ~/ 200 : width ~/ 330, + itemCount: data.length, + mainAxisSpacing: 4, + crossAxisSpacing: 4, + padding: EdgeInsets.all(5), + itemBuilder: (context, index) { + return PreviewTile( + dta: data[index], + onLongPress: (img) { + setState(() { + _previewImage = img; + }); + }, + onLongPressEnd: () { + setState(() { + _previewImage = null; + }); + }, + ); + }, + ), ), ) : Center( diff --git a/lib/preview/preview_tile.dart b/lib/preview/preview_tile.dart index 6ee192a..c517e78 100644 --- a/lib/preview/preview_tile.dart +++ b/lib/preview/preview_tile.dart @@ -105,16 +105,26 @@ class _PreviewTileState extends State { Container( child: Column( children: [ + ClipRRect( + child: image, + borderRadius: BorderRadius.circular(20.0), + ), + SizedBox( + height: 3, + ), Text( widget.dta.title, - style: TextStyle(fontSize: isTV() ? 8 : 10.5), + style: TextStyle( + fontSize: isTV() ? 8 : 10.5, color: Color(0xffe9e9e9)), overflow: TextOverflow.clip, maxLines: 1, ), - image + SizedBox( + height: 3, + ), ], ), - color: Color(0x6a94a6ff), + color: Color(0xff3f3f3f), ), Positioned.fill( child: Material(