Add accent color option to onboarding setup

This commit is contained in:
Tommy Chow
2024-09-08 12:41:36 -07:00
parent fbe3ee09b4
commit a00139fa8c

View File

@ -3,12 +3,14 @@ import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:firebase_performance/firebase_performance.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:frosty/screens/onboarding/onboarding_scaffold.dart';
import 'package:frosty/screens/onboarding/onboarding_welcome.dart';
import 'package:frosty/screens/settings/stores/settings_store.dart';
import 'package:frosty/screens/settings/widgets/settings_list_select.dart';
import 'package:frosty/screens/settings/widgets/settings_list_switch.dart';
import 'package:frosty/widgets/dialog.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
@ -34,6 +36,50 @@ class OnboardingSetup extends StatelessWidget {
onChanged: (newTheme) => settingsStore.themeType =
ThemeType.values[themeNames.indexOf(newTheme)],
),
ListTile(
title: const Text('Accent color'),
trailing: IconButton(
icon: DecoratedBox(
position: DecorationPosition.foreground,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Theme.of(context).colorScheme.onSurface,
width: 2,
),
),
child: CircleAvatar(
backgroundColor: Color(settingsStore.accentColor),
radius: 16,
),
),
onPressed: () {
showDialog(
context: context,
builder: (context) => FrostyDialog(
title: 'Accent color',
content: SingleChildScrollView(
child: ColorPicker(
pickerColor: Color(settingsStore.accentColor),
onColorChanged: (newColor) =>
settingsStore.accentColor = newColor.value,
enableAlpha: false,
pickerAreaBorderRadius:
const BorderRadius.all(Radius.circular(8)),
labelTypes: const [],
),
),
actions: [
FilledButton(
onPressed: () => Navigator.pop(context),
child: const Text('Done'),
),
],
),
);
},
),
),
SettingsListSwitch(
title: 'Show historical recent messages',
subtitle: Text.rich(