-
Notifications
You must be signed in to change notification settings - Fork 1
/
routing.dart
34 lines (33 loc) · 1.02 KB
/
routing.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:platty/src/theme.dart';
class PRoute {
/// Constructs a new [Route] based on the inherited [PTheme] or specified [TargetPlatform].
static Route<T> of<T>(
BuildContext context, {
@required WidgetBuilder builder,
RouteSettings settings,
bool maintainState = true,
bool fullScreenDialog = false,
String iosTitle,
TargetPlatform renderPlatform,
}) {
final platform = renderPlatform ?? PTheme.of(context).data.platform;
if (platform == TargetPlatform.android) {
return MaterialPageRoute(
builder: builder,
settings: settings,
maintainState: maintainState,
fullscreenDialog: fullScreenDialog);
} else {
return CupertinoPageRoute(
builder: builder,
settings: settings,
maintainState: maintainState,
fullscreenDialog: fullScreenDialog,
title: iosTitle,
);
}
}
}