add details

This commit is contained in:
Rajshinde046
2024-04-08 15:04:07 +05:30
parent abbd468500
commit 8cce1351ca
17 changed files with 857 additions and 555 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -57,10 +57,10 @@ class _CustomTextFormFieldState extends State<CustomTextFormField> {
Widget build(BuildContext context) {
return GlassmorphicContainer(
width: double.infinity,
height: 50,
height: 50.h,
borderRadius: 8,
blur: 10,
alignment: Alignment.bottomCenter,
alignment: Alignment.center,
border: 0.8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
@@ -82,6 +82,7 @@ class _CustomTextFormFieldState extends State<CustomTextFormField> {
],
),
child: TextFormField(
textAlignVertical: TextAlignVertical.center,
cursorColor: Colors.red,
initialValue: widget.value,
readOnly: widget.readonly,
@@ -127,7 +128,8 @@ class _CustomTextFormFieldState extends State<CustomTextFormField> {
? null
: widget.suffixIcon!,
border: InputBorder.none,
contentPadding: const EdgeInsets.symmetric(horizontal: 10),
contentPadding:
const EdgeInsets.symmetric(horizontal: 10, vertical: 20),
),
style: const TextStyle(color: Colors.white),
keyboardType: widget.texttype,

View File

@@ -1,6 +1,9 @@
// ignore_for_file: file_names, sized_box_for_whitespace
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
import 'package:traderscircuit/Utils/text.dart';
class NoInternet extends StatefulWidget {
const NoInternet({super.key});
@@ -13,6 +16,7 @@ class _NoInternetState extends State<NoInternet> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Container(
@@ -22,15 +26,11 @@ class _NoInternetState extends State<NoInternet> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'No Internet !',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
sizedBoxHeight(15.h),
Text(
'Please Check Your Internet\nConnection',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
Image.asset('assets/images/png/Nointernet.png'),
// sizedBoxHeight(50.h),
// text18W800('No Internet !'),
// sizedBoxHeight(15.h),
// text15W600('Please Check Your Internet\nConnection')
],
),
),

View File

@@ -1,6 +1,15 @@
class ApiUrls {
//Base URL
static const base = "http://192.168.50.117/Trader_circuit/api/";
static const base = "http://192.168.50.82/Trader_circuit/api/";
//send otp
static String sendOtp = "${base}sendOTP";
//verify otp
static String OTPVerify = "${base}OTPVerify";
//add details
static String AddDetails = "${base}userDetails";
// About API
static String aboutUsApi = "${base}aboutUs";

View File

@@ -15,4 +15,6 @@ enum ResponseStatus {
FAILED,
PRIVATE,
ERROR
}

31
lib/Utils/dialogs.dart Normal file
View File

@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';
class utils {
static showToast(String? msg) {
if (msg != null && msg != "null" && msg.isNotEmpty) {
Fluttertoast.showToast(msg: msg);
}
}
static loader() {
Get.dialog(
Dialog(
elevation: 0,
backgroundColor: Colors.transparent,
child: WillPopScope(
child: const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(
color: Colors.red,
),
],
),
onWillPop: () async => false),
),
barrierDismissible: false,
);
}
}

View File

@@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:developer';
import 'package:flutter/foundation.dart';
@@ -11,7 +12,9 @@ import 'base_api_services.dart';
class NetworkApiServices extends BaseApiServices {
Dio dio = Dio();
String basicAuth = 'Basic ' +
base64.encode(
utf8.encode('traderCircuitUser:71%@L%es^bUX94`J9XT*@bh,._WWM{'));
@override
Future<ResponseData> getApi(String url) async {
if (kDebugMode) {
@@ -19,7 +22,7 @@ class NetworkApiServices extends BaseApiServices {
}
Response response;
SharedPreferences prefs = await SharedPreferences.getInstance();
String? token = prefs.getString('token').toString();
String? token = prefs.getString('accessToken').toString();
log(token);
try {
response = await dio.get(
@@ -66,20 +69,19 @@ class NetworkApiServices extends BaseApiServices {
Response response;
SharedPreferences prefs = await SharedPreferences.getInstance();
String? token = prefs.getString('token');
String? token = prefs.getString('accessToken');
try {
response = await dio.post(url,
data: data,
options: (token == null || token == "")
? Options(
headers: {
"Authorization":
"Basic KzIkcVBiSlIzNncmaGUoalMmV0R6ZkpqdEVoSlVLVXA6dCRCZHEmSnQmc3Y0eUdqY0VVcTg5aEVZZHVSalhIMnU=",
"Authorization": basicAuth,
},
)
: Options(headers: {
"Authorization": "Bearer $token",
//'access-token': token,
"Authorization": basicAuth,
'access-token': token,
}));
} on Exception catch (e) {
if (e is DioException) {
@@ -121,7 +123,7 @@ class NetworkApiServices extends BaseApiServices {
}
Response response;
SharedPreferences prefs = await SharedPreferences.getInstance();
String? token = prefs.getString('token').toString();
String? token = prefs.getString('accessToken').toString();
log(token);
try {
response = await dio.delete(url,

View File

@@ -45,59 +45,59 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
late StreamSubscription<ConnectivityResult> subscription;
Connectivity connectivity = Connectivity();
// @override
// void initState() {
// super.initState();
// WidgetsBinding.instance.addObserver(this);
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
// connectivity = Connectivity();
// checkInternet();
// subscription =
// connectivity.onConnectivityChanged.listen((ConnectivityResult result) {
// _connectionStatus = result.toString();
// if (result == ConnectivityResult.wifi ||
// result == ConnectivityResult.mobile) {
// setState(() {
// _connectionStatus = result.toString();
connectivity = Connectivity();
checkInternet();
subscription =
connectivity.onConnectivityChanged.listen((ConnectivityResult result) {
_connectionStatus = result.toString();
if (result == ConnectivityResult.wifi ||
result == ConnectivityResult.mobile) {
setState(() {
_connectionStatus = result.toString();
// Get.back(result: true);
// });
// } else {
// setState(() {
// _connectionStatus = result.toString();
// Get.toNamed(RouteName.nointernet);
// });
// }
// });
// // print(_connectionStatus);
// }
Get.back(result: true);
});
} else {
setState(() {
_connectionStatus = result.toString();
Get.toNamed(RouteName.nointernet);
});
}
});
// print(_connectionStatus);
}
// Future<void> checkInternet() async {
// final connectivityResult = await (Connectivity().checkConnectivity());
Future<void> checkInternet() async {
final connectivityResult = await (Connectivity().checkConnectivity());
// if (connectivityResult == ConnectivityResult.wifi ||
// connectivityResult == ConnectivityResult.mobile) {
// setState(() {
// _connectionStatus = connectivityResult.toString();
// });
// } else {
// setState(() {
// _connectionStatus = connectivityResult.toString();
// print(_connectionStatus.toString());
// Get.toNamed(RouteName.nointernet);
if (connectivityResult == ConnectivityResult.wifi ||
connectivityResult == ConnectivityResult.mobile) {
setState(() {
_connectionStatus = connectivityResult.toString();
});
} else {
setState(() {
_connectionStatus = connectivityResult.toString();
print(_connectionStatus.toString());
Get.toNamed(RouteName.nointernet);
// // Navigator.pushReplacementNamed(context, "/noInternet");
// });
// }
// }
// Navigator.pushReplacementNamed(context, "/noInternet");
});
}
}
// @override
// void dispose() {
// super.dispose();
// WidgetsBinding.instance.removeObserver(this);
@override
void dispose() {
super.dispose();
WidgetsBinding.instance.removeObserver(this);
// subscription.cancel();
// }
subscription.cancel();
}
// This widget is the root of your application.
@override

View File

@@ -62,23 +62,10 @@ class _ExploreUnseenState extends State<ExploreUnseen> {
child: ListView(physics: BouncingScrollPhysics(), children: [
text22W600('Explore The Unseen'),
sizedBoxHeight(35.h),
DefaultTabController(
length: 2,
initialIndex: 1,
child: Column(
children: [
MyTabBar(),
SizedBox(
height: 700.h,
child: TabBarView(
children: [
ActiveCallsTab(),
ExitedCallsTab(),
],
),
),
],
),
Column(
children: [
ActiveCallsTab(),
],
),
]))
])
@@ -176,47 +163,6 @@ class _ExploreUnseenState extends State<ExploreUnseen> {
);
}
Widget ExitedCallsTab() {
List<Map<String, String>> cardcall = [
{
'text': 'Trident Ltd',
'amount': '₹ 453 - ₹234',
'pdfname': 'Download Pdf',
},
{
'text': 'Trident Ltd',
'amount': '₹ 453 - ₹234',
'pdfname': 'Download Pdf',
},
{
'text': 'Trident Ltd',
'amount': '₹ 453 - ₹234',
'pdfname': 'Download Pdf',
},
];
return SingleChildScrollView(
child: Column(
children: [
sizedBoxHeight(25.h),
Column(
children: List.generate(cardcall.length, (index) {
return Column(
children: [
cardcallWidget(
text: cardcall[index]['text']!,
amount: cardcall[index]['amount']!,
pdfname: cardcall[index]['pdfname']!),
sizedBoxHeight(20.h)
],
);
}),
),
],
),
);
}
Widget cardcallWidget(
{required String text, required String amount, required String pdfname}) {
return commonGlassContainer(

View File

@@ -3,12 +3,16 @@ import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:traderscircuit/Utils/Common/CommonAppbar.dart';
import 'package:traderscircuit/Utils/Common/CustomTextFormField.dart';
import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/Utils/utils.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view_model/Login/add_details_api.dart';
class AddDetails extends StatefulWidget {
const AddDetails({super.key});
@@ -18,7 +22,12 @@ class AddDetails extends StatefulWidget {
}
class _AddDetailsState extends State<AddDetails> {
final GlobalKey<FormState> _adddetailsform = GlobalKey<FormState>();
TextEditingController pincode = TextEditingController();
TextEditingController fullName = TextEditingController();
TextEditingController email = TextEditingController();
TextEditingController phone = TextEditingController();
TextEditingController city = TextEditingController();
TextEditingController dobcontroller = TextEditingController();
Color primaryColor = Colors.transparent.withOpacity(0.2);
Color secondaryColor = Colors.grey.shade800;
@@ -69,6 +78,53 @@ class _AddDetailsState extends State<AddDetails> {
}
}
_addDetails() async {
final isValid = _adddetailsform.currentState?.validate();
if (isValid!) {
Utils.loader();
Map<String, dynamic> updata = {
"full_name": fullName.text,
"email_address": email.text,
"mobile_number": phone.text,
"date_of_birth": dobcontroller.text,
"city": city.text,
"whatsapp_update": isSwitched == false ? 0 : 1,
};
final resp = await AddDetailsAPI(updata).adddetailsApi();
if (resp.status == ResponseStatus.SUCCESS) {
Get.back();
Get.toNamed(RouteName.kyc);
// SharedPreferences prefs = await SharedPreferences.getInstance();
// await prefs.setString('accessToken', resp.data["data"]["access-token"]);
// await prefs.setString('productType',
// resp.data["data"]["nature_of_business_id"].toString());
// naturebusiness =
// resp.data["data"]["nature_of_business_id"].toString();
// ProfileApi().GetProfileApi().then(
// (value) {
// Get.toNamed(RouteName.mainscreen);
// },
// );
// Get.to(() => CustomBottomBar(pageIndex: 0));
} else if (resp.status == ResponseStatus.PRIVATE) {
Get.back();
String? message = resp.data['message'];
Utils.showToast("$message");
} else if (resp.status == ResponseStatus.ERROR) {
Get.back();
String? message = resp.data['message'];
Utils.showToast("$message");
} else {
Get.back();
String? message = resp.data['message'];
Utils.showToast("$message");
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -83,129 +139,140 @@ class _AddDetailsState extends State<AddDetails> {
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: ListView(
physics: BouncingScrollPhysics(),
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
child: Form(
key: _adddetailsform,
child: ListView(
physics: BouncingScrollPhysics(),
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
text18W400("Full Name"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Email Address"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
texttype: TextInputType.emailAddress,
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Phone Number"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
texttype: TextInputType.phone,
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Date Of Birth"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
suffixIcon: Icon(
Icons.calendar_month_outlined,
color: Colors.white,
children: [
Row(
children: [
text18W400("Full Name"),
],
),
readonly: true,
onTap: () {
_selectDate(context);
},
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("City"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(),
SizedBox(
height: 40.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image.asset(
"assets/images/png/whatsapp.png",
height: 34.h,
width: 34.w,
),
SizedBox(
width: 10.w,
),
text18W600("Get Updates on WhatsApp"),
],
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: fullName,
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Email Address"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: email,
texttype: TextInputType.emailAddress,
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Phone Number"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: phone,
texttype: TextInputType.phone,
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Date Of Birth"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: dobcontroller,
suffixIcon: Icon(
Icons.calendar_month_outlined,
color: Colors.white,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Switch(
value: isSwitched,
onChanged: _toggleSwitch,
activeTrackColor: Colors.green,
activeColor: Colors.white,
inactiveTrackColor: Colors.white,
inactiveThumbColor: Colors.black,
),
],
),
],
),
SizedBox(
height: 70.h,
),
CommonBtn(
text: "Next",
onTap: () {
Get.toNamed(RouteName.kyc);
},
),
SizedBox(
height: 10.h,
),
],
readonly: true,
onTap: () {
_selectDate(context);
},
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("City"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: city,
),
SizedBox(
height: 40.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image.asset(
"assets/images/png/whatsapp.png",
height: 34.h,
width: 34.w,
),
SizedBox(
width: 10.w,
),
text18W600("Get Updates on WhatsApp"),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Switch(
value: isSwitched,
onChanged: _toggleSwitch,
activeTrackColor: Colors.green,
activeColor: Colors.white,
inactiveTrackColor: Colors.white,
inactiveThumbColor: Colors.black,
),
],
),
],
),
SizedBox(
height: 70.h,
),
CommonBtn(
text: "Next",
onTap: () {
_addDetails();
// Get.toNamed(RouteName.kyc);
},
),
SizedBox(
height: 10.h,
),
],
),
),
),
],

View File

@@ -7,9 +7,13 @@ import 'package:get/get.dart';
import 'package:glassmorphism/glassmorphism.dart';
import 'package:traderscircuit/Utils/Common/CustomTextFormField.dart';
import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/Utils/utils.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view_model/Login/send_otp_api.dart';
import 'package:traderscircuit/Utils/Dialogs.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key});
@@ -19,6 +23,7 @@ class LoginScreen extends StatefulWidget {
}
class _LoginScreenState extends State<LoginScreen> {
final GlobalKey<FormState> _sendotpform = GlobalKey<FormState>();
TextEditingController phonecontroller = TextEditingController();
bool isValidPhoneNumber(String phoneNumber) {
final RegExp phoneNumberExpression = RegExp(r"^0{10}$");
@@ -40,289 +45,329 @@ class _LoginScreenState extends State<LoginScreen> {
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: ListView(
physics: const BouncingScrollPhysics(),
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 20.h,
),
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Traders Circuit",
style: TextStyle(
fontFamily: 'hiragino',
color: Colors.white,
fontSize: 25,
fontWeight: FontWeight.w600),
),
],
),
SizedBox(
height: 42.h,
),
const Text(
"Lets get started ",
style: TextStyle(
fontFamily: 'hiragino',
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.w700),
),
SizedBox(
height: 10.h,
),
text18W800("Enter your mobile number to get otp"),
SizedBox(
height: 35.h,
),
Row(
children: [
Expanded(
child: GlassmorphicContainer(
width: 60,
height: 50,
borderRadius: 8,
blur: 10,
alignment: Alignment.center,
border: 0.8,
linearGradient: LinearGradient(
child: Form(
key: _sendotpform,
child: ListView(
physics: const BouncingScrollPhysics(),
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 20.h,
),
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Traders Circuit",
style: TextStyle(
fontFamily: 'hiragino',
color: Colors.white,
fontSize: 25,
fontWeight: FontWeight.w600),
),
],
),
SizedBox(
height: 42.h,
),
const Text(
"Lets get started ",
style: TextStyle(
fontFamily: 'hiragino',
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.w700),
),
SizedBox(
height: 10.h,
),
text18W800("Enter your mobile number to get otp"),
SizedBox(
height: 35.h,
),
Row(
children: [
Expanded(
child: GlassmorphicContainer(
width: 60,
height: 50,
borderRadius: 8,
blur: 10,
alignment: Alignment.center,
border: 0.8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: const [
0.1,
1,
]),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
const Color(0xff9A0000).withOpacity(0.5),
const Color(0xFFffffff).withOpacity(0.5),
],
stops: const [
0.1,
1,
]),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xff9A0000).withOpacity(0.5),
const Color(0xFFffffff).withOpacity(0.5),
],
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
// SvgPicture.asset("assets/images/svg/india.svg"),
Image.asset(
"assets/images/png/india.png",
height: 25.h,
width: 25.h,
),
const SizedBox(
width: 2,
),
const Text(
"+91",
style: TextStyle(
fontFamily: 'hiragino',
fontSize: 15,
color: Colors.white,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
// SvgPicture.asset("assets/images/svg/india.svg"),
Image.asset(
"assets/images/png/india.png",
height: 25.h,
width: 25.h,
),
)
],
const SizedBox(
width: 2,
),
const Text(
"+91",
style: TextStyle(
fontFamily: 'hiragino',
fontSize: 15,
color: Colors.white,
),
)
],
),
),
),
),
const SizedBox(
width: 10,
),
SizedBox(
width: 285.w,
child: CustomTextFormField(
texttype: TextInputType.phone,
textEditingController: phonecontroller,
// validator: (value) {
// if (value.isEmpty) {
// return 'Enter your phone number';
// } else if (!RegExp(r'(^(?:[+0]9)?[0-9]{10}$)')
// .hasMatch(value)) {
// return 'Enter a valid phone number';
// } else if (!isValidPhoneNumber(value)) {
// return 'Phone number cannot contain 10 zeros';
// }
// return null;
// },
inputFormatters: [
LengthLimitingTextInputFormatter(10),
FilteringTextInputFormatter.allow(
RegExp('[0-9]')),
const SizedBox(
width: 10,
),
SizedBox(
width: 285.w,
child: CustomTextFormField(
texttype: TextInputType.phone,
textEditingController: phonecontroller,
// validator: (value) {
// if (value.isEmpty) {
// return 'Enter your phone number';
// } else if (!RegExp(r'(^(?:[+0]9)?[0-9]{10}$)')
// .hasMatch(value)) {
// return 'Enter a valid phone number';
// } else if (!isValidPhoneNumber(value)) {
// return 'Phone number cannot contain 10 zeros';
// }
// return null;
// },
inputFormatters: [
LengthLimitingTextInputFormatter(10),
FilteringTextInputFormatter.allow(
RegExp('[0-9]')),
],
),
)
],
),
const SizedBox(
height: 10,
),
text14W300(
"Well send six digit code to the registered number. Standard data rates may apply"),
SizedBox(
height: 65.h,
),
CommonBtn(
text: "Login/Signup",
onTap: () async {
final isValid =
_sendotpform.currentState?.validate();
if (isValid!) {
utils.loader();
FocusManager.instance.primaryFocus?.unfocus();
Map<String, String> myLoginData = {
"mobile_number": phonecontroller.text,
};
var resp =
await SendOtpAPI(myLoginData).sendOtpApi();
print(resp.status);
print('Api msg : ${resp.message}');
if (resp.status == ResponseStatus.SUCCESS) {
Get.back();
print("api response is ${resp.data}");
Utils.showToast("OTP sent successfully");
Map<String, dynamic> res = resp.data;
print(res);
Get.toNamed(RouteName.verifyotp, arguments: {
"phonenumber": phonecontroller.text
});
} else {
Get.back();
Utils.showToast(resp.message);
print('Api msg : ${resp.message}');
}
} else {
Get.snackbar(
"Error", "Please Enter Login Credentials",
margin: EdgeInsets.all(8),
snackStyle: SnackStyle.FLOATING,
snackPosition: SnackPosition.BOTTOM);
}
}),
SizedBox(
height: 10.h,
),
text14W300(
"By continuing, you agree to our Terms & Conditions"),
SizedBox(
height: 45.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 0.2.h,
width: 108.w,
color: Colors.white,
),
SizedBox(
width: 22.w,
),
text18W600("OR"),
SizedBox(
width: 22.w,
),
Container(
height: 0.2.h,
width: 108.w,
color: Colors.white,
),
],
),
SizedBox(
height: 40.h,
),
GlassmorphicContainer(
width: double.infinity,
height: 55.h,
borderRadius: 8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFffffff).withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: const [
0.1,
1,
]),
border: 0.3,
blur: 10,
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFAF2E89).withOpacity(0.2),
const Color(0xFFA23E31).withOpacity(0.2),
const Color(0xFF0000).withOpacity(0.2),
],
stops: const [
0.3,
0.6,
1,
]),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/images/png/apple.png",
height: 30.h,
width: 30.w,
),
SizedBox(
width: 7.h,
),
text16W400("Continue with apple"),
],
),
)
],
),
const SizedBox(
height: 10,
),
text14W300(
"Well send six digit code to the registered number. Standard data rates may apply"),
SizedBox(
height: 65.h,
),
CommonBtn(
text: "Login/Signup",
onTap: () {
Get.toNamed(RouteName.verifyotp);
}),
SizedBox(
height: 10.h,
),
text14W300(
"By continuing, you agree to our Terms & Conditions"),
SizedBox(
height: 45.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: 0.2.h,
width: 108.w,
color: Colors.white,
),
SizedBox(
width: 22.w,
),
text18W600("OR"),
SizedBox(
width: 22.w,
),
Container(
height: 0.2.h,
width: 108.w,
color: Colors.white,
),
],
),
SizedBox(
height: 40.h,
),
GlassmorphicContainer(
width: double.infinity,
height: 55.h,
borderRadius: 8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFffffff).withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: const [
0.1,
1,
]),
border: 0.3,
blur: 10,
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFAF2E89).withOpacity(0.2),
const Color(0xFFA23E31).withOpacity(0.2),
const Color(0xFF0000).withOpacity(0.2),
],
stops: const [
0.3,
0.6,
1,
]),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/images/png/apple.png",
height: 30.h,
width: 30.w,
),
SizedBox(
width: 7.h,
),
text16W400("Continue with apple"),
],
),
),
),
SizedBox(
height: 15.h,
),
GlassmorphicContainer(
width: double.infinity,
height: 55.h,
borderRadius: 8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFffffff).withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: const [
0.1,
1,
]),
border: 0.5,
blur: 10,
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFAF2E89).withOpacity(0.2),
const Color(0xFFA23E31).withOpacity(0.2),
const Color(0xFF0000).withOpacity(0.2),
],
stops: const [
0.3,
0.6,
1,
]),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/images/png/google.png",
height: 30.h,
width: 30.w,
),
SizedBox(
width: 7.h,
),
text16W400(
"Continue with google",
),
],
),
SizedBox(
height: 15.h,
),
),
SizedBox(
height: 45.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
onTap: () {
Get.toNamed(RouteName.mainscreen);
},
child: text16W700(
"Continue as guest",
GlassmorphicContainer(
width: double.infinity,
height: 55.h,
borderRadius: 8,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFffffff).withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: const [
0.1,
1,
]),
border: 0.5,
blur: 10,
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFAF2E89).withOpacity(0.2),
const Color(0xFFA23E31).withOpacity(0.2),
const Color(0xFF0000).withOpacity(0.2),
],
stops: const [
0.3,
0.6,
1,
]),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/images/png/google.png",
height: 30.h,
width: 30.w,
),
SizedBox(
width: 7.h,
),
text16W400(
"Continue with google",
),
],
),
),
],
)
],
),
SizedBox(
height: 45.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
onTap: () {
Get.toNamed(RouteName.mainscreen);
},
child: text16W700(
"Continue as guest",
),
),
],
)
],
),
),
),
],

