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/gestures.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:tmail_ui_user/features/base/styles/hyper_link_widget_styles.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 {
|
class HyperLinkWidget extends StatelessWidget {
|
||||||
|
|
||||||
@@ -19,14 +19,7 @@ class HyperLinkWidget extends StatelessWidget {
|
|||||||
fontSize: HyperLinkWidgetStyles.textSize,
|
fontSize: HyperLinkWidgetStyles.textSize,
|
||||||
decoration: TextDecoration.underline
|
decoration: TextDecoration.underline
|
||||||
),
|
),
|
||||||
recognizer: TapGestureRecognizer()..onTap = () async {
|
recognizer: TapGestureRecognizer()..onTap = () => AppUtils.launchLink(urlString)
|
||||||
if (await canLaunchUrlString(urlString)) {
|
|
||||||
launchUrlString(
|
|
||||||
urlString,
|
|
||||||
mode: LaunchMode.externalApplication
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'package:core/presentation/extensions/color_extension.dart';
|
|||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.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 {
|
class PrivacyLinkWidget extends StatelessWidget {
|
||||||
static const linagoraPrivacy = 'https://www.linagora.com/en/legal/privacy';
|
static const linagoraPrivacy = 'https://www.linagora.com/en/legal/privacy';
|
||||||
@@ -19,14 +19,7 @@ class PrivacyLinkWidget extends StatelessWidget {
|
|||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: AppColor.loginTextFieldFocusedBorder,
|
color: AppColor.loginTextFieldFocusedBorder,
|
||||||
fontSize: 14),
|
fontSize: 14),
|
||||||
recognizer: TapGestureRecognizer()..onTap = () async {
|
recognizer: TapGestureRecognizer()..onTap = () => AppUtils.launchLink(privacyUrlString)
|
||||||
if (await canLaunchUrlString(privacyUrlString)) {
|
|
||||||
launchUrlString(
|
|
||||||
privacyUrlString,
|
|
||||||
mode: LaunchMode.externalApplication
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-9
@@ -6,7 +6,7 @@ import 'package:flutter_svg/flutter_svg.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:tmail_ui_user/features/base/widget/link_browser_widget.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: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 {
|
class AppGridDashboardItem extends StatelessWidget {
|
||||||
final LinagoraApp app;
|
final LinagoraApp app;
|
||||||
@@ -22,7 +22,7 @@ class AppGridDashboardItem extends StatelessWidget {
|
|||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: _openApp,
|
onTap: () => AppUtils.launchLink(app.appUri.toString()),
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
hoverColor: AppColor.colorBgMailboxSelected,
|
hoverColor: AppColor.colorBgMailboxSelected,
|
||||||
child: Container(
|
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(
|
await launchUrl(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
webOnlyWindowName: isNewTab ? '_blank' : '_self',
|
webOnlyWindowName: isNewTab ? '_blank' : '_self',
|
||||||
|
mode: LaunchMode.externalApplication
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user