Merge branch 'development_sikander' into 'master'

Development sikander

See merge request mirza.shafique/mohem_flutter_app!72
merge-requests/1/merge
Sikander Saleem 3 years ago
commit 4a5df86ca8

@ -271,6 +271,7 @@
"performance": "تقييم الاداء",
"performanceEvaluation": "تقييم الأداء في",
"performanceEvaluationIn": "تقييم أدائك في",
"valuationIn": "تقييم الأداء في",
"amount": "مقدار",
"correctCurrentDatails": "تعديل او اكمال التفاصيل الحالية",
"selectType": " حدد نوع التغيير الذي تريد القيام به",
@ -372,6 +373,20 @@
"offerAndDiscounts": "العروض والخصومات",
"offerValid": "العرض صالح",
"offerExpired": "انتهى العرض",
"whatAreYouOffering": "ما الذي تعرضه؟",
"selectCategory": "اختر الفئة",
"inProgress": "في تَقَدم",
"locked": "مقفل",
"addDetails": "أضف التفاصيل",
"reviewAndSell": "مراجعة وبيع",
"itemTitle": "عنوان البند",
"itemCondition": "حالة السلعة",
"used": "تستخدم",
"region": "منطقة",
"selectRegion": "اختر المنطقة",
"itemPrice": "سعر السلعة",
"itemPhotos": "صور البند",
"itemInfo": "معلومات العنصر",
"profile": {
"reset_password": {
"label": "Reset Password",

@ -316,7 +316,8 @@
"regular": "Regular",
"mark": "Mark",
"performance": "Performance Evaluation",
"performanceEvaluationIn": "Your performance Evaluation in ",
"performanceEvaluationIn": "Your performance Evaluation in",
"valuationIn": "Performance Evaluation in",
"viewBusinessCard": "View Business Card",
"performanceEvaluation": "Performance Evaluation",
"logout": "Logout",
@ -372,6 +373,20 @@
"offerAndDiscounts": "Offer & Discounts",
"offerValid": "Offer Valid",
"offerExpired": "Offer Expired",
"whatAreYouOffering": "What are you offering?",
"selectCategory": "Select Category",
"inProgress": "InProgress",
"locked": "Locked",
"addDetails": "Add Details",
"reviewAndSell": "Review & Sell",
"itemTitle": "Item Title",
"itemCondition": "Item Condition",
"used": "Used",
"region": "Region",
"selectRegion": "Select Region",
"itemPrice": "Item Price",
"itemPhotos": "Item Photos",
"itemInfo": "Item Info",
"profile": {
"reset_password": {
"label": "Reset Password",

@ -1,5 +1,6 @@
import 'dart:async';
import 'package:mohem_flutter_app/api/api_client.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart';
@ -11,21 +12,17 @@ import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart';
import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart';
import 'package:mohem_flutter_app/models/get_employee_phones_model.dart';
import 'package:mohem_flutter_app/models/performance.dart';
import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart';
import 'package:mohem_flutter_app/models/profile/get_contact_clos_structure_list.dart';
import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart';
import 'package:mohem_flutter_app/models/profile/get_countries_list_model.dart';
import 'package:mohem_flutter_app/models/profile/phone_number_types_model.dart';
import 'package:mohem_flutter_app/models/profile/start_address_approval_process_model.dart';
import 'package:mohem_flutter_app/models/profile/submit_address_transaction.dart';
import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart';
import 'package:mohem_flutter_app/models/profile/get_contact_clos_structure_list.dart';
import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart';
import 'package:mohem_flutter_app/models/profile/submit_basic_details_transaction_model.dart';
import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list_model.dart';
import 'package:mohem_flutter_app/models/profile/submit_phone_transactions.dart';
import 'package:mohem_flutter_app/models/start_phone_approval_process_model.dart';
import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list_model.dart';
import 'package:mohem_flutter_app/models/profile/submit_phone_transactions.dart';
import 'package:mohem_flutter_app/models/start_eit_approval_process_model.dart';
import 'package:mohem_flutter_app/api/api_client.dart';
class ProfileApiClient {
static final ProfileApiClient _instance = ProfileApiClient._internal();
@ -397,14 +394,14 @@ class ProfileApiClient {
}, url, postParams);
}
Future<List<GetPerformanceAppraisalList>?> getPerformanceAppraisal() async {
Future<List<GetPerformanceAppraisalList>> getPerformanceAppraisal() async {
String url = "${ApiConsts.erpRest}GET_Performance_Appraisal";
Map<String, dynamic> postParams = {};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getPerformanceAppraisalList;
return responseData.getPerformanceAppraisalList ?? [];
}, url, postParams);
}
}

@ -18,6 +18,7 @@ class MyColors {
static const Color grey98Color = Color(0xff989898);
static const Color lightGreyEFColor = Color(0xffEFEFEF);
static const Color lightGreyEDColor = Color(0xffEDEDED);
static const Color lightGreyDeColor = Color(0xffDEDEDE);
static const Color lightGreyE3Color = Color(0xffE3E3E3);
static const Color lightGreyE6Color = Color(0xffE6E6E6);
static const Color lightGreyEAColor = Color(0xffEAEAEA);
@ -29,7 +30,6 @@ class MyColors {
static const Color backgroundBlackColor = Color(0xff202529);
static const Color black = Color(0xff000000);
static const Color white = Color(0xffffffff);
static const Color green = Color(0xffffffff);
static const Color borderColor = Color(0xffE8E8E8);
static const Color borderE3Color = Color(0xffE3E3E3);
static const Color borderCEColor = Color(0xffCECECE);

@ -25,7 +25,7 @@ import 'package:mohem_flutter_app/ui/my_team/subordinate_leave.dart';
import 'package:mohem_flutter_app/ui/my_team/team_members.dart';
import 'package:mohem_flutter_app/ui/my_team/view_attendance.dart';
import 'package:mohem_flutter_app/ui/payslip/monthly_pay_slip_screen.dart';
import 'package:mohem_flutter_app/ui/performance/performance.dart';
import 'package:mohem_flutter_app/ui/performance/performance_appraisal_screen.dart';
import 'package:mohem_flutter_app/ui/profile/add_update_family_member.dart';
import 'package:mohem_flutter_app/ui/profile/basic_details.dart';
import 'package:mohem_flutter_app/ui/profile/contact_details.dart';

@ -42,12 +42,12 @@ extension WidgetExtensions on Widget {
child: this,
);
Widget objectContainerView({String title = "", String note = ""}) {
Widget objectContainerView({String title = "", String note = "", bool disablePadding = false,double radius =15}) {
return Container(
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14),
padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
borderRadius: BorderRadius.circular(radius),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),

@ -287,6 +287,7 @@ class CodegenLoader extends AssetLoader{
"performance": "تقييم الاداء",
"performanceEvaluation": "تقييم الأداء في",
"performanceEvaluationIn": "تقييم أدائك في",
"valuationIn": "تقييم الأداء في",
"amount": "مقدار",
"correctCurrentDatails": "تعديل او اكمال التفاصيل الحالية",
"selectType": " حدد نوع التغيير الذي تريد القيام به",
@ -388,6 +389,20 @@ class CodegenLoader extends AssetLoader{
"offerAndDiscounts": "العروض والخصومات",
"offerValid": "العرض صالح",
"offerExpired": "انتهى العرض",
"whatAreYouOffering": "ما الذي تعرضه؟",
"selectCategory": "اختر الفئة",
"inProgress": "في تَقَدم",
"locked": "مقفل",
"addDetails": "أضف التفاصيل",
"reviewAndSell": "مراجعة وبيع",
"itemTitle": "عنوان البند",
"itemCondition": "حالة السلعة",
"used": "تستخدم",
"region": "منطقة",
"selectRegion": "اختر المنطقة",
"itemPrice": "سعر السلعة",
"itemPhotos": "صور البند",
"itemInfo": "معلومات العنصر",
"profile": {
"reset_password": {
"label": "Reset Password",
@ -740,7 +755,8 @@ static const Map<String,dynamic> en_US = {
"regular": "Regular",
"mark": "Mark",
"performance": "Performance Evaluation",
"performanceEvaluationIn": "Your performance Evaluation in ",
"performanceEvaluationIn": "Your performance Evaluation in",
"valuationIn": "Performance Evaluation in",
"viewBusinessCard": "View Business Card",
"performanceEvaluation": "Performance Evaluation",
"logout": "Logout",
@ -796,6 +812,20 @@ static const Map<String,dynamic> en_US = {
"offerAndDiscounts": "Offer & Discounts",
"offerValid": "Offer Valid",
"offerExpired": "Offer Expired",
"whatAreYouOffering": "What are you offering?",
"selectCategory": "Select Category",
"inProgress": "InProgress",
"locked": "Locked",
"addDetails": "Add Details",
"reviewAndSell": "Review & Sell",
"itemTitle": "Item Title",
"itemCondition": "Item Condition",
"used": "Used",
"region": "Region",
"selectRegion": "Select Region",
"itemPrice": "Item Price",
"itemPhotos": "Item Photos",
"itemInfo": "Item Info",
"profile": {
"reset_password": {
"label": "Reset Password",

@ -272,6 +272,7 @@ abstract class LocaleKeys {
static const performance = 'performance';
static const performanceEvaluation = 'performanceEvaluation';
static const performanceEvaluationIn = 'performanceEvaluationIn';
static const valuationIn = 'valuationIn';
static const amount = 'amount';
static const correctCurrentDatails = 'correctCurrentDatails';
static const selectType = 'selectType';
@ -373,6 +374,20 @@ abstract class LocaleKeys {
static const offerAndDiscounts = 'offerAndDiscounts';
static const offerValid = 'offerValid';
static const offerExpired = 'offerExpired';
static const whatAreYouOffering = 'whatAreYouOffering';
static const selectCategory = 'selectCategory';
static const inProgress = 'inProgress';
static const locked = 'locked';
static const addDetails = 'addDetails';
static const reviewAndSell = 'reviewAndSell';
static const itemTitle = 'itemTitle';
static const itemCondition = 'itemCondition';
static const used = 'used';
static const region = 'region';
static const selectRegion = 'selectRegion';
static const itemPrice = 'itemPrice';
static const itemPhotos = 'itemPhotos';
static const itemInfo = 'itemInfo';
static const profile_reset_password_label = 'profile.reset_password.label';
static const profile_reset_password_username = 'profile.reset_password.username';
static const profile_reset_password_password = 'profile.reset_password.password';

@ -240,7 +240,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
],
).paddingOnly(left: 21, right: 21, top: 7),
ServicesWidget(),
8.height,
// 8.height,
Container(
width: double.infinity,
padding: const EdgeInsets.only(top: 31),

@ -33,69 +33,68 @@ class ServicesWidget extends StatelessWidget {
return data.isServicesMenusLoading
? whileLoading()
: ListView.separated(
padding: const EdgeInsets.only(top: 21),
itemBuilder: (context, parentIndex) {
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
data.homeMenus![parentIndex].menuEntry.prompt!.toSectionHeading().expanded,
LocaleKeys.viewAllServices.tr().toText12(isUnderLine: true),
],
).paddingOnly(left: 21, right: 21),
SizedBox(
height: 105 + 26,
child: ListView.separated(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13),
scrollDirection: Axis.horizontal,
itemBuilder: (cxt, index) {
return AspectRatio(
aspectRatio: 105 / 105,
child: data.isServicesMenusLoading
? ServicesMenuShimmer()
: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.asset(iconT[index]),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true),
),
SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)
],
)
],
).paddingOnly(left: 10, right: 10, bottom: 10, top: 12),
).onPress(() {
handleOnPress(context, data.homeMenus![parentIndex].menuEntiesList[index]);
}),
);
},
separatorBuilder: (cxt, index) => 9.width,
itemCount: data.homeMenus![parentIndex].menuEntiesList.length),
),
],
),
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
data.homeMenus![parentIndex].menuEntry.prompt!.toSectionHeading().expanded,
LocaleKeys.viewAllServices.tr().toText12(isUnderLine: true),
],
).paddingOnly(left: 21, right: 21),
SizedBox(
height: 105 + 26,
child: ListView.separated(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13),
scrollDirection: Axis.horizontal,
itemBuilder: (cxt, index) {
return AspectRatio(
aspectRatio: 105 / 105,
child: data.isServicesMenusLoading
? ServicesMenuShimmer()
: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.asset(iconT[index]),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true),
),
SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)
],
)
],
).paddingOnly(left: 10, right: 10, bottom: 10, top: 12),
).onPress(() {
handleOnPress(context, data.homeMenus![parentIndex].menuEntiesList[index]);
}),
);
},
separatorBuilder: (cxt, index) => 9.width,
itemCount: data.homeMenus![parentIndex].menuEntiesList.length),
),
],
);
},
separatorBuilder: (context, index) {
@ -152,7 +151,7 @@ class ServicesWidget extends StatelessWidget {
Widget whileLoading() {
return Column(
children: [
ServicesHeaderShimmer().paddingOnly(left: 21, right: 21),
ServicesHeaderShimmer().paddingOnly(left: 21, right: 21, top: 21),
SizedBox(
height: 105 + 26,
child: ListView.separated(

@ -1,114 +0,0 @@
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/profile_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/performance.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
class PerformanceAppraisal extends StatefulWidget {
const PerformanceAppraisal({Key? key}) : super(key: key);
@override
_PerformanceAppraisalState createState() => _PerformanceAppraisalState();
}
class _PerformanceAppraisalState extends State<PerformanceAppraisal> {
List<GetPerformanceAppraisalList> performance = [];
@override
void initState() {
getPerformanceAppraisal();
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColors.backgroundColor,
appBar: AppBarWidget(
context,
title: LocaleKeys.performance.tr(),
),
body: performance.isNotEmpty
? SingleChildScrollView(
child: Container(
width: double.infinity,
padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10),
child: Column(children: [
Row(children: [Expanded(flex: 1, child: getPerformanceCard(performance.first))]),
GridView.count(
crossAxisCount: 2,
shrinkWrap: true,
childAspectRatio:1.3,
children: performance
.where((GetPerformanceAppraisalList el) => performance.indexOf(el) != 0)
.map(
(GetPerformanceAppraisalList item) => getPerformanceCard(item),
)
.toList(),
)
])))
: Utils.getNoDataWidget(context),
);
}
Widget getPerformanceCard(GetPerformanceAppraisalList performance) {
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: Padding(
padding: const EdgeInsets.all(15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
LocaleKeys.performanceEvaluationIn.tr() + performance.aPPRAISALYEAR.toString(),
style: const TextStyle(fontWeight: FontWeight.bold),
),
const SizedBox(
height: 10,
),
SliderTheme(
data: SliderThemeData(trackHeight: 3, thumbShape: SliderComponentShape.noThumb, overlayShape: SliderComponentShape.noOverlay),
child: Slider(
max: 100,
min: 0,
inactiveColor: Colors.grey.withOpacity(.4),
activeColor: Colors.green,
value: double.parse(performance.aPPRAISALSCORE!),
onChanged: (value) {},
semanticFormatterCallback: (double newValue) {
return '${newValue.round()}';
})),
const SizedBox(
height: 10,
),
Text(
performance.aPPRAISALSCORE.toString() + '%',
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Colors.green,
),
),
],
)));
}
void getPerformanceAppraisal() async {
try {
Utils.showLoading(context);
performance = (await ProfileApiClient().getPerformanceAppraisal())!;
setState(() {});
Utils.hideLoading(context);
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
}

@ -0,0 +1,97 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/profile_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/performance.dart';
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
class PerformanceAppraisal extends StatelessWidget {
PerformanceAppraisal({Key? key}) : super(key: key);
Future<List<GetPerformanceAppraisalList>> getPerformanceAppraisal(context) async {
List<GetPerformanceAppraisalList> performance = [];
try {
Utils.showLoading(context);
performance = await ProfileApiClient().getPerformanceAppraisal();
Utils.hideLoading(context);
} catch (ex) {
performance = [];
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
return performance;
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColors.backgroundColor,
appBar: AppBarWidget(context, title: LocaleKeys.performance.tr()),
body: FutureBuilder(
future: getPerformanceAppraisal(context),
builder: (cxt, snapShot) {
if (snapShot.connectionState == ConnectionState.done) {
if (snapShot.hasData) {
List<GetPerformanceAppraisalList> performance = snapShot.data as List<GetPerformanceAppraisalList>;
if (performance.isNotEmpty) {
return ListView(
padding: const EdgeInsets.all(0),
children: [
getPerformanceCard(performance.first).paddingOnly(left: 21, right: 21, top: 21),
GridView.count(
physics: const NeverScrollableScrollPhysics(),
crossAxisCount: 2,
mainAxisSpacing: 13,
crossAxisSpacing: 13,
shrinkWrap: true,
childAspectRatio: 160 / 125,
padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 14),
children: performance
.where((GetPerformanceAppraisalList el) => performance.indexOf(el) != 0)
.map(
(GetPerformanceAppraisalList item) => getPerformanceCard(item, isGrid: true),
)
.toList(),
),
],
);
}
}
return Utils.getNoDataWidget(context);
}
return const SizedBox();
},
),
);
}
Widget getPerformanceCard(GetPerformanceAppraisalList performance, {bool isGrid = false}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.only(left: 12, right: 12, top: 2, bottom: 2),
decoration: Utils.containerRadius(MyColors.greenColor, 5),
child: "Excellent".toText10(color: Colors.white),
),
(isGrid ? 8 : 4).height,
isGrid ? "${LocaleKeys.performanceEvaluationIn.tr()} ${performance.aPPRAISALYEAR}".toText13() : "${LocaleKeys.performanceEvaluationIn.tr()} ${performance.aPPRAISALYEAR}".toText18(),
4.height,
LinearProgressIndicator(
minHeight: 4,
backgroundColor: MyColors.lightGreyDeColor,
valueColor: const AlwaysStoppedAnimation<Color>(MyColors.greenColor),
value: double.parse(performance.aPPRAISALSCORE!) / 100,
),
4.height,
isGrid ? "${performance.aPPRAISALSCORE}%".toText13(color: MyColors.greenColor) : "${performance.aPPRAISALSCORE}%".toText20(color: MyColors.greenColor),
],
).objectContainerView(radius: 10);
}
}

