【发布时间】:2020-12-22 22:15:49
【问题描述】:
我需要从其他页面调用文本输入详细信息,因为我在一个页面中有文本输入,而在其他页面中是用于收集 firebase 详细信息的代码,所以现在我想在用户输入输入后点击下一步以保存在其他页面
我在这里收集数据
// Check if user is new or old
// If user is new then add new user to firebase firestore katabase
if (diff < Duration(seconds: 15)) {
UserModel model = UserModel(
bio: '',
bio2: "",
status: '',
userName: _gUserNameController, // now here is error, need get function
dob: DateTime(2002, DateTime.now().month, DateTime.now().day + 3)
.toString(),
location: 'Location',
profilePic: user.photoURL,
displayName: user.displayName,
email: user.email,
这是其他页面输入的代码
TextEditingController _gUserNameController;
Texxh 输入
Container(
decoration: BoxDecoration(
border: Border.all(width: 1.0, color: Colors.black26),
borderRadius: BorderRadius.circular(7.0)),
child: TextField(
controller: _gUserNameController,
decoration: InputDecoration(
border: InputBorder.none,
contentPadding: const EdgeInsets.all(10.0),
labelText: "Username",
labelStyle: TextStyle(fontSize: 15.0)),
),
),
点击
GestureDetector(
onTap: () {
if (_gUserNameController.text == null ||
_gUserNameController.text.length == 0) {
return;
}
Navigator.pop(context, _gUserNameController.text);
},
child: Container(
width: 350.0,
height: 50.0,
child: Center(
child: Text(
"Next",
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold),
)),
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(7.0)),
))
【问题讨论】:
标签: android ios firebase flutter dart