mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-24 02:18:50 +01:00
Fix missing setState when tweaking color tools
This commit is contained in:
parent
0701bbf116
commit
37bf5500e3
1 changed files with 21 additions and 28 deletions
|
@ -221,10 +221,8 @@ class _ColorToolbarState extends State<ColorToolbar> {
|
||||||
max: 100,
|
max: 100,
|
||||||
initialValue:
|
initialValue:
|
||||||
(_filters[ColorToolType.brightness] as _BrightnessArguments).value,
|
(_filters[ColorToolType.brightness] as _BrightnessArguments).value,
|
||||||
onChangeEnd: (value) {
|
onChangeEnd: (value) => _onOptionValueChanged(
|
||||||
_filters[ColorToolType.brightness] = _BrightnessArguments(value);
|
ColorToolType.brightness, _BrightnessArguments(value)),
|
||||||
_notifyFiltersChanged();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildContrastOption(BuildContext context) => _buildSliderOption(
|
Widget _buildContrastOption(BuildContext context) => _buildSliderOption(
|
||||||
|
@ -234,10 +232,8 @@ class _ColorToolbarState extends State<ColorToolbar> {
|
||||||
max: 100,
|
max: 100,
|
||||||
initialValue:
|
initialValue:
|
||||||
(_filters[ColorToolType.contrast] as _ContrastArguments).value,
|
(_filters[ColorToolType.contrast] as _ContrastArguments).value,
|
||||||
onChangeEnd: (value) {
|
onChangeEnd: (value) => _onOptionValueChanged(
|
||||||
_filters[ColorToolType.contrast] = _ContrastArguments(value);
|
ColorToolType.contrast, _ContrastArguments(value)),
|
||||||
_notifyFiltersChanged();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildWhitePointOption(BuildContext context) => _buildSliderOption(
|
Widget _buildWhitePointOption(BuildContext context) => _buildSliderOption(
|
||||||
|
@ -247,10 +243,8 @@ class _ColorToolbarState extends State<ColorToolbar> {
|
||||||
max: 100,
|
max: 100,
|
||||||
initialValue:
|
initialValue:
|
||||||
(_filters[ColorToolType.whitePoint] as _WhitePointArguments).value,
|
(_filters[ColorToolType.whitePoint] as _WhitePointArguments).value,
|
||||||
onChangeEnd: (value) {
|
onChangeEnd: (value) => _onOptionValueChanged(
|
||||||
_filters[ColorToolType.whitePoint] = _WhitePointArguments(value);
|
ColorToolType.whitePoint, _WhitePointArguments(value)),
|
||||||
_notifyFiltersChanged();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildBlackPointOption(BuildContext context) => _buildSliderOption(
|
Widget _buildBlackPointOption(BuildContext context) => _buildSliderOption(
|
||||||
|
@ -260,10 +254,8 @@ class _ColorToolbarState extends State<ColorToolbar> {
|
||||||
max: 100,
|
max: 100,
|
||||||
initialValue:
|
initialValue:
|
||||||
(_filters[ColorToolType.blackPoint] as _BlackPointArguments).value,
|
(_filters[ColorToolType.blackPoint] as _BlackPointArguments).value,
|
||||||
onChangeEnd: (value) {
|
onChangeEnd: (value) => _onOptionValueChanged(
|
||||||
_filters[ColorToolType.blackPoint] = _BlackPointArguments(value);
|
ColorToolType.blackPoint, _BlackPointArguments(value)),
|
||||||
_notifyFiltersChanged();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildSaturationOption(BuildContext context) => _buildSliderOption(
|
Widget _buildSaturationOption(BuildContext context) => _buildSliderOption(
|
||||||
|
@ -273,10 +265,8 @@ class _ColorToolbarState extends State<ColorToolbar> {
|
||||||
max: 100,
|
max: 100,
|
||||||
initialValue:
|
initialValue:
|
||||||
(_filters[ColorToolType.saturation] as _SaturationArguments).value,
|
(_filters[ColorToolType.saturation] as _SaturationArguments).value,
|
||||||
onChangeEnd: (value) {
|
onChangeEnd: (value) => _onOptionValueChanged(
|
||||||
_filters[ColorToolType.saturation] = _SaturationArguments(value);
|
ColorToolType.saturation, _SaturationArguments(value)),
|
||||||
_notifyFiltersChanged();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildWarmthOption(BuildContext context) => _buildSliderOption(
|
Widget _buildWarmthOption(BuildContext context) => _buildSliderOption(
|
||||||
|
@ -286,10 +276,8 @@ class _ColorToolbarState extends State<ColorToolbar> {
|
||||||
max: 100,
|
max: 100,
|
||||||
initialValue:
|
initialValue:
|
||||||
(_filters[ColorToolType.warmth] as _WarmthArguments).value,
|
(_filters[ColorToolType.warmth] as _WarmthArguments).value,
|
||||||
onChangeEnd: (value) {
|
onChangeEnd: (value) => _onOptionValueChanged(
|
||||||
_filters[ColorToolType.warmth] = _WarmthArguments(value);
|
ColorToolType.warmth, _WarmthArguments(value)),
|
||||||
_notifyFiltersChanged();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildTintOption(BuildContext context) => _buildSliderOption(
|
Widget _buildTintOption(BuildContext context) => _buildSliderOption(
|
||||||
|
@ -298,10 +286,8 @@ class _ColorToolbarState extends State<ColorToolbar> {
|
||||||
min: -100,
|
min: -100,
|
||||||
max: 100,
|
max: 100,
|
||||||
initialValue: (_filters[ColorToolType.tint] as _TintArguments).value,
|
initialValue: (_filters[ColorToolType.tint] as _TintArguments).value,
|
||||||
onChangeEnd: (value) {
|
onChangeEnd: (value) =>
|
||||||
_filters[ColorToolType.tint] = _TintArguments(value);
|
_onOptionValueChanged(ColorToolType.tint, _TintArguments(value)),
|
||||||
_notifyFiltersChanged();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
void _onFilterPressed(ColorToolType type, ColorArguments defArgs) {
|
void _onFilterPressed(ColorToolType type, ColorArguments defArgs) {
|
||||||
|
@ -335,6 +321,13 @@ class _ColorToolbarState extends State<ColorToolbar> {
|
||||||
void _onTintPressed() =>
|
void _onTintPressed() =>
|
||||||
_onFilterPressed(ColorToolType.tint, const _TintArguments(0));
|
_onFilterPressed(ColorToolType.tint, const _TintArguments(0));
|
||||||
|
|
||||||
|
void _onOptionValueChanged(ColorToolType type, ColorArguments args) {
|
||||||
|
setState(() {
|
||||||
|
_filters[type] = args;
|
||||||
|
});
|
||||||
|
_notifyFiltersChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void _notifyFiltersChanged() {
|
void _notifyFiltersChanged() {
|
||||||
widget.onActiveFiltersChanged.call(_filters.values);
|
widget.onActiveFiltersChanged.call(_filters.values);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue