Merge pull request #32 from WDI-Ideas/temp

profile
This commit is contained in:
Raj
2024-04-19 13:26:34 +05:30
committed by GitHub
12 changed files with 1062 additions and 406 deletions

View File

@@ -0,0 +1,32 @@
import 'package:dio/dio.dart';
import 'package:flutter/services.dart';
class Helper {
static Future<MultipartFile> networkImageToMultipartFile(
String imageUrl) async {
Dio dio = Dio();
Response<Uint8List> response = await dio.get<Uint8List>(imageUrl,
options: Options(responseType: ResponseType.bytes));
MultipartFile multipartFile = MultipartFile.fromBytes(
response.data!,
filename: "test.jpg",
);
return multipartFile;
}
static Future<MultipartFile> assetImageToMultipartFile(
String assetImagePath, String fileName) async {
ByteData assetByteData = await rootBundle.load(assetImagePath);
List<int> assetBytes = assetByteData.buffer.asUint8List();
MultipartFile file = MultipartFile.fromBytes(
assetBytes,
filename: fileName,
);
return file;
}
}

View File

@@ -48,4 +48,8 @@ class ApiUrls {
static String getContentBytesCategoriesApi =
"${base}getContentByteCategories";
static String getContentBytesApi = "${base}getContentBytes";
//Profile
static String Getprofile = "${base}getuserDetails";
static String updateprofile = "${base}updateuserDetails";
}

View File

@@ -0,0 +1,135 @@
class ProfileModel {
String? status;
int? statusCode;
String? message;
Data? data;
ProfileModel({this.status, this.statusCode, this.message, this.data});
ProfileModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
statusCode = json['status_code'];
message = json['message'];
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
data['status_code'] = this.statusCode;
data['message'] = this.message;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
int? id;
int? principalTypeXid;
int? principalSourceXid;
String? userName;
Null? gender;
String? dateOfBirth;
String? phoneNumber;
Null? otherPhoneNumber;
String? emailAddress;
Null? addressLine1;
Null? addressLine2;
String? city;
Null? postCode;
String? profilePhoto;
Null? referralCode;
Null? description;
int? whatsappUpdate;
int? profileUpdated;
int? riskProfileUpdated;
int? kycUpdated;
int? securedAccess;
String? playerId;
int? notificationAlert;
String? isActive;
Data(
{this.id,
this.principalTypeXid,
this.principalSourceXid,
this.userName,
this.gender,
this.dateOfBirth,
this.phoneNumber,
this.otherPhoneNumber,
this.emailAddress,
this.addressLine1,
this.addressLine2,
this.city,
this.postCode,
this.profilePhoto,
this.referralCode,
this.description,
this.whatsappUpdate,
this.profileUpdated,
this.riskProfileUpdated,
this.kycUpdated,
this.securedAccess,
this.playerId,
this.notificationAlert,
this.isActive});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
principalTypeXid = json['principal_type_xid'];
principalSourceXid = json['principal_source_xid'];
userName = json['user_name'];
gender = json['gender'];
dateOfBirth = json['date_of_birth'];
phoneNumber = json['phone_number'];
otherPhoneNumber = json['other_phone_number'];
emailAddress = json['email_address'];
addressLine1 = json['address_line1'];
addressLine2 = json['address_line2'];
city = json['city'];
postCode = json['post_code'];
profilePhoto = json['profile_photo'];
referralCode = json['referral_code'];
description = json['description'];
whatsappUpdate = json['whatsapp_update'];
profileUpdated = json['profile_updated'];
riskProfileUpdated = json['risk_profile_updated'];
kycUpdated = json['kyc_updated'];
securedAccess = json['secured_access'];
playerId = json['player_id'];
notificationAlert = json['notification_alert'];
isActive = json['is_active'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['principal_type_xid'] = this.principalTypeXid;
data['principal_source_xid'] = this.principalSourceXid;
data['user_name'] = this.userName;
data['gender'] = this.gender;
data['date_of_birth'] = this.dateOfBirth;
data['phone_number'] = this.phoneNumber;
data['other_phone_number'] = this.otherPhoneNumber;
data['email_address'] = this.emailAddress;
data['address_line1'] = this.addressLine1;
data['address_line2'] = this.addressLine2;
data['city'] = this.city;
data['post_code'] = this.postCode;
data['profile_photo'] = this.profilePhoto;
data['referral_code'] = this.referralCode;
data['description'] = this.description;
data['whatsapp_update'] = this.whatsappUpdate;
data['profile_updated'] = this.profileUpdated;
data['risk_profile_updated'] = this.riskProfileUpdated;
data['kyc_updated'] = this.kycUpdated;
data['secured_access'] = this.securedAccess;
data['player_id'] = this.playerId;
data['notification_alert'] = this.notificationAlert;
data['is_active'] = this.isActive;
return data;
}
}

