add persisted theme toggle to RequestEditorPaneHome

This commit is contained in:
Matthew Krohn
2023-04-04 15:49:59 -07:00
parent 90823513ac
commit a7154aadfb
4 changed files with 84 additions and 2 deletions

View File

@@ -48,6 +48,7 @@ class RequestEditorPaneHome extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themeStateProvider);
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 40,
@@ -155,6 +156,48 @@ class RequestEditorPaneHome extends ConsumerWidget {
),
],
),
kVSpacer10,
Row(
children: [
Text.rich(
TextSpan(
children: [
const TextSpan(
text: "Choose your theme now: ",
),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: ElevatedButton(
onPressed: () async => await ref
.read(themeStateProvider.notifier)
.toggle(),
child: Row(
children: [
theme != null
? theme
? const Icon(Icons.dark_mode)
: const Icon(Icons.light_mode)
: const Icon(Icons.light_mode),
kHSpacer10,
Text.rich(
TextSpan(
text: theme != null
? theme
? "Dark"
: "Light"
: "Light",
),
),
],
),
),
),
],
),
style: Theme.of(context).textTheme.titleMedium,
),
],
),
kVSpacer20,
kVSpacer10,
Row(