首页 > 解决方案 > Flutter 2.x 升级抱怨 Snapshotting a view for text form field

问题描述

我最近升级了颤振,以下是规格

[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.57.1)

升级后,我在下面看到表单字段的日志。任何想法如何解决这一问题 ?

日志

[Snapshotting] Snapshotting a view (0x14f2ab100, _UIReplicantView) that has not been rendered at least once requires afterScreenUpdates:YES.
[Snapshotting] Snapshotting a view (0x14f4ae880, _UIReplicantView) that has not been rendered at least once requires afterScreenUpdates:YES.
[Snapshotting] Snapshotting a view (0x14f29a460, _UIReplicantView) that has not been rendered at least once requires afterScreenUpdates:YES.

表单域

     TextFormField(
      controller: controller,
      textAlignVertical: TextAlignVertical.center,
      validator:(){},
      onSaved: (){},
      enableInteractiveSelection: false,
      style: GoogleFonts.poppins(
        color: Theme.of(context).highlightColor,
        fontSize: 14.5,
        fontWeight: FontWeight.w500,
        letterSpacing: 0.5,
      ),
      textInputAction: TextInputAction.done,
      keyboardType: TextInputType.text,
      textCapitalization: TextCapitalization.words,
      decoration: InputDecoration(
        contentPadding: EdgeInsets.all(0),
        helperStyle: GoogleFonts.poppins(
          color: Theme.of(context).highlightColor,
          fontWeight: FontWeight.w500,
          letterSpacing: 0.5,
        ),
        errorStyle: GoogleFonts.poppins(
          fontSize: 13.0,
          fontWeight: FontWeight.w500,
          letterSpacing: 0.5,
          color: Theme.of(context).highlightColor,
        ),
        hintStyle: GoogleFonts.poppins(
          color: Theme.of(context).highlightColor,
          fontSize: 14.5,
          fontWeight: FontWeight.w500,
          letterSpacing: 0.5,
        ),
        prefixIcon: Icon(
          iconData,
          color: Theme.of(context).highlightColor,
        ),
        prefixIconConstraints: BoxConstraints(
          minWidth: 50.0,
        ),
        labelText: labelText,
        labelStyle: GoogleFonts.poppins(
          fontSize: 14.5,
          fontWeight: FontWeight.w500,
          letterSpacing: 0.5,
          color: Theme.of(context).highlightColor,
        ),
        enabledBorder: const OutlineInputBorder(
          // width: 0.0 produces a thin "hairline" border
          borderSide: const BorderSide(color: Colors.white, width: 0.0),
        ),
        border: OutlineInputBorder(
          borderRadius: BorderRadius.circular(12.0),
        ),
      ),
    );

发布规范.yaml

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  awesome_card: ^1.1.0
  carousel_pro: ^1.0.0
  carousel_slider: ^3.0.0
  cloud_firestore: ^2.1.0
  cupertino_icons: ^1.0.2
  extended_image: ^4.1.0
  firebase_analytics: ^8.0.4
  firebase_auth: ^1.0.1
  firebase_core: ^1.0.1
  firebase_dynamic_links: ^2.0.3
  firebase_messaging: ^9.0.0
  firebase_storage: ^8.0.0
  another_flushbar: ^1.10.22
  flutter_bloc: ^7.0.0
  flutter_email_sender: ^5.0.0
  flutter_local_notifications: ^5.0.0-nullsafety.1
  flutter_share: ^2.0.0
  flutter_svg: ^0.22.0
  font_awesome_flutter: ^9.0.0
  full_screen_image: ^1.0.2
  google_fonts: ^2.0.0
  http: ^0.13.0
  image_cropper: ^1.4.0
  image_picker: ^0.7.3
  intl: ^0.17.0
  introduction_screen: ^2.0.0
  path_provider: ^2.0.1
  shared_preferences: ^2.0.5
  shimmer: ^2.0.0
  transparent_image: ^2.0.0
  uuid: ^3.0.1
  badges: ^2.0.1

标签: flutterflutter-dependencies

解决方案


推荐阅读