mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-27 00:22:38 +01:00
35 lines
1006 B
Dart
35 lines
1006 B
Dart
|
import 'package:fluffychat/components/adaptive_page_layout.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
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,
|
||
|
),
|
||
|
);
|
||
|
}
|