-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PAINTROID-759: Add Text Tool #86
base: develop
Are you sure you want to change the base?
Conversation
Hi @bakicelebi @msesko @juliajulie95 |
@@ -123,6 +120,7 @@ class _DrawingCanvasState extends ConsumerState<DrawingCanvas> { | |||
_resetCanvasScale(fitToScreen: isFullscreen); | |||
}, | |||
); | |||
final selectedTool = ref.watch(toolBoxStateProvider).currentTool; | |||
return Listener( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (selectedTool is TextTool) ref.watch(textToolProvider)
This PR has a bounding box implementation that can be useful for text tool aswell. 👍🏻 |
Thanks for this, on it |
I have added a basic implementation; can you please review it @bakicelebi @juliajulie95 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please implement reasonable unit, widget, integration testcases for the new tool. Also merge the latest develop to get the latest bounding box implementation
@@ -38,4 +40,12 @@ class CommandFactory { | |||
Offset center, | |||
) => | |||
CircleShapeCommand(paint, radius, center); | |||
|
|||
AddTextCommand createAddTextCommand( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be just TextCommand
and createTextCommand
TextStyle style, | ||
Paint paint, | ||
) => | ||
AddTextCommand(point, text, style, paint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be just TextCommand
import 'package:paintroid/core/json_serialization/converter/paint_converter.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
|
||
class AddTextCommand extends GraphicCommand with EquatableMixin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be just TextCommand
} | ||
|
||
void undo(Canvas canvas) { | ||
// TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commands dont have undo method or rather should not have one. Please use the override in the specific tool, in this case text tool.
List<Object?> get props => [point, text, paint]; | ||
|
||
@override | ||
bool? get stringify => true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why nullable?
@@ -26,6 +24,7 @@ class _DrawingCanvasState extends ConsumerState<DrawingCanvas> { | |||
var _pointersOnScreen = 0; | |||
var _isZooming = false; | |||
Offset _lastPointerUpPosition = Offset.zero; | |||
final textController = TextEditingController(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is misplaced tool specific controller should be in a tool widget. Its not used anyway.
error: (_) => Container(), | ||
loading: (_) => Container(), | ||
), | ||
child: Stack( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this stacking?
ref | ||
.read(canvasStateProvider.notifier) | ||
.resetCanvasWithExistingCommands(); | ||
ref.read(toolBoxStateProvider.notifier).switchTool(ToolData.BRUSH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the switch to brush tool?
@@ -66,7 +68,7 @@ class _WorkspaceScreenState extends ConsumerState<WorkspacePage> { | |||
child: Scaffold( | |||
appBar: isFullscreen ? null : const TopAppBar(title: 'Pocket Paint'), | |||
backgroundColor: Colors.grey.shade400, | |||
resizeToAvoidBottomInset: true, | |||
resizeToAvoidBottomInset: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change necessary?
@@ -28,6 +28,8 @@ class _WorkspaceScreenState extends ConsumerState<WorkspacePage> { | |||
); | |||
} | |||
|
|||
final textController = TextEditingController(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used.
} | ||
} | ||
|
||
void rotate(Offset point) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure rotation should be supported by text tool. If this is a technical limitation of your current implementation it should be disabled in some other way, but definetly implemented before merge.
|
||
@override | ||
void onDown(Offset point, Paint paint) { | ||
paint = paint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of this?
IN DEVELOPMENT
Ticket
PAINTROID-759
New Features and Enhancements
Adds the text tool feature as mentioned in the ticket.
Checklist
Your checklist for this pull request
Please review the contributing guidelines and wiki pages of this repository.