diff --git a/lib/src/screens/about.dart b/lib/src/screens/about.dart index 4fbb094..8e39f18 100644 --- a/lib/src/screens/about.dart +++ b/lib/src/screens/about.dart @@ -1,8 +1,10 @@ import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:prosappco/src/components/pop_appbar.dart'; import 'package:prosappco/src/models/setting_model.dart'; import 'package:prosappco/src/screens/web_view.dart'; +import 'package:url_launcher/url_launcher.dart'; class AboutScreen extends StatefulWidget { const AboutScreen({super.key}); @@ -26,6 +28,14 @@ class _AboutScreenState extends State { } } + void _launchURL(String url) async { + if (await canLaunch(url)) { + await launch(url, forceSafariVC: false, forceWebView: false); + } else { + throw 'No se pudo abrir el enlace $url'; + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -38,17 +48,21 @@ class _AboutScreenState extends State { children: [ ListTile( onTap: () { - Navigator.push( - context, - CupertinoPageRoute( - builder: (BuildContext context) { - return WebViewScreen( - label: 'Políticas de privacidad', - link: settings?.proliticasPrivacidad ?? '', - ); - }, - ), - ); + if (kIsWeb) { + _launchURL(settings?.proliticasPrivacidad ?? ''); + } else { + Navigator.push( + context, + CupertinoPageRoute( + builder: (BuildContext context) { + return WebViewScreen( + label: 'Políticas de privacidad', + link: settings?.proliticasPrivacidad ?? '', + ); + }, + ), + ); + } }, title: const Text('Políticas de privacidad'), trailing: @@ -56,17 +70,21 @@ class _AboutScreenState extends State { ), ListTile( onTap: () { - Navigator.push( - context, - CupertinoPageRoute( - builder: (BuildContext context) { - return WebViewScreen( - label: 'Términos y condiciones', - link: settings?.terminosCondiciones ?? '', - ); - }, - ), - ); + if (kIsWeb) { + _launchURL(settings?.terminosCondiciones ?? ''); + } else { + Navigator.push( + context, + CupertinoPageRoute( + builder: (BuildContext context) { + return WebViewScreen( + label: 'Términos y condiciones', + link: settings?.terminosCondiciones ?? '', + ); + }, + ), + ); + } }, title: const Text('Términos y condiciones'), trailing: diff --git a/lib/src/screens/new_number.dart b/lib/src/screens/new_number.dart index 0415a61..d439105 100644 --- a/lib/src/screens/new_number.dart +++ b/lib/src/screens/new_number.dart @@ -5,7 +5,6 @@ import 'package:get/get.dart'; import 'package:intl_phone_field/intl_phone_field.dart'; import 'package:prosappco/src/components/primary_btn.dart'; import 'package:prosappco/src/controllers/new_phone_controller.dart'; -import 'package:prosappco/src/controllers/phone_auth_controller.dart'; class NewNumberScreen extends StatefulWidget { const NewNumberScreen({super.key}); diff --git a/lib/src/screens/professional_info.dart b/lib/src/screens/professional_info.dart index e0f56de..dd763cd 100644 --- a/lib/src/screens/professional_info.dart +++ b/lib/src/screens/professional_info.dart @@ -115,8 +115,8 @@ class _ProfessionalInfoScreenState extends State { ), ], ), - child: Row( - children: const [ + child: const Row( + children: [ Icon( Icons.error_outline, size: 27, diff --git a/lib/src/screens/service_after.dart b/lib/src/screens/service_after.dart index 8244b24..3373c66 100644 --- a/lib/src/screens/service_after.dart +++ b/lib/src/screens/service_after.dart @@ -204,9 +204,9 @@ class _ServiceAfterScreenState extends State { style: TextStyle(color: Colors.grey[600], fontStyle: FontStyle.italic), ), - Center( + const Center( child: Column( - children: const [ + children: [ Padding( padding: EdgeInsets.symmetric(vertical: 20), child: Icon( diff --git a/lib/src/screens/web_view.dart b/lib/src/screens/web_view.dart index 6fc390e..acd304d 100644 --- a/lib/src/screens/web_view.dart +++ b/lib/src/screens/web_view.dart @@ -33,7 +33,7 @@ class _WebViewScreenState extends State { }, ), ) - ..loadRequest(Uri.parse('${widget.link}')); + ..loadRequest(Uri.parse(widget.link)); return Scaffold( appBar: PopAppbar( onPressed: () {