Commit 2e7b76b

derdilla <derdilla06@gmail.com>
2023-05-23 15:23:04
make links easier to click
1 parent 13dc7bd
Changed files (2)
lib
lib/screens/subsettings/enter_timeformat.dart
@@ -2,7 +2,7 @@ import 'package:blood_pressure_app/model/settings_store.dart';
 import 'package:flutter/gestures.dart';
 import 'package:flutter/material.dart';
 import 'package:provider/provider.dart';
-import 'package:url_launcher/url_launcher.dart' show launchUrl;
+import 'package:url_launcher/url_launcher.dart' show LaunchMode, canLaunchUrl, launchUrl;
 
 
 class EnterTimeFormatScreen extends StatefulWidget {
@@ -31,17 +31,25 @@ class _EnterTimeFormatScreenState extends State<EnterTimeFormatScreen> {
               crossAxisAlignment: CrossAxisAlignment.start,
               children: [
                 const Text('A formatter String consists of a mixture of predefined ICU/Skeleton Strings and any other text you want to include.'),
-                const SizedBox(height: 5,),
-                RichText(
-                  text: TextSpan(
-                    text: 'For a full list of valid formats please look here.',
-                    style: const TextStyle(color: Colors.blue),
-                    recognizer: TapGestureRecognizer()
-                      ..onTap = () { launchUrl(Uri.parse('https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html'));
-                      },
+                InkWell(
+                  onTap: () async {
+                    final url = Uri.parse('https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html');
+                    if (await canLaunchUrl(url)) {
+                      await launchUrl(url, mode: LaunchMode.externalApplication);
+                    } else {
+                      ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Can\'t open URL:\nhttps://pub.dev/documentation/intl/latest/intl/DateFormat-class.html')));
+                    }
+                  },
+                  child: const SizedBox(
+                    height: 48,
+                    child: Center(
+                      child: Text(
+                        'For a full list of valid formats please look here.',
+                        style: TextStyle(color: Colors.blue),
+                      ),
+                    ),
                   ),
                 ),
-                const SizedBox(height: 7,),
                 const Text('Please note that having longer/shorter format Strings wont magically change the width of the table columns, so it might come to awkward line breaks.'),
                 const SizedBox(height: 7,),
                 const Text('default: "yy-MM-dd H:mm"'),
lib/screens/subsettings/warn_about.dart
@@ -23,19 +23,23 @@ class AboutWarnValuesScreen extends StatelessWidget {
             children: [
               const Text('The warn values are a pure suggestions and no medical advice.'),
               const SizedBox(height: 5,),
-              RichText(
-                text: TextSpan(
-                  text: 'The default age dependent values come from this source.',
-                  style: const TextStyle(color: Colors.blue),
-                  recognizer: TapGestureRecognizer()
-                    ..onTap = () async {
-                      final url = Uri.parse(BloodPressureWarnValues.source);
-                      if (await canLaunchUrl(url)) {
-                        await launchUrl(url, mode: LaunchMode.externalApplication);
-                      } else {
-                        ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Can\'t open URL:\n${BloodPressureWarnValues.source}')));
-                      }
-                    },
+              InkWell(
+                onTap: () async {
+                  final url = Uri.parse(BloodPressureWarnValues.source);
+                  if (await canLaunchUrl(url)) {
+                    await launchUrl(url, mode: LaunchMode.externalApplication);
+                  } else {
+                    ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Can\'t open URL:\n${BloodPressureWarnValues.source}')));
+                  }
+                },
+                child: const SizedBox(
+                  height: 48,
+                  child: Center(
+                    child: Text(
+                      "The default age dependent values come from this source.",
+                      style: TextStyle(color: Colors.blue),
+                    ),
+                  ),
                 ),
               ),
               const SizedBox(height: 5,),