-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(custom-widgets): add custom widgets to replace layer interaction…
… buttons (edit, remove, rotate, scale)
- Loading branch information
Showing
7 changed files
with
328 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
lib/models/custom_widgets/custom_widgets_layer_interaction.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'utils/custom_widgets_typedef.dart'; | ||
|
||
/// A class that defines a layer of interaction for custom widgets, | ||
/// allowing editing, removing, and rotating/scaling actions. | ||
/// | ||
/// Each interaction can be represented by specific buttons passed into | ||
/// the constructor. | ||
/// | ||
/// Example usage: | ||
/// ```dart | ||
/// CustomWidgetsLayerInteraction( | ||
/// editIcon: LayerInteractionTapButton(...), | ||
/// removeIcon: LayerInteractionTapButton(...), | ||
/// rotateScaleIcon: LayerInteractionScaleRotateButton(...), | ||
/// ); | ||
/// ``` | ||
class CustomWidgetsLayerInteraction { | ||
/// Creates a [CustomWidgetsLayerInteraction] with optional interaction | ||
/// buttons. | ||
/// | ||
/// * [editIcon]: A button that triggers the edit action. | ||
/// * [removeIcon]: A button that triggers the remove action. | ||
/// * [rotateScaleIcon]: A button for rotate/scale actions. | ||
const CustomWidgetsLayerInteraction({ | ||
this.editIcon, | ||
this.removeIcon, | ||
this.rotateScaleIcon, | ||
}); | ||
|
||
/// The button for the edit interaction, represented by | ||
/// [LayerInteractionTapButton]. | ||
final LayerInteractionTapButton? editIcon; | ||
|
||
/// The button for the remove interaction, represented by | ||
/// [LayerInteractionTapButton]. | ||
final LayerInteractionTapButton? removeIcon; | ||
|
||
/// The button for the rotate/scale interaction, represented by | ||
/// [LayerInteractionScaleRotateButton]. | ||
final LayerInteractionScaleRotateButton? rotateScaleIcon; | ||
|
||
/// Returns a copy of this object with the given fields updated. | ||
/// | ||
/// If no values are provided for the fields, the current values will be kept. | ||
/// | ||
/// * [editIcon]: Updates the button for the edit action. | ||
/// * [removeIcon]: Updates the button for the remove action. | ||
/// * [rotateScaleIcon]: Updates the button for rotate/scale actions. | ||
CustomWidgetsLayerInteraction copyWith({ | ||
LayerInteractionTapButton? editIcon, | ||
LayerInteractionTapButton? removeIcon, | ||
LayerInteractionScaleRotateButton? rotateScaleIcon, | ||
}) { | ||
return CustomWidgetsLayerInteraction( | ||
editIcon: editIcon ?? this.editIcon, | ||
removeIcon: removeIcon ?? this.removeIcon, | ||
rotateScaleIcon: rotateScaleIcon ?? this.rotateScaleIcon, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.