mirror of
https://github.com/git-touch/git-touch
synced 2025-03-12 01:00:16 +01:00
refactor: drop legacy pushRoute
This commit is contained in:
parent
032be3b8f3
commit
b816986c59
@ -165,25 +165,6 @@ class ThemeModel with ChangeNotifier {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pushRoute(
|
|
||||||
BuildContext context,
|
|
||||||
WidgetBuilder builder, {
|
|
||||||
bool fullscreenDialog = false,
|
|
||||||
}) {
|
|
||||||
switch (theme) {
|
|
||||||
case AppThemeType.cupertino:
|
|
||||||
return Navigator.of(context).push(CupertinoPageRoute(
|
|
||||||
builder: builder,
|
|
||||||
fullscreenDialog: fullscreenDialog,
|
|
||||||
));
|
|
||||||
default:
|
|
||||||
return Navigator.of(context).push(MaterialPageRoute(
|
|
||||||
builder: builder,
|
|
||||||
fullscreenDialog: fullscreenDialog,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> showConfirm(BuildContext context, Widget content) {
|
Future<bool> showConfirm(BuildContext context, Widget content) {
|
||||||
switch (theme) {
|
switch (theme) {
|
||||||
case AppThemeType.cupertino:
|
case AppThemeType.cupertino:
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:git_touch/models/theme.dart';
|
import 'package:git_touch/models/theme.dart';
|
||||||
import 'package:git_touch/screens/issue.dart';
|
|
||||||
import 'package:git_touch/screens/object.dart';
|
|
||||||
import 'package:git_touch/screens/repository.dart';
|
|
||||||
import 'package:git_touch/screens/user.dart';
|
|
||||||
import 'package:git_touch/utils/utils.dart';
|
import 'package:git_touch/utils/utils.dart';
|
||||||
import 'package:primer/primer.dart';
|
import 'package:primer/primer.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@ -40,17 +36,9 @@ class MarkdownView extends StatelessWidget {
|
|||||||
final x = basePaths.sublist(3).join('/');
|
final x = basePaths.sublist(3).join('/');
|
||||||
var y = path.join(x, url);
|
var y = path.join(x, url);
|
||||||
if (y.startsWith('/')) y = y.substring(1);
|
if (y.startsWith('/')) y = y.substring(1);
|
||||||
final paths = path.split(y);
|
|
||||||
|
|
||||||
return Provider.of<ThemeModel>(context).pushRoute(
|
return Provider.of<ThemeModel>(context).push(context,
|
||||||
context,
|
'/${basePaths[0]}/${basePaths[1]}/${basePaths[2]}?path=${y.urlencode}');
|
||||||
(_) => ObjectScreen(
|
|
||||||
basePaths[0],
|
|
||||||
basePaths[1],
|
|
||||||
basePaths[2],
|
|
||||||
paths: paths,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Relative paths
|
// TODO: Relative paths
|
||||||
@ -59,37 +47,22 @@ class MarkdownView extends StatelessWidget {
|
|||||||
|
|
||||||
m = matchPattern(url, '/{owner}/{name}/pull/{number}');
|
m = matchPattern(url, '/{owner}/{name}/pull/{number}');
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
return Provider.of<ThemeModel>(context).pushRoute(
|
return Provider.of<ThemeModel>(context).push(context, url);
|
||||||
context,
|
|
||||||
(_) => IssueScreen(
|
|
||||||
m['owner'],
|
|
||||||
m['name'],
|
|
||||||
int.parse(m['number']),
|
|
||||||
isPullRequest: true,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m = matchPattern(url, '/{owner}/{name}/issues/{number}');
|
m = matchPattern(url, '/{owner}/{name}/issues/{number}');
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
return Provider.of<ThemeModel>(context).pushRoute(
|
return Provider.of<ThemeModel>(context).push(context, url);
|
||||||
context,
|
|
||||||
(_) => IssueScreen(
|
|
||||||
m['owner'],
|
|
||||||
m['name'],
|
|
||||||
int.parse(m['number']),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m = matchPattern(url, '/{owner}/{name}');
|
m = matchPattern(url, '/{owner}/{name}');
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
return Provider.of<ThemeModel>(context).pushRoute(
|
return Provider.of<ThemeModel>(context).push(context, url);
|
||||||
context, (_) => RepositoryScreen(m['owner'], m['name']));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m = matchPattern(url, '/{login}');
|
m = matchPattern(url, '/{login}');
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
return Provider.of<ThemeModel>(context)
|
return Provider.of<ThemeModel>(context).push(context, url);
|
||||||
.pushRoute(context, (_) => UserScreen(m['login']));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user