我想使用mysql在我的应用程序中更改密码,但是我不知道如何获取特定的登录ID来更改密码,我有一个仪表板,我在上面使用卡,因此当我单击带有名称更改密码,它将重定向 转到此页面,我正在将mysql用于本地数据库。
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text('Change Password'),
backgroundColor: Color(0xff083663),
),
body: Form(
key: _key,
child: Center(
child: Column(
children: <Widget>[
SizedBox(
height: 30.0,
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Change Password',
style: TextStyle(
fontSize: 18.0, fontWeight: FontWeight.w900),
)
],
),
),
),
SizedBox(
height: 10.0,
),
///这是您将在其中输入当前密码的字段
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: TextFormField(
validator: (e) {
if (e.isEmpty) {
return "Please Enter Current Password";
}
return null;
},
obscureText: _secureText1,
onSaved: (e) => c1 = e,
decoration: InputDecoration(
labelText: 'Current Password',
suffixIcon: IconButton(
onPressed: showHide,
icon: Icon(_secureText1
? Icons.visibility_off
: Icons.visibility),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xff083663),
)),
border: OutlineInputBorder()),
),
),
SizedBox(
height: 10.0,
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: TextFormField(
validator: (e) {
if (e.isEmpty) {
return "Please Enter New Password";
}
return null;
},
obscureText: _secureText2,
onSaved: (e) => c2 = e,
decoration: InputDecoration(
labelText: 'New Password',
suffixIcon: IconButton(
onPressed: showHide2,
icon: Icon(_secureText2
? Icons.visibility_off
: Icons.visibility),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xff083663),
)),
border: OutlineInputBorder()),
),
),
//这是验证密码的字段
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: TextFormField(
validator: (e) {
if (e.isEmpty) {
return "Verify Password";
}
return null;
},
onSaved: (e) => c3 = e,
keyboardType: TextInputType.number,
decoration: InputDecoration(
labelText: 'Verify Password',
suffixIcon: IconButton(
onPressed: showHide3,
icon: Icon(_secureText3
? Icons.visibility_off
: Icons.visibility),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0xff083663),
)),
border: OutlineInputBorder()),
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
child: Divider(),
),
SizedBox(
height: 20.0,
),
Container(
height: 50,
width: 250,
child: RaisedButton(
onPressed: () {
check();
},
color: Color(0xffb5171d),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(30.0))),
textColor: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.vpn_key,
color: Colors.white,
),
Text(
'Save Changes',
style: TextStyle(fontSize: 15),
),
SizedBox(
height: 20,
)
],
),
),
),
],
),
),
),
);
}
}