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

@ -370,6 +370,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",

@ -386,6 +386,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",
@ -792,6 +806,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",

@ -371,6 +371,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,9 +33,9 @@ class ServicesWidget extends StatelessWidget {
return data.isServicesMenusLoading
? whileLoading()
: ListView.separated(
padding: const EdgeInsets.only(top: 21),
itemBuilder: (context, parentIndex) {
return Container(
child: Column(
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
@ -95,7 +95,6 @@ class ServicesWidget extends StatelessWidget {
itemCount: data.homeMenus![parentIndex].menuEntiesList.length),
),
],
),
);
},
separatorBuilder: (context, index) {
@ -149,7 +148,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,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,62 +46,27 @@ 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),
),
],
),
child: Row(
Row(
children: [
Expanded(
child: showProgress(
title: "Select Category",
status: _currentIndex == 0
? "InProgress"
: _currentIndex > 0
? "Completed"
: "Locked",
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(
child: showProgress(
title: "Add Details",
status: _currentIndex == 1
? "InProgress"
: _currentIndex > 1
? "Completed"
: "Locked",
color: _currentIndex == 1
? MyColors.orange
: _currentIndex > 1
? MyColors.greenColor
: MyColors.lightGrayColor,
).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: "Review & Sell",
status: _currentIndex == 2 ? "InProgress" : "Locked",
title: LocaleKeys.reviewAndSell.tr(),
status: _currentIndex == 2 ? LocaleKeys.inProgress.tr() : LocaleKeys.locked.tr(),
color: _currentIndex == 2
? MyColors.orange
: _currentIndex > 3
@ -108,12 +76,9 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
pageIndex: 2,
),
],
).paddingAll(21),
).paddingOnly(left: 21, right: 21, top: 21),
),
Expanded(
child: PageView(
physics: NeverScrollableScrollPhysics(),
).paddingAll(21).objectContainerView(disablePadding: true).paddingAll(21),
PageView(
physics: const NeverScrollableScrollPhysics(),
controller: _controller,
onPageChanged: (index) {
setState(() {
@ -126,8 +91,7 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
getSaleCategoriesList.isNotEmpty ? AddItemDetailsFragment(changePageViewIndex: changePageViewIndex, selectedSaleCategory: getSaleCategoriesList[0]) : Container(),
ItemReviewFragment(changePageViewIndex: changePageViewIndex),
],
),
),
).expanded,
],
),
);
@ -139,9 +103,6 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
if (_currentIndex > pageIndex!) changePageViewIndex(pageIndex);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
@ -161,21 +122,15 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
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(8),
title!.toText11(),
Utils.mHeight(2),
Container(
padding: EdgeInsets.all(5),
padding: const EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 4),
decoration: Utils.containerRadius(color.withOpacity(0.2), 4),
child: Text(
status!,
@ -188,8 +143,6 @@ class _AddNewItemForSaleState extends State<AddNewItemForSale> {
),
),
],
)
],
),
);
}

@ -51,17 +51,19 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
return Column(
children: [
ListView(
padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21),
children: [
"Add details".toText20(isBold: true).paddingOnly(top: 24, left: 21, right: 21),
LocaleKeys.addDetails.tr().toText20(),
12.height,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DynamicTextFieldWidget(
"Title",
itemTitle.isEmpty ? "Item title" : itemTitle,
LocaleKeys.title.tr(),
itemTitle.isEmpty ? LocaleKeys.itemTitle.tr() : itemTitle,
isEnable: true,
suffixIconData: Icons.search,
isPopup: false,
@ -71,10 +73,10 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
onChange: (String value) {
itemTitle = value;
},
).paddingOnly(),
),
DynamicTextFieldWidget(
"Description",
itemDescription.isEmpty ? "Item description" : itemDescription,
LocaleKeys.description.tr(),
itemDescription.isEmpty ? LocaleKeys.itemDescription.tr() : itemDescription,
isEnable: true,
suffixIconData: Icons.search,
isPopup: false,
@ -85,15 +87,15 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
itemDescription = value;
},
).paddingOnly(top: 12),
"Item Condition".toText14(isBold: true).paddingOnly(top: 21),
LocaleKeys.itemCondition.tr().toText14().paddingOnly(top: 21),
Row(
children: [
ShowRadio(title: "New", value: "new", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
ShowRadio(title: LocaleKeys.newString.tr(), value: "new", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "new";
setState(() {});
}),
12.width,
ShowRadio(title: "Used", value: "used", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
ShowRadio(title: LocaleKeys.used.tr(), value: "used", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() {
selectedItemCondition = "used";
setState(() {});
}),
@ -101,8 +103,8 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
).paddingOnly(top: 12),
PopupMenuButton(
child: DynamicTextFieldWidget(
"Region",
selectedRegion.regionName ?? "Select Region",
LocaleKeys.region.tr(),
selectedRegion.regionName ?? LocaleKeys.selectRegion.tr(),
isEnable: false,
isPopup: true,
isInputTypeNum: true,
@ -117,8 +119,8 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
},
).paddingOnly(top: 21),
DynamicTextFieldWidget(
"Item Price",
itemPrice == 0 ? "Price" : itemPrice.toString(),
LocaleKeys.itemPrice.tr(),
itemPrice == 0 ? LocaleKeys.price.tr() : itemPrice.toString(),
isEnable: true,
suffixIconData: Icons.search,
isPopup: false,
@ -129,8 +131,13 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
itemPrice = num.parse(value);
},
).paddingOnly(top: 12),
"Item Photos".toText14(isBold: true).paddingOnly(top: 16),
attachmentView("Attachments").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(
@ -140,7 +147,7 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
},
colors: const [Color(0xffD02127), Color(0xffD02127)],
).expanded,
12.width,
8.width,
DefaultButton(
LocaleKeys.next.tr(),
isButtonDisabled()
@ -152,11 +159,8 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
disabledColor: MyColors.lightGrayColor,
).expanded
],
).paddingOnly(top: 21),
).insideContainer
],
).objectContainerView(title: "Item Info").paddingAll(21),
],
),
);
}
@ -174,20 +178,7 @@ 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(
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
@ -237,7 +228,8 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
child: Icon(
Icons.delete_sharp,
color: Colors.red[300],
))
),
)
],
),
);
@ -245,11 +237,11 @@ class _AddItemDetailsFragmentState extends State<AddItemDetailsFragment> {
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);

@ -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,24 +39,14 @@ class SelectCategoryFragment extends StatelessWidget {
List<Widget> getItemsForSaleWidgets() {
List<Widget> itemsList = [];
getSaleCategoriesList.forEach((element) {
itemsList.add(InkWell(
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),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
@ -68,10 +60,11 @@ class SelectCategoryFragment extends StatelessWidget {
).expanded,
element.title!.toText12()
],
).paddingOnly(left: 10, right: 10, bottom: 10, top: 12),
).paddingOnly(left: 10, right: 10, bottom: 10, top: 16).expanded.objectContainerView(disablePadding: true),
),
));
});
);
},
);
return itemsList;
}

@ -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