mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 10:06:23 +08:00
opt insert rich text
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3251,7 +3251,7 @@ class EditableTextState extends State<EditableText>
|
||||
// to make sure the user can see the changes they just made. Programmatic
|
||||
// changes to `textEditingValue` do not trigger the behavior even if the
|
||||
// text field is focused.
|
||||
_scheduleShowCaretOnScreen(withAnimation: true);
|
||||
scheduleShowCaretOnScreen(withAnimation: true);
|
||||
}
|
||||
|
||||
bool _checkNeedsAdjustAffinity(TextEditingValue value) {
|
||||
@@ -4119,7 +4119,7 @@ class EditableTextState extends State<EditableText>
|
||||
|
||||
bool _showCaretOnScreenScheduled = false;
|
||||
|
||||
void _scheduleShowCaretOnScreen({required bool withAnimation}) {
|
||||
void scheduleShowCaretOnScreen({required bool withAnimation}) {
|
||||
if (_showCaretOnScreenScheduled) {
|
||||
return;
|
||||
}
|
||||
@@ -4217,7 +4217,7 @@ class EditableTextState extends State<EditableText>
|
||||
if (_lastBottomViewInset < view.viewInsets.bottom) {
|
||||
// Because the metrics change signal from engine will come here every frame
|
||||
// (on both iOS and Android). So we don't need to show caret with animation.
|
||||
_scheduleShowCaretOnScreen(withAnimation: false);
|
||||
scheduleShowCaretOnScreen(withAnimation: false);
|
||||
}
|
||||
}
|
||||
_lastBottomViewInset = view.viewInsets.bottom;
|
||||
@@ -4518,7 +4518,7 @@ class EditableTextState extends State<EditableText>
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
_lastBottomViewInset = View.of(context).viewInsets.bottom;
|
||||
if (!widget.readOnly) {
|
||||
_scheduleShowCaretOnScreen(withAnimation: true);
|
||||
scheduleShowCaretOnScreen(withAnimation: true);
|
||||
}
|
||||
final TextSelection? updatedSelection = _adjustedSelectionWhenFocused();
|
||||
if (updatedSelection != null) {
|
||||
@@ -4747,7 +4747,7 @@ class EditableTextState extends State<EditableText>
|
||||
final bool shouldShowCaret =
|
||||
widget.readOnly ? _value.selection != value.selection : _value != value;
|
||||
if (shouldShowCaret) {
|
||||
_scheduleShowCaretOnScreen(withAnimation: true);
|
||||
scheduleShowCaretOnScreen(withAnimation: true);
|
||||
}
|
||||
|
||||
// Even if the value doesn't change, it may be necessary to focus and build
|
||||
|
||||
@@ -82,12 +82,11 @@ typedef InputCounterWidgetBuilder = Widget? Function(
|
||||
|
||||
class _TextFieldSelectionGestureDetectorBuilder
|
||||
extends TextSelectionGestureDetectorBuilder {
|
||||
_TextFieldSelectionGestureDetectorBuilder(
|
||||
{required _RichTextFieldState state})
|
||||
_TextFieldSelectionGestureDetectorBuilder({required RichTextFieldState state})
|
||||
: _state = state,
|
||||
super(delegate: state);
|
||||
|
||||
final _RichTextFieldState _state;
|
||||
final RichTextFieldState _state;
|
||||
|
||||
@override
|
||||
bool get onUserTapAlwaysCalled => _state.widget.onTapAlwaysCalled;
|
||||
@@ -961,7 +960,7 @@ class RichTextField extends StatefulWidget {
|
||||
}
|
||||
|
||||
@override
|
||||
State<RichTextField> createState() => _RichTextFieldState();
|
||||
State<RichTextField> createState() => RichTextFieldState();
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
@@ -1150,7 +1149,7 @@ class RichTextField extends StatefulWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _RichTextFieldState extends State<RichTextField>
|
||||
class RichTextFieldState extends State<RichTextField>
|
||||
with RestorationMixin
|
||||
implements TextSelectionGestureDetectorBuilderDelegate, AutofillClient {
|
||||
// RestorableRichTextEditingController? _controller;
|
||||
@@ -1912,6 +1911,10 @@ class _RichTextFieldState extends State<RichTextField>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void scheduleShowCaretOnScreen({required bool withAnimation}) {
|
||||
_editableText?.scheduleShowCaretOnScreen(withAnimation: withAnimation);
|
||||
}
|
||||
}
|
||||
|
||||
TextStyle? _m2StateInputStyle(BuildContext context) =>
|
||||
|
||||
Reference in New Issue
Block a user