@ -1,8 +1,11 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/items_for_sale/items_for_sale_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/items_for_sale/get_sale_categories_list.dart';
import 'package:mohem_flutter_app/models/items_for_sale/item_review_model.dart';
import 'package:mohem_flutter_app/ui/screens/items_for_sale/fragments/add_details_fragment.dart';
@ -43,91 +46,52 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
getRequestID();
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(
context,
// title: LocaleKeys.mowadhafhiRequest.tr(),
title: "Items for sale",
showHomeButton: true,
),
appBar: AppBarWidget(context, title: LocaleKeys.itemsForSale.tr(), showHomeButton: true),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AspectRatio(
aspectRatio: 335 / 118,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
Row(
children: [
showProgress(
title: LocaleKeys.selectCategory.tr(),
status: _currentIndex == 0 ? LocaleKeys.inProgress.tr() : (_currentIndex > 0 ? LocaleKeys.completed.tr() : LocaleKeys.locked.tr()),
color: _currentIndex == 0 ? MyColors.orange : MyColors.greenColor,
pageIndex: 0,
).expanded,
showProgress(
title: LocaleKeys.addDetails.tr(),
status: _currentIndex == 1 ? LocaleKeys.inProgress.tr() : (_currentIndex > 1 ? LocaleKeys.completed.tr() : LocaleKeys.locked.tr()),
color: _currentIndex == 1 ? MyColors.orange : (_currentIndex > 1 ? MyColors.greenColor : MyColors.lightGrayColor),
pageIndex: 1,
).expanded,
showProgress(
title: LocaleKeys.reviewAndSell.tr(),
status: _currentIndex == 2 ? LocaleKeys.inProgress.tr() : LocaleKeys.locked.tr(),
color: _currentIndex == 2
? MyColors.orange
: _currentIndex > 3
? MyColors.greenColor
: MyColors.lightGrayColor,
isNeedBorder: false,
pageIndex: 2,
),
child: Row(
children: [
Expanded(
child: showProgress(
title: "Select Category",
status: _currentIndex == 0
? "InProgress"
: _currentIndex > 0
? "Completed"
: "Locked",
color: _currentIndex == 0 ? MyColors.orange : MyColors.greenColor,
pageIndex: 0,
),
),
Expanded(
child: showProgress(
title: "Add Details",
status: _currentIndex == 1
? "InProgress"
: _currentIndex > 1
? "Completed"
: "Locked",
color: _currentIndex == 1
? MyColors.orange
: _currentIndex > 1
? MyColors.greenColor
: MyColors.lightGrayColor,
pageIndex: 1,
),
),
showProgress(
title: "Review & Sell",
status: _currentIndex == 2 ? "InProgress" : "Locked",
color: _currentIndex == 2
? MyColors.orange
: _currentIndex > 3
? MyColors.greenColor
: MyColors.lightGrayColor,
isNeedBorder: false,
pageIndex: 2,
),
],
).paddingAll(21),
).paddingOnly(left: 21, right: 21, top: 21),
),
Expanded(
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: _controller,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
scrollDirection: Axis.horizontal,
children: [
getSaleCategoriesList.isNotEmpty ? SelectCategoryFragment(changePageViewIndex: changePageViewIndex, getSaleCategoriesList: getSaleCategoriesList) : Container(),
getSaleCategoriesList.isNotEmpty ? AddItemDetailsFragment(changePageViewIndex: changePageViewIndex, selectedSaleCategory: getSaleCategoriesList[0]) : Container(),
ItemReviewFragment(changePageViewIndex: changePageViewIndex),
],
),
),
],
).paddingAll(21).objectContainerView(disablePadding: true).paddingAll(21),
PageView(
physics: const NeverScrollableScrollPhysics(),
controller: _controller,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
scrollDirection: Axis.horizontal,
children: [
getSaleCategoriesList.isNotEmpty ? SelectCategoryFragment(changePageViewIndex: changePageViewIndex, getSaleCategoriesList: getSaleCategoriesList) : Container(),
getSaleCategoriesList.isNotEmpty ? AddItemDetailsFragment(changePageViewIndex: changePageViewIndex, selectedSaleCategory: getSaleCategoriesList[0]) : Container(),
ItemReviewFragment(changePageViewIndex: changePageViewIndex),
],
).expanded,
],
),
);
@ -141,54 +105,43 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
Row(
children: [
Row(
children: [
Container(
width: 26,
height: 26,
decoration: Utils.containerRadius(color!, 200),
child: const Icon(
Icons.done,
color: Colors.white,
size: 16,
),
),
if (isNeedBorder)
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Utils.mDivider(Colors.grey),
)),
],
),
Utils.mHeight(8),
Text(
title!,
style: const TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
letterSpacing: -0.44,
Container(
width: 26,
height: 26,
decoration: Utils.containerRadius(color!, 200),
child: const Icon(
Icons.done,
color: Colors.white,
size: 16,
),
),
Utils.mHeight(2),
Container(
padding: EdgeInsets.all(5),
decoration: Utils.containerRadius(color.withOpacity(0.2), 4),
child: Text(
status!,
style: TextStyle(
fontSize: 8,
fontWeight: FontWeight.w600,
letterSpacing: -0.32,
color: color,
if (isNeedBorder)
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Utils.mDivider(Colors.grey),
),
),
),
],
)
),
Utils.mHeight(8),
title!.toText11(),
Utils.mHeight(2),
Container(
padding: const EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 4),
decoration: Utils.containerRadius(color.withOpacity(0.2), 4),
child: Text(
status!,
style: TextStyle(
fontSize: 8,
fontWeight: FontWeight.w600,
letterSpacing: -0.32,
color: color,
),
),
),
],
),
);

