import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:tangheem/classes/const.dart'; import 'package:tangheem/classes/utils.dart'; import 'package:tangheem/ui/dialogs/opt_dialog.dart'; import 'package:tangheem/widgets/common_textfield_widget.dart'; class ForgotPasswordScreen extends StatefulWidget { static const String routeName = "/forgot_password"; ForgotPasswordScreen({Key key}) : super(key: key); @override _ForgotPasswordScreenState createState() { return _ForgotPasswordScreenState(); } } class _ForgotPasswordScreenState extends State { TextEditingController _usernameController = TextEditingController(); TextEditingController _emailController = TextEditingController(); @override void initState() { super.initState(); } @override void dispose() { super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Const.secondaryWhite, body: SingleChildScrollView( padding: EdgeInsets.all(32.0), physics: BouncingScrollPhysics(), child: Container( width: MediaQuery.of(context).size.width, decoration: BoxDecoration(borderRadius: BorderRadius.circular(8.0), color: Colors.white), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ Padding( padding: EdgeInsets.only(top: 36, bottom: 24), child: SvgPicture.asset("assets/icons/key.svg", width: 100, height: 100), ), Text( "نسيت كلمة المرور؟", style: TextStyle(fontSize: 22, color: Const.primaryBlue), ), Container( margin: EdgeInsets.only(top: 16), width: double.infinity, padding: EdgeInsets.all(32.0), decoration: BoxDecoration( color: Const.primaryBlue, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(8), bottomRight: Radius.circular(8), ), ), child: Column( mainAxisSize: MainAxisSize.min, children: [ CommonTextFieldWidget(hint: "اسم المستخدم", controller: _usernameController, prefixIcon: "assets/icons/user.svg"), SizedBox(height: 8), Text( "-أو-", style: TextStyle(color: Colors.white), ), SizedBox(height: 8), CommonTextFieldWidget(hint: "الايميل المسجل", controller: _emailController, prefixIcon: "assets/icons/email.svg"), SizedBox(height: 12), SizedBox( width: double.infinity, height: 50, child: TextButton( onPressed: () { if (_usernameController.text.length < 1) { Utils.showToast("Username is empty."); return; } if (_emailController.text.length < 1) { Utils.showToast("Email is empty."); return; } getOTP(); }, style: TextButton.styleFrom( primary: Colors.white, backgroundColor: Const.secondaryPink, textStyle: TextStyle(fontSize: 16, fontFamily: "DroidKufi"), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6.0), ), ), child: Text("اعادة تعيين كلمة المرور"), ), ), ], ), ), ], ), ), ), ); } getOTP() { showDialog( context: context, barrierColor: Const.secondaryWhite.withOpacity(0.8), builder: (BuildContext context) => OTPDialog(), ); } }