View File

@@ -43,14 +43,16 @@ class RouteName {
static const String contentbytes = '/contentbytes';
//contact us
static const String contactUsMain = '/contactUsMain';
static const String contactUsMainDetails = '/contactUsMainDetails';
//my Profile
static const String myProfileScreen = '/myProfileScreen';
//content byte
static const String videosmore = '/videosmore';
static const String audiomore = '/audiomore';
static const String bookmore = '/bookmore';
}

View File

@@ -4,6 +4,7 @@ import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/MainScreen/ExploreUnseen.dart';
import 'package:traderscircuit/view/Sidemenu/AboutUs.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/ContentBytes.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/VideosMore.dart';
import 'package:traderscircuit/view/Sidemenu/FaqScreen.dart';
import 'package:traderscircuit/view/Sidemenu/PrivacyPolicy.dart';
import 'package:traderscircuit/view/Sidemenu/Settings.dart';
@@ -155,11 +156,16 @@ class AppRoutes {
name: RouteName.settings,
page: () => const Settings(),
),
GetPage(
GetPage(
name: RouteName.contentbytes,
page: () => const ContentBytes(),
),
//content byte
GetPage(
name: RouteName.videosmore,
page: () => const VideosMore(),
),
//contact us
GetPage(
@@ -175,6 +181,5 @@ class AppRoutes {
name: RouteName.myProfileScreen,
page: () => const MyProfileScreen(),
)
];
}

View File

