item for sale ui improvements & translation added.

merge-requests/1/merge
Sikander Saleem 3 years ago
parent f647b32c65
commit 7eadd97869

@ -370,6 +370,20 @@
"offerAndDiscounts": "العروض والخصومات", "offerAndDiscounts": "العروض والخصومات",
"offerValid": "العرض صالح", "offerValid": "العرض صالح",
"offerExpired": "انتهى العرض", "offerExpired": "انتهى العرض",
"whatAreYouOffering": "ما الذي تعرضه؟",
"selectCategory": "اختر الفئة",
"inProgress": "في تَقَدم",
"locked": "مقفل",
"addDetails": "أضف التفاصيل",
"reviewAndSell": "مراجعة وبيع",
"itemTitle": "عنوان البند",
"itemCondition": "حالة السلعة",
"used": "تستخدم",
"region": "منطقة",
"selectRegion": "اختر المنطقة",
"itemPrice": "سعر السلعة",
"itemPhotos": "صور البند",
"itemInfo": "معلومات العنصر",
"profile": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",

@ -370,6 +370,20 @@
"offerAndDiscounts": "Offer & Discounts", "offerAndDiscounts": "Offer & Discounts",
"offerValid": "Offer Valid", "offerValid": "Offer Valid",
"offerExpired": "Offer Expired", "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": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",