View File

@@ -3,11 +3,20 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pin_code_fields/pin_code_fields.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:traderscircuit/Utils/Common/CommonAppbar.dart';
import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/Utils/utils.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view_model/Login/verify_number_api.dart';
bool? isVendorExist;
int? isProfileUpdated;
int? isriskProfileUpdated;
int? isKycUpdated;
class VerifyOTP extends StatefulWidget {
const VerifyOTP({super.key});
@@ -21,6 +30,73 @@ class _VerifyOTPState extends State<VerifyOTP> {
TextEditingController pincode = TextEditingController();
Color primaryColor = Colors.transparent.withOpacity(0.2);
Color secondaryColor = Colors.grey.shade800;
String? phonenumber;
@override
void initState() {
super.initState();
phonenumber = Get.arguments["phonenumber"];
}
_verifycheck() async {
final isValid = _otpform.currentState?.validate();
if (isValid!) {
Utils.loader();
Map<String, String> updata = {
"mobile_number": phonenumber.toString(),
"otp": pincode.text,
};
final resp = await VerifyNumberAPI(updata).verifynumberApi();
if (resp.status == ResponseStatus.SUCCESS) {
Get.back();
isVendorExist = resp.data["data"]["vendor_account_exist"];
isProfileUpdated = resp.data["data"]["user_data"]["profile_updated"];
isriskProfileUpdated =
resp.data["data"]["user_data"]["risk_profile_updated"];
isKycUpdated = resp.data["data"]["user_data"]["kyc_updated"];
if (isVendorExist!) {
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString(
'accessToken', resp.data["data"]["access-token"]);
// await prefs.setString('productType',
// resp.data["data"]["nature_of_business_id"].toString());
// naturebusiness =
// resp.data["data"]["nature_of_business_id"].toString();
// ProfileApi().GetProfileApi().then(
// (value) {
isProfileUpdated == 0
? Get.toNamed(RouteName.adddetails)
: isKycUpdated == 0
? Get.toNamed(RouteName.kyc)
: isriskProfileUpdated == 0
? Get.toNamed(RouteName.updateriskprofile)
: Get.toNamed(RouteName.mainscreen);
// Get.toNamed(RouteName.mainscreen);
// },
// );
// Get.to(() => CustomBottomBar(pageIndex: 0));
} else {
Get.toNamed(RouteName.loginscreen);
}
} else if (resp.status == ResponseStatus.PRIVATE) {
Get.back();
String? message = resp.data['message'];
Utils.showToast("$message");
} else if (resp.status == ResponseStatus.ERROR) {
Get.back();
String? message = resp.data['message'];
Utils.showToast("$message");
} else {
Get.back();
String? message = resp.data['message'];
Utils.showToast("$message");
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -113,7 +189,8 @@ class _VerifyOTPState extends State<VerifyOTP> {
CommonBtn(
text: "Verify OTP",
onTap: () {
Get.toNamed(RouteName.secureaccess);
_verifycheck();
// Get.toNamed(RouteName.secureaccess);
},
)
],

View File

@@ -0,0 +1,27 @@
import 'package:traderscircuit/Utils/api_urls.dart';
import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/data/network/network_api_services.dart';
class AddDetailsAPI {
AddDetailsAPI(this.data);
var data;
Future<ResponseData<dynamic>> adddetailsApi() async {
final response = await NetworkApiServices().postApi(
// optionalpar: true,
data,
ApiUrls.AddDetails,
);
if (response.status == ResponseStatus.SUCCESS) {
Map<String, dynamic> responseData =
Map<String, dynamic>.from(response.data);
if (responseData['status'] == "success") {
print("token is $response");
} else {
return ResponseData<dynamic>(
responseData['message'], ResponseStatus.FAILED);
}
}
return response;
}
}

View File

@@ -0,0 +1,28 @@
import 'package:shared_preferences/shared_preferences.dart';
import 'package:traderscircuit/Utils/api_urls.dart';
import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/data/network/network_api_services.dart';
class SendOtpAPI {
SendOtpAPI(this.data);
var data;
Future<ResponseData<dynamic>> sendOtpApi() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
final response = await NetworkApiServices().postApi(
data,
ApiUrls.sendOtp,
);
if (response.status == ResponseStatus.SUCCESS) {
Map<String, dynamic> responseData =
Map<String, dynamic>.from(response.data);
if (responseData['status'] == "success") {
print("OTP sent successfully");
} else {
return ResponseData<dynamic>(
responseData['message'], ResponseStatus.FAILED);
}
}
return response;
}
}

View File

@@ -0,0 +1,27 @@
import 'package:traderscircuit/Utils/api_urls.dart';
import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/data/network/network_api_services.dart';
class VerifyNumberAPI {
VerifyNumberAPI(this.data);
var data;
Future<ResponseData<dynamic>> verifynumberApi() async {
final response = await NetworkApiServices().postApi(
// optionalpar: true,
data,
ApiUrls.OTPVerify,
);
if (response.status == ResponseStatus.SUCCESS) {
Map<String, dynamic> responseData =
Map<String, dynamic>.from(response.data);
if (responseData['status'] == "success") {
print("token is $response");
} else {
return ResponseData<dynamic>(
responseData['message'], ResponseStatus.FAILED);
}
}
return response;
}
}

View File

@@ -93,10 +93,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
connectivity_plus:
dependency: "direct main"
description:
@@ -286,7 +286,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_branch_sdk:
dependency: transitive
description:
name: flutter_branch_sdk
sha256: "3850097e5c70d89db235fb160e92eac5928f4206ab167b0d83c7e4e50b1357f8"
url: "https://pub.dev"
source: hosted
version: "7.1.0"
flutter_cache_manager:
dependency: transitive
description:
@@ -295,7 +302,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.3.1"
flutter_isolate:
dependency: transitive
description:
name: flutter_isolate
sha256: "8ab879634322a012feb096153cf759caa118d81300189d1730455f3718bca24b"
url: "https://pub.dev"
source: hosted
version: "2.0.5-pre"
flutter_lints:
dependency: "direct dev"
description:
@@ -542,10 +556,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
mime:
dependency: transitive
description:
@@ -570,7 +584,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.5.0"
octo_image:
dependency: transitive
description:
@@ -587,23 +600,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.5.3"
package_info_plus:
dependency: transitive
description:
name: package_info_plus
sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017"
url: "https://pub.dev"
source: hosted
version: "4.2.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
path:
dependency: transitive
description:
@@ -724,7 +720,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.1.2"
rxdart:
dependency: transitive
description:
@@ -733,7 +728,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.27.7"
share_plus:
dependency: transitive
description:
name: share_plus
sha256: b1f15232d41e9701ab2f04181f21610c36c83a12ae426b79b4bd011c567934b1
url: "https://pub.dev"
source: hosted
version: "6.3.4"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
sha256: "251eb156a8b5fa9ce033747d73535bf53911071f8d3b6f4f0b578505ce0d4496"
url: "https://pub.dev"
source: hosted
version: "3.4.0"
shared_preferences:
dependency: "direct main"
description:
@@ -831,18 +841,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
@@ -871,10 +881,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
typed_data:
dependency: transitive
description:
@@ -883,17 +893,46 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811
url: "https://pub.dev"
source: hosted
version: "3.1.1"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b
url: "https://pub.dev"
source: hosted
version: "2.2.3"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7
url: "https://pub.dev"
source: hosted
version: "3.1.1"
uuid:
dependency: transitive
description:
name: uuid
sha256: "22c94e5ad1e75f9934b766b53c742572ee2677c56bc871d850a57dad0f82127f"
url: "https://pub.dev"
source: hosted
version: "4.2.2"
vector_graphics:
dependency: transitive
description:
@@ -1019,10 +1058,10 @@ packages:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
version: "0.3.0"
win32:
dependency: transitive
description:
@@ -1048,5 +1087,5 @@ packages:
source: hosted
version: "6.3.0"
sdks:
dart: ">=3.1.0 <4.0.0"
flutter: ">=3.13.0"
dart: ">=3.2.0 <4.0.0"
flutter: ">=3.16.0"

View File

@@ -63,4 +63,4 @@ flutter:
- family: hiragino
fonts:
- asset: assets/fonts/hiragino/Hiragino Sans GB W6.TTF
- asset: assets/fonts/hiragino/HiraginoInterface.ttc