initial commit to gitea
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_wisetronic/utils/utils.dart';
|
||||
import 'package:hovering/hovering.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../routes.dart';
|
||||
@@ -11,6 +12,7 @@ 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;
|
||||
@@ -24,8 +26,14 @@ class TextLink extends StatelessWidget {
|
||||
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,
|
||||
this.hoverColor,
|
||||
this.paddingHorizontal,
|
||||
this.paddingVertical,
|
||||
this.fontWeight,
|
||||
@@ -39,6 +47,10 @@ class TextLink extends StatelessWidget {
|
||||
bool closeDrawer,
|
||||
bool isEmail,
|
||||
bool isPhone,
|
||||
double fontSize,
|
||||
bool isAddress,
|
||||
TextOverflow overflow,
|
||||
int maxLines,
|
||||
}) :
|
||||
isLink = isLink ?? false,
|
||||
replace = replace ?? false,
|
||||
@@ -47,7 +59,11 @@ class TextLink extends StatelessWidget {
|
||||
rootNavigator = rootNavigator ?? false,
|
||||
closeDrawer = closeDrawer ?? false,
|
||||
isEmail = isEmail ?? false,
|
||||
isPhone = isPhone ?? false;
|
||||
isPhone = isPhone ?? false,
|
||||
fontSize = fontSize ?? null,
|
||||
isAddress = isAddress ?? false,
|
||||
overflow = overflow ?? TextOverflow.ellipsis,
|
||||
maxLines = maxLines ?? 1;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -59,19 +75,37 @@ class TextLink extends StatelessWidget {
|
||||
vertical: paddingVertical ?? 0.0,
|
||||
horizontal: paddingHorizontal ?? 0.0
|
||||
),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: color ?? Colors.blue,
|
||||
fontWeight: fontWeight ?? FontWeight.normal,
|
||||
child: HoverWidget(
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: color ?? Colors.blue,
|
||||
fontWeight: fontWeight ?? FontWeight.normal,
|
||||
fontSize: fontSize,
|
||||
),
|
||||
overflow: overflow,
|
||||
maxLines: maxLines,
|
||||
),
|
||||
hoverChild: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: hoverColor ?? Colors.grey,
|
||||
fontSize: fontSize,
|
||||
fontWeight: fontWeight ?? FontWeight.normal,
|
||||
),
|
||||
overflow: overflow,
|
||||
maxLines: maxLines,
|
||||
),
|
||||
onHover: (event) {
|
||||
|
||||
},
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: (selected != null && selected) ? Border(
|
||||
bottom: BorderSide(
|
||||
color: color ?? Colors.blue,
|
||||
width: 3.0,
|
||||
)
|
||||
bottom: BorderSide(
|
||||
color: color ?? Colors.blue,
|
||||
width: 3.0,
|
||||
)
|
||||
) : null,
|
||||
),
|
||||
),
|
||||
@@ -81,6 +115,8 @@ class TextLink extends StatelessWidget {
|
||||
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) {
|
||||
Routes.router.pop(context);
|
||||
|
||||
Reference in New Issue
Block a user