Simplify observed values about text selection in composer

hasTextSelection had no interest.

The other two values have been put inside an object to observe only one object.
This commit is contained in:
Théo Poizat
2025-12-11 11:13:35 +01:00
committed by Dat H. Pham
parent 2228596c1c
commit d369fcbf5f
4 changed files with 35 additions and 25 deletions
@@ -69,6 +69,18 @@ class TextSelectionCoordinates {
Offset get position => Offset(x, y);
}
class EditorTextSelection {
final String? selectedText;
final Offset? coordinates;
const EditorTextSelection({
this.selectedText,
this.coordinates,
});
bool get hasSelection => selectedText != null && selectedText!.isNotEmpty;
}
mixin TextSelectionMixin<T extends StatefulWidget> on State<T> {
OnTextSelectionChanged? get onSelectionChanged => null;