@ -51,112 +51,116 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Add details".toText20(isBold: true).paddingOnly(top: 24, left: 21, right: 21),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DynamicTextFieldWidget(
"Title",
itemTitle.isEmpty ? "Item title" : itemTitle,
isEnable: true,
suffixIconData: Icons.search,
isPopup: false,
lines: 1,
isInputTypeNum: false,
isReadOnly: false,
onChange: (String value) {
itemTitle = value;
},
).paddingOnly(),
DynamicTextFieldWidget(
"Description",
itemDescription.isEmpty ? "Item description" : itemDescription,
isEnable: true,
suffixIconData: Icons.search,
isPopup: false,
lines: 4,
isInputTypeNum: false,
isReadOnly: false,
onChange: (String value) {
itemDescription = value;
},
).paddingOnly(top: 12),
"Item Condition".toText14(isBold: true).paddingOnly(top: 21),
Row(
children: [
ShowRadio(title: "New", value: "new", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "new";
setState(() {});
}),
12.width,
ShowRadio(title: "Used", value: "used", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "used";
return Column(
children: [
ListView(
padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21),
children: [
LocaleKeys.addDetails.tr().toText20(),
12.height,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DynamicTextFieldWidget(
LocaleKeys.title.tr(),
itemTitle.isEmpty ? LocaleKeys.itemTitle.tr() : itemTitle,
isEnable: true,
suffixIconData: Icons.search,
isPopup: false,
lines: 1,
isInputTypeNum: false,
isReadOnly: false,
onChange: (String value) {
itemTitle = value;
},
),
DynamicTextFieldWidget(
LocaleKeys.description.tr(),
itemDescription.isEmpty ? LocaleKeys.itemDescription.tr() : itemDescription,
isEnable: true,
suffixIconData: Icons.search,
isPopup: false,
lines: 4,
isInputTypeNum: false,
isReadOnly: false,
onChange: (String value) {
itemDescription = value;
},
).paddingOnly(top: 12),
LocaleKeys.itemCondition.tr().toText14().paddingOnly(top: 21),
Row(
children: [
ShowRadio(title: LocaleKeys.newString.tr(), value: "new", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "new";
setState(() {});
}),
12.width,
ShowRadio(title: LocaleKeys.used.tr(), value: "used", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "used";
setState(() {});
}),
],
).paddingOnly(top: 12),
PopupMenuButton(
child: DynamicTextFieldWidget(
LocaleKeys.region.tr(),
selectedRegion.regionName ?? LocaleKeys.selectRegion.tr(),
isEnable: false,
isPopup: true,
isInputTypeNum: true,
isReadOnly: false,
),
itemBuilder: (_) => <PopupMenuItem<int>>[
for (int i = 0; i < getRegionsList!.length; i++) PopupMenuItem<int>(child: Text(getRegionsList[i].regionName!), value: i),
],
onSelected: (int popupIndex) {
selectedRegion = getRegionsList![popupIndex];
setState(() {});
}),
],
).paddingOnly(top: 12),
PopupMenuButton(
child: DynamicTextFieldWidget(
"Region",
selectedRegion.regionName ?? "Select Region",
isEnable: false,
isPopup: true,
},
).paddingOnly(top: 21),
DynamicTextFieldWidget(
LocaleKeys.itemPrice.tr(),
itemPrice == 0 ? LocaleKeys.price.tr() : itemPrice.toString(),
isEnable: true,
suffixIconData: Icons.search,
isPopup: false,
lines: 1,
isInputTypeNum: true,
isReadOnly: false,
),
itemBuilder: (_) => <PopupMenuItem<int>>[
for (int i = 0; i < getRegionsList!.length; i++) PopupMenuItem<int>(child: Text(getRegionsList[i].regionName!), value: i),
],
onSelected: (int popupIndex) {
selectedRegion = getRegionsList![popupIndex];
setState(() {});
},
).paddingOnly(top: 21),
DynamicTextFieldWidget(
"Item Price",
itemPrice == 0 ? "Price" : itemPrice.toString(),
isEnable: true,
suffixIconData: Icons.search,
isPopup: false,
lines: 1,
isInputTypeNum: true,
isReadOnly: false,
onChange: (String value) {
itemPrice = num.parse(value);
},
).paddingOnly(top: 12),
"Item Photos".toText14(isBold: true).paddingOnly(top: 16),
attachmentView("Attachments").paddingOnly(top: 12),
Row(
children: [
DefaultButton(
LocaleKeys.cancel.tr(),
() async {
Navigator.of(context).pop();
onChange: (String value) {
itemPrice = num.parse(value);
},
).paddingOnly(top: 12),
LocaleKeys.itemPhotos.tr().toText14().paddingOnly(top: 21),
attachmentView(LocaleKeys.attachments.tr()).paddingOnly(top: 12),
],
).objectContainerView(title: LocaleKeys.itemInfo.tr()),
],
).expanded,
1.divider,
Row(
children: [
DefaultButton(
LocaleKeys.cancel.tr(),
() async {
Navigator.of(context).pop();
},
colors: const [Color(0xffD02127), Color(0xffD02127)],
).expanded,
8.width,
DefaultButton(
LocaleKeys.next.tr(),
isButtonDisabled()
? null
: () async {
AddItemDetailsFragment.itemReviewModel = getItemReviewObject();
widget.changePageViewIndex(2);
},
colors: const [Color(0xffD02127), Color(0xffD02127)],
).expanded,
12.width,
DefaultButton(
LocaleKeys.next.tr(),
isButtonDisabled()
? null
: () async {
AddItemDetailsFragment.itemReviewModel = getItemReviewObject();
widget.changePageViewIndex(2);
},
disabledColor: MyColors.lightGrayColor,
).expanded
],
).paddingOnly(top: 21),
],
).objectContainerView(title: "Item Info").paddingAll(21),
],
),
disabledColor: MyColors.lightGrayColor,
).expanded
],
).insideContainer
],
);
}
@ -174,82 +178,70 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
}
Widget attachmentView(String title) {
return Container(
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
title.toText16().expanded,
6.width,
SimpleButton(LocaleKeys.add.tr(), () async {
ImageOptions.showImageOptions(context, (String image, File file) {
setState(() {
images.add(image);
});
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
title.toText16().expanded,
6.width,
SimpleButton(LocaleKeys.add.tr(), () async {
ImageOptions.showImageOptions(context, (String image, File file) {
setState(() {
images.add(image);
});
}, fontSize: 14),
],
),
if (images.isNotEmpty) 12.height,
if (images.isNotEmpty)
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) {
return Container(
margin: const EdgeInsets.all(10),
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Icon(Icons.attach_file_sharp),
const SizedBox(
width: 8,
),
'image ${index + 1}.png'.toText16(),
],
});
}, fontSize: 14),
],
),
if (images.isNotEmpty) 12.height,
if (images.isNotEmpty)
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) {
return Container(
margin: const EdgeInsets.all(10),
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Icon(Icons.attach_file_sharp),
const SizedBox(
width: 8,
),
'image ${index + 1}.png'.toText16(),
],
),
InkWell(
onTap: () {
setState(() {
images.remove(images[index]);
});
},
child: Icon(
Icons.delete_sharp,
color: Colors.red[300],
),
InkWell(
onTap: () {
setState(() {
images.remove(images[index]);
});
},
child: Icon(
Icons.delete_sharp,
color: Colors.red[300],
))
],
),
);
},
separatorBuilder: (cxt, index) => 6.height,
itemCount: images.length),
],
),
);
)
],
),
);
},
separatorBuilder: (cxt, index) => 6.height,
itemCount: images.length),
],
).objectContainerView();
}
void getAdDetails() async {
Future<void> getAdDetails() async {
// todo need to change this method later , its not a good approach to do it like this.
String details = await Utils.getStringFromPrefs(SharedPrefsConsts.editItemForSale);
var body = json.decode(details);
@ -274,17 +266,15 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
AddItemDetailsFragment.itemReviewModel = itemReviewModel;
SelectCategoryFragment.selectedSaleCategory = selectedSaleCategoryAd;
setState(() {});
}
void getRegions() async {
try {
Utils.showLoading(context);
getRegionsList = await ItemsForSaleApiClient().getRegions();
await getAdDetails();
Utils.hideLoading(context);
setState(() {});
getAdDetails();
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);

@ -95,34 +95,21 @@ class _ItemsForSaleFragmentState extends State<ItemsForSaleFragment> {
getItemsForSale(currentPageNo, currentCategoryID);
});
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.string(getSaleCategoriesList[index].content!, fit: BoxFit.contain),
currentCategoryID == getSaleCategoriesList[index].categoryID ? const Icon(Icons.check_circle_rounded, color: MyColors.greenColor, size: 16.0) : Container(),
],
).expanded,
getSaleCategoriesList[index].title!.toText10()
],
).paddingOnly(left: 10, right: 10, bottom: 10, top: 12),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.string(getSaleCategoriesList[index].content!, fit: BoxFit.contain),
currentCategoryID == getSaleCategoriesList[index].categoryID ? const Icon(Icons.check_circle_rounded, color: MyColors.greenColor, size: 16.0) : Container(),
],
).expanded,
getSaleCategoriesList[index].title!.toText10()
],
).paddingOnly(left: 10, right: 10, bottom: 10, top: 12).expanded.objectContainerView(disablePadding: true),
),
);
},
@ -133,7 +120,7 @@ class _ItemsForSaleFragmentState extends State<ItemsForSaleFragment> {
getItemsForSaleList.isNotEmpty
? GridView(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 162 / 266, crossAxisSpacing: 12, mainAxisSpacing: 12),
padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 21),
padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 12),
shrinkWrap: true,
primary: false,
physics: const ScrollPhysics(),
@ -160,49 +147,36 @@ class _ItemsForSaleFragmentState extends State<ItemsForSaleFragment> {
onTap: () {
Navigator.pushNamed(context, AppRoutes.itemsForSaleDetail, arguments: getItemsForSaleList);
},
child: Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Hero(
tag: "ItemImage" + getItemsForSaleList.itemSaleID.toString(),
transitionOnUserGestures: true,
child: AspectRatio(
aspectRatio: 148 / 127,
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: Image.memory(
base64Decode(getItemsForSaleList.itemAttachments![0].content!),
fit: BoxFit.cover,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
children: [
Hero(
tag: "ItemImage" + getItemsForSaleList.itemSaleID.toString(),
transitionOnUserGestures: true,
child: AspectRatio(
aspectRatio: 148 / 127,
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: Image.memory(
base64Decode(getItemsForSaleList.itemAttachments![0].content!),
fit: BoxFit.cover,
),
),
),
10.height,
getItemsForSaleList.title!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1),
getItemsForSaleList.description!.toText12(maxLine: 2, color: const Color(0xff535353)),
16.height,
getItemsForSaleList.status!.toText14(isBold: true, color: getItemsForSaleList.status == 'Approved' ? MyColors.greenColor : MyColors.yellowColor),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: ["${getItemsForSaleList.quotePrice} ${getItemsForSaleList.currencyCode!}".toText14(isBold: true), SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)],
),
],
),
),
),
10.height,
getItemsForSaleList.title!.toText16(maxlines: 1),
getItemsForSaleList.description!.toText12(maxLine: 3, color: MyColors.grey57Color).expanded,
// 8.height,
getItemsForSaleList.status!.toText14(color: getItemsForSaleList.status == 'Approved' ? MyColors.greenColor : MyColors.yellowColor),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: ["${getItemsForSaleList.quotePrice} ${getItemsForSaleList.currencyCode!}".toText16(isBold: true), SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)],
),
6.height
],
).paddingAll(8).expanded.objectContainerView(disablePadding: true),
);
}

