diff --git a/lib/ui/image_editor_page.dart b/lib/ui/image_editor_page.dart index edc1ca4e9..295f0f69c 100644 --- a/lib/ui/image_editor_page.dart +++ b/lib/ui/image_editor_page.dart @@ -38,12 +38,19 @@ class ImageEditorPage extends StatefulWidget { } class _ImageEditorPageState extends State { + static const double kBrightnessDefault = 1; + static const double kBrightnessMin = 0; + static const double kBrightnessMax = 2; + static const double kSaturationDefault = 1; + static const double kSaturationMin = 0; + static const double kSaturationMax = 2; + final _logger = Logger("ImageEditor"); final GlobalKey editorKey = GlobalKey(); - double _brightness = 0; - double _saturation = 0; + double _brightness = kBrightnessDefault; + double _saturation = kSaturationDefault; bool _hasEdited = false; @override @@ -68,8 +75,8 @@ class _ImageEditorPageState extends State { onPressed: () { editorKey.currentState.reset(); setState(() { - _brightness = 0; - _saturation = 0; + _brightness = kBrightnessDefault; + _saturation = kSaturationDefault; }); }, icon: Icon(Icons.history), @@ -99,7 +106,9 @@ class _ImageEditorPageState extends State { } bool _hasBeenEdited() { - return _hasEdited || _saturation != 0 || _brightness != 0; + return _hasEdited || + _saturation != kSaturationDefault || + _brightness != kBrightnessDefault; } Widget _buildImage() { @@ -283,8 +292,8 @@ class _ImageEditorPageState extends State { option.addOption(RotateOption(radian.toInt())); } - option.addOption(ColorOption.saturation(_saturation + 1)); - option.addOption(ColorOption.brightness(_brightness + 1)); + option.addOption(ColorOption.saturation(_saturation)); + option.addOption(ColorOption.brightness(_brightness)); option.outputFormat = const OutputFormat.png(88); @@ -398,8 +407,8 @@ class _ImageEditorPageState extends State { value: _saturation, enableTooltip: true, stepSize: 0.01, - min: -1.0, - max: 1.0, + min: kSaturationMin, + max: kSaturationMax, ), ), ), @@ -443,8 +452,8 @@ class _ImageEditorPageState extends State { value: _brightness, enableTooltip: true, stepSize: 0.01, - min: -1.0, - max: 1.0, + min: kBrightnessMin, + max: kBrightnessMax, ), ), ), diff --git a/pubspec.lock b/pubspec.lock index 6bf0a2296..c2e4d7b32 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -484,7 +484,7 @@ packages: name: image_editor url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" implicitly_animated_reorderable_list: dependency: "direct main" description: diff --git a/thirdparty/extended_image b/thirdparty/extended_image index 7a9f224b7..112cc8be0 160000 --- a/thirdparty/extended_image +++ b/thirdparty/extended_image @@ -1 +1 @@ -Subproject commit 7a9f224b7f8fc6302b0374d87ba0e31caefcbf9e +Subproject commit 112cc8be0c2f07129edd7575003a3f9ddb62ae3f