diff --git a/lib/screens/ComicInfoScreen.dart b/lib/screens/ComicInfoScreen.dart index 70cd7d6..b60ba78 100644 --- a/lib/screens/ComicInfoScreen.dart +++ b/lib/screens/ComicInfoScreen.dart @@ -33,6 +33,7 @@ class ComicInfoScreen extends StatefulWidget { class _ComicInfoScreenState extends State with RouteAware { late var _tabIndex = 0; late Future _comicFuture = _loadComic(); + late Key _comicFutureKey = UniqueKey(); late Future _viewFuture = _loadViewLog(); late Future> _epListFuture = _loadEps(); @@ -85,6 +86,7 @@ class _ComicInfoScreenState extends State with RouteAware { Widget buildScreen(BuildContext context) { return FutureBuilder( + key: _comicFutureKey, future: _comicFuture, builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.hasError) { @@ -96,6 +98,7 @@ class _ComicInfoScreenState extends State with RouteAware { onRefresh: () async { setState(() { _comicFuture = _loadComic(); + _comicFutureKey = UniqueKey(); }); }, ), diff --git a/lib/screens/GameInfoScreen.dart b/lib/screens/GameInfoScreen.dart index 9598679..87b6682 100644 --- a/lib/screens/GameInfoScreen.dart +++ b/lib/screens/GameInfoScreen.dart @@ -15,7 +15,7 @@ import 'components/RightClickPop.dart'; class GameInfoScreen extends StatefulWidget { final String gameId; - const GameInfoScreen(this.gameId,{Key? key}):super(key: key); + const GameInfoScreen(this.gameId, {Key? key}) : super(key: key); @override State createState() => _GameInfoScreenState(); @@ -23,9 +23,10 @@ class GameInfoScreen extends StatefulWidget { class _GameInfoScreenState extends State { late var _future = method.game(widget.gameId); + late var _key = UniqueKey(); @override - Widget build(BuildContext context){ + Widget build(BuildContext context) { return rightClickPop( child: buildScreen(context), context: context, @@ -35,6 +36,7 @@ class _GameInfoScreenState extends State { Widget buildScreen(BuildContext context) { return FutureBuilder( + key: _key, future: _future, builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.hasError) { @@ -48,6 +50,7 @@ class _GameInfoScreenState extends State { onRefresh: () async { setState(() { _future = method.game(widget.gameId); + _key = UniqueKey(); }); }), ); @@ -86,7 +89,8 @@ class _GameInfoScreenState extends State { bottom: 10, ), child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(5)), + borderRadius: + const BorderRadius.all(Radius.circular(5)), child: MaterialButton( color: Theme.of(context).colorScheme.secondary, textColor: Colors.white, @@ -151,8 +155,7 @@ class _GameInfoScreenState extends State { ], indicatorColor: Theme.of(context).colorScheme.secondary, - labelColor: - Theme.of(context).colorScheme.secondary, + labelColor: Theme.of(context).colorScheme.secondary, onTap: (val) async { setState(() { _tabIndex = val;