当前位置:   article > 正文

Flutter 开发错误集合_incorrect use of parentdatawidget.

incorrect use of parentdatawidget.

HandshakeException: Handshake error in client (OS Error: WRONG_VERSION_NUMBER(tls_record.cc:242)) 

因为使用Dio网络框架进行数据请求时采用的http请求,保证了手机连接的网络和电脑连接的网络IP是同一个

解决方案:

  1. Dio 请求的 BaseUrl
  2. var url = Uri.https('xx.x.x.x:端口号', '请求地址后面部分')

例如 :

var url = Uri.https('192.168.xx.xx:8080', '/')

Launching lib/main.dart on KOZ AL00 in debug mode...
Running Gradle task 'assembleDebug'...   一直进行中 

 

修改 build.gradle 文件

  1. maven {
  2. allowInsecureProtocol = true
  3. url 'https://maven.aliyun.com/repository/google'
  4. }
  5. maven {
  6. allowInsecureProtocol = true
  7. url 'https://maven.aliyun.com/repository/jcenter'
  8. }
  9. maven {
  10. allowInsecureProtocol = true
  11. url 'http://maven.aliyun.com/nexus/content/groups/public'
  12. }

minSdkVersion 16 cannot be smaller than version 19  

  1. Suggestion: use a compatible library with a minSdk of at most 16,
  2. or increase this project's minSdk version to at least 19,
  3. or use tools:overrideLibrary="com.leeson.image_pickers" to force usage (may lead to runtime failures)
  4. FAILURE: Build failed with an exception.
  5. * What went wrong:
  6. Execution failed for task ':app:processDebugMainManifest'.
  7. > Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library

解决方案

修改minSdkVerison版本

Flutter Incorrect use of ParentDataWidget 

原因 

Expanded、Flexible等组件 , 在“Container、Padding、Stack”组件中导致的

Expanded、Flexible只在Row、Column等组件内,不在其他组件内使用。

修改后

TextField/Rect argument contained a NaN value. 'dart:ui/painting.dart':

  1. The following assertion was thrown during paint():
  2. Rect argument contained a NaN value.
  3. 'dart:ui/painting.dart':
  4. Failed assertion: line 40 pos 10: '<optimized out>'
  5. Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
  6. In either case, please report this assertion by filing a bug on GitHub:
  7. https://github.com/flutter/flutter/issues/new?template=2_bug.md
  8. When the exception was thrown, this was the stack:
  9. #2 _rectIsValid (dart:ui/painting.dart:40:10)
  10. #3 Canvas.drawRect (dart:ui/painting.dart:4354:12)
  11. #4 _FloatingCursorPainter.paintRegularCursor (package:flutter/src/rendering/editable.dart:2701:16)
  12. #5 _FloatingCursorPainter.paint (package:flutter/src/rendering/editable.dart:2732:7)
  13. #6 _CompositeRenderEditablePainter.paint (package:flutter/src/rendering/editable.dart:2784:15)
  14. #7 _RenderEditableCustomPaint.paint (package:flutter/src/rendering/editable.dart:2434:15)
  15. #8 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2403:7)
  16. #9 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
  17. #10 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
  18. #11 PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:973:29)
  19. #12 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:499:19)
  20. #13 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
  21. #14 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
  22. #15 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145:15)
  23. #16 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
  24. #17 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
  25. #21 _invoke (dart:ui/hooks.dart:150:10)
  26. #22 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
  27. #23 _drawFrame (dart:ui/hooks.dart:114:31)
  28. (elided 5 frames from class _AssertionError and dart:async)
  29. The following RenderObject was being processed when the exception was fired: _RenderEditableCustomPaint#9a2f0
  30. ... needs compositing
  31. ... parentData: offset=Offset(0.0, 0.0); offset=Offset(0.0, 0.0)
  32. ... constraints: BoxConstraints(w=292.0, h=1.0)
  33. ... layer: OffsetLayer#55d58
  34. ... engine layer: OffsetEngineLayer#4eb7b
  35. ... handles: 2
  36. ... offset: Offset(0.0, 0.0)
  37. ... size: Size(292.0, 1.0)
  38. RenderObject: _RenderEditableCustomPaint#9a2f0
  39. needs compositing
  40. parentData: offset=Offset(0.0, 0.0); offset=Offset(0.0, 0.0)
  41. constraints: BoxConstraints(w=292.0, h=1.0)
  42. layer: OffsetLayer#55d58
  43. engine layer: OffsetEngineLayer#4eb7b
  44. handles: 2
  45. offset: Offset(0.0, 0.0)
  46. size: Size(292.0, 1.0)

