risk profile api

This commit is contained in:
jayesh
2024-04-08 19:02:21 +05:30
23 changed files with 1141 additions and 641 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,12 +1,19 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:traderscircuit/controller/risk_profile_controller.dart';
import '../text.dart';
class CustomDropDownWidget extends StatefulWidget {
const CustomDropDownWidget(
{super.key, required this.header, required this.listData});
{super.key,
required this.header,
required this.title,
required this.listData});
final String header;
final String title;
final List<String> listData;
@override
@@ -16,6 +23,27 @@ class CustomDropDownWidget extends StatefulWidget {
class _CustomDropDownWidgetState extends State<CustomDropDownWidget> {
RxBool onDropTap = false.obs;
RxString selectedValue = "".obs;
RiskProfileController riskProfileController =
Get.put(RiskProfileController());
void updateOrAddData(String key, String value) {
bool keyExists = false;
for (int i = 0; i < riskProfileController.selectedData.length; i++) {
Map<String, String> item = riskProfileController.selectedData[i];
if (item.containsKey(key)) {
riskProfileController.selectedData[i][key] =
value; // Update existing value
keyExists = true;
break;
}
}
if (!keyExists) {
// Add new key-value pair
riskProfileController.selectedData.add({key: value});
}
}
@override
Widget build(BuildContext context) {
return Obx(
@@ -146,6 +174,8 @@ class _CustomDropDownWidgetState extends State<CustomDropDownWidget> {
onTap: () {
selectedValue.value = widget.listData[index];
onDropTap.value = !onDropTap.value;
updateOrAddData(
widget.title, widget.listData[index]);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,

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

@@ -4,7 +4,16 @@ class ApiUrls {
static const String pieBase = "https://app.piadvisors.in/";
//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";
@@ -20,6 +29,5 @@ class ApiUrls {
//RISK PROFILE API
static String getRiskProfileQuestionAnswerApi = "${base}riskProfileQueAns";
static String addRiskProfileQuestionAnswerApi =
"${base}getRiskProfileQuestionAnswerApi";
static String addRiskProfileQuestionAnswerApi = "${base}addUserRiskProfile";
}

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

@@ -0,0 +1,9 @@
import 'package:get/get.dart';
import '../model/RiskProfileModel/risk_profile_ques_answer_model.dart';
class RiskProfileController extends GetxController {
RiskProfileQuestionAnswerModel riskProfileQuestionAnswerModel =
RiskProfileQuestionAnswerModel();
List<Map<String, String>> selectedData = [];
}

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, {bool isAuth = false}) async {
if (kDebugMode) {
@@ -19,13 +22,20 @@ 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(url,
options: Options(headers: {
isAuth ? 'authorization' : "Bearer $token": "",
}));
options: (token == null || token == "")
? Options(
headers: {
"Authorization": basicAuth,
},
)
: Options(headers: {
"Authorization": basicAuth,
'access-token': token,
}));
if (response.statusCode == 200) {
return ResponseData<dynamic>(
@@ -62,13 +72,20 @@ 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: Options(headers: {
isAuth ? 'authorization' : "Bearer $token": "",
}));
options: (token == null || token == "")
? Options(
headers: {
"Authorization": basicAuth,
},
)
: Options(headers: {
"Authorization": basicAuth,
'access-token': token,
}));
} on Exception catch (e) {
if (e is DioException) {
log(e.response.toString());
@@ -109,7 +126,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

@@ -54,59 +54,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

@@ -0,0 +1,123 @@
class RiskProfileQuestionAnswerModel {
String? status;
int? statusCode;
String? message;
List<Data>? data;
RiskProfileQuestionAnswerModel(
{this.status, this.statusCode, this.message, this.data});
RiskProfileQuestionAnswerModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
statusCode = json['status_code'];
message = json['message'];
if (json['data'] != null) {
data = <Data>[];
json['data'].forEach((v) {
data!.add(Data.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['status'] = status;
data['status_code'] = statusCode;
data['message'] = message;
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Data {
int? id;
String? question;
String? isActive;
String? createdAt;
String? updatedAt;
List<Answer>? answer;
Data(
{this.id,
this.question,
this.isActive,
this.createdAt,
this.updatedAt,
this.answer});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
question = json['question'];
isActive = json['is_active'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
if (json['answer'] != null) {
answer = <Answer>[];
json['answer'].forEach((v) {
answer!.add(Answer.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['question'] = question;
data['is_active'] = isActive;
data['created_at'] = createdAt;
data['updated_at'] = updatedAt;
if (answer != null) {
data['answer'] = answer!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Answer {
int? id;
int? questionId;
String? answer;
int? points;
String? isActive;
String? createdAt;
String? updatedAt;
Answer(
{this.id,
this.questionId,
this.answer,
this.points,
this.isActive,
this.createdAt,
this.updatedAt});
Answer.fromJson(Map<String, dynamic> json) {
id = json['id'];
questionId = json['question_id'];
answer = json['answer'];
points = json['points'];
isActive = json['is_active'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['question_id'] = questionId;
data['answer'] = answer;
data['points'] = points;
data['is_active'] = isActive;
data['created_at'] = createdAt;
data['updated_at'] = updatedAt;
return data;
}
}

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

@@ -68,6 +68,7 @@ class CreateTicketBottomSheet {
"Content Buytes",
"Market Insights"
],
title: "",
),
const Gap(14),
Stack(

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

@@ -14,6 +14,7 @@ import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import '../../controller/kyc_controller.dart';
import '../../view_model/RiskProfileApi/risk_profile_api.dart';
class Kyc extends StatefulWidget {
const Kyc({super.key});

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

@@ -1,15 +1,21 @@
import 'dart:ui';
import 'dart:convert';
import 'dart:developer';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:get/get.dart' hide FormData;
import 'package:traderscircuit/Utils/Common/CommonAppbar.dart';
import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/dialogs.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/controller/risk_profile_controller.dart';
import 'package:traderscircuit/model/RiskProfileModel/risk_profile_ques_answer_model.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import '../../Utils/Common/commonBotton.dart';
import '../../Utils/Common/custom_drop_down.dart';
import '../../resources/routes/route_name.dart';
import '../../view_model/RiskProfileApi/risk_profile_api.dart';
class UpdateRiskProfile extends StatefulWidget {
const UpdateRiskProfile({super.key});
@@ -19,6 +25,34 @@ class UpdateRiskProfile extends StatefulWidget {
}
class _UpdateRiskProfileState extends State<UpdateRiskProfile> {
RxBool isLoading = true.obs;
RiskProfileController riskProfileController =
Get.put(RiskProfileController());
List<int> questionIdList = [];
List<int> answerIdList = [];
List<Map<String, List<String>>> dropHeader = [];
@override
void initState() {
RiskProfileApi().getRiskProfileData().then((value) {
riskProfileController.riskProfileQuestionAnswerModel =
RiskProfileQuestionAnswerModel.fromJson(value.data);
for (var a
in riskProfileController.riskProfileQuestionAnswerModel.data!) {
List<String> titleTxt = [];
titleTxt.clear();
for (var b in a.answer!) {
titleTxt.add(b.answer!);
}
dropHeader.add({a.question!: titleTxt});
}
log(dropHeader.toString());
isLoading.value = false;
});
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -28,125 +62,151 @@ class _UpdateRiskProfileState extends State<UpdateRiskProfile> {
),
backgroundColor: Colors.black,
extendBody: true,
body: Stack(
children: [
const CommonBlurLeft(),
const CommonBlurRight(),
Stack(
children: [
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: ListView(
physics: const BouncingScrollPhysics(),
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
updateRiskProfileData(
"What is your investment goal?",
"Select your goal",
),
updateRiskProfileData(
"Add Investment Experience field",
"Select your Experience",
),
updateRiskProfileData(
"What types of stocks do you prefer?",
"Select types of stock",
),
updateRiskProfileData(
"What is your Risk Perception?",
"Select your Perception",
),
updateRiskProfileData(
"What is your favoured Market Condition?",
"Select Condition",
),
updateRiskProfileData(
"What is your Emotional Response to Market Volatility?",
"Choose your query",
),
SizedBox(
height: 70.h,
),
CommonBtn(
text: "Submit",
onTap: () {
Get.toNamed(RouteName.mainscreen);
},
),
SizedBox(
height: 10.h,
),
],
body: Obx(
() => isLoading.value
? const Center(
child: CircularProgressIndicator(
color: Color(0xFF9A0000),
),
)
: Stack(
children: [
const CommonBlurLeft(),
const CommonBlurRight(),
Stack(
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 16),
child: ListView.builder(
itemCount: riskProfileController
.riskProfileQuestionAnswerModel
.data!
.length +
1,
itemBuilder: (ctx, index) {
return riskProfileController
.riskProfileQuestionAnswerModel
.data!
.length <=
index
? Column(
children: [
SizedBox(
height: 70.h,
),
CommonBtn(
text: "Submit",
onTap: () {
questionIdList.clear();
answerIdList.clear();
if (riskProfileController
.riskProfileQuestionAnswerModel
.data!
.length !=
riskProfileController
.selectedData.length) {
utils.showToast(
"All Fields Required");
} else {
// Iterate through selected data and match with provided data
for (var entry
in riskProfileController
.selectedData) {
String question =
entry.keys.first;
String answer =
entry.values.first;
// Find matching question
var questionMatch =
riskProfileController
.riskProfileQuestionAnswerModel
.data!
.firstWhere(
(item) =>
item.question ==
question,
);
if (questionMatch != null) {
questionIdList
.add(questionMatch.id!);
}
// Find matching answer
if (questionMatch != null) {
var answerMatch =
questionMatch.answer!
.firstWhere(
(ans) =>
ans.answer == answer,
);
if (answerMatch != null) {
answerIdList
.add(answerMatch.id!);
}
}
}
RiskProfileApi()
.addRiskProfileData(
FormData.fromMap({
"question_ids": jsonEncode(
questionIdList),
"answer_ids":
jsonEncode(answerIdList),
}))
.then((value) {
Map<String, dynamic>
responseData =
Map<String, dynamic>.from(
value.data);
utils.showToast(
responseData["message"]);
Get.toNamed(
RouteName.mainscreen);
});
}
},
),
SizedBox(
height: 10.h,
),
],
)
: updateRiskProfileData(
riskProfileController
.riskProfileQuestionAnswerModel
.data![index]
.question!,
"Select your goal",
index);
})),
],
),
],
),
],
),
],
),
);
}
}
Widget updateRiskProfileData(
String tilte,
String headerText,
) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18W400(tilte),
SizedBox(
height: 15.h,
),
CustomDropDownWidget(
header: headerText,
listData: dropHeader[headerText]!,
),
SizedBox(
height: 35.h,
),
],
);
Widget updateRiskProfileData(String tilte, String headerText, int index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18W400(tilte),
SizedBox(
height: 15.h,
),
CustomDropDownWidget(
header: headerText,
listData: dropHeader[index][tilte]!,
title: tilte,
),
SizedBox(
height: 35.h,
),
],
);
}
}
Map<String, List<String>> dropHeader = {
"Select your goal": [
"Wealth Preservation",
"Capital Growth",
"Income Generation",
"Retirement Planning"
],
"Select your Experience": [
"No Experience",
"Beginner (0 - 3 months)",
"Intermediate (3 - 12 months)",
"Expert ( > 12 months)",
"Professional ( 3 - 5 years )"
],
"Select types of stock": [
"Swing Trade",
"Options",
"Multibagger",
"Long term",
],
"Select your Perception": [
"Very Conservative",
"Conservative",
"Moderate",
"Aggressive",
],
"Select Condition": [
"Bullish",
"Neutral",
"Bearish",
],
"Choose your query": [
"Calm",
"Neutral",
"Anxious",
"Stressed",
],
};

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

@@ -28,7 +28,6 @@ class RiskProfileApi {
final response = await NetworkApiServices().postApi(
data,
ApiUrls.addRiskProfileQuestionAnswerApi,
isAuth: true,
);
log(response.data.toString());
if (response.status == ResponseStatus.SUCCESS) {

View File

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