Skip to content
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

[Bug report] extende_text_field图文混合输入中,当输入框中只有图片时,添加换行符“\n”后,下一行行高会是“图片元素”的高度,输入一个字后,行高会缩小为“文字字号”高度,用户看到会行高闪烁问题 #240

Open
ChanKen opened this issue Jul 24, 2024 · 2 comments

Comments

@ChanKen
Copy link

ChanKen commented Jul 24, 2024

Version

14.0.0

Platforms

iOS

Device Model

iphoneXR(iOS15.1)

flutter info

flutter doctor -v

[!] Flutter (Channel stable, 3.19.6, on macOS 13.5.2 22G91 darwin-x64, locale zh-Hans-CN)
    • Flutter version 3.19.6 on channel stable at /Users/liqian/.fvm/versions/3.13.2
    ! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/2.19.6/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/liqian/.fvm/versions/3.13.2. Consider adding /Users/liqian/.fvm/versions/3.13.2/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (3 months ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/liqian/Library/Android/sdk
    • Platform android-34, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.15.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

How to reproduce?

遇到一个extended-text-field 图文混排的行高问题,demo也有这情况。场景是:输入框中只有“图片元素”时,添加换行符“\n”后,下一行行高会是“图片元素”的高度,输入一个字后,行高会缩小为“文字字号”高度,用户看到会行高闪烁问题。

Logs

No response

Example code (optional)

Container(
              height: 200,
              child: ExtendedTextField(
                key: _key,
                // minLines: 1,
                maxLines: null,
                // expands: true,
                // maxLines: 2,
                // StrutStyle get strutStyle {
                //   if (_strutStyle == null) {
                //     return StrutStyle.fromTextStyle(style, forceStrutHeight: true);
                //   }
                //   return _strutStyle!.inheritFromTextStyle(style);
                // }
                //
                textInputAction: TextInputAction.newline,
                strutStyle: const StrutStyle(),
                specialTextSpanBuilder: MySpecialTextSpanBuilder(
                  showAtBackground: true,
                ),
                controller: _textEditingController,
                selectionControls: _myExtendedMaterialTextSelectionControls,
                extendedContextMenuBuilder: MyTextSelectionControls.defaultContextMenuBuilder,
                focusNode: _focusNode,
                decoration: InputDecoration(
                    suffixIcon: GestureDetector(
                      onTap: () {
                        setState(() {
                          sessions.insert(0, _textEditingController.text);
                          _textEditingController.value = _textEditingController.value.copyWith(text: '', selection: const TextSelection.collapsed(offset: 0), composing: TextRange.empty);
                        });
                      },
                      child: const Icon(Icons.send),
                    ),
                    contentPadding: const EdgeInsets.all(12.0)),
                //textDirection: TextDirection.rtl,
              ),
            ),

Contact

jin22dc@163.com

@ChanKen
Copy link
Author

ChanKen commented Jul 24, 2024

VID_20240724_113528.mp4

@RicoAustin
Copy link

同上,我也遇到相同的问题,使用最新版extended_text_field: 16.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants