- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的 signup.dart 文件:
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
class SignUp extends StatefulWidget {
@override
_SignUpState createState() => _SignUpState();
}
class _SignUpState extends State<SignUp> {
final FirebaseAuth firebaseAuth = FirebaseAuth.instance;
final _formKey = GlobalKey<FormState>();
TextEditingController _emailTextController = TextEditingController();
TextEditingController _passwordTextController = TextEditingController();
TextEditingController _nameTextController = TextEditingController();
TextEditingController _confirmPasswordTextController =
TextEditingController();
String gender;
String groupValue = "Erkek";
bool loading = false;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
Image.asset(
'images/backg.jpg',
fit: BoxFit.fill,
width: double.infinity,
height: double.infinity,
),
Container(
color: Colors.black.withOpacity(0.4),
width: double.infinity,
height: double.infinity,
),
Padding(
padding: const EdgeInsets.only(top: 200.0),
child: Center(
child: Form(
key: _formKey,
child: ListView(
children: <Widget>[
Padding(
padding:
const EdgeInsets.fromLTRB(14.0, 8.0, 14.0, 8.0),
child: Material(
borderRadius: BorderRadius.circular(20.0),
color: Colors.white.withOpacity(0.4),
elevation: 0.0,
child: Padding(
padding: const EdgeInsets.only(left: 12.0),
child: ListTile(
title: TextFormField(
controller: _passwordTextController,
decoration: InputDecoration(
hintText: "Ad Soyad",
icon: Icon(Icons.person),
border: InputBorder.none
),
// ignore: missing_return
validator: (value) {
if (value.isEmpty) {
return "İsim boşluğu doldurulmalıdır.";
}
return null;
},
// ignore: missing_return
),
trailing: Icon(Icons.remove_red_eye),
),
),
),
),
Padding(
padding:
const EdgeInsets.fromLTRB(14.0, 8.0, 14.0, 8.0),
child: Material(
borderRadius: BorderRadius.circular(20.0),
color: Colors.white.withOpacity(0.4),
elevation: 0.0,
child: Padding(
padding: const EdgeInsets.only(left: 12.0),
child: TextFormField(
controller: _emailTextController,
decoration: InputDecoration(
hintText: "Email",
icon: Icon(Icons.email),
border: InputBorder.none
),
// ignore: missing_return
validator: (value) {
if (value.isEmpty) {
Pattern pattern =
r'^(([^<>()[]\.,;:\s@"]+(.[^<>()[]\.,;:\s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$';
RegExp regex = new RegExp(pattern);
if (!regex.hasMatch(value))
return "Lütfen geçerli bir mail adresi giriniz.";
else
return null;
}
}),
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(14.0, 8.0, 14.0, 8.0),
child: new Container(
color: Colors.white.withOpacity(0.4),
child: Row(
children: <Widget>[
Expanded(
child: ListTile(
title: Text(
"Erkek",
textAlign: TextAlign.end ,
style: TextStyle(color: Colors.white),
),
trailing: Radio(value: "Erkek", groupValue: groupValue, onChanged: (e)=>valueChanged(e)),
)),
Expanded(
child: ListTile(
title: Text(
"Kadın",
textAlign: TextAlign.end ,
style: TextStyle(color: Colors.white),
),
trailing: Radio(value: "Kadın", groupValue: groupValue, onChanged: (e)=>valueChanged(e)),
)),
],
),
),
),
Padding(
padding:
const EdgeInsets.fromLTRB(14.0, 8.0, 14.0, 8.0),
child: Material(
borderRadius: BorderRadius.circular(20.0),
color: Colors.white.withOpacity(0.4),
elevation: 0.0,
child: Padding(
padding: const EdgeInsets.only(left: 12.0),
child: ListTile(
title: TextFormField(
controller: _passwordTextController,
obscureText: true,
decoration: InputDecoration(
hintText: "Şifre",
icon: Icon(Icons.lock_outline),
border: InputBorder.none
),
// ignore: missing_return
validator: (value) {
if (value.isEmpty) {
return "Şifre boşluğu doldurulmalıdır.";
} else if (value.length < 6) {
return "Şifre 6 haneden uzun olmalı!";
}
return null;
},
// ignore: missing_return
),
trailing : IconButton(icon: Icon(Icons.remove_red_eye), onPressed: (){})
),
),
),
),
Padding(
padding:
const EdgeInsets.fromLTRB(14.0, 8.0, 14.0, 8.0),
child: Material(
borderRadius: BorderRadius.circular(20.0),
color: Colors.white.withOpacity(0.4),
elevation: 0.0,
child: Padding(
padding: const EdgeInsets.only(left: 12.0),
child: ListTile(
title : TextFormField(
controller: _confirmPasswordTextController,
obscureText: true,
decoration: InputDecoration(
hintText: "Şifreyi Doğrula",
icon: Icon(Icons.lock_outline),
border: InputBorder.none
),
// ignore: missing_return
validator: (value) {
if (value.isEmpty) {
return "Şifre boşluğu doldurulmalıdır.";
} else if (value.length < 6) {
return "Şifre 6 haneden uzun olmalı!";
}else if (_passwordTextController != value){
return "Şifreler uyuşmuyor.";
}
return null;
},
// ignore: missing_return
),
trailing : IconButton(icon: Icon(Icons.remove_red_eye), onPressed: (){}),
),
),
),
),
Padding(
padding:
const EdgeInsets.fromLTRB(12.0, 8.0, 12.0, 8.0),
child: Material(
borderRadius: BorderRadius.circular(20.0),
color: Colors.red.withOpacity(0.8),
elevation: 0.0,
child: MaterialButton(
onPressed: () {
validateForm();
},
minWidth: MediaQuery.of(context).size.width,
child: Text(
"Kayıt Ol",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15.0),
),
)),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(
onTap: () {
Navigator.pop(context);
},
child: Text(
"Giriş Yap",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.red),
))),
],
)),
),
),
Visibility(
visible: loading ?? true,
child: Center(
child: Container(
alignment: Alignment.center,
color: Colors.white.withOpacity(0.9),
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.red),
),
),
))
],
),
);
}
valueChanged(e) {
setState(() {
if (e == "Erkek") {
groupValue = e;
gender = e;
} else if (e == "Kadın") {
groupValue = e;
gender = e;
}
});
}
void validateForm() async{
FormState formState = _formKey.currentState;
if(formState.validate()){
User user = await firebaseAuth.currentUser;
if(user == null){
firebaseAuth.createUserWithEmailAndPassword(email: _emailTextController, password: _passwordTextController).then((user) => {
});
}
}
}
}
我的显示错误。
正在执行热重载...正在将文件同步到设备 sdk gphone x86...lib/pages/signup.dart:276:60:错误:参数类型“TextEditingController”不能分配给参数类型“String”。
'TextEditingController' 来自'package:flutter/src/widgets/editable_text.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/editable_text.dart')。firebaseAuth.createUserWithEmailAndPassword(电子邮件:_emailTextController,密码:_passwordTextController).then((用户)=> {^lib/pages/signup.dart:276:92:错误:参数类型“TextEditingController”不能分配给参数类型“String”。
'TextEditingController' 来自'package:flutter/src/widgets/editable_text.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/editable_text.dart')。firebaseAuth.createUserWithEmailAndPassword(电子邮件:_emailTextController,密码:_passwordTextController).then((用户)=> {^==========新错误RR==================
void validateForm() 异步 {FormState formState = _formKey.currentState;if (formState.validate()) {用户用户 = 等待 firebaseAuth.currentUser;如果(用户 == 空){firebaseAuth.createUserWithEmailAndPassword(电子邮件:_emailTextController.text,密码:_passwordTextController.text).then((用户) => {
_userServices.createUser(
{
"username": _nameTextController.text,
"email": user.email
}
)
});
}
}
}}
最佳答案
使用 _emailTextController.text
而不仅仅是 _emailTextController
。
关于firebase - flutter 中的错误 : The argument type 'TextEditingController' can't be assigned to the parameter type 'String' .,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66119366/
在嵌入式系统的背景下,给出以下函数结构: 返回变量的条件赋值: int foo(int x) { int status; if (is_valid(x)) {
#input |--IDs-|--Value-| |--da1-|--100---| |--da2-|---80---| |--da3-|--200---| |--da4-|--300---| |--
您可以declare a list of variables and assign them some value在 Perl 6 my ($a, $b) = 33,44 # $a will be 3
在下面的代码中实现对象的浅拷贝,但是不同的输出让我很困惑: 对象.分配: var obj = { name: 'wsscat', age: 0, add: { a: 'beijin
我正在查看一位已不复存在的开发人员的一些旧代码,并注意到有时他使用 Object.assign({}, xyz) 还有他用过的其他东西 Object.assign([], abc); 两者有区别吗?
这个问题在这里已经有了答案: Why were ES5 Object methods not added to Object.prototype? (2 个答案) 关闭 4 个月前。 我正在做一个
我想知道这之间的区别: Object.assign(otherObject, { someNewProperty: '' }); 和 otherObject.someNewProperty = '
考虑以下代码: const defaultState = () => { return { profile: { id: '', displayName: '',
我刚刚偶然发现this line of TS code : const { title = item.text } = item; 这似乎是一个destructuring assigment但是大括号
我是一个没有经验的 JavaScript 用户,正在阅读这本书 CoffeeScript: Accelerated JavaScript Development ,其中作者制作了一种 Scrabble
当我查看日志文件时 D:\SAS\XXX\Lev1\SASMain\BatchServer\Logs 我看到了这两行 NOTE: Libref TESTLIB successfully assigne
我似乎不明白为什么要使用移动赋值运算符: CLASSA & operator=(CLASSA && other); //move assignment operator 结束了,复制赋值运算符: CL
在Eiffel Studio中,我一直试图访问从另一个类定义的一个类的对象的字段。但是,它不断给出我无法理解和解决的错误。以下是示例代码片段: 创建对象的类: class TEST1 feat
为什么这个片段在 Node (10.5) .then(function() { this = {...this, ...payload}; this.update();
我在我的 React 应用程序中使用以下包来生成 Recaptcha 组件:https://github.com/appleboy/react-recaptcha 组件如下所示,带有 eslint 警
我有以下代码: #include #include using std::cout; struct SomeType { SomeType() {} SomeType(const Some
我有这个代码示例: var a = 10; ({a}) = 0; 在 Google Chrome 中,它显示错误:SyntaxError:无效的解构赋值目标 在 Firefox 中,它显示错误:Ref
我有一个函数,用于对两个输入字段的输入求和并将其分配给一个。我的函数如下所示: function sum(id) { nextId = id+2 console.log
我收到这个警告 "Automatic Reference Counting Issue: Assigning retained object to unsafe_unretained variable
在使用 Shopify 的 Liquid 语言编码时,我注意到使用以下语法分配了一些变量: {%- assign variable = value -%} 和使用以下语法分配的其他变量: {% ass
我是一名优秀的程序员,十分优秀!