尝试在 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)