diff --git a/lib/src/_paint_over_image.dart b/lib/src/_paint_over_image.dart index 5e5f1bd..d5c5d3d 100644 --- a/lib/src/_paint_over_image.dart +++ b/lib/src/_paint_over_image.dart @@ -46,6 +46,8 @@ class ImagePainter extends StatefulWidget { this.onPaintModeChanged, this.textDelegate, this.showControls = true, + this.bottomPadding, + this.iconColor, this.controlsBackgroundColor, this.optionSelectedColor, this.optionUnselectedColor, @@ -76,6 +78,8 @@ class ImagePainter extends StatefulWidget { TextDelegate? textDelegate, bool? controlsAtTop, bool? showControls, + double? bottomPadding, + Color? iconColor, Color? controlsBackgroundColor, Color? selectedColor, Color? unselectedColor, @@ -104,6 +108,8 @@ class ImagePainter extends StatefulWidget { textDelegate: textDelegate, controlsAtTop: controlsAtTop ?? true, showControls: showControls ?? true, + bottomPadding: bottomPadding, + iconColor: iconColor, controlsBackgroundColor: controlsBackgroundColor, optionSelectedColor: selectedColor, optionUnselectedColor: unselectedColor, @@ -135,6 +141,8 @@ class ImagePainter extends StatefulWidget { TextDelegate? textDelegate, bool? controlsAtTop, bool? showControls, + double? bottomPadding, + Color? iconColor, Color? controlsBackgroundColor, Color? selectedColor, Color? unselectedColor, @@ -163,6 +171,8 @@ class ImagePainter extends StatefulWidget { textDelegate: textDelegate, controlsAtTop: controlsAtTop ?? true, showControls: showControls ?? true, + bottomPadding: bottomPadding, + iconColor: iconColor, controlsBackgroundColor: controlsBackgroundColor, optionSelectedColor: selectedColor, optionUnselectedColor: unselectedColor, @@ -194,6 +204,8 @@ class ImagePainter extends StatefulWidget { TextDelegate? textDelegate, bool? controlsAtTop, bool? showControls, + double? bottomPadding, + Color? iconColor, Color? controlsBackgroundColor, Color? selectedColor, Color? unselectedColor, @@ -222,6 +234,8 @@ class ImagePainter extends StatefulWidget { textDelegate: textDelegate, controlsAtTop: controlsAtTop ?? true, showControls: showControls ?? true, + bottomPadding: bottomPadding, + iconColor: iconColor, controlsBackgroundColor: controlsBackgroundColor, optionSelectedColor: selectedColor, optionUnselectedColor: unselectedColor, @@ -253,6 +267,8 @@ class ImagePainter extends StatefulWidget { TextDelegate? textDelegate, bool? controlsAtTop, bool? showControls, + double? bottomPadding, + Color? iconColor, Color? controlsBackgroundColor, Color? selectedColor, Color? unselectedColor, @@ -281,6 +297,8 @@ class ImagePainter extends StatefulWidget { textDelegate: textDelegate, controlsAtTop: controlsAtTop ?? true, showControls: showControls ?? true, + bottomPadding: bottomPadding, + iconColor: iconColor, controlsBackgroundColor: controlsBackgroundColor, optionSelectedColor: selectedColor, optionUnselectedColor: unselectedColor, @@ -307,6 +325,8 @@ class ImagePainter extends StatefulWidget { TextDelegate? textDelegate, bool? controlsAtTop, bool? showControls, + double? bottomPadding, + Color? iconColor, Color? controlsBackgroundColor, Color? selectedColor, Color? unselectedColor, @@ -332,6 +352,8 @@ class ImagePainter extends StatefulWidget { textDelegate: textDelegate, controlsAtTop: controlsAtTop ?? true, showControls: showControls ?? true, + bottomPadding: bottomPadding, + iconColor: iconColor, controlsBackgroundColor: controlsBackgroundColor, optionSelectedColor: selectedColor, optionUnselectedColor: unselectedColor, @@ -412,6 +434,11 @@ class ImagePainter extends StatefulWidget { ///It will control displaying the Control Bar final bool showControls; + ///sets the bottom padding if set, else MediaQuery.padding.bottom is used + final double? bottomPadding; + + final Color? iconColor; + final Color? controlsBackgroundColor; final Color? optionSelectedColor; @@ -439,6 +466,7 @@ class ImagePainterState extends State { int _strokeMultiplier = 1; late TextDelegate textDelegate; + @override void initState() { super.initState(); @@ -603,7 +631,10 @@ class ImagePainterState extends State { ), ), if (!widget.controlsAtTop && widget.showControls) _buildControls(), - SizedBox(height: MediaQuery.of(context).padding.bottom) + SizedBox( + height: + widget.bottomPadding ?? MediaQuery.of(context).padding.bottom, + ) ], ), ); @@ -926,8 +957,8 @@ class ImagePainterState extends State { shape: ContinuousRectangleBorder( borderRadius: BorderRadius.circular(20), ), - icon: - widget.brushIcon ?? Icon(Icons.brush, color: Colors.grey[700]), + icon: widget.brushIcon ?? + Icon(Icons.brush, color: widget.iconColor ?? Colors.grey[700]), itemBuilder: (_) => [_showRangeSlider()], ), AnimatedBuilder( @@ -956,7 +987,8 @@ class ImagePainterState extends State { const Spacer(), IconButton( tooltip: textDelegate.undo, - icon: widget.undoIcon ?? Icon(Icons.reply, color: Colors.grey[700]), + icon: widget.undoIcon ?? + Icon(Icons.reply, color: widget.iconColor ?? Colors.grey[700]), onPressed: () { widget.onUndo?.call(); _controller.undo(); @@ -965,7 +997,7 @@ class ImagePainterState extends State { IconButton( tooltip: textDelegate.clearAllProgress, icon: widget.clearAllIcon ?? - Icon(Icons.clear, color: Colors.grey[700]), + Icon(Icons.clear, color: widget.iconColor ?? Colors.grey[700]), onPressed: () { widget.onClear?.call(); _controller.clear();