made PageRoutes adapt to os, default to MaterialPageRoute
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
@@ -56,7 +59,7 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (_) => const SettingsView()),
|
Platform.isIOS ? CupertinoPageRoute(builder: (_) => const SettingsView()) : MaterialPageRoute(builder: (_) => const SettingsView()),
|
||||||
);
|
);
|
||||||
setState(() {
|
setState(() {
|
||||||
tabKeyCount++;
|
tabKeyCount++;
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/constants.dart';
|
import 'package:game_tracker/core/constants.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
@@ -85,7 +88,11 @@ class _GroupsViewState extends State<GroupsView> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
Platform.isIOS ? CupertinoPageRoute(
|
||||||
|
builder: (context) {
|
||||||
|
return const CreateGroupView();
|
||||||
|
},
|
||||||
|
) : MaterialPageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return const CreateGroupView();
|
return const CreateGroupView();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
@@ -140,7 +142,12 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
: games[selectedGameIndex].$1,
|
: games[selectedGameIndex].$1,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
selectedGameIndex = await Navigator.of(context).push(
|
selectedGameIndex = await Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
Platform.isIOS ? CupertinoPageRoute(
|
||||||
|
builder: (context) => ChooseGameView(
|
||||||
|
games: games,
|
||||||
|
initialGameIndex: selectedGameIndex,
|
||||||
|
),
|
||||||
|
) : MaterialPageRoute(
|
||||||
builder: (context) => ChooseGameView(
|
builder: (context) => ChooseGameView(
|
||||||
games: games,
|
games: games,
|
||||||
initialGameIndex: selectedGameIndex,
|
initialGameIndex: selectedGameIndex,
|
||||||
@@ -168,7 +175,12 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
: translateRulesetToString(selectedRuleset!, context),
|
: translateRulesetToString(selectedRuleset!, context),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
selectedRuleset = await Navigator.of(context).push(
|
selectedRuleset = await Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
Platform.isIOS ? CupertinoPageRoute(
|
||||||
|
builder: (context) => ChooseRulesetView(
|
||||||
|
rulesets: _rulesets,
|
||||||
|
initialRulesetIndex: selectedRulesetIndex,
|
||||||
|
),
|
||||||
|
) : MaterialPageRoute(
|
||||||
builder: (context) => ChooseRulesetView(
|
builder: (context) => ChooseRulesetView(
|
||||||
rulesets: _rulesets,
|
rulesets: _rulesets,
|
||||||
initialRulesetIndex: selectedRulesetIndex,
|
initialRulesetIndex: selectedRulesetIndex,
|
||||||
@@ -190,7 +202,12 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
: selectedGroup!.name,
|
: selectedGroup!.name,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
selectedGroup = await Navigator.of(context).push(
|
selectedGroup = await Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
Platform.isIOS ? CupertinoPageRoute(
|
||||||
|
builder: (context) => ChooseGroupView(
|
||||||
|
groups: groupsList,
|
||||||
|
initialGroupId: selectedGroupId,
|
||||||
|
),
|
||||||
|
): MaterialPageRoute(
|
||||||
builder: (context) => ChooseGroupView(
|
builder: (context) => ChooseGroupView(
|
||||||
groups: groupsList,
|
groups: groupsList,
|
||||||
initialGroupId: selectedGroupId,
|
initialGroupId: selectedGroupId,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:core' hide Match;
|
import 'dart:core' hide Match;
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -105,7 +106,9 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
Platform.isIOS ? CupertinoPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
CreateMatchView(onWinnerChanged: loadGames)) : MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
CreateMatchView(onWinnerChanged: loadGames),
|
CreateMatchView(onWinnerChanged: loadGames),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user