解决方案

发现没有设置编辑框的字体大小 , 设置fontSize 大于 0.0

Please remove the file from history and try again 

执行git push (向仓库推送代码) 时报错如下 :  

  1. git: 'credential-wincred' is not a git command. See 'git --help'.
  2. Enumerating objects: 235, done.
  3. Counting objects: 100% (235/235), done.
  4. Delta compression using up to 4 threads
  5. Compressing objects: 100% (191/191), done.
  6. Writing objects: 100% (234/234), 217.68 MiB | 9.88 MiB/s, done.
  7. Total 234 (delta 30), reused 0 (delta 0), pack-reused 0
  8. remote: Resolving deltas: 100% (30/30), done.
  9. remote: Powered by GITEE.COM [GNK-6.2]
  10. remote: error: File: c7cef8e5daa50e92ddd2a0d4758759dfbfd98eb8 196.64 MB, exceeds 100.00 MB.
  11. remote: Use command below to see the filename:
  12. remote: git rev-list --objects --all | grep c7cef8e5daa50e92ddd2a0d4758759dfbfd98eb8
  13. remote: Please remove the file from history and try again.

解决方案

执行清理缓存

git gc --prune=now

根据错误提示执行命令 / 查看要占有内存过大的文件 / 进行删除

  1. git rev-list --objects --all |
  2. grep c7cef8e5daa50e92ddd2a0d4758759dfbfd98eb8

占用内存过大的路径是

再次执行命令进行删除

git filter-branch --tree-filter 'rm -f 文件名' HEAD  

 最后执行命令

git push

background_fetch Received status code 502 from server: Bad Gateway 

  1. FAILURE: Build failed with an exception.
  2. * What went wrong:
  3. Could not determine the dependencies of task ':app:processDebugResources'.
  4. > Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
  5. > Could not resolve com.transistorsoft:tsbackgroundfetch:+.
  6. Required by:
  7. project :app > project :background_fetch
  8. > Failed to list versions for com.transistorsoft:tsbackgroundfetch.
  9. > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml.
  10. > Could not get resource 'https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml'.
  11. > Could not GET 'https://google.bintray.com/exoplayer/com/transistorsoft/tsbackgroundfetch/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
  12. * Try:
  13. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

解决方案

更新 Android Studio 版本 / 修改build.gradle配置 / 修改gradle版本号 / 开发工具要和gradle配置一一对应

  ​​​​​​

 Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.

  1. An exception occurred applying plugin request [id: 'com.android.application']
  2. > Failed to apply plugin 'com.android.internal.application'.
  3.    > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
  4.      You can try some of the following options:
  5.        - changing the IDE settings.
  6.        - changing the JAVA_HOME environment variable.
  7.        - changing `org.gradle.java.home` in `gradle.properties`.

解决方案

No toolchains found in the NDK toolchains folder for ABI with prefix: arm-linux-androideabi 

解决方案 (Android Studio build.gradle)

Gradle download:kotlin-compiler-embeddable 一直下载中

 解决方案

打开 maven 进行搜索 kotlin-compiler

 我这里是下载版本1.5.21

 

找到电脑磁盘里面的 .gradle 文件打开 

删除下面标识的文件夹里面的文件 , 替换成下载的jar包

再重新打开AndroidStudio同步一下即可

The binary version of its metadata is 1.5.1, expected version is 1.1.15

解决方案

修改 kotlin_version 版本号 / 旧版本号(1.3.50) 变成新版本号 (1.4.32)

注意 : koltin_version 版本号要和 gradle 版本号对应

Your flutter checkout has local changes that would be erased by upgrading. If you want to keep these changes, it is recommended that you stash them via "git stash" or else
commit the changes to a local branch. If it is okay to remove local changes, then re-run this command with --force. 

 解决方案  执行命令

flutter upgrade --force

运行命令 查看安装完成后的 flutter sdk 版本

flutter --version

Unspported class file major version 61

表示还不支持Java17

解决方案 

尝试降低JDK版本号 (使用Java16 或者 Java 11 或者 Java8

使用命令查看电脑安装的JDK版本

/usr/libexec/java_home -V

如果本地不存在比Java17版本低的JDK , 参考Flutter环境变量配置下载JDK

gradle.properties 配置 低于JDK 17 的 JDK 的路径

sendReq failed for wechat app signature check
fluwx 插件 微信分享 , 红米手机系统版本为11 提示 微信未安装 

 

 解决方案 : 

在应用的AndroidManifest.xml添加如下<queries>标签 , 指定微信包名 

NDK matched the requested version

No version of NDK matched the requested version 21.0.6113669. Versions available locally: 22.1.7171670, 23.1.7779620

解决方案

ndkVersion '23.1.7779620'

fluttercontactpicker: ^2.0.0 通讯录插件使用异常
 android Attempt to invoke virtual method 'android.content.ContentResolver android.content.Context.getContentResolver()' on a null object reference

 解决方案:

Flutter SDK 版本更新到最新

如果用命令更新失败,那么可以直接下载sdk压缩包进行解压后替换以前原有的sdk.

io.flutter.embedding.engine.FlutterEngine@7bd534e

  1. W/FlutterEnginePluginRegistry( 4322): Attempted to register plugin (io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry$ShimRegistrarAggregate@d001e49) but it was already registered with this Flutte
  2. rEngine (io.flutter.embedding.engine.FlutterEngine@7bd534e).
  3. 大概意思:早注册了FlutterEngine

解决方案:

删除 GeneratedPluginRegistrant.registerWith(flutterEngine);

 Xcode The sandbox is not in sync with the Podfile.lock.

The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

解决方案:

Android Studio 执行命令flutter build ios

Cannot fit requested classes in a single dex file (# methods: 68807 > 65536)

  1. Running Gradle task 'assembleDebug'...
  2. D8: Cannot fit requested classes in a single dex file (# methods: 68807 > 65536)
  3. com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
  4. The number of method references in a .dex file cannot exceed 64K.
  1. D8: Cannot fit requested classes in a single dex file (# methods: 65671 > 65536)
  2. com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
  3. The number of method references in a .dex file cannot exceed 64K.
  4. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
  5. at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:132)
  6. at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:119)
  7. at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
  8. at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:445)
  9. at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:348)
  10. at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
  11. at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:47)
  12. at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
  13. at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
  14. at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
  15. at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
  16. at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
  17. at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
  18. at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
  19. at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
  20. at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
  21. at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
  22. at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
  23. at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
  24. at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
  25. at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
  26. at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:56)
  27. at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:215)
  28. at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:210)
  29. at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  30. at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
  31. at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
  32. at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
  33. at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  34. at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  35. at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
  36. at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
  37. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  38. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  39. at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
  40. at java.lang.Thread.run(Thread.java:748)
  41. Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
  42. at com.android.tools.r8.utils.O.a(:65)
  43. at com.android.tools.r8.D8.run(:11)
  44. at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:117)
  45. ... 34 more
  46. Caused by: com.android.tools.r8.utils.b: Error: null, Cannot fit requested classes in a single dex file (# methods: 65671 > 65536)
  47. at com.android.tools.r8.utils.y0.a(:21)
  48. at com.android.tools.r8.dex.K.a(:56)
  49. at com.android.tools.r8.dex.K$h.a(:5)
  50. at com.android.tools.r8.dex.b.b(:15)
  51. at com.android.tools.r8.dex.b.a(:38)
  52. at com.android.tools.r8.D8.d(:87)
  53. at com.android.tools.r8.D8.b(:1)
  54. at com.android.tools.r8.utils.O.a(:30)
  55. ... 36 more
  56. FAILURE: Build failed with an exception.
  57. * What went wrong:
  58. Execution failed for task ':app:mergeDexDebug'.
  59. > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
  60. > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
  61. The number of method references in a .dex file cannot exceed 64K.
  62. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
  63. * Try:
  64. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  65. * Get more help at https://help.gradle.org

 解决方案:参考

build.gradle下配置修改

  1. defaultConfig {
  2. ......
  3. multiDexEnabled true
  4. ......
  5. }
  1. dependencies {
  2. ......
  3. implementation 'com.android.support:multidex:1.0.3'
  4. ......
  5. }

Attribute provider#androidx.core.content.FileProvider@authorities

Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/file_paths) 

  1. <provider
  2. android:name="androidx.core.content.FileProvider"
  3. android:authorities="com.android.demo.fileProvider"
  4. android:exported="false"
  5. android:grantUriPermissions="true"
  6. >
  7. <meta-data
  8. android:name="android.support.FILE_PROVIDER_PATHS"
  9. android:resource="@xml/file_paths" />
  10. </provider>
  1. Attribute provider#androidx.core.content.FileProvider@authorities value=(com.android.demo.fileProvider) from AndroidManifest.xml:58:13-64
  2. is also present at [:flutter_webview_plugin] AndroidManifest.xml:11:13-64 value=(com.android.demo.fileprovider).
  3. Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml to override.
  1. Attribute meta-data#android.support.FILE_PROVIDER_PATHS@resource value=(@xml/file_paths) from AndroidManifest.xml:53:17-55
  2. is also present at [:flutter_webview_plugin] AndroidManifest.xml:17:17-50 value=(@xml/filepaths).
  3. Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.

解决方案:

  1. <provider
  2. android:name="androidx.core.content.FileProvider"
  3. android:authorities="com.android.demo.fileProvider"
  4. android:exported="false"
  5. tools:replace="android:authorities"
  6. android:grantUriPermissions="true"
  7. >
  8. <meta-data
  9. android:name="android.support.FILE_PROVIDER_PATHS"
  10. tools:replace="android:resource"
  11. android:resource="@xml/file_paths" />
  12. </provider>

The overflowing RenderFlex has an orientation of Axis.vertical.
e.g. using an Expanded widget 

  1. @override
  2. Widget build(BuildContext context) {
  3. ScreenUtil.init(context, width: 750, height: 1624, allowFontScaling: true);
  4. return Scaffold(
  5. backgroundColor: scaffoldBackColor(),
  6. body: isSv ? getBaseViewNoSv(context) : getBaseView(context),
  7. );
  8. }
  1. I/flutter (26133): The overflowing RenderFlex has an orientation of Axis.vertical.
  2. I/flutter (26133): The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
  3. I/flutter (26133): black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
  4. I/flutter (26133): Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
  5. I/flutter (26133): RenderFlex to fit within the available space instead of being sized to their natural size.
  6. I/flutter (26133): This is considered an error condition because it indicates that there is content that cannot be
  7. I/flutter (26133): seen. If the content is legitimately bigger than the available space, consider clipping it with a
  8. I/flutter (26133): ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
  9. I/flutter (26133): like a ListView.
  10. I/flutter (26133): The specific RenderFlex in question is: RenderFlex#c0a57 relayoutBoundary=up3 OVERFLOWING:
  11. I/flutter (26133): needs compositing
  12. I/flutter (26133): creator: Column ← _PointerListener ← Listener ← _GestureSemantics ← RawGestureDetector ←
  13. I/flutter (26133): GestureDetector ← _BodyBuilder ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ←
  14. I/flutter (26133): CustomMultiChildLayout ← AnimatedBuilder ← DefaultTextStyle ← ⋯
  15. I/flutter (26133): parentData: <none> (can use size)
  16. I/flutter (26133): constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=441.5)
  17. I/flutter (26133): size: Size(411.4, 441.5)
  18. I/flutter (26133): direction: vertical
  19. I/flutter (26133): mainAxisAlignment: start
  20. I/flutter (26133): mainAxisSize: max
  21. I/flutter (26133): crossAxisAlignment: center
  22. I/flutter (26133): verticalDirection: down
  23. I/flutter (26133): ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤

 解决方案 : 

