backup.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../routes.dart';
|
||||
|
||||
class TextLink extends StatelessWidget {
|
||||
final String title;
|
||||
final String url;
|
||||
@@ -11,13 +14,33 @@ class TextLink extends StatelessWidget {
|
||||
final double paddingVertical;
|
||||
final FontWeight fontWeight;
|
||||
final bool selected;
|
||||
final bool isLink;
|
||||
final bool replace;
|
||||
final bool clearStack;
|
||||
final bool maintainState;
|
||||
final bool rootNavigator;
|
||||
final TransitionType transition;
|
||||
final bool closeDrawer;
|
||||
TextLink(this.title, this.url, {
|
||||
this.color,
|
||||
this.paddingHorizontal,
|
||||
this.paddingVertical,
|
||||
this.fontWeight,
|
||||
this.selected
|
||||
});
|
||||
this.selected,
|
||||
bool isLink,
|
||||
bool replace,
|
||||
bool clearStack,
|
||||
bool maintainState,
|
||||
bool rootNavigator,
|
||||
this.transition,
|
||||
bool closeDrawer,
|
||||
}) :
|
||||
isLink = isLink ?? false,
|
||||
replace = replace ?? false,
|
||||
clearStack = clearStack ?? false,
|
||||
maintainState = maintainState ?? true,
|
||||
rootNavigator = rootNavigator ?? false,
|
||||
closeDrawer = closeDrawer ?? false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -46,10 +69,23 @@ class TextLink extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
onTap: () async {
|
||||
if (await canLaunch(url)) {
|
||||
await launch(url);
|
||||
if (!isLink) {
|
||||
if (closeDrawer) {
|
||||
Routes.router.pop(context);
|
||||
}
|
||||
Routes.router.navigateTo(
|
||||
context, url,
|
||||
replace: replace,
|
||||
clearStack: clearStack,
|
||||
maintainState: maintainState,
|
||||
rootNavigator: rootNavigator,
|
||||
);
|
||||
} else {
|
||||
throw 'Could not launch $url';
|
||||
if (await canLaunch(url)) {
|
||||
await launch(url);
|
||||
} else {
|
||||
throw 'Could not launch $url';
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user