final
This commit is contained in:
@@ -10,26 +10,26 @@ import '../../routes.dart';
|
||||
|
||||
class TextLink extends StatelessWidget {
|
||||
final String title;
|
||||
final String url;
|
||||
final Color color;
|
||||
final Color hoverColor;
|
||||
final double paddingHorizontal;
|
||||
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;
|
||||
final bool isEmail;
|
||||
final bool isPhone;
|
||||
final double fontSize;
|
||||
final bool isAddress;
|
||||
final TextOverflow overflow;
|
||||
final int maxLines;
|
||||
final String? url;
|
||||
final Color? color;
|
||||
final Color? hoverColor;
|
||||
final double? paddingHorizontal;
|
||||
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;
|
||||
final bool? isEmail;
|
||||
final bool? isPhone;
|
||||
final double? fontSize;
|
||||
final bool? isAddress;
|
||||
final TextOverflow? overflow;
|
||||
final int? maxLines;
|
||||
|
||||
TextLink(this.title, this.url, {
|
||||
this.color,
|
||||
@@ -38,19 +38,19 @@ class TextLink extends StatelessWidget {
|
||||
this.paddingVertical,
|
||||
this.fontWeight,
|
||||
this.selected,
|
||||
bool isLink,
|
||||
bool replace,
|
||||
bool clearStack,
|
||||
bool maintainState,
|
||||
bool rootNavigator,
|
||||
bool? isLink,
|
||||
bool? replace,
|
||||
bool? clearStack,
|
||||
bool? maintainState,
|
||||
bool? rootNavigator,
|
||||
this.transition,
|
||||
bool closeDrawer,
|
||||
bool isEmail,
|
||||
bool isPhone,
|
||||
double fontSize,
|
||||
bool isAddress,
|
||||
TextOverflow overflow,
|
||||
int maxLines,
|
||||
bool? closeDrawer,
|
||||
bool? isEmail,
|
||||
bool? isPhone,
|
||||
double? fontSize,
|
||||
bool? isAddress,
|
||||
TextOverflow? overflow,
|
||||
int? maxLines,
|
||||
}) :
|
||||
isLink = isLink ?? false,
|
||||
replace = replace ?? false,
|
||||
@@ -101,7 +101,7 @@ class TextLink extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: (selected != null && selected) ? Border(
|
||||
border: (selected != null && selected!) ? Border(
|
||||
bottom: BorderSide(
|
||||
color: color ?? Colors.blue,
|
||||
width: 3.0,
|
||||
@@ -110,27 +110,27 @@ class TextLink extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
onTap: () async {
|
||||
if (selected == null || !selected) {
|
||||
if (isEmail) {
|
||||
Utils.openEmail(url);
|
||||
} else if (isPhone) {
|
||||
Utils.callPhone(url);
|
||||
} else if (isAddress) {
|
||||
await launch('https://maps.google.com/?q=${url}');
|
||||
} else if (!isLink) {
|
||||
if (closeDrawer) {
|
||||
if (selected == null || !selected!) {
|
||||
if (isEmail!) {
|
||||
Utils.openEmail(url!);
|
||||
} else if (isPhone!) {
|
||||
Utils.callPhone(url!);
|
||||
} else if (isAddress!) {
|
||||
await launchUrl(Uri.parse('https://maps.google.com/?q=${url}'));
|
||||
} else if (!isLink!) {
|
||||
if (closeDrawer!) {
|
||||
Routes.router.pop(context);
|
||||
}
|
||||
Routes.router.navigateTo(
|
||||
context, url,
|
||||
replace: replace,
|
||||
clearStack: clearStack,
|
||||
maintainState: maintainState,
|
||||
rootNavigator: rootNavigator,
|
||||
context, url!,
|
||||
replace: replace!,
|
||||
clearStack: clearStack!,
|
||||
maintainState: maintainState!,
|
||||
rootNavigator: rootNavigator!,
|
||||
);
|
||||
} else {
|
||||
if (await canLaunch(url)) {
|
||||
await launch(url);
|
||||
if (await canLaunchUrl(Uri.parse(url!))) {
|
||||
await launchUrl(Uri.parse(url!));
|
||||
} else {
|
||||
throw 'Could not launch $url';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user