From a998eeed1edf46544a185be543663ecfe05e0370 Mon Sep 17 00:00:00 2001 From: FrostNova <83959988+frostnova721@users.noreply.github.com> Date: Sat, 9 Mar 2024 21:03:24 +0530 Subject: [PATCH] fix: nav bar transparency, updates --- lib/core/app/update.dart | 39 ++- lib/main.dart | 20 +- lib/ui/models/cards.dart | 43 +-- lib/ui/pages/home.dart | 450 +++++++++++++++------------ lib/ui/pages/newHome.dart | 373 ---------------------- lib/ui/pages/settingPages/theme.dart | 2 +- lib/ui/pages/watch.dart | 2 +- lib/ui/theme/themes.dart | 2 +- todo.md | 1 - 9 files changed, 294 insertions(+), 638 deletions(-) delete mode 100644 lib/ui/pages/newHome.dart diff --git a/lib/core/app/update.dart b/lib/core/app/update.dart index 0047b61..29337a6 100644 --- a/lib/core/app/update.dart +++ b/lib/core/app/update.dart @@ -30,6 +30,7 @@ Future checkForUpdates() async { final releasesRes = json.decode(await fetch(releasesUrl))[0]; final String currentVersion = packageInfo.version; final String latestVersion = releasesRes['tag_name']; + print("$currentVersion , $latestVersion"); final String description = releasesRes['body']; final bool pre = releasesRes['prerelease']; if (currentVersion != latestVersion.replaceAll('v', '').split("-")[0]) { @@ -53,6 +54,7 @@ showUpdateSheet( showModalBottomSheet( showDragHandle: true, backgroundColor: backgroundColor, + isScrollControlled: true, context: context, builder: (context) { return Container( @@ -61,19 +63,28 @@ showUpdateSheet( mainAxisSize: MainAxisSize.min, children: [ if (pre) - Text("Test Version", - style: TextStyle(color: textSubColor, fontFamily: "Poppins")), - MarkdownBody( - data: markdownText, - styleSheet: MarkdownStyleSheet( - h1: style(), - h2: style(), - listBullet: style(), - h3: style(), - h4: style(), - h5: style(), - h6: style(), - p: style(), + Text( + "Test Version", + style: TextStyle(color: textSubColor, fontFamily: "Poppins"), + ), + Container( + child: ListView( + shrinkWrap: true, + children: [ + MarkdownBody( + data: markdownText, + styleSheet: MarkdownStyleSheet( + h1: style(), + h2: style(), + listBullet: style(), + h3: style(), + h4: style(), + h5: style(), + h6: style(), + p: style(), + ), + ), + ], ), ), Container( @@ -139,7 +150,7 @@ showUpdateSheet( ), ], ), - ) + ), ], ), ); diff --git a/lib/main.dart b/lib/main.dart index 493f71a..1ce4dd2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:animestream/core/data/theme.dart'; import 'package:animestream/ui/models/notification.dart'; -import 'package:animestream/ui/pages/newHome.dart'; +import 'package:animestream/ui/pages/home.dart'; import 'package:animestream/ui/theme/mainTheme.dart'; import 'package:flutter/material.dart'; import 'package:animated_splash_screen/animated_splash_screen.dart'; @@ -41,15 +41,18 @@ class _MyAppState extends State { onDismissActionReceivedMethod: NotificationController.onDismissActionReceivedMethod); + getTheme().then((theme) => { + accentColor = theme.accentColor, + textMainColor = theme.textMainColor, + textSubColor = theme.textSubColor, + backgroundColor = theme.backgroundColor + }); + SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( - systemNavigationBarColor: Colors.black.withOpacity(0.002))); + systemNavigationBarColor: Colors.black.withOpacity(0.002), + )); - getTheme().then((theme) => { - accentColor = theme.accentColor, - textMainColor = theme.textMainColor, - textSubColor = theme.textSubColor, - backgroundColor = theme.backgroundColor - }); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge, overlays: [SystemUiOverlay.top]); super.initState(); } @@ -57,7 +60,6 @@ class _MyAppState extends State { // This widget is the root of your application. @override Widget build(BuildContext context) { - return MaterialApp( title: 'Animestream', theme: ThemeData( diff --git a/lib/ui/models/cards.dart b/lib/ui/models/cards.dart index 3a37eef..a7ed539 100644 --- a/lib/ui/models/cards.dart +++ b/lib/ui/models/cards.dart @@ -38,7 +38,7 @@ Widget characterCard(String name, String role, String imageUrl) { child: Text( name, style: TextStyle( - color: Colors.white, + color: textMainColor, fontFamily: 'NotoSans', fontSize: 15, overflow: TextOverflow.ellipsis, @@ -50,7 +50,7 @@ Widget characterCard(String name, String role, String imageUrl) { Text( role, style: TextStyle( - color: const Color.fromARGB(255, 141, 141, 141), + color: textSubColor, fontFamily: 'NotoSans', fontSize: 12, overflow: TextOverflow.ellipsis, @@ -95,7 +95,7 @@ Widget NewsCard(String title, String imageUrl, String date, String time) { overflow: TextOverflow.ellipsis, maxLines: 5, style: TextStyle( - color: Colors.white, + color: textMainColor, fontSize: 18, fontFamily: "Rubik", ), @@ -109,7 +109,7 @@ Widget NewsCard(String title, String imageUrl, String date, String time) { style: TextStyle( fontFamily: "NotoSans", fontSize: 13, - color: const Color.fromARGB(255, 151, 151, 151), + color: textSubColor, ), ), ), @@ -157,7 +157,7 @@ Widget animeCard(String title, String imageUrl) { Text( title, style: TextStyle( - color: Colors.white, + color: textMainColor, fontFamily: 'NotoSans', fontSize: 15, overflow: TextOverflow.ellipsis, @@ -170,39 +170,6 @@ Widget animeCard(String title, String imageUrl) { ); } -Widget animeCardSkeleton(String title) { - return Card( - color: Colors.black, - clipBehavior: Clip.hardEdge, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20), - ), - child: Column( - children: [ - Container( - margin: EdgeInsets.only(bottom: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - ), - clipBehavior: Clip.hardEdge, - height: 175, - width: 115, - ), - Text( - title, - style: TextStyle( - color: Colors.white, - fontFamily: 'NotoSans', - fontSize: 15, - overflow: TextOverflow.ellipsis, - ), - maxLines: 2, - ), - ], - ), - ); -} - class AnimeData { final String imageUrl; final String title; diff --git a/lib/ui/pages/home.dart b/lib/ui/pages/home.dart index c36b988..1d1abf7 100644 --- a/lib/ui/pages/home.dart +++ b/lib/ui/pages/home.dart @@ -1,46 +1,53 @@ +import 'package:animestream/core/app/update.dart'; import 'package:animestream/core/database/anilist/anilist.dart'; import 'package:animestream/ui/models/cards.dart'; +import 'package:animestream/ui/models/drawer.dart'; import 'package:animestream/ui/pages/Discover.dart'; -import 'package:animestream/ui/pages/newHome.dart'; import 'package:animestream/ui/pages/info.dart'; +import 'package:animestream/ui/pages/search.dart'; +import 'package:animestream/ui/pages/settings.dart'; import 'package:animestream/ui/theme/mainTheme.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_spinkit/flutter_spinkit.dart'; -import 'package:flutter/services.dart'; import 'package:hive/hive.dart'; -class HomeOld extends StatefulWidget { - const HomeOld({super.key}); +class Home extends StatefulWidget { + const Home({super.key}); @override - State createState() => _HomeState(); + State createState() => _HomeState(); } -class _HomeState extends State { +class _HomeState extends State { @override void initState() { super.initState(); - error = false; + getLists(); - SystemChrome.setPreferredOrientations([ - DeviceOrientation.portraitUp, - DeviceOrientation.landscapeRight, - DeviceOrientation.landscapeLeft, - ]); - SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); + checkForUpdates().then((value) { + if(value != null) { + showUpdateSheet(context, value.description, value.downloadLink, value.preRelease); + } + },); } + int activeIndex = 0; + + TextEditingController textEditingController = TextEditingController(); + List recentlyWatched = []; List currentlyAiring = []; + bool dataLoaded = false; bool error = false; - int activeIndex = 0; - // TabController tabController =; - Future getLists() async { - // currentlyAiring = []; - // recentlyWatched = []; + onItemTapped(int index) { + if (mounted) + setState(() { + activeIndex = index; + }); + } + Future getLists() async { try { final box = await Hive.openBox('animestream'); List watching = box.get('watching') ?? []; @@ -59,7 +66,7 @@ class _HomeState extends State { if (currentlyAiringResponse.length == 0) return; currentlyAiring = []; - currentlyAiringResponse.forEach((e) { + currentlyAiringResponse.sublist(0, 20).forEach((e) { final title = e['title']['english'] ?? e['title']['romaji']; final image = e['coverImage']['large'] ?? e['coverImage']['extraLarge']; currentlyAiring @@ -78,196 +85,220 @@ class _HomeState extends State { } } - Widget getPage(context) { - switch (activeIndex) { - case 0: - return _homePage(context); - case 1: - return Discover( - currentSeason: currentlyAiring, - ); - default: - return _homePage(context); - } - } + final GlobalKey _globalKey = GlobalKey(); @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.black, - body: SingleChildScrollView(child: getPage(context)), - floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, - floatingActionButton: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50), - ), - width: 150, - height: 50, - child: ClipRRect( - borderRadius: BorderRadius.circular(50), - child: Theme( - data: ThemeData( - splashColor: Colors.transparent, - highlightColor: Colors.transparent, - hoverColor: Colors.transparent), - child: BottomNavigationBar( - selectedItemColor: accentColor, - unselectedItemColor: Colors.white, - currentIndex: activeIndex, - backgroundColor: Color.fromARGB(255, 24, 24, 24), - elevation: 0, - onTap: (val) { - if (val == 2) - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => Home(), - ), - ); - setState(() { - activeIndex = val; - }); - }, - selectedLabelStyle: TextStyle(fontSize: 0), - items: [ - BottomNavigationBarItem( - label: "", - icon: Icon(Icons.home_rounded), - tooltip: "home"), - BottomNavigationBarItem( - label: "", - icon: Image.asset( - 'lib/assets/images/shines.png', - color: activeIndex == 1 ? accentColor : Colors.white, - scale: 22, + key: _globalKey, + backgroundColor: backgroundColor, + drawer: HomeDrawer( + onItemTapped: onItemTapped, + activeIndex: activeIndex, + ), + body: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top, bottom: MediaQuery.of(context).padding.bottom), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + // width: MediaQuery.of(context).size.width - 100, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + IconButton( + onPressed: () { + _globalKey.currentState!.openDrawer(); + }, + icon: Icon( + Icons.menu_rounded, + color: textMainColor, + size: 30, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 10), + child: Text( + "AnimeStream", + style: TextStyle( + color: textMainColor, + fontSize: 23, + fontFamily: 'NunitoSans', + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Container( + padding: EdgeInsets.only(left: 10, right: 0, top: 10), + width: 300, + child: TextField( + controller: textEditingController, + autocorrect: false, + maxLines: 1, + onSubmitted: (String input) { + textEditingController.value = + TextEditingValue.empty; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + Search(searchedText: input), + ), + ); + }, + cursorColor: accentColor, + decoration: InputDecoration( + prefixIcon: Padding( + padding: const EdgeInsets.only(left: 5), + child: Image.asset( + "lib/assets/images/search.png", + color: textMainColor, + scale: 1.75, + ), + ), + hintText: "Search...", + hintStyle: TextStyle( + color: textSubColor, + fontFamily: "Poppins", + fontSize: 16, + ), + focusColor: accentColor, + contentPadding: EdgeInsets.only( + top: 5, bottom: 5, left: 20, right: 20), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: accentColor, + ), + borderRadius: BorderRadius.circular(25), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: textMainColor, + width: 1.5, + ), + borderRadius: BorderRadius.circular(25), + ), + ), + style: TextStyle( + backgroundColor: backgroundColor, + color: textMainColor, + fontFamily: 'Poppins', + fontSize: 16, + ), + ), + ), + ], ), - tooltip: "discover", ), - BottomNavigationBarItem( - icon: Icon(Icons.fiber_new_rounded), label: "") + Container( + padding: EdgeInsets.only(right: 15), + child: IconButton( + onPressed: () { + Navigator.push(context, MaterialPageRoute(builder: (context) => SettingsPage(),)); + }, + icon: Icon( + Icons.settings, + color: textMainColor, + size: 45, + ), + ), + // padding: EdgeInsets.only(right: 25), + // child: CircleAvatar( + // radius: 25, + // backgroundColor: , + // ), + ) ], ), - ), + activeIndex == 0 + ? _homeItems() + : Discover(currentSeason: currentlyAiring), + ], ), - )); + ), + ), + ); } - Column _homePage(BuildContext context) { + Column _homeItems() { return Column( children: [ Container( - height: 50, - ), - Row( - children: [ - IconButton( - onPressed: () async { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => Search(), - // ), - // ).then( - // (value) => setState( - // () { - // getLists(); - // }, - // ), - // ); - }, - iconSize: 40, - tooltip: "Discover", - icon: Image.asset( - "lib/assets/images/search.png", - color: Colors.white, - scale: 1.5, - ), - ), - ], - ), - Column( - children: [ - Container( - padding: const EdgeInsets.only( - left: 15, right: 10, top: 40, bottom: 10), - alignment: Alignment.topLeft, - child: const Text( - 'Recently Watched', + width: double.infinity, + padding: EdgeInsets.only(top: 40, left: 20, right: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Recently Watched", + textAlign: TextAlign.left, style: TextStyle( - fontSize: 22, + color: textMainColor, fontFamily: "Rubik", - color: Colors.white, + fontSize: 20, ), ), - ), - error - ? _errorText() - : dataLoaded - ? _cardListMaker(recentlyWatched) - : Container( - height: 280, - child: Center( - child: SpinKitThreeBounce( - color: accentColor, - size: 30, - ), + dataLoaded + ? _cardListMaker(recentlyWatched) + : Container( + height: 250, + child: Center( + child: CircularProgressIndicator( + color: accentColor, ), ), - Container( - padding: const EdgeInsets.only(left: 15, right: 10, bottom: 10), - alignment: Alignment.topLeft, - child: const Text( - 'Currently Airing', + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(left: 30, right: 30, top: 10, bottom: 10), + height: 5, + decoration: BoxDecoration( + color: accentColor.withOpacity(0.4), + borderRadius: BorderRadius.circular( + 50, + ), + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 10, left: 20, right: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Currently Airing", + textAlign: TextAlign.left, style: TextStyle( - fontSize: 22, + color: textMainColor, fontFamily: "Rubik", - color: Colors.white, + fontSize: 20, ), ), - ), - error - ? _errorText() - : dataLoaded - ? _cardListMaker(currentlyAiring.sublist(0, 20)) - : Container( - height: 280, - child: Center( - child: SpinKitThreeBounce( - color: accentColor, - size: 30, - ), + dataLoaded + ? _cardListMaker(currentlyAiring) + : Container( + height: 250, + child: Center( + child: CircularProgressIndicator( + color: accentColor, ), ), - ], - ) - ], - ); - } - - Container _errorText() { - return Container( - height: 280, - alignment: Alignment.center, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'lib/assets/images/broken_heart.png', - scale: 7.5, - ), - Padding( - padding: const EdgeInsets.only(top: 15), - child: Text( - "Had some issues loading the list!", - style: TextStyle( - color: Color(0xfff92b60), - fontFamily: "NunitoSans", - fontSize: 16, - ), - ), + ), + ], ), - ], - ), + ), + ], ); } @@ -276,15 +307,15 @@ class _HomeState extends State { children: [ widgetList.length > 0 ? Container( - padding: const EdgeInsets.only(left: 15, right: 15, top: 15), - height: 255, + padding: const EdgeInsets.only(top: 15), + height: 250, child: ListView.builder( itemCount: widgetList.length, scrollDirection: Axis.horizontal, itemBuilder: (context, index) { return Container( alignment: Alignment.centerLeft, - width: 125, + width: 120, child: GestureDetector( onTap: () { Navigator.push( @@ -293,9 +324,14 @@ class _HomeState extends State { builder: (context) => Info(id: widgetList[index].info['id']), ), - ).then((value) => setState(() { - getLists(); - })); + ).then( + (value) { + if (mounted) + setState(() { + getLists(); + }); + }, + ); }, child: widgetList[index].widget, ), @@ -303,17 +339,31 @@ class _HomeState extends State { }, ), ) - : Container( - height: 280, - padding: EdgeInsets.only(top: 125), - child: Text( - "Nothing to see here!", - textAlign: TextAlign.center, - style: TextStyle( - fontFamily: "NunitoSans", - fontWeight: FontWeight.w500, - color: Color.fromARGB(255, 80, 80, 80), - fontSize: 18, + : Center( + child: Container( + height: 250, + alignment: Alignment.center, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Image.asset( + "lib/assets/images/ghost.png", + color: Color.fromARGB(255, 80, 80, 80), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0), + child: Text( + "Boo! Nothing's here!", + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: "NunitoSans", + fontWeight: FontWeight.w500, + color: Color.fromARGB(255, 80, 80, 80), + fontSize: 18, + ), + ), + ), + ], ), ), ), diff --git a/lib/ui/pages/newHome.dart b/lib/ui/pages/newHome.dart deleted file mode 100644 index c2670d5..0000000 --- a/lib/ui/pages/newHome.dart +++ /dev/null @@ -1,373 +0,0 @@ -import 'package:animestream/core/app/update.dart'; -import 'package:animestream/core/database/anilist/anilist.dart'; -import 'package:animestream/ui/models/cards.dart'; -import 'package:animestream/ui/models/drawer.dart'; -import 'package:animestream/ui/pages/Discover.dart'; -import 'package:animestream/ui/pages/info.dart'; -import 'package:animestream/ui/pages/search.dart'; -import 'package:animestream/ui/pages/settings.dart'; -import 'package:animestream/ui/theme/mainTheme.dart'; -import 'package:flutter/material.dart'; -import 'package:hive/hive.dart'; - -class Home extends StatefulWidget { - const Home({super.key}); - - @override - State createState() => _HomeState(); -} - -class _HomeState extends State { - @override - void initState() { - super.initState(); - - getLists(); - checkForUpdates().then((value) { - if(value != null) { - showUpdateSheet(context, value.description, value.downloadLink, value.preRelease); - } - },); - } - - int activeIndex = 0; - - TextEditingController textEditingController = TextEditingController(); - - List recentlyWatched = []; - List currentlyAiring = []; - - bool dataLoaded = false; - bool error = false; - - onItemTapped(int index) { - if (mounted) - setState(() { - activeIndex = index; - }); - } - - Future getLists() async { - try { - final box = await Hive.openBox('animestream'); - List watching = box.get('watching') ?? []; - recentlyWatched = []; - if (watching.length != 0) { - if (watching.length > 20) watching = watching.sublist(0, 20); - watching.reversed.toList().forEach((e) { - recentlyWatched.add(ListElement( - widget: animeCard(e['title'], e['imageUrl']), info: e)); - }); - } - box.close(); - - final List currentlyAiringResponse = - await Anilist().getCurrentlyAiringAnime(); - if (currentlyAiringResponse.length == 0) return; - - currentlyAiring = []; - currentlyAiringResponse.sublist(0, 20).forEach((e) { - final title = e['title']['english'] ?? e['title']['romaji']; - final image = e['coverImage']['large'] ?? e['coverImage']['extraLarge']; - currentlyAiring - .add(ListElement(widget: animeCard(title, image), info: e)); - }); - if (mounted) - setState(() { - dataLoaded = true; - }); - } catch (err) { - print(err); - if (mounted) - setState(() { - error = true; - }); - } - } - - final GlobalKey _globalKey = GlobalKey(); - - @override - Widget build(BuildContext context) { - return Scaffold( - key: _globalKey, - backgroundColor: backgroundColor, - drawer: HomeDrawer( - onItemTapped: onItemTapped, - activeIndex: activeIndex, - ), - body: SingleChildScrollView( - child: Padding( - padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top, bottom: MediaQuery.of(context).padding.bottom), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - // width: MediaQuery.of(context).size.width - 100, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - IconButton( - onPressed: () { - _globalKey.currentState!.openDrawer(); - }, - icon: Icon( - Icons.menu_rounded, - color: Colors.white, - size: 30, - ), - ), - Padding( - padding: const EdgeInsets.only(left: 10), - child: Text( - "AnimeStream", - style: TextStyle( - color: textMainColor, - fontSize: 23, - fontFamily: 'NunitoSans', - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - Container( - padding: EdgeInsets.only(left: 10, right: 0, top: 10), - width: 300, - child: TextField( - controller: textEditingController, - autocorrect: false, - maxLines: 1, - onSubmitted: (String input) { - textEditingController.value = - TextEditingValue.empty; - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - Search(searchedText: input), - ), - ); - }, - cursorColor: accentColor, - decoration: InputDecoration( - prefixIcon: Padding( - padding: const EdgeInsets.only(left: 5), - child: Image.asset( - "lib/assets/images/search.png", - color: Colors.white, - scale: 1.75, - ), - ), - hintText: "Search...", - hintStyle: TextStyle( - color: const Color.fromARGB(255, 129, 129, 129), - fontFamily: "Poppins", - fontSize: 16, - ), - focusColor: accentColor, - contentPadding: EdgeInsets.only( - top: 5, bottom: 5, left: 20, right: 20), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: accentColor, - ), - borderRadius: BorderRadius.circular(25), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.white, - width: 1.5, - ), - borderRadius: BorderRadius.circular(25), - ), - ), - style: TextStyle( - backgroundColor: backgroundColor, - color: textMainColor, - fontFamily: 'Poppins', - fontSize: 16, - ), - ), - ), - ], - ), - ), - Container( - padding: EdgeInsets.only(right: 15), - child: IconButton( - onPressed: () { - Navigator.push(context, MaterialPageRoute(builder: (context) => SettingsPage(),)); - }, - icon: Icon( - Icons.settings, - color: textMainColor, - size: 45, - ), - ), - // padding: EdgeInsets.only(right: 25), - // child: CircleAvatar( - // radius: 25, - // backgroundColor: , - // ), - ) - ], - ), - activeIndex == 0 - ? _homeItems() - : Discover(currentSeason: currentlyAiring), - ], - ), - ), - ), - ); - } - - Column _homeItems() { - return Column( - children: [ - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 40, left: 20, right: 20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Recently Watched", - textAlign: TextAlign.left, - style: TextStyle( - color: textMainColor, - fontFamily: "Rubik", - fontSize: 20, - ), - ), - dataLoaded - ? _cardListMaker(recentlyWatched) - : Container( - height: 250, - child: Center( - child: CircularProgressIndicator( - color: accentColor, - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(left: 30, right: 30, top: 10, bottom: 10), - height: 5, - decoration: BoxDecoration( - color: accentColor.withOpacity(0.4), - borderRadius: BorderRadius.circular( - 50, - ), - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 10, left: 20, right: 20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Currently Airing", - textAlign: TextAlign.left, - style: TextStyle( - color: textMainColor, - fontFamily: "Rubik", - fontSize: 20, - ), - ), - dataLoaded - ? _cardListMaker(currentlyAiring) - : Container( - height: 250, - child: Center( - child: CircularProgressIndicator( - color: accentColor, - ), - ), - ), - ], - ), - ), - ], - ); - } - - Column _cardListMaker(List widgetList) { - return Column( - children: [ - widgetList.length > 0 - ? Container( - padding: const EdgeInsets.only(top: 15), - height: 250, - child: ListView.builder( - itemCount: widgetList.length, - scrollDirection: Axis.horizontal, - itemBuilder: (context, index) { - return Container( - alignment: Alignment.centerLeft, - width: 120, - child: GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - Info(id: widgetList[index].info['id']), - ), - ).then( - (value) { - if (mounted) - setState(() { - getLists(); - }); - }, - ); - }, - child: widgetList[index].widget, - ), - ); - }, - ), - ) - : Center( - child: Container( - height: 250, - alignment: Alignment.center, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Image.asset( - "lib/assets/images/ghost.png", - color: Color.fromARGB(255, 80, 80, 80), - ), - Padding( - padding: const EdgeInsets.only(top: 10.0), - child: Text( - "Boo! Nothing's here!", - textAlign: TextAlign.center, - style: TextStyle( - fontFamily: "NunitoSans", - fontWeight: FontWeight.w500, - color: Color.fromARGB(255, 80, 80, 80), - fontSize: 18, - ), - ), - ), - ], - ), - ), - ), - ], - ); - } -} diff --git a/lib/ui/pages/settingPages/theme.dart b/lib/ui/pages/settingPages/theme.dart index c600637..80bffbe 100644 --- a/lib/ui/pages/settingPages/theme.dart +++ b/lib/ui/pages/settingPages/theme.dart @@ -48,7 +48,7 @@ class _ThemeSettingState extends State { children: [ _themeItem("Dark Ash - Lime", lime), _themeItem("Monochrome", monochrome), - _themeItem("Hot Pink", hotPink) + _themeItem("Hot Pink", hotPink), ], ), ), diff --git a/lib/ui/pages/watch.dart b/lib/ui/pages/watch.dart index 71d66ef..17e5fca 100644 --- a/lib/ui/pages/watch.dart +++ b/lib/ui/pages/watch.dart @@ -284,7 +284,7 @@ class _WatchState extends State with TickerProviderStateMixin { ); } - //idea use this in customControls file! + //idea: use this in customControls file! Container overlay() { return Container( decoration: BoxDecoration( diff --git a/lib/ui/theme/themes.dart b/lib/ui/theme/themes.dart index 8f35870..df40f34 100644 --- a/lib/ui/theme/themes.dart +++ b/lib/ui/theme/themes.dart @@ -26,4 +26,4 @@ final hotPink = AnimeStreamTheme( backgroundColor: Colors.black, textMainColor: Colors.white, textSubColor: Color.fromARGB(255, 180, 180, 180), -); \ No newline at end of file +); diff --git a/todo.md b/todo.md index 74124db..24a9251 100644 --- a/todo.md +++ b/todo.md @@ -1,5 +1,4 @@ ## TODO LIST FOR ANIMESTREAM - preload next ep with preselected stream -- improve ui - add more sources