resizeToAvoidBottomPadding: false

  1. @override
  2. Widget build(BuildContext context) {
  3. ScreenUtil.init(context, width: 750, height: 1624, allowFontScaling: true);
  4. return Scaffold(
  5. backgroundColor: scaffoldBackColor(),
  6. resizeToAvoidBottomPadding: false,
  7. body: isSv ? getBaseViewNoSv(context) : getBaseView(context),
  8. );
  9. }

AnimationControllers should be disposed by calling dispose() on the AnimationController itself. 

  1. class CurWidget extends StatefulWidget {
  2. @override
  3. State<StatefulWidget> createState() => CurWidgetState();
  4. }
  5. class CurWidgetState extends State<CurWidget>
  6. with TickerProviderStateMixin {
  7. AnimationController controller;
  8. Animation<double> animation;
  9. @override
  10. void initState() {
  11. // TODO: implement initState
  12. super.initState();
  13. controller =
  14. AnimationController(duration: const Duration(seconds: 4), vsync: this);
  15. animation = Tween(begin: 0.0, end: 1.0).animate(controller);
  16. animation.addStatusListener((status) {
  17. if (status == AnimationStatus.completed) {
  18. ///评估完成
  19. }
  20. });
  21. controller.forward();
  22. }
  23. @override
  24. Widget build(BuildContext context) {
  25. return Column(
  26. children: [
  27. Padding(
  28. padding: ViewUtils.mp(20.0, 20.0, 20.0, 20.0),
  29. child: Image.asset(R.assetsImgIcEvaluateProcessTop),
  30. ),
  31. ViewUtils.commTextEll(
  32. '额度评估中……', 0xff000000, 16.0, FontWeight.normal, TextAlign.center),
  33. Container(
  34. padding: ViewUtils.mp(0.0, 20.0, 0.0, 40.0),
  35. child: RotationTransition(
  36. //设置动画的旋转中心
  37. alignment: Alignment.center,
  38. //动画控制器
  39. turns: animation,
  40. //将要执行动画的子view
  41. child: Image.asset(
  42. R.assetsImgIcEvaluateProgressAnimation,
  43. alignment: Alignment.center,
  44. ),
  45. ),
  46. ),
  47. ],
  48. );
  49. }
  50. @override
  51. void dispose() {
  52. // TODO: implement dispose
  53. super.dispose();
  54. if (controller != null) {
  55. controller.dispose();
  56. }
  57. }
  58. }
  1. Reloaded 0 of 947 libraries in 1,515ms.
  2. I/chatty ( 9839): uid=10133(com.example.market) 1.ui identical 2 lines
  3. I/flutter ( 9839): AppInfo v TopBannerWidget_build
  4. I/flutter ( 9839): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
  5. I/flutter ( 9839): The following assertion was thrown while finalizing the widget tree:
  6. I/flutter ( 9839): EvaProWidgetState#0f3c5(tickers: tracking 1 ticker) was disposed with an active Ticker.
  7. I/flutter ( 9839): EvaProWidgetState created a Ticker via its TickerProviderStateMixin, but at the time dispose() was
  8. I/flutter ( 9839): called on the mixin, that Ticker was still active. All Tickers must be disposed before calling
  9. I/flutter ( 9839): super.dispose().
  10. I/flutter ( 9839): Tickers used by AnimationControllers should be disposed by calling dispose() on the
  11. I/flutter ( 9839): AnimationController itself. Otherwise, the ticker will leak.
  12. I/flutter ( 9839): The offending ticker was:
  13. I/flutter ( 9839): _WidgetTicker(created by EvaProWidgetState#0f3c5(lifecycle state: created, tickers: tracking 0
  14. I/flutter ( 9839): tickers))
  15. I/flutter ( 9839): The stack trace when the _WidgetTicker was actually created was:

