Skip to content

Commit

Permalink
fix(gebura): local hero animation
Browse files Browse the repository at this point in the history
  • Loading branch information
MuZhou233 committed Jun 17, 2024
1 parent 808bb04 commit 2ee8225
Showing 1 changed file with 40 additions and 24 deletions.
64 changes: 40 additions & 24 deletions lib/route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:local_hero/local_hero.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:tuihub_protos/librarian/sephirah/v1/gebura.pb.dart';
import 'package:tuihub_protos/librarian/sephirah/v1/tiphereth.pb.dart';
Expand Down Expand Up @@ -338,6 +339,13 @@ class GeburaRoute extends StatefulShellBranchData {
const GeburaRoute();

static final GlobalKey<NavigatorState> $navigatorKey = _geburaNavigateKey;

static Widget rootWidget({required Widget child}) {
return LocalHeroScope(
curve: Curves.easeInOut,
child: child,
);
}
}

class GeburaRootRoute extends GoRouteData {
Expand All @@ -360,13 +368,15 @@ class GeburaStoreRoute extends GoRouteData {

@override
NoTransitionPage<void> buildPage(BuildContext context, GoRouterState state) {
return const NoTransitionPage(
child: FramePage(
selectedNav: ModuleName.gebura,
leftPart: GeburaNav(
function: GeburaFunctions.store,
return NoTransitionPage(
child: GeburaRoute.rootWidget(
child: const FramePage(
selectedNav: ModuleName.gebura,
leftPart: GeburaNav(
function: GeburaFunctions.store,
),
middlePart: GeburaStorePage(),
),
middlePart: GeburaStorePage(),
),
);
}
Expand All @@ -377,13 +387,15 @@ class GeburaLibraryRoute extends GoRouteData {

@override
NoTransitionPage<void> buildPage(BuildContext context, GoRouterState state) {
return const NoTransitionPage(
child: FramePage(
selectedNav: ModuleName.gebura,
leftPart: GeburaNav(
function: GeburaFunctions.library,
return NoTransitionPage(
child: GeburaRoute.rootWidget(
child: const FramePage(
selectedNav: ModuleName.gebura,
leftPart: GeburaNav(
function: GeburaFunctions.library,
),
middlePart: GeburaLibraryOverview(),
),
middlePart: GeburaLibraryOverview(),
),
);
}
Expand All @@ -394,13 +406,15 @@ class GeburaLibrarySettingsRoute extends GoRouteData {

@override
NoTransitionPage<void> buildPage(BuildContext context, GoRouterState state) {
return const NoTransitionPage(
child: FramePage(
selectedNav: ModuleName.gebura,
leftPart: GeburaNav(
function: GeburaFunctions.librarySettings,
return NoTransitionPage(
child: GeburaRoute.rootWidget(
child: const FramePage(
selectedNav: ModuleName.gebura,
leftPart: GeburaNav(
function: GeburaFunctions.librarySettings,
),
middlePart: GeburaLibrarySettings(),
),
middlePart: GeburaLibrarySettings(),
),
);
}
Expand All @@ -420,13 +434,15 @@ class GeburaLibraryDetailRoute extends GoRouteData {
GeburaLibraryDetailActions.assignApp: const GeburaAssignAppPanel(),
};
return NoTransitionPage(
child: FramePage(
selectedNav: ModuleName.gebura,
leftPart: const GeburaNav(
function: GeburaFunctions.library,
child: GeburaRoute.rootWidget(
child: FramePage(
selectedNav: ModuleName.gebura,
leftPart: const GeburaNav(
function: GeburaFunctions.library,
),
middlePart: GeburaLibraryDetailPage(id: id ?? 0),
rightPart: actions[action],
),
middlePart: GeburaLibraryDetailPage(id: id ?? 0),
rightPart: actions[action],
),
);
}
Expand Down

0 comments on commit 2ee8225

Please sign in to comment.