|
|
|
@ -5,11 +5,17 @@ import '../../translations/toolbar.i18n.dart'; |
|
|
|
|
|
|
|
|
|
class ImageResizer extends StatefulWidget { |
|
|
|
|
const ImageResizer( |
|
|
|
|
{required this.imageWidth, required this.imageHeight, Key? key}) |
|
|
|
|
{required this.imageWidth, |
|
|
|
|
required this.imageHeight, |
|
|
|
|
required this.maxWidth, |
|
|
|
|
required this.maxHeight, |
|
|
|
|
Key? key}) |
|
|
|
|
: super(key: key); |
|
|
|
|
|
|
|
|
|
final double? imageWidth; |
|
|
|
|
final double? imageHeight; |
|
|
|
|
final double maxWidth; |
|
|
|
|
final double maxHeight; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
_ImageResizerState createState() => _ImageResizerState(); |
|
|
|
@ -18,16 +24,16 @@ class ImageResizer extends StatefulWidget { |
|
|
|
|
class _ImageResizerState extends State<ImageResizer> { |
|
|
|
|
late double _width; |
|
|
|
|
late double _height; |
|
|
|
|
late double _maxWidth; |
|
|
|
|
late double _maxHeight; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
_maxWidth = MediaQuery.of(context).size.width; |
|
|
|
|
_maxHeight = MediaQuery.of(context).size.height; |
|
|
|
|
_width = widget.imageWidth ?? _maxWidth; |
|
|
|
|
_height = widget.imageHeight ?? _maxHeight; |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
_width = widget.imageWidth ?? widget.maxWidth; |
|
|
|
|
_height = widget.imageHeight ?? widget.maxHeight; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return CupertinoActionSheet(actions: [ |
|
|
|
|
CupertinoActionSheetAction( |
|
|
|
|
onPressed: () {}, |
|
|
|
@ -36,7 +42,7 @@ class _ImageResizerState extends State<ImageResizer> { |
|
|
|
|
child: Card( |
|
|
|
|
child: Slider( |
|
|
|
|
value: _width, |
|
|
|
|
max: _maxWidth, |
|
|
|
|
max: widget.maxWidth, |
|
|
|
|
divisions: 100, |
|
|
|
|
label: 'Width'.i18n, |
|
|
|
|
onChanged: (val) { |
|
|
|
@ -54,7 +60,7 @@ class _ImageResizerState extends State<ImageResizer> { |
|
|
|
|
child: Card( |
|
|
|
|
child: Slider( |
|
|
|
|
value: _height, |
|
|
|
|
max: _maxHeight, |
|
|
|
|
max: widget.maxHeight, |
|
|
|
|
divisions: 100, |
|
|
|
|
label: 'Height'.i18n, |
|
|
|
|
onChanged: (val) { |
|
|
|
|