Merge 32a6c3b7a2 into bb150ce42a
This commit is contained in:
commit
0c79b159bb
1 changed files with 24 additions and 7 deletions
|
|
@ -22,6 +22,7 @@ class AccentColorPickerDialog extends StatefulWidget {
|
|||
|
||||
class _AccentColorPickerDialogState extends State<AccentColorPickerDialog> {
|
||||
late Color currentColor;
|
||||
static const Color defaultColor = Color(0xFF9246FE);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -41,6 +42,11 @@ class _AccentColorPickerDialogState extends State<AccentColorPickerDialog> {
|
|||
setState(() => currentColor = newColor);
|
||||
widget.onColorChanged(newColor);
|
||||
}
|
||||
void _resetToDefaultColor() {
|
||||
HapticFeedback.lightImpact();
|
||||
setState(() => currentColor = defaultColor);
|
||||
widget.onColorChanged(defaultColor);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -62,13 +68,24 @@ class _AccentColorPickerDialogState extends State<AccentColorPickerDialog> {
|
|||
),
|
||||
labelTypes: const [],
|
||||
),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton.tonalIcon(
|
||||
icon: const Icon(Icons.casino_rounded),
|
||||
onPressed: _generateRandomColor,
|
||||
label: const Text('Random'),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FilledButton.tonalIcon(
|
||||
icon: const Icon(Icons.casino_rounded),
|
||||
onPressed: _generateRandomColor,
|
||||
label: const Text('Random'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: FilledButton.tonalIcon(
|
||||
icon: const Icon(Icons.refresh_rounded),
|
||||
onPressed: _resetToDefaultColor,
|
||||
label: const Text('Reset'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue