flutter - Flutter 中的神经拟态设计
问题描述
如何在 Flutter 中实现神经拟态设计或 UI
我正在使用这个插件flutter_neumorphic 3.1.0
但是得到了这些错误
我究竟做错了什么?
我如何才能在颤振中实现神经拟态设计
Launching lib\main.dart on sdk gphone x86 in debug mode...
lib\main.dart:1
/C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_neumorphic-3.1.0/lib/src/widget/button.dart:200:14: Error: 'AnimatedScale' is imported from both 'package:flutter/src/widgets/implicit_animations.dart' and 'package:flutter_neumorphic/src/widget/animation/animated_scale.dart'.
child: AnimatedScale(
^^^^^^^^^^^^^
/C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_neumorphic-3.1.0/lib/src/widget/switch.dart:167:20: Error: 'AnimatedScale' is imported from both 'package:flutter/src/widgets/implicit_animations.dart' and 'package:flutter_neumorphic/src/widget/animation/animated_scale.dart'.
child: AnimatedScale(
^^^^^^^^^^^^^
3
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\Admin\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\Admin\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
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.
* Get more help at https://help.gradle.org
BUILD FAILED in 23s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
我确信发生这种情况是因为 AnimatedScale 是从不同的包中调用的。我该如何解决?
解决方案
图书馆似乎没有问题,进口问题。
'AnimatedScale' is imported from both 'package:flutter/src/widgets/implicit_animations.dart' and 'package:flutter_neumorphic/src/widget/animation/animated_scale.dart'
如您所见,它显示 AnimatedScale 是从两个库中导入的。除非您指定,否则 Dart 编译器不会知道您要使用哪个 AnimatedScale。
简单的解决方案是
步骤1。
我假设您想在导入库时使用 neumorphic
import 'package:flutter_neumorphic/src/widget/animation/animated_scale.dart' as nmAnimatedScale
第2步。
无论您在哪里使用 AnimatedScale 将其替换为nmAnimatedScale.AnimatedScale( ......)
推荐阅读
- javascript - 有没有办法让自定义命令在命名空间或赛普拉斯的对象中可用?
- excel - 如何过滤范围并复制到不同工作表中的表格底部?
- doctrine-orm - Symfony 多对多返回空的 ArrayCollection
- python - 我得到的是部分工件(金属片)而不是整个工件。似乎边缘不是连续的,但它们是
- html - Windows 10 Desktop Chrome Chip-path scale 变换鬼线出现
- python - 如何从 Json api 响应中减去键并检查是否有更多键,如果有,将它们放入列表中?
- nhibernate - Nhibernate Evers,如何更改 AuditJoinTable 名称
- python - 部署在 Heroku 上时更新 Django Web 应用程序内容的最佳实践
- wordpress - Wordpress:我可以在单击链接后调用函数并使用快捷方式吗?
- d3.js - d3js 通过改变 bin 的数量来制作 violinplot 动画