Compare commits
13 Commits
7c47c2ce24
...
f8246d33ed
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8246d33ed | ||
|
|
f9fca85bf5 | ||
|
|
5cb32f1152 | ||
|
|
bb3eec2081 | ||
|
|
c108aa7ddd | ||
|
|
b547f96ec6 | ||
|
|
636f79fb60 | ||
|
|
7a33e1f2c0 | ||
|
|
e6e84a058c | ||
|
|
db8fd0f98b | ||
|
|
a6bbf734e9 | ||
|
|
2ac83c5c37 | ||
| 7960707396 |
@@ -1,4 +1,9 @@
|
||||
|
||||
|
||||
class ApiUrls {
|
||||
|
||||
|
||||
|
||||
static const baseUrl = "https://regroup.betadelivery.com/api/v1/";
|
||||
|
||||
static const getlogin = "${baseUrl}login";
|
||||
|
||||
@@ -13,9 +13,17 @@ import 'package:http/http.dart' as http;
|
||||
import '../../entry_point_controller.dart';
|
||||
|
||||
class NetworkApiServices {
|
||||
// String basicAuth = 'Basic ' +
|
||||
// base64.encode(
|
||||
// utf8.encode('RegroupUserName:71%@L%es^bUX94`J9XT*@bh,._WWM{\$%^^&&'));
|
||||
|
||||
Dio dio = Dio();
|
||||
final controllerEntryPoint = Get.put(EntryPointController());
|
||||
|
||||
String basicAuth = 'Basic ' +
|
||||
base64.encode(
|
||||
utf8.encode('RegroupUserName:71%@L%es^bUX94`J9XT*@bh,._WWM{\$%^^&&'));
|
||||
|
||||
Future<ResponseData> getApi(String url) async {
|
||||
if (kDebugMode) {
|
||||
print("api url is >>> $url");
|
||||
@@ -51,45 +59,136 @@ class NetworkApiServices {
|
||||
}
|
||||
}
|
||||
|
||||
Future<ResponseData> postApi({data, required String url}) async {
|
||||
// Future<ResponseData> postApi(
|
||||
// data,
|
||||
// String url,
|
||||
// {bool optionalpar = false}
|
||||
// ) async {
|
||||
// if (kDebugMode) {
|
||||
// print("data >>> $data");
|
||||
// print("api url is >>> $url");
|
||||
// }
|
||||
// Response response;
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// // ignore: unused_local_variable
|
||||
// String? token = prefs.getString('token').toString();
|
||||
// print("token is $token");
|
||||
// log(token.toString());
|
||||
// try {
|
||||
// response = await dio.post(url,
|
||||
// data: data,
|
||||
// options: optionalpar
|
||||
// ?
|
||||
// Options(
|
||||
// headers: {
|
||||
// "authorization": basicAuth,
|
||||
// },
|
||||
// )
|
||||
// :
|
||||
// Options(
|
||||
// headers: {'authorization': basicAuth, 'access-token': token},
|
||||
// ),
|
||||
// );
|
||||
// log(response.toString());
|
||||
// } on Exception catch (e) {
|
||||
// if (e is DioException) {
|
||||
// log(e.response.toString());
|
||||
// }
|
||||
// return ResponseData<dynamic>(
|
||||
// 'Opps something went wrong', ResponseStatus.FAILED);
|
||||
// }
|
||||
|
||||
// // if (kDebugMode) {
|
||||
// // print(response);
|
||||
// // }
|
||||
|
||||
// // print("response in post $response");
|
||||
|
||||
// if (response.statusCode == 200) {
|
||||
// // print(response.data);
|
||||
|
||||
// return ResponseData<dynamic>("success", ResponseStatus.SUCCESS,
|
||||
// data: response.data);
|
||||
// } else {
|
||||
// try {
|
||||
// return ResponseData<dynamic>(
|
||||
// response.data['message'].toString(), ResponseStatus.FAILED);
|
||||
// } catch (_) {
|
||||
// return ResponseData<dynamic>(
|
||||
// response.statusMessage!, ResponseStatus.FAILED);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//New post api
|
||||
|
||||
Future<ResponseData> postApi(data, String url,
|
||||
{bool optionalpar = false}) async {
|
||||
if (kDebugMode) {
|
||||
print("data >>> $data");
|
||||
print("api url is >>> $url");
|
||||
}
|
||||
Response response;
|
||||
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// ignore: unused_local_variable
|
||||
String? token = prefs.getString('token').toString();
|
||||
print("token is $token");
|
||||
String? token = prefs.getString('access-token');
|
||||
log(token.toString());
|
||||
log(basicAuth);
|
||||
try {
|
||||
response = await dio.post(url,
|
||||
data: data,
|
||||
options: Options(
|
||||
headers: {
|
||||
"authorization": "Bearer $token",
|
||||
'content-Type': 'application/json',
|
||||
"Accept": 'application/json'
|
||||
},
|
||||
));
|
||||
response = await dio.post(
|
||||
url,
|
||||
data: data,
|
||||
options: optionalpar
|
||||
? Options(
|
||||
headers: {
|
||||
"authorization": basicAuth,
|
||||
},
|
||||
)
|
||||
: Options(
|
||||
headers: {
|
||||
'authorization': basicAuth,
|
||||
// 'access-token': token
|
||||
},
|
||||
),
|
||||
);
|
||||
log(response.toString());
|
||||
} on Exception catch (e) {
|
||||
if (e is DioException) {
|
||||
log(e.response.toString());
|
||||
if (e.response == null) {
|
||||
return ResponseData<dynamic>(
|
||||
'Oops something Went Wrong, Please try again!',
|
||||
ResponseStatus.FAILED,
|
||||
);
|
||||
}
|
||||
if (e.response!.statusCode == 401) {
|
||||
prefs.remove('token');
|
||||
prefs.remove('refreshToken');
|
||||
// Get.toNamed(RouteName.login);
|
||||
return ResponseData<dynamic>(
|
||||
'Oops something Went Wrong, Please try again!',
|
||||
ResponseStatus.FAILED,
|
||||
);
|
||||
}
|
||||
if (e.response!.statusCode == 403) {
|
||||
return ResponseData<dynamic>(
|
||||
e.response!.statusMessage!, ResponseStatus.PRIVATE,
|
||||
data: e.response!.data);
|
||||
}
|
||||
}
|
||||
return ResponseData<dynamic>(
|
||||
'Opps something went wrong', ResponseStatus.FAILED);
|
||||
'Oops something Went Wrong',
|
||||
ResponseStatus.FAILED,
|
||||
);
|
||||
}
|
||||
|
||||
// if (kDebugMode) {
|
||||
// print(response);
|
||||
// }
|
||||
|
||||
// print("response in post $response");
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
// print(response.data);
|
||||
|
||||
if (response.statusCode == 200 || response.statusCode == 201) {
|
||||
return ResponseData<dynamic>("success", ResponseStatus.SUCCESS,
|
||||
data: response.data);
|
||||
} else if (response.statusCode == 203) {
|
||||
print(response.data);
|
||||
return ResponseData<dynamic>("success", ResponseStatus.PRIVATE,
|
||||
data: response.data);
|
||||
} else {
|
||||
try {
|
||||
return ResponseData<dynamic>(
|
||||
@@ -196,17 +295,18 @@ class NetworkApiServices {
|
||||
var resp = await response.stream.bytesToString();
|
||||
var jsonResp = jsonDecode(resp);
|
||||
print(jsonResp);
|
||||
var errorMessage = jsonResp["errors"]["email2"].join(", ") + "\n" +
|
||||
jsonResp["errors"]["contact_number2"].join(", ");
|
||||
var errorMessage = jsonResp["errors"]["email2"].join(", ") +
|
||||
"\n" +
|
||||
jsonResp["errors"]["contact_number2"].join(", ");
|
||||
// return ResponseData<dynamic>(
|
||||
// jsonResp["errors"][0]["email2"] +
|
||||
// jsonResp["errors"][0]["contact_number2"],
|
||||
// ResponseStatus.PRIVATE,
|
||||
// );
|
||||
return ResponseData<String>(
|
||||
errorMessage,
|
||||
ResponseStatus.PRIVATE,
|
||||
);
|
||||
return ResponseData<String>(
|
||||
errorMessage,
|
||||
ResponseStatus.PRIVATE,
|
||||
);
|
||||
} else if (response.statusCode == 500) {
|
||||
var resp = await response.stream.bytesToString();
|
||||
var jsonResp = jsonDecode(resp);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
LatLng? latlong;
|
||||
|
||||
@@ -25,3 +26,16 @@ getLocation() async {
|
||||
print('done');
|
||||
}
|
||||
|
||||
|
||||
setname() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
String? token = prefs.getString('token');
|
||||
if (token != null) {
|
||||
// await ProfileAPI().getApi();
|
||||
// prefs.setString('email', getProfileObj!.data!.email!);
|
||||
// prefs.setString('profile_img', getProfileObj!.data!.profilePhoto!);
|
||||
// prefs.setString('firstName', getProfileObj!.data!.firstName!);
|
||||
// prefs.setString('phoneNo', getProfileObj!.data!.phoneNo ?? "");
|
||||
// prefs.setInt('complete', getProfileObj!.data!.profileComplete ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
|
||||
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
|
||||
import 'package:regroup/Common/global.dart' as global;
|
||||
// import 'package:regroup/Common/global.dart' as global;
|
||||
|
||||
class LoginScreen extends StatefulWidget {
|
||||
const LoginScreen({super.key});
|
||||
@@ -106,14 +108,15 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
);
|
||||
} else {
|
||||
Map<String, String> updata = {
|
||||
"email": _emailController.text,
|
||||
"email_address": _emailController.text,
|
||||
"password": _passwordController.text,
|
||||
"access-token":
|
||||
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3JlZ3JvdXAuYmV0YWRlbGl2ZXJ5LmNvbS9hcGkvdjEvbG9naW4iLCJpYXQiOjE3MjA1MDgwNzcsIm5iZiI6MTcyMDUwODA3NywianRpIjoiNlFsbU1hSzB1cGJ2MDN5WSIsInN1YiI6IjIzIiwicHJ2IjoiNDBiYzNmZGUzNDYyNTdhODUwOTUwMmZlNjQyMzU1OWExMTE2NGJkMyJ9.3rmDa3ZXoAPFlxAVx-Rms78tZ-VHaVDYn1YG3eYYQp0",
|
||||
// "access-token" : ""
|
||||
//
|
||||
// "player_id": global.player_id!,
|
||||
};
|
||||
final data = await LoginAPI().loginApi(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
// await global.setname();
|
||||
Get.snackbar(
|
||||
"Success!",
|
||||
'Login successful!',
|
||||
@@ -265,6 +268,11 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter your password';
|
||||
}
|
||||
if (!RegExp(
|
||||
r'^(?=.*?[A-Z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{8,}$')
|
||||
.hasMatch(value)) {
|
||||
return 'Enter a valid password';
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
@@ -285,7 +293,11 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
alignment: Alignment.centerRight,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(right: 6.w),
|
||||
child: text14400white('Forgot password ?'),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(RouteName.forgotpass);
|
||||
},
|
||||
child: text14400white('Forgot password ?')),
|
||||
)),
|
||||
sizedBoxHeight(40.h),
|
||||
CustomButton(
|
||||
|
||||
@@ -1,23 +1,26 @@
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Common/controller/data/network/network_api.dart';
|
||||
import 'package:regroup/Login/Model/LoginModel.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class LoginAPI {
|
||||
LoginAPI();
|
||||
Future<ResponseData<dynamic>> loginApi(var data) async {
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final response = await NetworkApiServices().postApi(url: 'https://regroup.betadelivery.com/api/v1/login', data: data
|
||||
Future<ResponseData> loginApi(var data) async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final response = await NetworkApiServices().postApi(
|
||||
data, 'https://regroup.betadelivery.com/api/v1/login',
|
||||
optionalpar: true
|
||||
|
||||
// "auth/login/",
|
||||
);
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
//Map<String, dynamic> responseData = jsonDecode(response.data);
|
||||
if (response.data['success'] == true) {
|
||||
if (response.data['status'] == 'success') {
|
||||
LoginModel loginObj = LoginModel.fromJson(response.data);
|
||||
// await prefs.setString('token', loginObj.data!.access!);
|
||||
await prefs.setString('access-token', loginObj.data!.accessToken!);
|
||||
// await prefs.setString('refreshToken', loginObj.data!.refresh!);
|
||||
// print("token is ${loginObj.data!.access!}");
|
||||
print("token is ${loginObj.data!.accessToken!}");
|
||||
// print("refresh-token is ${loginObj.data!.refresh!}");
|
||||
} else {
|
||||
return ResponseData<dynamic>(
|
||||
|
||||
@@ -530,6 +530,16 @@ Widget text12w400_FCFCFC(String text) {
|
||||
fontWeight: FontWeight.w400),
|
||||
);
|
||||
}
|
||||
Widget text12w400_8E8E8E(String text) {
|
||||
return Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: Color(0xFF8E8E8E),
|
||||
fontFamily: 'Helvetica',
|
||||
fontWeight: FontWeight.w400),
|
||||
);
|
||||
}
|
||||
|
||||
Widget text12w700_FCFCFC(String text) {
|
||||
return Text(
|
||||
|
||||
@@ -16,19 +16,19 @@ import 'package:statsfl/statsfl.dart';
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
SystemChrome.setPreferredOrientations([
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
]).then(
|
||||
(value) =>
|
||||
// runApp(MyApp())
|
||||
runApp(StatsFl(
|
||||
align: Alignment.center,
|
||||
width: 200,
|
||||
height: 100,
|
||||
child: const MyApp())),
|
||||
);
|
||||
}
|
||||
]).then((value) =>
|
||||
// runApp(MyApp())
|
||||
runApp(const MyApp())
|
||||
|
||||
// StatsFl(
|
||||
// align: Alignment.center,
|
||||
// width: 200,
|
||||
// height: 100,
|
||||
// child: const MyApp())),
|
||||
);
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
61
lib/onboarding/NewPass/View/NewPass.dart
Normal file
61
lib/onboarding/NewPass/View/NewPass.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:regroup/Common/CommonButton.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
|
||||
class NewPassword extends StatefulWidget {
|
||||
const NewPassword({super.key});
|
||||
|
||||
@override
|
||||
State<NewPassword> createState() => _NewPasswordState();
|
||||
}
|
||||
|
||||
class _NewPasswordState extends State<NewPassword> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: Color(0xFF222935),
|
||||
extendBody: true,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: CommonAppbar(
|
||||
titleTxt: "",
|
||||
),
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
sizedBoxHeight(30.h),
|
||||
text22400white("Create password"),
|
||||
sizedBoxHeight(15.h),
|
||||
Container(
|
||||
height: 1.h,
|
||||
width: 250.w,
|
||||
color: Color(0xFF858585),
|
||||
),
|
||||
sizedBoxHeight(35.h),
|
||||
text16w400_FCFCFC("Create new password"),
|
||||
sizedBoxHeight(15.h),
|
||||
CustomTextFormField(),
|
||||
sizedBoxHeight(20.h),
|
||||
text16w400_FCFCFC("Confirm password"),
|
||||
sizedBoxHeight(15.h),
|
||||
CustomTextFormField(),
|
||||
sizedBoxHeight(90.h),
|
||||
CommonBtn(text: 'Continue'),
|
||||
])))
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,16 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:glassmorphism/glassmorphism.dart';
|
||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
import 'package:regroup/Utils/Common/CustomNextButton.dart';
|
||||
import 'package:regroup/Utils/Common/blureffect.dart';
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/onboarding/forgotPass/ViewModel/ForgotPassAPI.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class VerifyuserScreenState extends StatefulWidget {
|
||||
const VerifyuserScreenState({super.key});
|
||||
@@ -20,8 +23,64 @@ class VerifyuserScreenState extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _VerifyuserScreenStateState extends State<VerifyuserScreenState> {
|
||||
String accounttype = Get.arguments;
|
||||
// String accounttype = Get.arguments;
|
||||
TextEditingController? pincode = TextEditingController();
|
||||
final String emailAddress = Get.arguments;
|
||||
|
||||
String? principleId;
|
||||
|
||||
// principleId = prefs.getString('email').toString();
|
||||
|
||||
checkValidation() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
principleId = prefs.getString('principal_xid');
|
||||
if (pincode!.text.isEmpty) {
|
||||
utils.showToast('Pin field is empty');
|
||||
} else {
|
||||
Map<String, String> updata = {
|
||||
"iam_principal_xid": principleId.toString(),
|
||||
"otp": pincode!.text,
|
||||
};
|
||||
final data = await ForgotPassAPI().verifyotp(updata);
|
||||
if (data.status == ResponseStatus.SUCCESS) {
|
||||
// btnController.success();
|
||||
// btnController.reset();
|
||||
Get.snackbar(
|
||||
"Success!",
|
||||
'OTP verification successful!',
|
||||
duration: Duration(seconds: 2),
|
||||
colorText: Colors.white,
|
||||
backgroundColor: Colors.green,
|
||||
margin: EdgeInsets.all(8),
|
||||
snackStyle: SnackStyle.FLOATING,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
Future.delayed(Duration(seconds: 1), () {
|
||||
Get.toNamed(RouteName.newpassword, arguments: emailAddress);
|
||||
});
|
||||
// print('success');
|
||||
} else {
|
||||
// btnController.error();
|
||||
// btnController.reset();
|
||||
Get.snackbar(
|
||||
"Error!",
|
||||
data.data['message'],
|
||||
duration: Duration(seconds: 2),
|
||||
colorText: Colors.white,
|
||||
backgroundColor: Colors.red,
|
||||
margin: EdgeInsets.all(8),
|
||||
snackStyle: SnackStyle.FLOATING,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
print(emailAddress);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -80,7 +139,7 @@ class _VerifyuserScreenStateState extends State<VerifyuserScreenState> {
|
||||
text22400white('Check your email'),
|
||||
sizedBoxHeight(10.h),
|
||||
text14400white(
|
||||
'Enter the verification code that we sent to loremipsum@gmail.com'),
|
||||
'Enter the verification code that we sent to $emailAddress'),
|
||||
sizedBoxHeight(40.h),
|
||||
text16400white('Enter code'),
|
||||
sizedBoxHeight(20.h),
|
||||
@@ -147,17 +206,18 @@ class _VerifyuserScreenStateState extends State<VerifyuserScreenState> {
|
||||
CustomButton(
|
||||
text: 'Continue',
|
||||
onPressed: () {
|
||||
if (pincode!.text.isEmpty) {
|
||||
utils.showToast('Pin field is empty');
|
||||
} else {
|
||||
if (accounttype == 'Individual') {
|
||||
print('individual selected');
|
||||
Get.toNamed(RouteName.tellusindividualscreen);
|
||||
} else if (accounttype == 'Business') {
|
||||
print('business selected');
|
||||
Get.toNamed(RouteName.tellusbusinessscreen);
|
||||
}
|
||||
}
|
||||
// if (pincode!.text.isEmpty) {
|
||||
// utils.showToast('Pin field is empty');
|
||||
// } else {
|
||||
// if (accounttype == 'Individual') {
|
||||
// print('individual selected');
|
||||
// Get.toNamed(RouteName.tellusindividualscreen);
|
||||
// } else if (accounttype == 'Business') {
|
||||
// print('business selected');
|
||||
// Get.toNamed(RouteName.tellusbusinessscreen);
|
||||
// }
|
||||
// }
|
||||
checkValidation();
|
||||
}),
|
||||
const Spacer(
|
||||
// flex: 2,
|
||||
|
||||
161
lib/onboarding/forgotPass/View/ForgotPass.dart
Normal file
161
lib/onboarding/forgotPass/View/ForgotPass.dart
Normal file
@@ -0,0 +1,161 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
||||
import 'package:regroup/Utils/Common/CustomNextButton.dart';
|
||||
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
|
||||
import 'package:regroup/Utils/Common/sized_box.dart';
|
||||
import 'package:regroup/Utils/dialogs.dart';
|
||||
import 'package:regroup/Utils/texts.dart';
|
||||
import 'package:regroup/onboarding/forgotPass/ViewModel/ForgotPassAPI.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class ForgotPass extends StatefulWidget {
|
||||
const ForgotPass({super.key});
|
||||
|
||||
@override
|
||||
State<ForgotPass> createState() => _ForgotPassState();
|
||||
}
|
||||
|
||||
class _ForgotPassState extends State<ForgotPass> {
|
||||
TextEditingController emailController = TextEditingController();
|
||||
// final _formKey = GlobalKey<FormState>();
|
||||
|
||||
checkValidation() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
if (emailController.text.isEmpty) {
|
||||
utils.showToast('Enter a email address');
|
||||
} else if (!emailController.text.isEmail) {
|
||||
utils.showToast('Enter a valid email address');
|
||||
} else {
|
||||
// Get.toNamed(RouteName.verifyusercreen,
|
||||
// arguments: {
|
||||
// "emailAddress": emailController.text
|
||||
// });
|
||||
|
||||
Map<String, String> updata = {
|
||||
"email_address": emailController.text,
|
||||
};
|
||||
final resp = await ForgotPassAPI().requestotp(updata);
|
||||
if (resp.status == ResponseStatus.SUCCESS) {
|
||||
Get.snackbar(
|
||||
"Success!",
|
||||
'OTP sent successfully!',
|
||||
duration: Duration(seconds: 2),
|
||||
colorText: Colors.white,
|
||||
backgroundColor: Colors.green,
|
||||
margin: EdgeInsets.all(8),
|
||||
snackStyle: SnackStyle.FLOATING,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
prefs.setString('email', emailController.text);
|
||||
prefs.setString('principal_xid', resp.data['data']['iam_principal_xid']);
|
||||
Future.delayed(Duration(seconds: 1), () {
|
||||
Get.toNamed(RouteName.verifyusercreen,
|
||||
arguments: emailController.text);
|
||||
});
|
||||
// print('success');
|
||||
} else if (resp.status == ResponseStatus.FAILED) {
|
||||
Get.snackbar(
|
||||
"Error!",
|
||||
resp.message,
|
||||
duration: Duration(seconds: 2),
|
||||
colorText: Colors.white,
|
||||
backgroundColor: Colors.red,
|
||||
margin: EdgeInsets.all(8),
|
||||
snackStyle: SnackStyle.FLOATING,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
// btnController.error();
|
||||
// btnController.reset();
|
||||
Get.snackbar(
|
||||
"Error!",
|
||||
resp.data['message'],
|
||||
duration: Duration(seconds: 2),
|
||||
colorText: Colors.white,
|
||||
backgroundColor: Colors.red,
|
||||
margin: EdgeInsets.all(8),
|
||||
snackStyle: SnackStyle.FLOATING,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
// key: _scaffoldKey1,
|
||||
backgroundColor: Color(0xFF222935),
|
||||
extendBody: true,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: CommonAppbar(
|
||||
titleTxt: "",
|
||||
),
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
||||
fit: BoxFit.fill)),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
sizedBoxHeight(30.h),
|
||||
text22400white("Forgot password"),
|
||||
sizedBoxHeight(15.h),
|
||||
Container(
|
||||
height: 1.h,
|
||||
width: 250.w,
|
||||
color: Color(0xFF858585),
|
||||
),
|
||||
sizedBoxHeight(35.h),
|
||||
text16w400_FCFCFC("Email address"),
|
||||
sizedBoxHeight(15.h),
|
||||
CustomTextFormField(
|
||||
textEditingController: emailController,
|
||||
leadingIcon: Container(
|
||||
height: 18.h,
|
||||
width: 23.w,
|
||||
child: Center(
|
||||
child: Image.asset(
|
||||
"assets/images/png/Frame 12 (1).png",
|
||||
height: 18.h,
|
||||
width: 23.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
hintText: "loremipsum@gmail.comess",
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Enter your e-mail address';
|
||||
}
|
||||
if (!RegExp(
|
||||
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$')
|
||||
.hasMatch(value)) {
|
||||
return 'Enter a valid e-mail address';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
sizedBoxHeight(8.h),
|
||||
text12w400_8E8E8E(
|
||||
"We’ll send four digit code to the registered email"),
|
||||
sizedBoxHeight(90.h),
|
||||
CustomButton(
|
||||
text: 'Continue',
|
||||
onPressed: () {
|
||||
checkValidation();
|
||||
}),
|
||||
])))
|
||||
]));
|
||||
}
|
||||
}
|
||||
50
lib/onboarding/forgotPass/ViewModel/ForgotPassAPI.dart
Normal file
50
lib/onboarding/forgotPass/ViewModel/ForgotPassAPI.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
import 'package:regroup/Common/base_manager.dart';
|
||||
import 'package:regroup/Common/controller/data/network/network_api.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class ForgotPassAPI {
|
||||
ForgotPassAPI();
|
||||
// class otpAPI {
|
||||
// otpAPI(this.data);
|
||||
// var data;
|
||||
Future<ResponseData<dynamic>> requestotp(var data) async {
|
||||
final response = await NetworkApiServices().postApi(
|
||||
data,
|
||||
"https://regroup.betadelivery.com/api/v1/forgot-password",
|
||||
);
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
//Map<String, dynamic> responseData = jsonDecode(response.data);
|
||||
if (response.data['status'] == "success") {
|
||||
return ResponseData<dynamic>(
|
||||
response.data['message'], ResponseStatus.SUCCESS,data: response.data);
|
||||
} else {
|
||||
return ResponseData<dynamic>(
|
||||
response.data['message'], ResponseStatus.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<ResponseData<dynamic>> verifyotp(var data) async {
|
||||
final response = await NetworkApiServices().postApi(
|
||||
data,
|
||||
"https://regroup.betadelivery.com/api/v1/forgot-password/verify-otp",
|
||||
);
|
||||
|
||||
if (response.status == ResponseStatus.SUCCESS) {
|
||||
//Map<String, dynamic> responseData = jsonDecode(response.data);
|
||||
if (response.data['status'] == "success") {
|
||||
return ResponseData<dynamic>(
|
||||
response.data['message'], ResponseStatus.SUCCESS);
|
||||
} else {
|
||||
return ResponseData<dynamic>(
|
||||
response.data['message'], ResponseStatus.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ class RouteName {
|
||||
static const String verifyusercreen = '/verifyuser';
|
||||
static const String tellusindividualscreen = '/tellusindividualscreen';
|
||||
static const String tellusbusinessscreen = '/tellusbusinessscreen';
|
||||
static const String forgotpass = '/forgotpass';
|
||||
|
||||
static const String individualprofilestep1 = '/individualprofilestep1';
|
||||
static const String individualactivitystep2 = '/individualactivitystep2';
|
||||
@@ -79,8 +80,9 @@ class RouteName {
|
||||
static const String changepassword = '/changepassword';
|
||||
static const String addtimeline = '/addtimeline';
|
||||
static const String verifycode = '/verifycode';
|
||||
static const String availability = '/availability';
|
||||
static const String newpassword = '/newpassword';
|
||||
|
||||
static const String availability = '/availability';
|
||||
|
||||
//Group Tab
|
||||
|
||||
@@ -96,8 +98,6 @@ class RouteName {
|
||||
static const String certificate = '/certificate';
|
||||
static const String sessions = '/sessions';
|
||||
|
||||
|
||||
|
||||
//subgroup
|
||||
static const String subgroups = '/subgroups';
|
||||
static const String subgroupinfo = '/subgroupinfo';
|
||||
@@ -110,7 +110,5 @@ class RouteName {
|
||||
static const String searchgroup = '/searchgroup';
|
||||
static const String detailexplore = '/detailexplore';
|
||||
|
||||
|
||||
|
||||
static const String notificaationpage = '/notificationpage';
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ import 'package:regroup/Feed%20Module/sidemenu/SavedPosts/SavedPosts.dart';
|
||||
import 'package:regroup/Feed%20Module/sidemenu/sidemenu.dart';
|
||||
|
||||
import 'package:regroup/Utils/Common/NoInternet.dart';
|
||||
import 'package:regroup/onboarding/NewPass/View/NewPass.dart';
|
||||
import 'package:regroup/onboarding/Signup/View/Business/step1Letusunderstandbetter.dart';
|
||||
import 'package:regroup/onboarding/Signup/View/Business/step2Selectgroup.dart';
|
||||
import 'package:regroup/onboarding/Signup/View/Business/step3SelectCommunity.dart';
|
||||
@@ -96,6 +97,7 @@ import 'package:regroup/onboarding/Signup/View/communitycommitment.dart';
|
||||
import 'package:regroup/onboarding/Signup/View/signupendpage.dart';
|
||||
import 'package:regroup/onboarding/Signup/View/signupscreen.dart';
|
||||
import 'package:regroup/onboarding/Signup/View/verifyuser.dart';
|
||||
import 'package:regroup/onboarding/forgotPass/View/ForgotPass.dart';
|
||||
import 'package:regroup/onboarding/onboarding1.dart';
|
||||
import 'package:regroup/onboarding/splashscreen.dart';
|
||||
import 'package:regroup/resources/routes/route_name.dart';
|
||||
@@ -476,5 +478,14 @@ class AppRoutes {
|
||||
name: RouteName.sessions,
|
||||
page: () => const Sessions(),
|
||||
),
|
||||
|
||||
GetPage(
|
||||
name: RouteName.forgotpass,
|
||||
page: () => const ForgotPass(),
|
||||
),
|
||||
GetPage(
|
||||
name: RouteName.newpassword,
|
||||
page: () => const NewPassword(),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
48
pubspec.lock
48
pubspec.lock
@@ -552,30 +552,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.1"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.0"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_testing
|
||||
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -596,26 +572,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
|
||||
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.16+1"
|
||||
version: "0.12.16"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
|
||||
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.0"
|
||||
version: "0.5.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
|
||||
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.11.0"
|
||||
version: "1.10.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -636,10 +612,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
|
||||
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.0"
|
||||
version: "1.8.3"
|
||||
path_drawing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1021,14 +997,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "13.0.0"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user