@@ -6,10 +6,14 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:glassmorphism/glassmorphism.dart';
import 'package:lottie/lottie.dart';
import 'package:scgateway_flutter_plugin/scgateway_flutter_plugin.dart';
import 'package:traderscircuit/Utils/Common/CommonBottomNavigation.dart';
import 'package:traderscircuit/Utils/Common/CustomTextFormField.dart';
import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/view/MainScreen/MainScreen.dart';
import 'package:traderscircuit/view/MainScreen/Portfolio/Holdings.dart';
@@ -83,7 +87,7 @@ class _PastPerformanceState extends State<PastPerformance> {
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: Column(
child: ListView(
children: [
Row(
children: [
@@ -107,67 +111,53 @@ class _PastPerformanceState extends State<PastPerformance> {
),
],
),
CommonBtn(
text: "Add",
onTap: () {
// replaceAddAccountBtnWithLoader();
// Timer.periodic(Duration(seconds: 8), (timer) {
// // replaceLoaderWithAddAccountBtn();
// timer.cancel();
// });
fetchAuthToken().then((fetchedAuthToken) {
debugPrint("fetchedAuthToken $fetchedAuthToken");
fetchBrokerConnectTxnId(
authToken: fetchedAuthToken)
.then(
(txnId) => ScgatewayFlutterPlugin.initGateway(
fetchedAuthToken)
.then(
(value) => ScgatewayFlutterPlugin
.triggerGatewayTransaction(
txnId,
).then(
(loginRes) {
if (loginRes != null) {
var data = jsonDecode(loginRes)['data'];
if (data != null) {
String authToken = jsonDecode(
data)['smallcaseAuthToken'];
String brokerName =
jsonDecode(data)['broker'];
String txnId =
jsonDecode(data)['transactionId'];
// getUserId().then((userId) {
postBrokerAccount(
userId: "12",
brokerName: brokerName,
authToken: authToken,
txnId: txnId)
.then((isPosted) {
// replaceLoaderWithAddAccountBtn();
// Navigator.pushReplacement(
// context,
// MaterialPageRoute(
// builder: (context) =>
// Broker()));
ScaffoldMessenger.of(context)
.clearSnackBars();
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(
content: Text(
'New broker account is added')));
});
// });
// replaceLoaderWithAddAccountBtn();
}
}
},
),
),
);
});
}),
const Spacer(),
SizedBox(
height: 20.h,
),
commonGlassContainer(
width: double.infinity,
height: 440.h,
borderradius: 8,
customWidget: Column(
children: [
Row(
children: [
text18W400("Traders Circuit Metrics"),
text12W400("(Mar 2023 - Jan 2024)"),
],
),
],
),
),
SizedBox(
height: 20.h,
),
text24W500("Exited Calls"),
SizedBox(
height: 20.h,
),
ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: 3,
itemBuilder: (context, index) {
return cardMultibaggerWidget(
text: cardMultibagger[index]['text']!,
price: cardMultibagger[index]['price']!,
date: cardMultibagger[index]['date']!,
returns: cardMultibagger[index]['returns']!,
stoploss: cardMultibagger[index]['stoploss']!,
duration: cardMultibagger[index]['duration']!,
pdfname: cardMultibagger[index]['pdfname']!);
},
separatorBuilder: (context, index) {
return SizedBox(
height: 10,
);
},
),
// ListView.builder(itemBuilder: itemBuilder),
],
),
),
@@ -180,6 +170,195 @@ class _PastPerformanceState extends State<PastPerformance> {
);
}
List<Map<String, String>> cardMultibagger = [
{
'text': 'TATA MOTORS',
'price': '₹ 453 - ₹234',
'date': '25 March 2024',
'returns': '103%',
'stoploss': '₹ 198',
'duration': '271 Days',
'pdfname': 'Download Pdf'
},
{
'text': 'TATA MOTORS',
'price': '₹ 453 - ₹234',
'date': '25 March 2024',
'returns': '103%',
'stoploss': '₹ 198',
'duration': '271 Days',
'pdfname': 'Download Pdf'
},
{
'text': 'TATA MOTORS',
'price': '₹ 453 - ₹234',
'date': '25 March 2024',
'returns': '103%',
'stoploss': '₹ 198',
'duration': '271 Days',
'pdfname': 'Download Pdf'
},
];
Widget cardMultibaggerWidget({
required String text,
required String price,
required String date,
required String returns,
required String stoploss,
required String duration,
required String pdfname,
}) {
return commonGlassContainer(
width: double.infinity,
height: 330.h,
borderradius: 8,
customWidget: Column(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w),
child: Row(
children: [
GlassmorphicContainer(
width: 47.w,
height: 47.h,
borderRadius: 100,
blur: 10,
alignment: Alignment.center,
border: 0.9,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff3A3A3A),
Color(0xFF3A3A3A),
],
),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color.fromRGBO(70, 5, 1, 0.8),
Color.fromRGBO(102, 102, 102, 0.8),
],
),
child: Center(
child: Image.asset(
'assets/images/png/TATAMOTORS.NS_BIG 1.png',
width: 26.w,
height: 23.h,
),
),
),
sizedBoxWidth(15.w),
SizedBox(width: 200.w, child: text18W600(text)),
Spacer(),
Container(
width: 62.w,
height: 25.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r),
color: Color(0xFFFFAD31),
),
child: Center(child: text14W600_1B1B1B('Hold')),
)
],
),
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFF3A3A3A),
),
Padding(
padding: const EdgeInsets.all(18),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Initial Entry Price'),
sizedBoxHeight(5.h),
SizedBox(width: 150.w, child: text15W600(price))
],
),
sizedBoxWidth(30.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 130.w,
child: text14W400_979797('Date of recommendation')),
sizedBoxHeight(5.h),
text15W600(date)
],
)
],
),
sizedBoxHeight(15.h),
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('% Return'),
sizedBoxHeight(5.h),
SizedBox(
width: 150.w, child: text15W600_00FF19(returns))
],
),
sizedBoxWidth(30.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Stop Loss'),
sizedBoxHeight(5.h),
text15W600(stoploss)
],
)
],
),
sizedBoxHeight(15.h),
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Duration'),
sizedBoxHeight(5.h),
SizedBox(width: 150.w, child: text15W600(duration))
],
),
sizedBoxWidth(30.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Report'),
sizedBoxHeight(5.h),
Row(
children: [
Image.asset(
'assets/images/png/pdf.png',
height: 20.h,
width: 20.w,
),
text15W600(pdfname),
],
)
],
)
],
),
],
),
)
],
),
);
}
Future<bool> _onBackButtonPressed(BuildContext context) async {
bool? exitApp = await showDialog(
context: context,

View File

@@ -7,12 +7,14 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:traderscircuit/Utils/Common/CommonAppbar.dart';
import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/controller/content_bytes_controller.dart';
import 'package:traderscircuit/model/ContentBytesModel/content_bytes_categories_model.dart';
import 'package:traderscircuit/model/ContentBytesModel/content_bytes_model.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/PlayerWidget.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/read_pdf.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
@@ -86,127 +88,130 @@ class _ContentBytesState extends State<ContentBytes> {
child: Scaffold(
key: _scaffoldKey1,
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Obx(() => contentBytesController
.isAudioSeekBarVisible.value
? commonGlassContainer(
borderradius: 8,
width: Get.size.width,
height: 100,
customWidget: Row(
children: [
Expanded(
flex: 1,
child: Align(
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image.network(
contentBytesController
.contentBytesModel
.data!
.audio![
contentBytesController.indexForAudios.value]
.image!,
width: 57,
height: 57,
fit: BoxFit.cover,
floatingActionButton: Obx(
() => contentBytesController.isAudioSeekBarVisible.value
? commonGlassContainer(
borderradius: 8,
width: Get.size.width,
height: 100,
customWidget: Row(
children: [
Expanded(
flex: 1,
child: Align(
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image.network(
contentBytesController
.contentBytesModel
.data!
.audio![contentBytesController
.indexForAudios.value]
.image!,
width: 57,
height: 57,
fit: BoxFit.cover,
),
),
),
),
),
Expanded(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
contentBytesController
.contentBytesModel
.data!
.audio![
contentBytesController.indexForAudios.value]
.title!,
style: const TextStyle(
fontSize: 14,
color: Colors.white,
fontFamily: 'hiragino',
fontWeight: FontWeight.w600,
height: 1.5,
Expanded(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
contentBytesController
.contentBytesModel
.data!
.audio![contentBytesController
.indexForAudios.value]
.title!,
style: const TextStyle(
fontSize: 14,
color: Colors.white,
fontFamily: 'hiragino',
fontWeight: FontWeight.w600,
height: 1.5,
),
),
),
// SizedBox(height: 5),
Text(
contentBytesController
.contentBytesModel
.data!
.audio![
contentBytesController.indexForAudios.value]
.description!,
style: const TextStyle(
fontSize: 14,
color: Colors.white,
fontFamily: 'hiragino',
fontWeight: FontWeight.w600,
height: 1.5,
// SizedBox(height: 5),
Text(
contentBytesController
.contentBytesModel
.data!
.audio![contentBytesController
.indexForAudios.value]
.description!,
style: const TextStyle(
fontSize: 14,
color: Colors.white,
fontFamily: 'hiragino',
fontWeight: FontWeight.w600,
height: 1.5,
),
),
),
ValueListenableBuilder<ProgressBarState>(
valueListenable:
contentBytesController.progressNotifier,
builder: (context, value, _) {
return ProgressBar(
progress: value.current,
buffered: value.buffered,
total: value.total,
onSeek: contentBytesController.seek,
barHeight: 4,
thumbRadius: 6,
thumbGlowRadius: 15,
timeLabelTextStyle: TextStyle(
color: Colors.white,
),
thumbColor: Colors.white,
baseBarColor: Colors.white.withOpacity(0.3),
progressBarColor: Colors.white,
bufferedBarColor: Colors.white.withOpacity(0.3),
);
},
),
],
ValueListenableBuilder<ProgressBarState>(
valueListenable:
contentBytesController.progressNotifier,
builder: (context, value, _) {
return ProgressBar(
progress: value.current,
buffered: value.buffered,
total: value.total,
onSeek: contentBytesController.seek,
barHeight: 4,
thumbRadius: 6,
thumbGlowRadius: 15,
timeLabelTextStyle: TextStyle(
color: Colors.white,
),
thumbColor: Colors.white,
baseBarColor: Colors.white.withOpacity(0.3),
progressBarColor: Colors.white,
bufferedBarColor:
Colors.white.withOpacity(0.3),
);
},
),
],
),
),
),
Expanded(
flex: 1,
child: ValueListenableBuilder<ButtonState>(
valueListenable: contentBytesController.buttonNotifier,
builder: (context, value, _) {
switch (value) {
case ButtonState.paused:
return IconButton(
icon: const Icon(
Icons.play_arrow_rounded,
color: Colors.white,
),
iconSize: 50.0,
onPressed: () => contentBytesController.play(
contentBytesController
.indexForAudios.value),
);
case ButtonState.playing:
return IconButton(
icon: const Icon(Icons.pause,
color: Colors.white),
iconSize: 50.0,
onPressed: contentBytesController.pause,
);
}
},
Expanded(
flex: 1,
child: ValueListenableBuilder<ButtonState>(
valueListenable:
contentBytesController.buttonNotifier,
builder: (context, value, _) {
switch (value) {
case ButtonState.paused:
return IconButton(
icon: const Icon(
Icons.play_arrow_rounded,
color: Colors.white,
),
iconSize: 50.0,
onPressed: () => contentBytesController.play(
contentBytesController
.indexForAudios.value),
);
case ButtonState.playing:
return IconButton(
icon: const Icon(Icons.pause,
color: Colors.white),
iconSize: 50.0,
onPressed: contentBytesController.pause,
);
}
},
),
),
),
],
),
)
: Container()),
],
),
)
: Container(),
),
backgroundColor: Colors.black,
extendBody: true,
appBar: const CommonAppbar(titleTxt: "Content Bytes"),
@@ -301,7 +306,7 @@ class _ReadsState extends State<Reads> {
// SizedBox(
// height: 10.h,
// ),
text22W600('Harnessing the Power of Ebooks"'),
text22W600('Harnessing the Power of Ebooks'),
sizedBoxHeight(20.h),
ListView.builder(
itemCount:
@@ -885,7 +890,31 @@ class _VideosState extends State<Videos> {
// SizedBox(
// height: 10.h,
// ),
text22W600('Content Bytes'),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
text22W600('Content Bytes'),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.videosmore);
},
child: Container(
height: 35.h,
width: 105.w,
decoration: BoxDecoration(
color: Color(0xFF3A3A3A).withOpacity(0.6),
borderRadius: BorderRadius.circular(5.r),
border: Border.all(
color: Color(0xFF3A3A3A),
)),
child: Center(
child: text16W500('View More'),
),
),
),
],
),
sizedBoxHeight(8.w),
text16W400_DADADA('The Beauty and Power of Video'),
sizedBoxHeight(20.h),

View File

@@ -0,0 +1,78 @@
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:traderscircuit/Utils/Common/CommonAppbar.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/model/TermsConditionModel/terms_condition_model.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view_model/TermsAndConditionApi/terms_condition_api.dart';
class VideosMore extends StatefulWidget {
const VideosMore({super.key});
@override
State<VideosMore> createState() => _VideosMoreState();
}
class _VideosMoreState extends State<VideosMore> {
RxBool isLoading = false.obs;
// TermsAndConditionModel termsAndConditionModel = TermsAndConditionModel();
// @override
// void initState() {
// TermsAndConditionApi().getTermsAndConditionData().then((value) {
// termsAndConditionModel = TermsAndConditionModel.fromJson(value.data);
// isLoading.value = false;
// });
// super.initState();
// }
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const CommonAppbar(
titleTxt: "Videos",
),
backgroundColor: Colors.black,
extendBody: true,
body: Obx(
() => Stack(
children: [
const CommonBlurLeft(),
const CommonBlurRight(),
isLoading.value
? const Center(
child: CircularProgressIndicator(
color: Color(0xFF9A0000),
),
)
: Stack(
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 16),
child: ListView(
physics: const BouncingScrollPhysics(),
children: [
// CommonDropdownBtn(hint: "hint", items: ["hi", "hii"]),
SizedBox(
height: 10.h,
),
text16W400(
"",
),
SizedBox(
height: 10.h,
),
],
),
),
],
),
],
),
),
);
}
}

