小编ame*_*hta的帖子

动画控制器 vsync 未将“this”识别为有效表达式

尝试在 dart 中填写 TextFormField 时实现加载动画。在声明 AnimationController 时,我的声明无法识别“this”。

我找到的每个文档都使用“this”作为 vsync,出于某种原因,我的无法识别它。

class _SettingsScreenState extends State<SettingsScreen> with SingleTickerProviderStateMixin {
final _animationController = AnimationController(vsync: this, duration: Duration(seconds: 1));
Run Code Online (Sandbox Code Playgroud)

...

ListTile(
                  title: new TextFormField(
                    controller: _serverController,
                    keyboardType: TextInputType.emailAddress,
                    style: TextStyle(
                        color: darkGray,
                        fontSize: 18,
                        fontWeight: FontWeight.w500,
                        fontFamily: mainFontFamily
                    ),
                    onFieldSubmitted: _handleSubmitted,
                    autocorrect: false,
                    decoration: new InputDecoration(
                      icon: AnimatedIcon(icon: AnimatedIcons.search_ellipsis, progress: _animationController, color: darkGray,), /*TODO get this to actually show up and animate while checking server*/
                      contentPadding: EdgeInsets.symmetric(
                          vertical: 12, horizontal: 12),
                      border: OutlineInputBorder(
                        borderRadius: BorderRadius.circular(10.0), …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-animation

7
推荐指数
1
解决办法
7498
查看次数

标签 统计

dart ×1

flutter ×1

flutter-animation ×1