diff --git a/lib/src/schedules/presentations/section_widget.dart b/lib/src/schedules/presentations/section_widget.dart index c6c7992..7f5a7ff 100644 --- a/lib/src/schedules/presentations/section_widget.dart +++ b/lib/src/schedules/presentations/section_widget.dart @@ -79,11 +79,19 @@ class SectionWidget extends ConsumerWidget { child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ TextButton( - onPressed: () => _launchUrl(Uri.parse( - 'https://www.jw.org/finder?srcid=jwlshare&wtlocale=${bibleLanguage?.wtCode}&prefer=lang&bible=${section.url}')), + onPressed: () async { + final url = Uri.parse( + 'https://www.jw.org/finder?srcid=jwlshare&wtlocale=${bibleLanguage?.wtCode}&prefer=lang&bible=${section.url}'); + + if (await canLaunchUrl(url)) { + await launchUrl(url); + } + }, child: Text( '${bibleLanguage?.books[section.bookIndex].name} ${section.ref}', - style: const TextStyle(color: Color(0xff007bff)))), + style: TextStyle( + color: Theme.of(context).colorScheme.primary, + ))), if (plan.showEvents) ...section.events .map((eventKey) => events?.events[eventKey] != null @@ -101,9 +109,3 @@ class SectionWidget extends ConsumerWidget { ); } } - -Future _launchUrl(Uri url) async { - if (!await launchUrl(url)) { - throw Exception('Could not launch $url'); - } -}