View File

@@ -8,6 +8,7 @@ import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view_model/ProfileAPI/GetProfileApi.dart';
class SideMenu extends StatefulWidget {
const SideMenu({super.key});
@@ -110,10 +111,10 @@ class _SideMenuState extends State<SideMenu> {
Container(
width: 80.w,
height: 80.h,
decoration: const ShapeDecoration(
decoration: ShapeDecoration(
image: DecorationImage(
image: AssetImage(
"assets/images/png/Ellipse 560 (1).png"),
image: NetworkImage(
ProfileObj!.data!.profilePhoto ?? ""),
fit: BoxFit.fill,
),
shape: OvalBorder(),
@@ -123,7 +124,7 @@ class _SideMenuState extends State<SideMenu> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18W400('Afrid Mulla'),
text18W400(ProfileObj!.data!.userName ?? ""),
sizedBoxHeight(4.h),
text18W400('My Profile'),
],

View File

@@ -1,10 +1,17 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:get/get.dart' hide MultipartFile, FormData;
import 'package:traderscircuit/Utils/Common/Helper.dart';
import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/Utils/utils.dart';
import 'package:traderscircuit/model/ProfileModel/GetProfileModel.dart';
import 'package:traderscircuit/view_model/ProfileAPI/GetProfileApi.dart';
import 'package:path/path.dart' as path;
import 'package:traderscircuit/view_model/ProfileAPI/PostProfileApi.dart';
import '../../../Utils/Common/CommonAppbar.dart';
import '../../../Utils/Common/CustomTextFormField.dart';
import '../../../Utils/Common/ImageUpload.dart';
@@ -21,6 +28,7 @@ class MyProfileScreen extends StatefulWidget {
}
class _MyProfileScreenState extends State<MyProfileScreen> {
RxBool isLoading = true.obs;
final ProfileImageController editProfileImage =
Get.put(ProfileImageController());
RxBool isEdit = false.obs;
@@ -31,6 +39,26 @@ class _MyProfileScreenState extends State<MyProfileScreen> {
TextEditingController dobController = TextEditingController();
TextEditingController cityController = TextEditingController();
late Future myfuture;
ProfileModel profileModel = ProfileModel();
@override
void initState() {
// TODO: implement initState
myfuture = GetProfile().GetProfileAPI().then((value) {
profileModel = ProfileModel.fromJson(value.data);
fullNameController.text = ProfileObj!.data!.userName ?? "User";
emailController.text = ProfileObj!.data!.emailAddress ?? "Email";
phoneNoController.text = ProfileObj!.data!.phoneNumber ?? "phone number";
dobController.text = ProfileObj!.data!.dateOfBirth ?? "date of birth";
cityController.text = ProfileObj!.data!.city ?? "date of birth";
isLoading.value = false;
});
super.initState();
}
DateTime timebackPressed = DateTime.now();
Future<void> _selectDate(BuildContext context) async {
@@ -69,6 +97,74 @@ class _MyProfileScreenState extends State<MyProfileScreen> {
}
}
void UploadData() async {
Utils.loader();
var imageFile;
if (editProfileImage.profilePicPath.value.isNotEmpty) {
imageFile = await MultipartFile.fromFile(
editProfileImage.profilePicPath.value,
filename: path.basename(editProfileImage.profilePicPath.value),
);
} else {
if (ProfileObj!.data!.profilePhoto == null) {
imageFile = await Helper.assetImageToMultipartFile(
"assets/images/profileBig.png", "profile");
} else {
if (editProfileImage.profilePicPath.value.isEmpty) {
imageFile = await Helper.networkImageToMultipartFile(
"${ProfileObj!.data!.profilePhoto ?? ""}",
);
} else {
imageFile = await MultipartFile.fromFile(
editProfileImage.profilePicPath.value,
filename: path.basename(editProfileImage.profilePicPath.value),
);
}
}
}
FormData formData;
if (editProfileImage.profilePicPath.value.isEmpty ||
editProfileImage.profilePicPath.value == "") {
formData = FormData.fromMap({
"user_name": fullNameController.text,
"email_address": emailController.text,
"phone_number": phoneNoController.text,
"date_of_birth": dobController.text,
"city": cityController.text,
});
} else {
formData = FormData.fromMap({
"user_name": fullNameController.text,
"email_address": emailController.text,
"phone_number": phoneNoController.text,
"date_of_birth": dobController.text,
"city": cityController.text,
'profile_photo': imageFile,
});
}
print("formData is ${formData.fields}");
final data = await PostProfileAPI(formData).ProfileApi();
// Profiledetails().postProfiledetails(formData);
if (data.status == ResponseStatus.SUCCESS) {
Get.back();
Utils.showToast("Profile updated Successfully!");
// Get.to(() => CustomBottomBar(pageIndex: 0));
Get.back(result: true);
GetProfile().GetProfileAPI();
// await prefs.setString('name', nameController.text);
// myusername = nameController.text;
// Get.back();
// Get.back(result: true);
} else {
Get.back();
return Utils.showToast(data.message);
}
}
@override
Widget build(BuildContext context) {
return Obx(
@@ -86,232 +182,247 @@ class _MyProfileScreenState extends State<MyProfileScreen> {
children: [
const CommonBlurLeft(),
const CommonBlurRight(),
Stack(
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 16),
child: ListView(
physics: const BouncingScrollPhysics(),
isLoading.value
? const Center(
child: CircularProgressIndicator(
color: Color(0xFF9A0000),
),
)
: Stack(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
text25W600("My Profile"),
isEdit.value
? const SizedBox()
: InkWell(
onTap: () {
isEdit.value = true;
},
child: CircleAvatar(
radius: 20.r,
backgroundColor: const Color(0xFF5A5A5A),
child: Icon(
Icons.edit,
size: 20.sp,
color: Colors.white,
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 16),
child: ListView(
physics: const BouncingScrollPhysics(),
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
text25W600("My Profile"),
isEdit.value
? const SizedBox()
: InkWell(
onTap: () {
isEdit.value = true;
},
child: CircleAvatar(
radius: 20.r,
backgroundColor:
const Color(0xFF5A5A5A),
child: Icon(
Icons.edit,
size: 20.sp,
color: Colors.white,
),
),
),
],
),
const Gap(20),
Center(
child: Stack(
children: [
Obx(
() => editProfileImage
.profilePicPath.value !=
''
? ClipOval(
child: SizedBox.fromSize(
size: Size.fromRadius(60.r),
child: editProfileImage
.profilePicPath
.value !=
''
? Image(
image: FileImage(
File(
editProfileImage
.profilePicPath
.value,
),
),
fit: BoxFit.cover,
width: 200.w,
height: 200.h,
)
: Image.asset(
"assets/images/blank-profile-picture-973460_1280.png"),
),
)
: ClipOval(
child: SizedBox.fromSize(
size: Size.fromRadius(60.r),
child: ProfileObj?.data!
.profilePhoto !=
null
? ClipOval(
child:
SizedBox.fromSize(
size:
Size.fromRadius(
25.r),
child: CircleAvatar(
backgroundImage:
NetworkImage(
ProfileObj!
.data!
.profilePhoto!),
radius: 25.r,
),
),
)
: Image.asset(
"assets/images/png/Ellipse 560 (1).png",
width: 130,
height: 130,
)),
),
),
Positioned(
right: 0,
bottom: 0,
child: GestureDetector(
onTap: () {
ImageUploadBottomSheet().showModal(
context,
false,
(result) {
print("File path is $result");
editProfileImage.profilePicPath
.value = result;
},
);
},
child: CircleAvatar(
radius: 20.r,
backgroundColor:
const Color(0xFF5A5A5A),
child: Icon(
Icons.camera_alt_outlined,
size: 20.sp,
color: Colors.white,
),
),
),
),
),
],
),
const Gap(20),
Center(
child: Stack(
children: [
Obx(
() =>
editProfileImage.profilePicPath.value != ''
? ClipOval(
child: SizedBox.fromSize(
size: Size.fromRadius(60.r),
child: editProfileImage
.profilePicPath
.value !=
''
? Image(
image: FileImage(
File(
editProfileImage
.profilePicPath
.value,
),
),
fit: BoxFit.cover,
width: 200.w,
height: 200.h,
)
: Image.asset(
"assets/images/blank-profile-picture-973460_1280.png"),
),
)
: ClipOval(
child: SizedBox.fromSize(
size: Size.fromRadius(60.r),
child:
// ProfileObj?.user?.profileImage !=
// null
// ? ClipOval(
// child: SizedBox.fromSize(
// size: Size.fromRadius(25.r),
// child: CircleAvatar(
// backgroundImage:
// NetworkImage(ProfileObj!
// .user!
// .profileImage!),
// radius: 25.r,
// ),
// ),
// )
// :
Image.asset(
"assets/images/png/Ellipse 560 (1).png",
width: 130,
height: 130,
)),
),
),
Positioned(
right: 0,
bottom: 0,
child: GestureDetector(
onTap: () {
ImageUploadBottomSheet().showModal(
context,
false,
(result) {
print("File path is $result");
editProfileImage.profilePicPath.value =
result;
},
);
},
child: CircleAvatar(
radius: 20.r,
backgroundColor: const Color(0xFF5A5A5A),
child: Icon(
Icons.camera_alt_outlined,
size: 20.sp,
color: Colors.white,
),
),
],
),
),
Row(
children: [
text18W400("Full Name"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: fullNameController,
enabled: isEdit.value,
validator: (value) {
if (value == "") {
return "Name is Required";
}
},
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Email Address"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: emailController,
enabled: isEdit.value,
texttype: TextInputType.emailAddress,
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Phone Number"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: phoneNoController,
enabled: isEdit.value,
texttype: TextInputType.phone,
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Date Of Birth"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: dobController,
enabled: isEdit.value,
suffixIcon: const Icon(
Icons.calendar_month_outlined,
color: Colors.white,
),
readonly: true,
onTap: () {
_selectDate(context);
},
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("City"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: cityController,
enabled: isEdit.value,
),
SizedBox(
height: 40.h,
),
!isEdit.value
? const SizedBox()
: SizedBox(
width: Get.width,
child: kycBtn(
text: "Save",
onTap: () {
final isValid =
formK.currentState?.validate();
if (isValid!) {
UploadData();
}
},
bgClr: const Color(0xFF6C0000),
borderClr: const Color(0xFF990000),
),
),
],
),
),
Row(
children: [
text18W400("Full Name"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: fullNameController,
enabled: isEdit.value,
validator: (value) {
if (value == "") {
return "Name is Required";
}
},
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Email Address"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: emailController,
enabled: isEdit.value,
texttype: TextInputType.emailAddress,
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Phone Number"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: phoneNoController,
enabled: isEdit.value,
texttype: TextInputType.phone,
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("Date Of Birth"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: dobController,
enabled: isEdit.value,
suffixIcon: const Icon(
Icons.calendar_month_outlined,
color: Colors.white,
),
readonly: true,
onTap: () {
_selectDate(context);
},
),
SizedBox(
height: 30.h,
),
Row(
children: [
text18W400("City"),
],
),
SizedBox(
height: 15.h,
),
CustomTextFormField(
textEditingController: cityController,
enabled: isEdit.value,
),
SizedBox(
height: 40.h,
),
!isEdit.value
? const SizedBox()
: SizedBox(
width: Get.width,
child: kycBtn(
text: "Save",
onTap: () {
final isValid =
formK.currentState?.validate();
if (isValid!) {}
},
bgClr: const Color(0xFF6C0000),
borderClr: const Color(0xFF990000),
),
),
)
],
),
)
],
)
)
],
),
),

View File

@@ -0,0 +1,42 @@
import 'dart:convert';
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';
import 'package:traderscircuit/model/ProfileModel/GetProfileModel.dart';
ProfileModel? ProfileObj;
class GetProfile {
GetProfile();
Future<ResponseData<dynamic>> GetProfileAPI() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
final response = await NetworkApiServices().getApi(ApiUrls.Getprofile);
if (response.status == ResponseStatus.SUCCESS) {
dynamic responseData = response.data;
if (responseData is Map<String, dynamic>) {
// Assuming response data is a map
ProfileObj = ProfileModel.fromJson(responseData);
} else if (responseData is String) {
// Parse the JSON string into a map
Map<String, dynamic> jsonMap;
try {
jsonMap = json.decode(responseData);
} catch (e) {
return ResponseData<dynamic>(
"Error decoding JSON string: $responseData",
ResponseStatus.FAILED);
}
} else {
// Handle other types if necessary
return ResponseData<dynamic>(
"Unexpected response format", ResponseStatus.FAILED);
}
}
return response;
}
}

View File

@@ -0,0 +1,38 @@
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 PostProfileAPI {
PostProfileAPI(this.data);
var data;
Future<ResponseData<dynamic>> ProfileApi() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
final response = await NetworkApiServices().postApi(
data,
// "https://development.wedzy.co/vendor_api/v1/vendor_business_add_information",
ApiUrls.updateprofile
// optionalpar: true,
);
if (response.status == ResponseStatus.SUCCESS) {
Map<String, dynamic> responseData =
Map<String, dynamic>.from(response.data);
if (responseData['status'] == "success") {
// print("registration sucess");
print("profile updated");
} else {
return ResponseData<dynamic>(
responseData['message'], ResponseStatus.FAILED);
}
} else if (response.status == ResponseStatus.FAILED &&
response.message == "Forbidden") {
Map<String, dynamic> responseData =
Map<String, dynamic>.from(response.data);
return ResponseData<dynamic>(
responseData['message'][0], ResponseStatus.FAILED);
}
return response;
}
}