TF-2078 Sync use launchLink to open hyper link
(cherry picked from commit f5c9b0b0f2d2c5fcf06201fb06a1534f5da3a0f7)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:tmail_ui_user/features/base/styles/hyper_link_widget_styles.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_utils.dart';
|
||||
|
||||
class HyperLinkWidget extends StatelessWidget {
|
||||
|
||||
@@ -19,14 +19,7 @@ class HyperLinkWidget extends StatelessWidget {
|
||||
fontSize: HyperLinkWidgetStyles.textSize,
|
||||
decoration: TextDecoration.underline
|
||||
),
|
||||
recognizer: TapGestureRecognizer()..onTap = () async {
|
||||
if (await canLaunchUrlString(urlString)) {
|
||||
launchUrlString(
|
||||
urlString,
|
||||
mode: LaunchMode.externalApplication
|
||||
);
|
||||
}
|
||||
}
|
||||
recognizer: TapGestureRecognizer()..onTap = () => AppUtils.launchLink(urlString)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_utils.dart';
|
||||
|
||||
class PrivacyLinkWidget extends StatelessWidget {
|
||||
static const linagoraPrivacy = 'https://www.linagora.com/en/legal/privacy';
|
||||
@@ -19,14 +19,7 @@ class PrivacyLinkWidget extends StatelessWidget {
|
||||
style: const TextStyle(
|
||||
color: AppColor.loginTextFieldFocusedBorder,
|
||||
fontSize: 14),
|
||||
recognizer: TapGestureRecognizer()..onTap = () async {
|
||||
if (await canLaunchUrlString(privacyUrlString)) {
|
||||
launchUrlString(
|
||||
privacyUrlString,
|
||||
mode: LaunchMode.externalApplication
|
||||
);
|
||||
}
|
||||
}
|
||||
recognizer: TapGestureRecognizer()..onTap = () => AppUtils.launchLink(privacyUrlString)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
+2
-9
@@ -6,7 +6,7 @@ import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/link_browser_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/app_dashboard/linagora_app.dart';
|
||||
import 'package:url_launcher/url_launcher.dart' as launcher;
|
||||
import 'package:tmail_ui_user/main/utils/app_utils.dart';
|
||||
|
||||
class AppGridDashboardItem extends StatelessWidget {
|
||||
final LinagoraApp app;
|
||||
@@ -22,7 +22,7 @@ class AppGridDashboardItem extends StatelessWidget {
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: _openApp,
|
||||
onTap: () => AppUtils.launchLink(app.appUri.toString()),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
hoverColor: AppColor.colorBgMailboxSelected,
|
||||
child: Container(
|
||||
@@ -60,11 +60,4 @@ class AppGridDashboardItem extends StatelessWidget {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void _openApp() async {
|
||||
final url = app.appUri;
|
||||
if (await launcher.canLaunchUrl(url)) {
|
||||
await launcher.launchUrl(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ class AppUtils {
|
||||
await launchUrl(
|
||||
Uri.parse(url),
|
||||
webOnlyWindowName: isNewTab ? '_blank' : '_self',
|
||||
mode: LaunchMode.externalApplication
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user