小编Vin*_*ack的帖子

如何修复错误:“用户?”类型的值 不能分配给“用户”类型的变量

我是应用程序开发的初学者,遇到了这个错误。我得到的错误是“错误:‘用户’类型的值?不能分配给“用户”类型的变量。”

我的代码:

Future signUpWithEmailAndPassword( String email, String password) async {
    try {
      UserCredential result = await _auth.createUserWithEmailAndPassword(email: email, password: password);
      User user = result.user;
      return _userFromFirebaseUser(user);
    } catch(e){
      print(e.toString());
      return null;
    }
  }
Run Code Online (Sandbox Code Playgroud)

dart firebase firebase-authentication flutter

3
推荐指数
2
解决办法
479
查看次数

TextFormField 中的水平滚动在文本输入上抖动

我有一个电子邮件输入文本字段,当我写入的文本多于此输入的宽度时,其余文本不可见。当我输入此文本表单字段时,有没有办法进行水平滚动?

下图描述了我想要的行为。

TextFormField 中的水平滚动

编辑:我的代码

Container(
  width: 270,
  height: 42,
  child: new TextFormField(
    validator: (val) => val.isEmpty ? 'Enter an email' : null,
    decoration: new InputDecoration(
      icon: Icon(
        Icons.email_outlined,
      ),
      labelText: 'Email',
      border: new OutlineInputBorder(
        borderRadius: new BorderRadius.circular(25.0),
        borderSide: new BorderSide(),
      ),
    ),
    keyboardType: TextInputType.emailAddress,
    onChanged: (val) {
      setState(() => email = val);
    },
  ),
),
Run Code Online (Sandbox Code Playgroud)

这就是当我输入超出 TextFormField 宽度时发生的情况 这就是当我输入超出 TextFormField 宽度时发生的情况

dart flutter

2
推荐指数
1
解决办法
2902
查看次数

标签 统计

dart ×2

flutter ×2

firebase ×1

firebase-authentication ×1