FlutterKaigi / conference-app-2023

The Official Conference Application for FlutterKaigi 2023
https://flutterkaigi.jp/conference-app-2023/
Apache License 2.0
133 stars 27 forks source link

StatefulShellRouteによる画面切り替え時にアニメーションを追加する #145

Closed koji-1009 closed 1 year ago

koji-1009 commented 1 year ago

Is your feature request related to a problem? Please describe.

142 の実装では画面切り替え時のアニメーションが実装されていないので、切り替えアニメーションを追加する。

Describe the solution you'd like AnimatedOpacityによるアニメーションの実現。 https://api.flutter.dev/flutter/widgets/AnimatedOpacity-class.html

Describe alternatives you've considered 実装時に提案があれば歓迎します。

Additional context ~#142 がマージされたら着手可能。~

HiroyukiTamura commented 1 year ago

I'd like to try this, but i'm not sure how to implement this.

Applying animation to BranchContainer is not enough to apply animation to AboutUsRoute and LegalNoticesRoute because they belongs to the LicensesRoute.

should i apply animations them? if so, is it good way to wrap them with CustomTransitionPage indivisually?

class AboutUsRoute extends GoRouteData {
  const AboutUsRoute();

  static const path = 'about-us';

  static final $parentNavigatorKey = rootNavigatorKey;

  @override
  Page<void> buildPage(BuildContext context, GoRouterState state) {
    return CustomTransitionPage<void>(
      key: state.pageKey,
      child: const AboutUsPage(),
      transitionsBuilder: (context, animation, animation2, child) => FadeTransition(
        opacity: animation,
        child: child,
      ),
    );
  }
}
koji-1009 commented 1 year ago

Hi @HiroyukiTamura Thanks for your interest!

The AboutUsRoute and LegalNoticesRoute are defined as MaterialPage and are already animated on screen transition. For this reason, they are not the target of this Issue. This Issue targets animations between pages switched by NavigationBar, Drawer, and NavigationRails. Specifically, the following TODO comment is described in the following section, and there is code in go_router_builder's example that can be used as a reference.

https://github.com/FlutterKaigi/conference-app-2023/pull/142/files#diff-51fcdb168444c7ea5ac831a380f17ea24d4555326a27f7e28a48ed4044c67411R21

Sorry for the lack of description in the Issue.