Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depend on stable flutter instead of master #30

Merged
merged 3 commits into from Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/mail_view_router.dart
@@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:reply/transition_page_builder.dart';

import 'home.dart';
import 'inbox.dart';
Expand All @@ -26,11 +27,12 @@ class MailViewRouterDelegate extends RouterDelegate<void>
onPopPage: _handlePopPage,
pages: [
// TODO: Add Fade through transition between mailbox pages (Motion)
TransitionBuilderPage(
pageBuilder: (context, animation, secondaryAnimation) {
return InboxPage(destination: currentlySelectedInbox);
},
),
CustomTransitionPageBuilder(
transitionKey: ValueKey(currentlySelectedInbox),
screen: InboxPage(
destination: currentlySelectedInbox,
),
)
],
);
},
Expand Down
15 changes: 7 additions & 8 deletions lib/router.dart
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:reply/home.dart';
import 'package:reply/search_page.dart';
import 'package:reply/transition_page_builder.dart';

import 'model/router_provider.dart';

Expand Down Expand Up @@ -47,16 +48,14 @@ class ReplyRouterDelegate extends RouterDelegate<ReplyRoutePath>
onPopPage: _handlePopPage,
pages: [
// TODO: Add Shared Z-Axis transition from search icon to search view page (Motion)
TransitionBuilderPage(
pageBuilder: (context, animation, secondaryAnimation) {
return const HomePage();
},
const CustomTransitionPageBuilder(
transitionKey: ValueKey('Home'),
screen: HomePage(),
),
if (routePath is ReplySearchPath)
TransitionBuilderPage(
pageBuilder: (context, animation, secondaryAnimation) {
return const SearchPage();
},
const CustomTransitionPageBuilder(
transitionKey: ValueKey('Search'),
screen: SearchPage(),
),
],
);
Expand Down
22 changes: 22 additions & 0 deletions lib/transition_page_builder.dart
@@ -0,0 +1,22 @@
import 'package:flutter/widgets.dart';

// Prefer to use TransitionBuilderPage once it lands in stable.
Renzo-Olivares marked this conversation as resolved.
Show resolved Hide resolved
class CustomTransitionPageBuilder extends Page {
Renzo-Olivares marked this conversation as resolved.
Show resolved Hide resolved
final Widget screen;
final ValueKey transitionKey;

const CustomTransitionPageBuilder(
{@required this.screen, @required this.transitionKey})
: assert(screen != null),
assert(transitionKey != null),
super(key: transitionKey);

@override
Route createRoute(BuildContext context) {
return PageRouteBuilder(
settings: this,
pageBuilder: (context, animation, secondaryAnimation) {
return screen;
});
}
}