@ -386,6 +386,20 @@ class CodegenLoader extends AssetLoader{
"offerAndDiscounts": "العروض والخصومات", "offerAndDiscounts": "العروض والخصومات",
"offerValid": "العرض صالح", "offerValid": "العرض صالح",
"offerExpired": "انتهى العرض", "offerExpired": "انتهى العرض",
"whatAreYouOffering": "ما الذي تعرضه؟",
"selectCategory": "اختر الفئة",
"inProgress": "في تَقَدم",
"locked": "مقفل",
"addDetails": "أضف التفاصيل",
"reviewAndSell": "مراجعة وبيع",
"itemTitle": "عنوان البند",
"itemCondition": "حالة السلعة",
"used": "تستخدم",
"region": "منطقة",
"selectRegion": "اختر المنطقة",
"itemPrice": "سعر السلعة",
"itemPhotos": "صور البند",
"itemInfo": "معلومات العنصر",
"profile": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",
@ -792,6 +806,20 @@ static const Map<String,dynamic> en_US = {
"offerAndDiscounts": "Offer & Discounts", "offerAndDiscounts": "Offer & Discounts",
"offerValid": "Offer Valid", "offerValid": "Offer Valid",
"offerExpired": "Offer Expired", "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": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",

@ -371,6 +371,20 @@ abstract class LocaleKeys {
static const offerAndDiscounts = 'offerAndDiscounts'; static const offerAndDiscounts = 'offerAndDiscounts';
static const offerValid = 'offerValid'; static const offerValid = 'offerValid';
static const offerExpired = 'offerExpired'; 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_label = 'profile.reset_password.label';
static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_username = 'profile.reset_password.username';
static const profile_reset_password_password = 'profile.reset_password.password'; 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), ).paddingOnly(left: 21, right: 21, top: 7),
ServicesWidget(), ServicesWidget(),
8.height, // 8.height,
Container( Container(
width: double.infinity, width: double.infinity,
padding: const EdgeInsets.only(top: 31), padding: const EdgeInsets.only(top: 31),

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

@ -1,8 +1,11 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.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/api/items_for_sale/items_for_sale_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.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/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/get_sale_categories_list.dart';
import 'package:mohem_flutter_app/models/items_for_sale/item_review_model.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'; 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(); getRequestID();
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBarWidget( appBar: AppBarWidget(context, title: LocaleKeys.itemsForSale.tr(), showHomeButton: true),
context,
// title: LocaleKeys.mowadhafhiRequest.tr(),
title: "Items for sale",
showHomeButton: true,
),
body: Column( body: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AspectRatio( Row(
aspectRatio: 335 / 118, children: [
child: Container( showProgress(
decoration: BoxDecoration( title: LocaleKeys.selectCategory.tr(),
color: Colors.white, status: _currentIndex == 0 ? LocaleKeys.inProgress.tr() : (_currentIndex > 0 ? LocaleKeys.completed.tr() : LocaleKeys.locked.tr()),
borderRadius: BorderRadius.circular(20), color: _currentIndex == 0 ? MyColors.orange : MyColors.greenColor,
boxShadow: [ pageIndex: 0,
BoxShadow( ).expanded,
color: const Color(0xff000000).withOpacity(.05), showProgress(
blurRadius: 26, title: LocaleKeys.addDetails.tr(),
offset: const Offset(0, -3), 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: [ ).paddingAll(21).objectContainerView(disablePadding: true).paddingAll(21),
Expanded( PageView(
child: showProgress( physics: const NeverScrollableScrollPhysics(),
title: "Select Category", controller: _controller,
status: _currentIndex == 0 onPageChanged: (index) {
? "InProgress" setState(() {
: _currentIndex > 0 _currentIndex = index;
? "Completed" });
: "Locked", },
color: _currentIndex == 0 ? MyColors.orange : MyColors.greenColor, scrollDirection: Axis.horizontal,
pageIndex: 0, children: [
), getSaleCategoriesList.isNotEmpty ? SelectCategoryFragment(changePageViewIndex: changePageViewIndex, getSaleCategoriesList: getSaleCategoriesList) : Container(),
), getSaleCategoriesList.isNotEmpty ? AddItemDetailsFragment(changePageViewIndex: changePageViewIndex, selectedSaleCategory: getSaleCategoriesList[0]) : Container(),
Expanded( ItemReviewFragment(changePageViewIndex: changePageViewIndex),
child: showProgress( ],
title: "Add Details", ).expanded,
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),
],
),
),
], ],
), ),
); );
@ -141,54 +105,43 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Column( Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Container(
children: [ width: 26,
Container( height: 26,
width: 26, decoration: Utils.containerRadius(color!, 200),
height: 26, child: const Icon(
decoration: Utils.containerRadius(color!, 200), Icons.done,
child: const Icon( color: Colors.white,
Icons.done, size: 16,
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,
), ),
), ),
Utils.mHeight(2), if (isNeedBorder)
Container( Expanded(
padding: EdgeInsets.all(5), child: Padding(
decoration: Utils.containerRadius(color.withOpacity(0.2), 4), padding: const EdgeInsets.all(8.0),
child: Text( child: Utils.mDivider(Colors.grey),
status!,
style: TextStyle(
fontSize: 8,
fontWeight: FontWeight.w600,
letterSpacing: -0.32,
color: color,
), ),
), ),
),
], ],
) ),
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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SingleChildScrollView( return Column(
child: Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, ListView(
children: [ padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21),
"Add details".toText20(isBold: true).paddingOnly(top: 24, left: 21, right: 21), children: [
Column( LocaleKeys.addDetails.tr().toText20(),
crossAxisAlignment: CrossAxisAlignment.start, 12.height,
children: [ Column(
DynamicTextFieldWidget( crossAxisAlignment: CrossAxisAlignment.start,
"Title", children: [
itemTitle.isEmpty ? "Item title" : itemTitle, DynamicTextFieldWidget(
isEnable: true, LocaleKeys.title.tr(),
suffixIconData: Icons.search, itemTitle.isEmpty ? LocaleKeys.itemTitle.tr() : itemTitle,
isPopup: false, isEnable: true,
lines: 1, suffixIconData: Icons.search,
isInputTypeNum: false, isPopup: false,
isReadOnly: false, lines: 1,
onChange: (String value) { isInputTypeNum: false,
itemTitle = value; isReadOnly: false,
}, onChange: (String value) {
).paddingOnly(), itemTitle = value;
DynamicTextFieldWidget( },
"Description", ),
itemDescription.isEmpty ? "Item description" : itemDescription, DynamicTextFieldWidget(
isEnable: true, LocaleKeys.description.tr(),
suffixIconData: Icons.search, itemDescription.isEmpty ? LocaleKeys.itemDescription.tr() : itemDescription,
isPopup: false, isEnable: true,
lines: 4, suffixIconData: Icons.search,
isInputTypeNum: false, isPopup: false,
isReadOnly: false, lines: 4,
onChange: (String value) { isInputTypeNum: false,
itemDescription = value; isReadOnly: false,
}, onChange: (String value) {
).paddingOnly(top: 12), itemDescription = value;
"Item Condition".toText14(isBold: true).paddingOnly(top: 21), },
Row( ).paddingOnly(top: 12),
children: [ LocaleKeys.itemCondition.tr().toText14().paddingOnly(top: 21),
ShowRadio(title: "New", value: "new", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() { Row(
selectedItemCondition = "new"; children: [
setState(() {}); ShowRadio(title: LocaleKeys.newString.tr(), value: "new", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
}), selectedItemCondition = "new";
12.width, setState(() {});
ShowRadio(title: "Used", value: "used", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() { }),
selectedItemCondition = "used"; 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(() {}); setState(() {});
}), },
], ).paddingOnly(top: 21),
).paddingOnly(top: 12), DynamicTextFieldWidget(
PopupMenuButton( LocaleKeys.itemPrice.tr(),
child: DynamicTextFieldWidget( itemPrice == 0 ? LocaleKeys.price.tr() : itemPrice.toString(),
"Region", isEnable: true,
selectedRegion.regionName ?? "Select Region", suffixIconData: Icons.search,
isEnable: false, isPopup: false,
isPopup: true, lines: 1,
isInputTypeNum: true, isInputTypeNum: true,
isReadOnly: false, isReadOnly: false,
), onChange: (String value) {
itemBuilder: (_) => <PopupMenuItem<int>>[ itemPrice = num.parse(value);
for (int i = 0; i < getRegionsList!.length; i++) PopupMenuItem<int>(child: Text(getRegionsList[i].regionName!), value: i), },
], ).paddingOnly(top: 12),
onSelected: (int popupIndex) { LocaleKeys.itemPhotos.tr().toText14().paddingOnly(top: 21),
selectedRegion = getRegionsList![popupIndex]; attachmentView(LocaleKeys.attachments.tr()).paddingOnly(top: 12),
setState(() {}); ],
}, ).objectContainerView(title: LocaleKeys.itemInfo.tr()),
).paddingOnly(top: 21), ],
DynamicTextFieldWidget( ).expanded,
"Item Price", 1.divider,
itemPrice == 0 ? "Price" : itemPrice.toString(), Row(
isEnable: true, children: [
suffixIconData: Icons.search, DefaultButton(
isPopup: false, LocaleKeys.cancel.tr(),
lines: 1, () async {
isInputTypeNum: true, Navigator.of(context).pop();
isReadOnly: false, },
onChange: (String value) { colors: const [Color(0xffD02127), Color(0xffD02127)],
itemPrice = num.parse(value); ).expanded,
}, 8.width,
).paddingOnly(top: 12), DefaultButton(
"Item Photos".toText14(isBold: true).paddingOnly(top: 16), LocaleKeys.next.tr(),
attachmentView("Attachments").paddingOnly(top: 12), isButtonDisabled()
Row( ? null
children: [ : () async {
DefaultButton( AddItemDetailsFragment.itemReviewModel = getItemReviewObject();
LocaleKeys.cancel.tr(), widget.changePageViewIndex(2);
() async {
Navigator.of(context).pop();
}, },
colors: const [Color(0xffD02127), Color(0xffD02127)], disabledColor: MyColors.lightGrayColor,
).expanded, ).expanded
12.width, ],
DefaultButton( ).insideContainer
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),
],
),
); );
} }
@ -174,82 +178,70 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
} }
Widget attachmentView(String title) { Widget attachmentView(String title) {
return Container( return Column(
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), crossAxisAlignment: CrossAxisAlignment.start,
decoration: BoxDecoration( mainAxisSize: MainAxisSize.min,
color: Colors.white, children: [
borderRadius: BorderRadius.circular(15), Row(
boxShadow: [ mainAxisSize: MainAxisSize.min,
BoxShadow( crossAxisAlignment: CrossAxisAlignment.center,
color: const Color(0xff000000).withOpacity(.05), children: [
blurRadius: 26, title.toText16().expanded,
offset: const Offset(0, -3), 6.width,
), SimpleButton(LocaleKeys.add.tr(), () async {
], ImageOptions.showImageOptions(context, (String image, File file) {
), setState(() {
child: Column( images.add(image);
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), });
], }, fontSize: 14),
), ],
if (images.isNotEmpty) 12.height, ),
if (images.isNotEmpty) if (images.isNotEmpty) 12.height,
ListView.separated( if (images.isNotEmpty)
shrinkWrap: true, ListView.separated(
physics: const NeverScrollableScrollPhysics(), shrinkWrap: true,
itemBuilder: (cxt, index) { physics: const NeverScrollableScrollPhysics(),
return Container( itemBuilder: (cxt, index) {
margin: const EdgeInsets.all(10), return Container(
padding: const EdgeInsets.all(8.0), margin: const EdgeInsets.all(10),
child: Row( padding: const EdgeInsets.all(8.0),
mainAxisAlignment: MainAxisAlignment.spaceBetween, child: Row(
children: <Widget>[ mainAxisAlignment: MainAxisAlignment.spaceBetween,
Row( children: <Widget>[
crossAxisAlignment: CrossAxisAlignment.start, Row(
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
const Icon(Icons.attach_file_sharp), children: <Widget>[
const SizedBox( const Icon(Icons.attach_file_sharp),
width: 8, const SizedBox(
), width: 8,
'image ${index + 1}.png'.toText16(), ),
], '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]); );
}); },
}, separatorBuilder: (cxt, index) => 6.height,
child: Icon( itemCount: images.length),
Icons.delete_sharp, ],
color: Colors.red[300], ).objectContainerView();
))
],
),
);
},
separatorBuilder: (cxt, index) => 6.height,
itemCount: images.length),
],
),
);
} }
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); String details = await Utils.getStringFromPrefs(SharedPrefsConsts.editItemForSale);
var body = json.decode(details); var body = json.decode(details);
@ -274,17 +266,15 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
AddItemDetailsFragment.itemReviewModel = itemReviewModel; AddItemDetailsFragment.itemReviewModel = itemReviewModel;
SelectCategoryFragment.selectedSaleCategory = selectedSaleCategoryAd; SelectCategoryFragment.selectedSaleCategory = selectedSaleCategoryAd;
setState(() {});
} }
void getRegions() async { void getRegions() async {
try { try {
Utils.showLoading(context); Utils.showLoading(context);
getRegionsList = await ItemsForSaleApiClient().getRegions(); getRegionsList = await ItemsForSaleApiClient().getRegions();
await getAdDetails();
Utils.hideLoading(context); Utils.hideLoading(context);
setState(() {}); setState(() {});
getAdDetails();
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.handleException(ex, context, null); Utils.handleException(ex, context, null);

@ -1,7 +1,9 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/extensions/string_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/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/get_sale_categories_list.dart';
class SelectCategoryFragment extends StatelessWidget { class SelectCategoryFragment extends StatelessWidget {
@ -18,11 +20,11 @@ class SelectCategoryFragment extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ 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 getSaleCategoriesList.isNotEmpty
? GridView( ? GridView(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 105 / 105, crossAxisSpacing: 12, mainAxisSpacing: 12), 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, shrinkWrap: true,
primary: false, primary: false,
physics: const ScrollPhysics(), physics: const ScrollPhysics(),
@ -37,41 +39,32 @@ class SelectCategoryFragment extends StatelessWidget {
List<Widget> getItemsForSaleWidgets() { List<Widget> getItemsForSaleWidgets() {
List<Widget> itemsList = []; List<Widget> itemsList = [];
getSaleCategoriesList.forEach((element) { getSaleCategoriesList.forEach(
itemsList.add(InkWell( (element) {
onTap: () { itemsList.add(
selectedSaleCategory = element; InkWell(
changePageViewIndex(1); onTap: () {
}, selectedSaleCategory = element;
child: Container( changePageViewIndex(1);
decoration: BoxDecoration( },
color: Colors.white, child: Column(
borderRadius: BorderRadius.circular(15), mainAxisAlignment: MainAxisAlignment.spaceBetween,
boxShadow: [ crossAxisAlignment: CrossAxisAlignment.start,
BoxShadow( children: [
color: const Color(0xff000000).withOpacity(.05), Row(
blurRadius: 26, mainAxisAlignment: MainAxisAlignment.spaceBetween,
offset: const Offset(0, -3), 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; return itemsList;
} }

@ -46,7 +46,7 @@ class _ItemsForSaleState extends State<ItemsForSale> {
), ),
), ),
child: Row( 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( PageView(

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

Loading…
Cancel
Save