全面升级后出现错误'textBaseline!= null'

时间:2020-04-09 20:16:16

标签: flutter dart flutter-layout flutter-web

所以在升级master上的flutter后,为网络构建,我得到了以下错误。除了提升抖动外,我什么也没做。再次切换分支和升级活动似乎不起作用,而且活动清除和发布升级/程序包也没有获得。

[+5273 ms] ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════

[ +318 ms] The following assertion was thrown building InputDecorator(decoration: InputDecoration(hintMaxLines:

[ +104 ms] "1", floatingLabelBehavior: FloatingLabelBehavior.auto, focusedBorder: UnderlineInputBorder(),

[  +11 ms] disabledBorder: UnderlineInputBorder(), enabledBorder: UnderlineInputBorder(), alignLabelWithHint:

[   +1 ms] false), baseStyle: TextStyle(inherit: true, size: 15.0), isFocused: false, isEmpty: true, dirty,

[  +13 ms] dependencies: [_EffectiveTickerMode, _InheritedTheme, _LocalizationsScope-[GlobalKey#83362],

[   +3 ms] Directionality, MediaQuery], state: _InputDecoratorState#403a5(tickers: tracking 2 tickers)):

[   +2 ms] Assertion failed:

[  +10 ms] file:///C:/Users/me/Documents/flutter/packages/flutter/lib/src/material/input_decorator.dart:1664:15

[   +2 ms] textBaseline != null

[   +1 ms] is not true

[   +4 ms] The relevant error-causing widget was:

[  +10 ms]   TextField

[   +1 ms]   file:///C:/Users/me/Desktop/work/platform/lib/views/login/login_content.dart:195:28

[   +2 ms] When the exception was thrown, this was the stack:

[  +13 ms] C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 195:49  throw_

[  +16 ms] C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 26:3    assertFailed

[  +18 ms] packages/flutter/src/material/input_decorator.dart 1664:27                                                                 new

[   +3 ms] packages/flutter/src/material/input_decorator.dart 2312:12                                                                 build

[ +204 ms] packages/flutter/src/widgets/framework.dart 4623:28                                                                        build

[  +17 ms] packages/flutter/src/widgets/framework.dart 4506:15                                                                        performRebuild

[   +5 ms] packages/flutter/src/widgets/framework.dart 4679:11                                                                        performRebuild

[  +13 ms] packages/flutter/src/widgets/framework.dart 4222:5                                                                         rebuild

[...] (many more lines)

[  +11 ms] packages/flutter/src/widgets/binding.dart 921:24                                                                           attachRootWidget

[   +1 ms] packages/flutter/src/widgets/binding.dart 903:7                                                                            <fn>

[   +1 ms] C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 50:19       internalCallback

[   +3 ms] ════════════════════════════════════════════════════════════════════════════════════════════════════

问题影响应用程序中的每个文本字段。

扑打医生:

[√] Flutter (Channel master, v1.18.0-5.0.pre.54, on Microsoft Windows [Version 10.0.18363.720], locale de-DE)
    • Flutter version 1.18.0-5.0.pre.54 at C:\Users\me\Documents\flutter
    • Framework revision 292bbd872d (52 minutes ago), 2020-04-09 11:58:13 -0700
    • Engine revision 5b4b1f33c6
    • Dart version 2.8.0 (build 2.8.0-dev.20.0 dcdc71d763)


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\me\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[!] IntelliJ IDEA Ultimate Edition (version 2019.1)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2
    X Flutter plugin not installed; this adds Flutter specific functionality.
    • Dart plugin version 191.8593
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[√] VS Code (version 1.44.0)
    • VS Code at C:\Users\me\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.9.1

[√] Connected device (2 available)
    • Chrome     • chrome     • web-javascript • Google Chrome 81.0.4044.92
    • Web Server • web-server • web-javascript • Flutter Tools

! Doctor found issues in 1 category.

谢谢您的帮助!

1 个答案:

答案 0 :(得分:2)

将textBaseline添加到TextField的样式。

style: TextStyle(textBaseline: TextBaseline.alphabetic)