diff --git a/db/db.go b/db/db.go index 8b52528..a159e00 100644 --- a/db/db.go +++ b/db/db.go @@ -221,8 +221,10 @@ func (c *Client) SaveEposideDetail(d *ent.Episode) (int, error) { SetEpisodeNumber(d.EpisodeNumber). SetOverview(d.Overview). SetTitle(d.Title).Save(context.TODO()) - - return ep.ID, err + if err != nil { + return 0, errors.Wrap(err, "save episode") + } + return ep.ID, nil } func (c *Client) SaveEposideDetail2(d *ent.Episode) (int, error) { diff --git a/ui/lib/main.dart b/ui/lib/main.dart index 66886f8..3cb1fa9 100644 --- a/ui/lib/main.dart +++ b/ui/lib/main.dart @@ -25,6 +25,19 @@ class MyApp extends ConsumerStatefulWidget { } } +CustomTransitionPage buildPageWithDefaultTransition({ + required BuildContext context, + required GoRouterState state, + required Widget child, +}) { + return CustomTransitionPage( + key: state.pageKey, + child: child, + transitionsBuilder: (context, animation, secondaryAnimation, child) => + FadeTransition(opacity: animation, child: child), + ); +} + class _MyAppState extends ConsumerState { // This widget is the root of your application. @override @@ -45,38 +58,51 @@ class _MyAppState extends ConsumerState { ), GoRoute( path: WelcomePage.routeTv, - builder: (context, state) => const WelcomePage(), - ), - GoRoute( - path: TvDetailsPage.route, - builder: (context, state) => - TvDetailsPage(seriesId: state.pathParameters['id']!), + pageBuilder: (context, state) => buildPageWithDefaultTransition( + context: context, state: state, child: const WelcomePage()), ), GoRoute( path: WelcomePage.routeMoivie, - builder: (context, state) => const WelcomePage(), + pageBuilder: (context, state) => buildPageWithDefaultTransition( + context: context, state: state, child: const WelcomePage()), + ), + GoRoute( + path: TvDetailsPage.route, + pageBuilder: (context, state) => buildPageWithDefaultTransition( + context: context, + state: state, + child: TvDetailsPage(seriesId: state.pathParameters['id']!)), ), GoRoute( path: MovieDetailsPage.route, - builder: (context, state) => - MovieDetailsPage(id: state.pathParameters['id']!), + pageBuilder: (context, state) => buildPageWithDefaultTransition( + context: context, + state: state, + child: MovieDetailsPage(id: state.pathParameters['id']!)), ), GoRoute( path: SearchPage.route, - builder: (context, state) => - SearchPage(query: state.uri.queryParameters["query"]), + pageBuilder: (context, state) => buildPageWithDefaultTransition( + context: context, + state: state, + child: SearchPage(query: state.uri.queryParameters["query"])), ), GoRoute( path: SystemSettingsPage.route, - builder: (context, state) => const SystemSettingsPage(), + pageBuilder: (context, state) => buildPageWithDefaultTransition( + context: context, + state: state, + child: const SystemSettingsPage()), ), GoRoute( path: ActivityPage.route, - builder: (context, state) => const ActivityPage(), + pageBuilder: (context, state) => buildPageWithDefaultTransition( + context: context, state: state, child: const ActivityPage()), ), GoRoute( path: SystemPage.route, - builder: (context, state) => const SystemPage(), + pageBuilder: (context, state) => buildPageWithDefaultTransition( + context: context, state: state, child: const SystemPage()), ) ], ); @@ -177,29 +203,28 @@ class _MainSkeletonState extends State { return [Text("dadada")]; }), MenuAnchor( - menuChildren: [ - MenuItemButton( - leadingIcon: const Icon(Icons.exit_to_app), - child: const Text("登出"), - onPressed: () async { - await APIs.logout(); - }, - ), - ], - builder: (context, controller, child) { - return TextButton( - onPressed: () { - if (controller.isOpen) { - controller.close(); - } else { - controller.open(); - } - }, - child: const Icon(Icons.account_circle), - ); - }, - ) - + menuChildren: [ + MenuItemButton( + leadingIcon: const Icon(Icons.exit_to_app), + child: const Text("登出"), + onPressed: () async { + await APIs.logout(); + }, + ), + ], + builder: (context, controller, child) { + return TextButton( + onPressed: () { + if (controller.isOpen) { + controller.close(); + } else { + controller.open(); + } + }, + child: const Icon(Icons.account_circle), + ); + }, + ) ], ), useDrawer: false, diff --git a/ui/lib/movie_watchlist.dart b/ui/lib/movie_watchlist.dart index 2bb43d9..b3b50d0 100644 --- a/ui/lib/movie_watchlist.dart +++ b/ui/lib/movie_watchlist.dart @@ -42,7 +42,7 @@ class _MovieDetailsPageState extends ConsumerState { child: Container( decoration: BoxDecoration( image: DecorationImage( - fit: BoxFit.fitWidth, + fit: BoxFit.cover, opacity: 0.5, image: NetworkImage( "${APIs.imagesUrl}/${details.id}/backdrop.jpg", diff --git a/ui/lib/tv_details.dart b/ui/lib/tv_details.dart index 9c29eaa..fce724a 100644 --- a/ui/lib/tv_details.dart +++ b/ui/lib/tv_details.dart @@ -152,7 +152,7 @@ class _TvDetailsPageState extends ConsumerState { child: Container( decoration: BoxDecoration( image: DecorationImage( - fit: BoxFit.fitWidth, + fit: BoxFit.cover, opacity: 0.5, image: NetworkImage( "${APIs.imagesUrl}/${details.id}/backdrop.jpg"))),