@ -1,7 +1,9 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/models/items_for_sale/get_sale_categories_list.dart';
class SelectCategoryFragment extends StatelessWidget {
@ -18,11 +20,11 @@ class SelectCategoryFragment extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
"What are you offering".toText20(isBold: true).paddingOnly(top: 24, left: 21, right: 21),
LocaleKeys.whatAreYouOffering.tr().toText20().paddingOnly(top: 0, left: 21, right: 21),
getSaleCategoriesList.isNotEmpty
? GridView(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 105 / 105, crossAxisSpacing: 12, mainAxisSpacing: 12),
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 21, right: 21),
padding: const EdgeInsets.only(top: 15, bottom: 21, left: 21, right: 21),
shrinkWrap: true,
primary: false,
physics: const ScrollPhysics(),
@ -37,41 +39,32 @@ class SelectCategoryFragment extends StatelessWidget {
List<Widget> getItemsForSaleWidgets() {
List<Widget> itemsList = [];
getSaleCategoriesList.forEach((element) {
itemsList.add(InkWell(
onTap: () {
selectedSaleCategory = element;
changePageViewIndex(1);
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
getSaleCategoriesList.forEach(
(element) {
itemsList.add(
InkWell(
onTap: () {
selectedSaleCategory = element;
changePageViewIndex(1);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.string(element.content!, fit: BoxFit.contain, width: 32, height: 32),
],
).expanded,
element.title!.toText12()
],
).paddingOnly(left: 10, right: 10, bottom: 10, top: 16).expanded.objectContainerView(disablePadding: true),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.string(element.content!, fit: BoxFit.contain, width: 32, height: 32),
],
).expanded,
element.title!.toText12()
],
).paddingOnly(left: 10, right: 10, bottom: 10, top: 12),
),
));
});
);
},
);
return itemsList;
}

