ezColorPicker function
Future
ezColorPicker({
- required BuildContext context,
- required Color startColor,
- required void onColorChange(
- Color chosenColor
- required void apply(),
- required void cancel(),
Wrap a ColorPicker
in an EzDialog
Implementation
Future<dynamic> ezColorPicker({
required BuildContext context,
required Color startColor,
required void Function(Color chosenColor) onColorChange,
required void Function() apply,
required void Function() cancel,
}) {
final double space = EzConfig.instance.prefs[buttonSpacingKey];
return showPlatformDialog(
context: context,
builder: (context) => EzDialog(
title: const EzSelectableText('Pick a color!'),
contents: [
// Color picker
ColorPicker(
pickerColor: startColor,
onColorChanged: onColorChange,
// ignore: deprecated_member_use
labelTextStyle: Theme.of(context).dialogTheme.contentTextStyle,
// Above is necessary for Cupertino
// It is deprecated, but it points to an also deprecated solution
// ...ain't broke...
),
EzSpacer(space),
// Apply/cancel
EzYesNo(
onConfirm: apply,
confirmMsg: 'Apply',
onDeny: cancel,
denyMsg: 'Cancel',
),
],
needsClose: false,
),
);
}