import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:farmer_client/widgets/layout/BasicPage.dart';

import 'package:farmer_client/utils/timer.dart';
import 'package:farmer_client/widgets/DefaultButton.dart';

class ResetPassword extends BasicPage {
  ResetPassword({Key? key}) : super(key: key) {
    naviTitle = '修改密码';
  }

  @override
  Widget builder(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(15.w),
      decoration: const BoxDecoration(color: Colors.white),
      child: Column(
        children: [
          Expanded(
            flex: 1,
            child: ListView(
              children: [
                Container(
                  width: 345.w,
                  alignment: Alignment.centerLeft,
                  margin: EdgeInsets.only(top: 40.h),
                  decoration: BoxDecoration(
                    color: Colors.white,
                    boxShadow: [
                      BoxShadow(
                          color: const Color(0x1f000000),
                          offset: Offset(0, 1.w))
                    ],
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        '原始密码:',
                        style: TextStyle(
                            color: const Color(0xFF333333),
                            fontSize: 17.sp,
                            fontWeight: FontWeight.bold,
                            letterSpacing: 2),
                      ),
                      Container(
                        height: 54.h,
                        alignment: Alignment.centerLeft,
                        child: Row(
                          children: [
                            Expanded(
                              flex: 1,
                              child: TextField(
                                style: TextStyle(
                                    fontSize: 17.sp,
                                    fontWeight: FontWeight.bold,
                                    color: const Color(0xff333333)),
                                decoration: const InputDecoration(
                                  isCollapsed: true,
                                  hintText: '请输入原始密码',
                                  counterText: '', //去掉右下角的东西
                                  border: InputBorder.none,
                                  floatingLabelBehavior:
                                  FloatingLabelBehavior.never,
                                ),
                                onChanged: (val) {
                                },
                              ),
                            ),
                            GestureDetector(
                              behavior: HitTestBehavior.opaque,
                              onTap: () {},
                              child: Container(
                                width: 50.w,
                                alignment: Alignment.center,
                                child: Image.asset(
                                  'images/icons/cancel.png',
                                  width: 18.w,
                                ),
                              ),
                            )
                          ],
                        ),
                      ),
                    ],
                  ),
                ),
                Container(
                  width: 345.w,
                  alignment: Alignment.centerLeft,
                  margin: EdgeInsets.only(top: 40.h),
                  decoration: BoxDecoration(
                    color: Colors.white,
                    boxShadow: [
                      BoxShadow(
                          color: Color(0x1f000000), offset: Offset(0, 1.w))
                    ],
                  ),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        '新密码:',
                        style: TextStyle(
                            color: const Color(0xFF333333),
                            letterSpacing: 2,
                            fontSize: 17.sp,
                            fontWeight: FontWeight.bold),
                      ),
                      Container(
                        height: 54.h,
                        alignment: Alignment.centerLeft,
                        child: Row(
                          children: [
                            Expanded(
                              flex: 1,
                              child: TextField(
                                //赋初值
                                maxLength: 11,
                                keyboardType: TextInputType.number,
                                style: TextStyle(
                                    fontSize: 17.sp,
                                    fontWeight: FontWeight.bold,
                                    color: const Color(0xff333333)),
                                decoration: const InputDecoration(
                                  isCollapsed: true,
                                  hintText: '请输入新密码',
                                  counterText: '', //去掉右下角的东西
                                  border: InputBorder.none,
                                  floatingLabelBehavior:
                                  FloatingLabelBehavior.never,
                                ),
                                onChanged: (val) {
                                },
                              ),
                            ),
                            GestureDetector(
                              behavior: HitTestBehavior.opaque,
                              onTap: () {
                              },
                              child: Container(
                                width: 50.w,
                                alignment: Alignment.center,
                                child: Image.asset(
                                  'images/icons/cancel.png',
                                  width: 18.w,
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
          Padding(
            padding: EdgeInsets.only(bottom: 15.w),
            child: DefaultButton(
              text: '保存',
              color: const Color(0xffffffff),
              backColor: const Color(0xFFFF703B),
              width: 345.w,
              height: 49.h,
              onPressed: () {
                EasyLoading.show(status: '请稍候...');
                setTimeout(() {
                  EasyLoading.showToast("网络超时, 请稍后再试");

                  setTimeout(() {
                    EasyLoading.dismiss();
                  }, 1500);
                }, 3000);
              },
              margin: const EdgeInsets.all(0),
              fontSize: 20.sp,
              radius: 24.5.w,
            ),
          ),
        ],
      ),
    );
  }

}