解决方案

  1. @override
  2. void dispose() {
  3. // TODO: implement dispose
  4. if (controller != null) {
  5. controller.dispose();
  6. }
  7. super.dispose();
  8. }

pull_to_refresh

No named parameter with the name 'keyboardDismissBehavior'

解决方案

  could not find a Material 

  1. The following assertion was thrown building TextField(controller:
  2. TextEditingController#2ed1a(TextEditingValue(text: ┤四大范德萨方式ADF反对党是发生大幅撒地方├, selection:
  3. TextSelection(baseOffset: 21, extentOffset: 21, affinity: TextAffinity.downstream, isDirectional:
  4. false), composing: TextRange(start: -1, end: -1))), autofocus: true, dirty, dependencies:
  5. [MediaQuery, UnmanagedRestorationScope], state: _TextFieldState#884a1):
  6. No Material widget found.
  7. TextField widgets require a Material widget ancestor.
  8. In material design, most widgets are conceptually "printed" on a sheet of material. In Flutter's
  9. material library, that material is represented by the Material widget. It is the Material widget
  10. that renders ink splashes, for instance. Because of this, many material library widgets require that
  11. there be a Material widget in the tree above them.
  12. To introduce a Material widget, you can either directly include one, or use a widget that contains
  13. Material itself, such as a Card, Dialog, Drawer, or Scaffold.
  14. The specific widget that could not find a Material ancestor was:
  15. TextField
  16. The ancestors of this widget were:
  17. ...
  18. Container
  19. Expanded
  20. Row
  21. InputPage
  22. Semantics
  23. ...
  24. The relevant error-causing widget was:

原代码:

  1. @override
  2. Widget build(BuildContext context) {
  3. return Row(
  4. children: []
  5. );

 解决方案:  添加Scaffold()

  1. @override
  2. Widget build(BuildContext context) {
  3. return Scaffold(
  4. body: Row(
  5. children: [
  6. ],
  7. ),
  8. );
  9. }

 This widget has been unmounted, so the State no longer has a context (and should be considered defunct)

  1. showDialog<void>(
  2. context: context,
  3. barrierDismissible: false, // user must tap button!
  4. builder: (BuildContext context) {
  5. return AlertDialog(
  6. title: null,
  7. content: SingleChildScrollView(
  8. child: ListBody(
  9. children:[],
  10. )),
  11. actions: <Widget>[
  12. FlatButton(
  13. child: Text('关闭'),
  14. onPressed: () {
  15. Navigator.of(context).pop();
  16. },
  17. ),
  18. ],
  19. );
  20. },
  21. );

Navigator.of(context).pop();

关闭对话框传递的context应该是builder参数对应的函数里面的context,不应该是State对应的context.

如果传递State对应的context,那么State被销毁后对话框还会显示.

Element、BuildContext和RenderObject #

 Unhandled Exception: MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker)

解决方案 

点击工具栏绿色箭头运行工程(不通过 flutter run 命令来启动工程)

  

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/145344
推荐阅读
相关标签
  

闽ICP备14008679号