-
Notifications
You must be signed in to change notification settings - Fork 972
Fix selection in readOnly mode, Add magnifier via RawMagnifier widget #2529
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d90bc6c
enable selection handles in read only mode, added magnifier
mtallenca 7ac0ae8
hide the context menu when dragging selection handles
mtallenca ff883df
remove duplicate line
mtallenca 8492791
added entry to change log file
mtallenca b92ed48
code clean up
mtallenca 8b55268
after a long press (from double tap or drag) make sure magnifier is r…
mtallenca b5759d3
code clean up
mtallenca 36fe118
docs: improve CHANGELOG
EchoEllet a66bd34
added dragOffsetNotifier explanation
mtallenca e3f3763
created [QuillMagnifer] and added a [QuillEditorConfig] parameter qui…
mtallenca d247d87
reorder imports
mtallenca 542ab43
update dragOffsetNotifier documentation
mtallenca bd0004d
Merge branch 'singerdmx:master' into selection_updates
mtallenca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -853,8 +853,9 @@ class QuillRawEditorState extends EditorState | |
}); | ||
} | ||
|
||
controller.addListener(_didChangeTextEditingValueListener); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's looks like this PR removes the lines added by #2488 but keet some of the other changes, does this PR handle any related issues or conflicts with that PR? If no, then we need to revert that PR first, then merge this but revert the selection fix changes. |
||
|
||
if (!widget.config.readOnly) { | ||
controller.addListener(_didChangeTextEditingValueListener); | ||
// listen to composing range changes | ||
composingRange.addListener(_onComposingRangeChanged); | ||
// Focus | ||
|
@@ -965,8 +966,8 @@ class QuillRawEditorState extends EditorState | |
assert(!hasConnection); | ||
_selectionOverlay?.dispose(); | ||
_selectionOverlay = null; | ||
controller.removeListener(_didChangeTextEditingValueListener); | ||
if (!widget.config.readOnly) { | ||
controller.removeListener(_didChangeTextEditingValueListener); | ||
widget.config.focusNode.removeListener(_handleFocusChanged); | ||
composingRange.removeListener(_onComposingRangeChanged); | ||
} | ||
|
@@ -1081,6 +1082,7 @@ class QuillRawEditorState extends EditorState | |
contextMenuBuilder: widget.config.contextMenuBuilder == null | ||
? null | ||
: (context) => widget.config.contextMenuBuilder!(context, this), | ||
dragOffsetNotifier: widget.dragOffsetNotifier, | ||
); | ||
_selectionOverlay!.handlesVisible = _shouldShowSelectionHandles(); | ||
_selectionOverlay!.showHandles(); | ||
|
This file contains hidden or 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 hidden or 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,43 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
typedef QuillMagnifierBuilder = Widget Function(Offset dragPosition); | ||
|
||
Widget defaultQuillMagnifierBuilder(Offset dragPosition) => | ||
QuillMagnifier(dragPosition: dragPosition); | ||
|
||
class QuillMagnifier extends StatelessWidget { | ||
const QuillMagnifier({required this.dragPosition, super.key}); | ||
|
||
final Offset dragPosition; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final position = dragPosition.translate(-60, -80); | ||
return Positioned( | ||
top: position.dy, | ||
left: position.dx, | ||
child: Container( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(20), | ||
), | ||
child: RawMagnifier( | ||
clipBehavior: Clip.hardEdge, | ||
decoration: MagnifierDecoration( | ||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), | ||
shadows: const [ | ||
BoxShadow( | ||
color: Colors.black26, | ||
spreadRadius: 2, | ||
blurRadius: 5, | ||
offset: Offset(3, 3), // changes position of shadow | ||
), | ||
], | ||
), | ||
size: const Size(100, 45), | ||
focalPointOffset: const Offset(5, 55), | ||
magnificationScale: 1.3, | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.