Skip to content

Commit

Permalink
schedules: use primary color for section buttons (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
wfleischer authored Dec 1, 2024
1 parent 66014de commit b185822
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/src/schedules/presentations/section_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -101,9 +109,3 @@ class SectionWidget extends ConsumerWidget {
);
}
}

Future<void> _launchUrl(Uri url) async {
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
}

0 comments on commit b185822

Please sign in to comment.