You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
doctor_app_flutter/lib/widgets/auth/change_password.dart

160 lines
6.0 KiB
Dart

import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
class ChangePassword extends StatelessWidget {
final changePassFormKey = GlobalKey<FormState>();
var changePassFormValues = {
'currentPass': null,
'newPass': null,
'repeatedPass': null
};
@override
Widget build(BuildContext context) {
return Form(
key: changePassFormKey,
child: Container(
width: SizeConfig.realScreenWidth * 0.90,
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: <
Widget>[
buildSizedBox(),
TextFormField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
// ts/images/password_icon.png
prefixIcon: Image.asset('assets/images/password_icon.png'),
hintText: 'Current Password',
hintStyle:
TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide:
BorderSide(color: Theme.of(context).primaryColor),
)
//BorderRadius.all(Radius.circular(20));
),
validator: (value) {
if (value.isEmpty) {
return 'Please enter your Current Password';
}
return null;
},
onSaved: (value) {
// changePassFormValues. = value;
},
),
buildSizedBox(40),
// buildSizedBox(),
Text(
"New Password",
style: TextStyle(
fontSize: 2.8 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w800),
),
buildSizedBox(10.0),
// Text()
TextFormField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
// ts/images/password_icon.png
prefixIcon: Image.asset('assets/images/password_icon.png'),
hintText: 'New Password',
hintStyle:
TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide:
BorderSide(color: Theme.of(context).primaryColor),
)
//BorderRadius.all(Radius.circular(20));
),
validator: (value) {
if (value.isEmpty) {
return 'Please enter your New Password';
}
return null;
},
onSaved: (value) {
// userInfo.UserID = value;
},
),
buildSizedBox(),
TextFormField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
prefixIcon: Image.asset('assets/images/password_icon.png'),
hintText: 'Repeat Password',
hintStyle:
TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide:
BorderSide(color: Theme.of(context).primaryColor),
)
//BorderRadius.all(Radius.circular(20));
),
validator: (value) {
if (value.isEmpty) {
return 'Please enter your Repeat Password';
}
return null;
},
onSaved: (value) {
// userInfo.UserID = value;
},
),
buildSizedBox(),
RaisedButton(
onPressed:changePass,
elevation: 0.0,
child: Container(
width: double.infinity,
height: 50,
child: Center(
child: Text(
'Change Password'
.toUpperCase(),
// textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 2.5 * SizeConfig.textMultiplier),
),
),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(width: 0.5, color: Hexcolor('#CCCCCC'))),
),
SizedBox(
height: 10,
),
])));
}
SizedBox buildSizedBox([double height = 20]) {
return SizedBox(
height: height,
);
}
changePass(){
if(changePassFormKey.currentState.validate()){
changePassFormKey.currentState.save();
// call Api
}
}
}