@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/date_uitl.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
@ -11,6 +12,7 @@ import 'package:mohem_flutter_app/models/items_for_sale/get_items_for_sale_list.
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
import 'package:url_launcher/url_launcher.dart';
class ItemForSaleDetailPage extends StatefulWidget {
@ -26,113 +28,86 @@ class _ItemForSaleDetailPageState extends State<ItemForSaleDetailPage> {
@override
Widget build(BuildContext context) {
getItemsForSaleList = ModalRoute.of(context)?.settings.arguments as GetItemsForSaleList;
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarWidget(context, title: LocaleKeys.itemsForSale.tr(), showHomeButton: true),
body: SingleChildScrollView(
child: Column(
children: [
AspectRatio(
aspectRatio: 336 / 554,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
body: Column(
children: [
ListView(
padding: const EdgeInsets.all(21),
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Hero(
tag: "ItemImage" + getItemsForSaleList.itemSaleID.toString(),
transitionOnUserGestures: true,
child: AspectRatio(
aspectRatio: 322 / 261,
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: Image.memory(
base64Decode(getItemsForSaleList.itemAttachments![0].content!),
fit: BoxFit.cover,
),
),
),
],
),
// color: Colors.red,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: const Color(0xffEBEBEB).withOpacity(1.0),
blurRadius: 26,
offset: const Offset(0, -3),
).paddingAll(8),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
getItemsForSaleList.title!.toText20(),
getItemsForSaleList.description!.toText12(maxLine: 5, color: MyColors.grey57Color),
21.height,
getItemsForSaleList.status!.toText16(color: getItemsForSaleList.status == 'Approved' ? MyColors.greenColor : MyColors.yellowColor),
"${getItemsForSaleList.quotePrice} ${getItemsForSaleList.currencyCode!}".toText20(isBold: true),
1.divider.paddingOnly(top: 16, bottom: 16),
Row(
children: [
CircularAvatar(
url: getItemsForSaleList.profilePicture,
height: 34,
width: 34,
),
7.width,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [getItemsForSaleList.fullName!.toText14(), ItemDetailView("Posted on", DateUtil.formatDateToDate(DateTime.parse(getItemsForSaleList.created!), false))],
).expanded,
],
),
child: Hero(
tag: "ItemImage" + getItemsForSaleList.itemSaleID.toString(),
transitionOnUserGestures: true,
child: AspectRatio(
aspectRatio: 148 / 127,
child: ClipRRect(
borderRadius: BorderRadius.circular(6),
child: Image.memory(
base64Decode(getItemsForSaleList.itemAttachments![0].content!),
fit: BoxFit.cover,
),
),
).paddingAll(8),
),
),
getItemsForSaleList.title!.toText20(isBold: true, color: const Color(0xff2B353E)).paddingOnly(left: 21, right: 21),
getItemsForSaleList.description!.toText12(maxLine: 5, color: const Color(0xff535353)).paddingOnly(left: 21, right: 21, bottom: 21),
getItemsForSaleList.status!.toText16(isBold: true, color: getItemsForSaleList.status == 'Approved' ? MyColors.greenColor : MyColors.yellowColor).paddingOnly(left: 21, right: 21),
"${getItemsForSaleList.quotePrice} ${getItemsForSaleList.currencyCode!}".toText20(isBold: true).paddingOnly(left: 21, right: 21, bottom: 15),
const Divider().paddingOnly(left: 21, right: 21),
Row(
children: [
CircularAvatar(
height: 40,
width: 40,
).paddingOnly(left: 21, top: 21),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
getItemsForSaleList.fullName!.toText14(isBold: true).paddingOnly(left: 7, right: 7),
"Posted on: ${DateUtil.formatDateToDate(DateTime.parse(getItemsForSaleList.created!), false)}".toText12().paddingOnly(left: 7, right: 7),
],
).paddingOnly(top: 18),
],
),
],
),
).paddingAll(21),
),
Container(
decoration: const BoxDecoration(
color: MyColors.white,
boxShadow: [
BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 1),
],
),
child: Row(
children: [
DefaultButton("Email", () async {
Uri emailLaunchUri = Uri(
scheme: 'mailto',
path: getItemsForSaleList.emailAddress,
);
launchUrl(emailLaunchUri);
}, iconData: Icons.email_sharp, isTextExpanded: false)
.insideContainer
.expanded,
DefaultButton("Call", () async {
Uri callLaunchUri = Uri(
scheme: 'tel',
path: getItemsForSaleList.mobileNumber,
);
launchUrl(callLaunchUri);
}, iconData: Icons.call_sharp, isTextExpanded: false)
.insideContainer
.expanded,
],
).paddingOnly(right: 16, left: 16, top: 6, bottom: 16)
],
),
),
],
),
).objectContainerView(disablePadding: true),
],
).expanded,
Row(
children: [
DefaultButton("Email", () async {
Uri emailLaunchUri = Uri(
scheme: 'mailto',
path: getItemsForSaleList.emailAddress,
);
launchUrl(emailLaunchUri);
}, iconData: Icons.email_sharp, isTextExpanded: false)
.expanded,
8.width,
DefaultButton("Call", () async {
Uri callLaunchUri = Uri(
scheme: 'tel',
path: getItemsForSaleList.mobileNumber,
);
launchUrl(callLaunchUri);
}, iconData: Icons.call_sharp, isTextExpanded: false)
.expanded,
],
).insideContainer,
],
),
);
}

@ -46,7 +46,7 @@ class _ItemsForSaleState extends State<ItemsForSale> {
),
),
child: Row(
children: [myTab(LocaleKeys.itemsForSale.tr(), 0), myTab("My posted ads", 1)],
children: [myTab(LocaleKeys.itemsForSale.tr(), 0), myTab(LocaleKeys.myPostedAds.tr(), 1)],
),
),
PageView(

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
class ShowRadio extends StatelessWidget {
String title, value, groupValue;
@ -39,7 +38,7 @@ class ShowRadio extends StatelessWidget {
),
),
12.width,
title.toText12(isBold: true, maxLine: 2)
title.toText12(maxLine: 2)
],
);
}

Loading…
Cancel
Save