optimized
This commit is contained in:
@ -13,150 +13,170 @@ class ChangePasswordPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
|
||||
backgroundColor: Colors.white,
|
||||
leading:
|
||||
IconButton( onPressed: (){
|
||||
Navigator.pop(context);
|
||||
},icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 20,
|
||||
color: Colors.black,
|
||||
)),
|
||||
),
|
||||
body:
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
child: Text("change_password".tr, style: const TextStyle(fontSize: 24.0),),
|
||||
),
|
||||
const SizedBox(height: 30,),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 40
|
||||
),
|
||||
child: Column(
|
||||
body: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
makeInput(label: "old_password".tr, controller: oldPasswordController),
|
||||
makeInput(label: "new_password".tr, controller: newPasswordController, obsureText: true),
|
||||
Text(
|
||||
"change_password".tr,
|
||||
style: const TextStyle(fontSize: 24.0),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 3,left: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
),
|
||||
child: Obx((() =>
|
||||
indexController.is_loading == true ? MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:60,
|
||||
onPressed: (){
|
||||
|
||||
},
|
||||
color: Colors.grey[400],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: const CircularProgressIndicator(),
|
||||
) :
|
||||
Column(
|
||||
children: [
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:60,
|
||||
onPressed: (){
|
||||
if(oldPasswordController.text.isEmpty || newPasswordController.text.isEmpty){
|
||||
Get.snackbar(
|
||||
"no_values".tr,
|
||||
"values_required".tr,
|
||||
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
return;
|
||||
}
|
||||
indexController.is_loading.value = true;
|
||||
indexController.changePassword(oldPasswordController.text, newPasswordController.text, context);
|
||||
//indexController.login(oldPasswordController.text, newPasswordController.text, context);
|
||||
},
|
||||
color: Colors.indigoAccent[400],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: const Text("ログイン",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10.0,),
|
||||
|
||||
],
|
||||
)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Column(
|
||||
children: [
|
||||
makeInput(
|
||||
label: "old_password".tr,
|
||||
controller: oldPasswordController),
|
||||
makeInput(
|
||||
label: "new_password".tr,
|
||||
controller: newPasswordController,
|
||||
obsureText: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 20,),
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
],
|
||||
)
|
||||
],
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 3, left: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
),
|
||||
child: Obx(
|
||||
(() => indexController.isLoading.value == true
|
||||
? MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height: 60,
|
||||
onPressed: () {},
|
||||
color: Colors.grey[400],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)),
|
||||
child: const CircularProgressIndicator(),
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height: 60,
|
||||
onPressed: () {
|
||||
if (oldPasswordController
|
||||
.text.isEmpty ||
|
||||
newPasswordController
|
||||
.text.isEmpty) {
|
||||
Get.snackbar(
|
||||
"no_values".tr,
|
||||
"values_required".tr,
|
||||
icon: const Icon(
|
||||
Icons.assistant_photo_outlined,
|
||||
size: 40.0,
|
||||
color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(
|
||||
milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
return;
|
||||
}
|
||||
indexController.isLoading.value = true;
|
||||
indexController.changePassword(
|
||||
oldPasswordController.text,
|
||||
newPasswordController.text,
|
||||
context);
|
||||
//indexController.login(oldPasswordController.text, newPasswordController.text, context);
|
||||
},
|
||||
color: Colors.indigoAccent[400],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(40)),
|
||||
child: const Text(
|
||||
"ログイン",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16,
|
||||
color: Colors.white70),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,style:const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black87
|
||||
),),
|
||||
const SizedBox(height: 5,),
|
||||
TextField(
|
||||
controller: controller,
|
||||
obscureText: obsureText,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: (Colors.grey[400])!,
|
||||
Widget makeInput(
|
||||
{label, required TextEditingController controller, obsureText = false}) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
TextField(
|
||||
controller: controller,
|
||||
obscureText: obsureText,
|
||||
decoration: InputDecoration(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(vertical: 0, horizontal: 10),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: (Colors.grey[400])!,
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: (Colors.grey[400])!),
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: (Colors.grey[400])!
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30.0,)
|
||||
],
|
||||
);
|
||||
const SizedBox(
|
||||
height: 30.0,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user