Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions lib/src/_paint_over_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class ImagePainter extends StatefulWidget {
this.optionColor,
this.onUndo,
this.onClear,
this.optionSelectedBackgroundColor,
this.optionsBackgroundColor,
}) : super(key: key);

///Constructor for loading image from network url.
Expand Down Expand Up @@ -77,6 +79,8 @@ class ImagePainter extends StatefulWidget {
Color? optionColor,
VoidCallback? onUndo,
VoidCallback? onClear,
Color? optionsSelectedBackgroundColor,
Color? optionsBackgroundColor,
}) {
return ImagePainter._(
key: key,
Expand All @@ -103,6 +107,8 @@ class ImagePainter extends StatefulWidget {
optionColor: optionColor,
onUndo: onUndo,
onClear: onClear,
optionSelectedBackgroundColor: optionsSelectedBackgroundColor,
optionsBackgroundColor: optionsBackgroundColor,
);
}

Expand Down Expand Up @@ -132,6 +138,8 @@ class ImagePainter extends StatefulWidget {
Color? optionColor,
VoidCallback? onUndo,
VoidCallback? onClear,
Color? optionsSelectedBackgroundColor,
Color? optionsBackgroundColor,
}) {
return ImagePainter._(
controller: controller,
Expand All @@ -158,6 +166,8 @@ class ImagePainter extends StatefulWidget {
optionColor: optionColor,
onUndo: onUndo,
onClear: onClear,
optionSelectedBackgroundColor: optionsSelectedBackgroundColor,
optionsBackgroundColor: optionsBackgroundColor,
);
}

Expand Down Expand Up @@ -187,6 +197,8 @@ class ImagePainter extends StatefulWidget {
Color? optionColor,
VoidCallback? onUndo,
VoidCallback? onClear,
Color? optionsSelectedBackgroundColor,
Color? optionsBackgroundColor,
}) {
return ImagePainter._(
controller: controller,
Expand All @@ -213,6 +225,8 @@ class ImagePainter extends StatefulWidget {
optionColor: optionColor,
onUndo: onUndo,
onClear: onClear,
optionSelectedBackgroundColor: optionsSelectedBackgroundColor,
optionsBackgroundColor: optionsBackgroundColor,
);
}

Expand Down Expand Up @@ -242,6 +256,8 @@ class ImagePainter extends StatefulWidget {
Color? optionColor,
VoidCallback? onUndo,
VoidCallback? onClear,
Color? optionsSelectedBackgroundColor,
Color? optionsBackgroundColor,
}) {
return ImagePainter._(
controller: controller,
Expand All @@ -268,6 +284,8 @@ class ImagePainter extends StatefulWidget {
optionColor: optionColor,
onUndo: onUndo,
onClear: onClear,
optionSelectedBackgroundColor: optionsSelectedBackgroundColor,
optionsBackgroundColor: optionsBackgroundColor,
);
}

Expand Down Expand Up @@ -393,6 +411,12 @@ class ImagePainter extends StatefulWidget {

final Color? optionSelectedColor;

/// The background color of the selected option in the options list.
final Color? optionSelectedBackgroundColor;

/// The background color of the options list.
final Color? optionsBackgroundColor;

final Color? optionUnselectedColor;

final Color? optionColor;
Expand Down Expand Up @@ -718,6 +742,8 @@ class ImagePainterState extends State<ImagePainter> {
data: item,
isSelected: _controller.mode == item.mode,
selectedColor: widget.optionSelectedColor,
selectedBackgroundColor:
widget.optionSelectedBackgroundColor,
unselectedColor: widget.optionUnselectedColor,
onTap: () {
if (widget.onPaintModeChanged != null) {
Expand Down Expand Up @@ -834,6 +860,7 @@ class ImagePainterState extends State<ImagePainter> {
.firstWhere((item) => item.mode == _controller.mode)
.icon;
return PopupMenuButton(
color: widget.optionsBackgroundColor,
tooltip: textDelegate.changeMode,
shape: ContinuousRectangleBorder(
borderRadius: BorderRadius.circular(40),
Expand Down
9 changes: 7 additions & 2 deletions lib/src/widgets/_mode_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class SelectionItems extends StatelessWidget {
final VoidCallback? onTap;
final Color? selectedColor;
final Color? unselectedColor;
final Color? selectedBackgroundColor;

const SelectionItems({
required this.data,
Expand All @@ -16,15 +17,19 @@ class SelectionItems extends StatelessWidget {
this.onTap,
this.selectedColor,
this.unselectedColor,
this.selectedBackgroundColor,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 2.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.0),
color: isSelected ? Colors.blue : Colors.transparent),
borderRadius: BorderRadius.circular(4.0),
color: isSelected
? selectedBackgroundColor ?? Colors.blue
: Colors.transparent,
),
child: ListTile(
leading: IconTheme(
data: const IconThemeData(opacity: 1.0),
Expand Down