showNativeIosColorPicker method
Future<void>
showNativeIosColorPicker({
- required ValueChanged<
Color> onColorChanged, - Color? startingColor,
- bool? darkMode,
- String? title,
iOS Native color Picker, Only for iOS.
If darkMode is null, then the color will depend on device system
startingColor is null then the default color will be green
Implementation
Future<void> showNativeIosColorPicker({
required ValueChanged<Color> onColorChanged,
Color? startingColor,
bool? darkMode,
String? title,
}) async {
assert(Platform.isIOS,
"Only works for iOS use (showIOSCustomColorPicker) for other platforms");
selectedColor = startingColor ?? selectedColor;
IosColorPickerPlatform.instance
.getPlatformColor(selectedColor.toMap(), darkMode, title);
_colorSubscription = _eventChannel.receiveBroadcastStream().listen((event) {
if (event != null) {
try {
selectedColor = (event as Map<Object?, Object?>).toColor();
} catch (error) {
rethrow;
}
onColorChanged(selectedColor);
}
}, onError: (err) {
throw err;
});
}