2020-01-01 18:10:13 +00:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2020-10-15 13:51:24 +00:00
|
|
|
import '../components/adaptive_page_layout.dart';
|
|
|
|
|
2020-01-01 18:10:13 +00:00
|
|
|
class AppRoute extends PageRouteBuilder {
|
|
|
|
static Route defaultRoute(BuildContext context, Widget page) {
|
|
|
|
return context != null && !AdaptivePageLayout.columnMode(context)
|
|
|
|
? CupertinoPageRoute(
|
|
|
|
builder: (BuildContext context) => page,
|
|
|
|
)
|
|
|
|
: AppRoute(page);
|
|
|
|
}
|
|
|
|
|
|
|
|
final Widget page;
|
|
|
|
AppRoute(this.page)
|
|
|
|
: super(
|
|
|
|
pageBuilder: (
|
|
|
|
BuildContext context,
|
|
|
|
Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
) =>
|
|
|
|
page,
|
|
|
|
transitionsBuilder: (
|
|
|
|
BuildContext context,
|
|
|
|
Animation<double> animation,
|
|
|
|
Animation<double> secondaryAnimation,
|
|
|
|
Widget child,
|
|
|
|
) =>
|
|
|
|
FadeTransition(
|
|
|
|
opacity: animation,
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|