mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:19:17 +03:30
Set Pass Screen
This commit is contained in:
+2
-3
@@ -53,7 +53,7 @@ import 'pages/LabelPages/label_result_screen.dart';
|
|||||||
import 'pages/LabelPages/label_scan_screen.dart';
|
import 'pages/LabelPages/label_scan_screen.dart';
|
||||||
import 'pages/LoginRegisterPages/login_screen.dart';
|
import 'pages/LoginRegisterPages/login_screen.dart';
|
||||||
import 'pages/my_info_screen.dart';
|
import 'pages/my_info_screen.dart';
|
||||||
import 'pages/LoginRegisterPages/rePass_screen.dart';
|
import 'pages/LoginRegisterPages/re_pass_screen.dart';
|
||||||
import 'pages/TestPages/test_add_screen.dart';
|
import 'pages/TestPages/test_add_screen.dart';
|
||||||
import 'pages/TestPages/test_detail_screen.dart';
|
import 'pages/TestPages/test_detail_screen.dart';
|
||||||
import 'pages/TestPages/test_filter_screen.dart';
|
import 'pages/TestPages/test_filter_screen.dart';
|
||||||
@@ -195,8 +195,7 @@ class MyApp extends StatelessWidget {
|
|||||||
Routes.myPackagesResultScreen: (ctx) =>
|
Routes.myPackagesResultScreen: (ctx) =>
|
||||||
MyPackagesResultScreen(),
|
MyPackagesResultScreen(),
|
||||||
Routes.myPackagesFilterScreen: (ctx) => MyPackageFilterScreen(),
|
Routes.myPackagesFilterScreen: (ctx) => MyPackageFilterScreen(),
|
||||||
Routes.myPackagesDetailScreen: (ctx) =>
|
Routes.myPackagesDetailScreen: (ctx) => PackageDetailScreen(),
|
||||||
PackageDetailScreen(),
|
|
||||||
Routes.packagesTransferScreen: (ctx) => PackageTransferScreen(),
|
Routes.packagesTransferScreen: (ctx) => PackageTransferScreen(),
|
||||||
Routes.myPackagesHistoryScreen: (ctx) =>
|
Routes.myPackagesHistoryScreen: (ctx) =>
|
||||||
MyPackagesHistoryScreen(),
|
MyPackagesHistoryScreen(),
|
||||||
|
|||||||
@@ -1,239 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
import '../../providers/auth.dart';
|
|
||||||
import '../../providers/connectivity.dart';
|
|
||||||
import '../../widgets/Global/internet_error.dart';
|
|
||||||
|
|
||||||
class RePassScreen extends StatefulWidget {
|
|
||||||
// static const route = '/HomeScreen';
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<StatefulWidget> createState() {
|
|
||||||
return _RePassScreenState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _RePassScreenState extends State<RePassScreen> {
|
|
||||||
final _form = GlobalKey<FormState>();
|
|
||||||
bool _isLoading = false;
|
|
||||||
// final cellNumberController = TextEditingController();
|
|
||||||
final passwordController = new TextEditingController();
|
|
||||||
final rePasswordController = new TextEditingController();
|
|
||||||
String token = 'Bearer ';
|
|
||||||
// String token = 'Bearer ';
|
|
||||||
|
|
||||||
bool _hidePass = true;
|
|
||||||
bool _hideRePass = true;
|
|
||||||
bool isInit = true;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didChangeDependencies() {
|
|
||||||
if (isInit) {
|
|
||||||
token += ModalRoute.of(context)!.settings.arguments.toString();
|
|
||||||
isInit = false;
|
|
||||||
}
|
|
||||||
super.didChangeDependencies();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _showDialog(String message) async {
|
|
||||||
await showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (ctx) => AlertDialog(
|
|
||||||
content: Text(message),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
child: Text('Ok'),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(ctx).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _sendRePass() async {
|
|
||||||
if (!_form.currentState!.validate()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_form.currentState!.save();
|
|
||||||
setState(() {
|
|
||||||
_isLoading = true;
|
|
||||||
});
|
|
||||||
await Provider.of<Auth>(context, listen: false)
|
|
||||||
.sendRePass(passwordController.text, token)
|
|
||||||
.then((value) async {
|
|
||||||
if (value == 'done') {
|
|
||||||
await _showDialog(
|
|
||||||
'Password changed successfully.Now login to your account.');
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final _media = MediaQuery.of(context);
|
|
||||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
|
||||||
final double _devicewidth = _media.size.width;
|
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
|
||||||
return SafeArea(
|
|
||||||
child: Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
centerTitle: true,
|
|
||||||
title: Text('CSSD', style: TextStyle(color: Colors.white,),),
|
|
||||||
backgroundColor: Colors.black,
|
|
||||||
),
|
|
||||||
body: Selector<ConnectivityProvider, String>(
|
|
||||||
builder: (ctx, value, _) => value != 'offline'
|
|
||||||
? _isLoading
|
|
||||||
? Center(
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Form(
|
|
||||||
key: _form,
|
|
||||||
child: ListView(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
|
||||||
children: <Widget>[
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 20),
|
|
||||||
child: Text(
|
|
||||||
'CHANGE PASSWORD',
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 6 * _deviceBlockSize,
|
|
||||||
letterSpacing: 3,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
validator: (value) {
|
|
||||||
if (value!.isEmpty) {
|
|
||||||
return 'Password is required.';
|
|
||||||
}
|
|
||||||
if (value.length < 8) {
|
|
||||||
return 'Password at least is 8 characters.';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
obscureText: _hidePass,
|
|
||||||
controller: passwordController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
icon: Icon(
|
|
||||||
FontAwesomeIcons.starOfLife,
|
|
||||||
size: 6 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
fontWeight: FontWeight.w100,
|
|
||||||
fontSize: 4 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
labelText: 'Password',
|
|
||||||
isDense: true,
|
|
||||||
contentPadding: EdgeInsets.symmetric(
|
|
||||||
vertical: 2, horizontal: 3),
|
|
||||||
suffixIcon: InkWell(
|
|
||||||
child: Icon(FontAwesomeIcons.eye),
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
_hidePass = !_hidePass;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
textInputAction: TextInputAction.done,
|
|
||||||
onFieldSubmitted: (_) {
|
|
||||||
_sendRePass();
|
|
||||||
},
|
|
||||||
keyboardType: TextInputType.visiblePassword,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 30,
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
validator: (value) {
|
|
||||||
if (value!.length < 8) {
|
|
||||||
return 'Password at least is 8 characters.';
|
|
||||||
}
|
|
||||||
if (value != passwordController.text) {
|
|
||||||
return 'Password doesnt match!';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
obscureText: _hideRePass,
|
|
||||||
controller: rePasswordController,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
icon: Icon(
|
|
||||||
FontAwesomeIcons.starOfLife,
|
|
||||||
size: 6 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
fontWeight: FontWeight.w100,
|
|
||||||
fontSize: 4 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
labelText: 'Confirm Password',
|
|
||||||
isDense: true,
|
|
||||||
contentPadding: EdgeInsets.symmetric(
|
|
||||||
vertical: 2, horizontal: 3),
|
|
||||||
suffixIcon: InkWell(
|
|
||||||
child: Icon(FontAwesomeIcons.eye),
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
_hideRePass = !_hideRePass;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
textInputAction: TextInputAction.done,
|
|
||||||
onFieldSubmitted: (_) {
|
|
||||||
_sendRePass();
|
|
||||||
},
|
|
||||||
keyboardType: TextInputType.visiblePassword,
|
|
||||||
),
|
|
||||||
SizedBox(height: 40),
|
|
||||||
Row(
|
|
||||||
children: <Widget>[
|
|
||||||
InkWell(
|
|
||||||
onTap: () => _sendRePass(),
|
|
||||||
child: Container(
|
|
||||||
width: 88 * _deviceBlockSize,
|
|
||||||
padding: EdgeInsets.all(10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.black,
|
|
||||||
borderRadius: BorderRadius.circular(7),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'Change',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 10),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: ConnectionErrorBox(),
|
|
||||||
selector: (_, connectivity) => connectivity.conStatus,
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,262 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../config/routes.dart';
|
||||||
|
import '../../providers/auth.dart';
|
||||||
|
import '../../providers/connectivity.dart';
|
||||||
|
import '../../widgets/Global/internet_error.dart';
|
||||||
|
|
||||||
|
class RePassScreen extends StatefulWidget {
|
||||||
|
// static const route = '/HomeScreen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return _RePassScreenState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RePassScreenState extends State<RePassScreen> {
|
||||||
|
final _form = GlobalKey<FormState>();
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
// final cellNumberController = TextEditingController();
|
||||||
|
final passwordController = new TextEditingController();
|
||||||
|
final rePasswordController = new TextEditingController();
|
||||||
|
String token = 'Bearer ';
|
||||||
|
|
||||||
|
// String token = 'Bearer ';
|
||||||
|
|
||||||
|
bool _hidePass = true;
|
||||||
|
bool _hideRePass = true;
|
||||||
|
bool isInit = true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
if (isInit) {
|
||||||
|
token += ModalRoute.of(context)!.settings.arguments.toString();
|
||||||
|
isInit = false;
|
||||||
|
}
|
||||||
|
super.didChangeDependencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _showDialog(String message) async {
|
||||||
|
await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (ctx) => AlertDialog(
|
||||||
|
content: Text(message),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text('Ok'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(ctx).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _sendRePass() async {
|
||||||
|
if (!_form.currentState!.validate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_form.currentState!.save();
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
await Provider.of<Auth>(context, listen: false)
|
||||||
|
.sendRePass(passwordController.text, rePasswordController.text, token)
|
||||||
|
.then((value) async {
|
||||||
|
if (value == 'done') {
|
||||||
|
await _showDialog('Password changed successfully.');
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final _media = MediaQuery.of(context);
|
||||||
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
|
final double _devicewidth = _media.size.width;
|
||||||
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text(
|
||||||
|
'Home',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () => Navigator.of(context).pushNamed(Routes.homePage),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Selector<ConnectivityProvider, String>(
|
||||||
|
builder: (ctx, value, _) => value != 'offline'
|
||||||
|
? _isLoading
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: ListView(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(top: 20, bottom: 5),
|
||||||
|
child: Text(
|
||||||
|
'CHANGE PASSWORD',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
// letterSpacing: 3,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 5),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
TextFormField(
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Password is required.';
|
||||||
|
}
|
||||||
|
if (value.length < 8) {
|
||||||
|
return 'Password at least is 8 characters.';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
obscureText: _hidePass,
|
||||||
|
controller: passwordController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
// icon: Icon(
|
||||||
|
// FontAwesomeIcons.starOfLife,
|
||||||
|
// size: 6 * _deviceBlockSize,
|
||||||
|
// ),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'Password',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
// suffixIcon: InkWell(
|
||||||
|
// child: Icon(FontAwesomeIcons.eye),
|
||||||
|
// onTap: () {
|
||||||
|
// setState(() {
|
||||||
|
// _hidePass = !_hidePass;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
_sendRePass();
|
||||||
|
},
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.length < 8) {
|
||||||
|
return 'Password at least is 8 characters.';
|
||||||
|
}
|
||||||
|
if (value != passwordController.text) {
|
||||||
|
return 'Password doesnt match!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
obscureText: _hideRePass,
|
||||||
|
controller: rePasswordController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
// icon: Icon(
|
||||||
|
// FontAwesomeIcons.starOfLife,
|
||||||
|
// size: 6 * _deviceBlockSize,
|
||||||
|
// ),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelText: 'retype your new password',
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
// suffixIcon: InkWell(
|
||||||
|
// child: Icon(FontAwesomeIcons.eye),
|
||||||
|
// onTap: () {
|
||||||
|
// setState(() {
|
||||||
|
// _hideRePass = !_hideRePass;
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
_sendRePass();
|
||||||
|
},
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
),
|
||||||
|
SizedBox(height: 40),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
InkWell(
|
||||||
|
onTap: () => _sendRePass(),
|
||||||
|
child: Container(
|
||||||
|
width: 88 * _deviceBlockSize,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.black,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(7),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Save New Password',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 10),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox(),
|
||||||
|
selector: (_, connectivity) => connectivity.conStatus,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -372,7 +372,8 @@ class SelectionItem extends StatelessWidget {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: firstLineColor,
|
color: firstLineColor,
|
||||||
fontSize: 5 * _deviceBlockSize,
|
fontSize: 5 * _deviceBlockSize,
|
||||||
letterSpacing: 3.5,
|
// letterSpacing: 3.5,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import '../config/colors.dart';
|
||||||
import '../config/routes.dart';
|
import '../config/routes.dart';
|
||||||
import '../providers/auth.dart';
|
import '../providers/auth.dart';
|
||||||
|
import 'home_screen.dart';
|
||||||
|
|
||||||
class MyInfoScreen extends StatefulWidget {
|
class MyInfoScreen extends StatefulWidget {
|
||||||
// static const route = '/MyInfoScreenRoute';
|
// static const route = '/MyInfoScreenRoute';
|
||||||
@@ -52,7 +54,7 @@ class _MyInfoScreenState extends State<MyInfoScreen> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
titleSpacing: -10,
|
titleSpacing: -10,
|
||||||
title: Text(
|
title: Text(
|
||||||
'Dashboard',
|
'Home',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
@@ -131,8 +133,28 @@ class _MyInfoScreenState extends State<MyInfoScreen> {
|
|||||||
icon: FontAwesomeIcons.envelope,
|
icon: FontAwesomeIcons.envelope,
|
||||||
inputType: TextInputType.emailAddress,
|
inputType: TextInputType.emailAddress,
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(height: 20),
|
||||||
height: 40,
|
SelectionItem(
|
||||||
|
firstLine: 'CHANGE PASSWORD',
|
||||||
|
secondLine: 'Set a new password',
|
||||||
|
firstLineColor: Colors.black,
|
||||||
|
backgroundColor: kLightGreyBackground,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context)
|
||||||
|
.popAndPushNamed(Routes.rePassScreen);
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// MaterialPageRoute(
|
||||||
|
// builder: (context) {
|
||||||
|
// return Consumer<Auth>(
|
||||||
|
// builder: (ctx, auth, _) {
|
||||||
|
// return MyInfoScreen();
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
},
|
||||||
),
|
),
|
||||||
Consumer<Auth>(builder: (context, auth, _) {
|
Consumer<Auth>(builder: (context, auth, _) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
@@ -140,7 +162,7 @@ class _MyInfoScreenState extends State<MyInfoScreen> {
|
|||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 60, vertical: 10),
|
horizontal: 60, vertical: 10),
|
||||||
margin: EdgeInsets.only(
|
margin: EdgeInsets.only(
|
||||||
top: 50, bottom: 20),
|
top: 20, bottom: 20),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ class Auth with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> sendRePass(String password, String token) async {
|
Future<String> sendRePass(
|
||||||
|
String password, String passwordConfirmation, String token) async {
|
||||||
print(password);
|
print(password);
|
||||||
print(token);
|
print(token);
|
||||||
|
|
||||||
@@ -90,9 +91,12 @@ class Auth with ChangeNotifier {
|
|||||||
Uri.parse(Url.sendResetPass),
|
Uri.parse(Url.sendResetPass),
|
||||||
body: {
|
body: {
|
||||||
'password': password,
|
'password': password,
|
||||||
'password_confirmation': password,
|
'password_confirmation': passwordConfirmation,
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
'Authorization': User.token,
|
||||||
|
// 'X-Requested-With': 'XMLHttpRequest',
|
||||||
},
|
},
|
||||||
headers: {'Authorization': token, 'X-Requested-With': 'XMLHttpRequest'},
|
|
||||||
// headers: {'X-Requested-With': 'XMLHttpRequest'},
|
// headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||||
);
|
);
|
||||||
final responseData = json.decode(response.body);
|
final responseData = json.decode(response.body);
|
||||||
@@ -102,7 +106,8 @@ class Auth with ChangeNotifier {
|
|||||||
// return 'Done';
|
// return 'Done';
|
||||||
// }
|
// }
|
||||||
print(responseData);
|
print(responseData);
|
||||||
if (responseData['status'] == 'Success') {
|
if (responseData['status'] == 'Success' &&
|
||||||
|
responseData['message'] == 'Success Change Password') {
|
||||||
return 'done';
|
return 'done';
|
||||||
} else {
|
} else {
|
||||||
return 'error';
|
return 'error';
|
||||||
|
|||||||
Reference in New Issue
Block a user