mirror of
https://github.com/git-touch/git-touch
synced 2024-12-18 19:22:54 +01:00
refactor: push url
This commit is contained in:
parent
b91db22eb4
commit
829c7fa514
@ -4,6 +4,7 @@ import 'package:fimber/fimber.dart';
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_button.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@ -156,17 +157,21 @@ class ThemeModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
push(BuildContext context, String path, {bool replace = false}) {
|
||||
return router.navigateTo(
|
||||
context,
|
||||
path,
|
||||
transition: replace
|
||||
? TransitionType.fadeIn
|
||||
: theme == AppThemeType.cupertino
|
||||
? TransitionType.cupertino
|
||||
: TransitionType.material,
|
||||
replace: replace,
|
||||
);
|
||||
push(BuildContext context, String url, {bool replace = false}) {
|
||||
if (url.startsWith('/')) {
|
||||
return router.navigateTo(
|
||||
context,
|
||||
url,
|
||||
transition: replace
|
||||
? TransitionType.fadeIn
|
||||
: theme == AppThemeType.cupertino
|
||||
? TransitionType.cupertino
|
||||
: TransitionType.material,
|
||||
replace: replace,
|
||||
);
|
||||
} else {
|
||||
launchUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> showConfirm(BuildContext context, Widget content) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
|
||||
@ -21,13 +20,7 @@ class Link extends StatelessWidget {
|
||||
if (onTap != null) {
|
||||
return onTap();
|
||||
}
|
||||
if (url != null) {
|
||||
if (url.startsWith('/')) {
|
||||
Provider.of<ThemeModel>(context).push(context, url);
|
||||
} else {
|
||||
launchUrl(url);
|
||||
}
|
||||
}
|
||||
Provider.of<ThemeModel>(context).push(context, url);
|
||||
}
|
||||
|
||||
@override
|
||||
|
Loading…
Reference in New Issue
Block a user