Skip to content

Commit

Permalink
First Version
Browse files Browse the repository at this point in the history
  • Loading branch information
Anchit Makkar committed Jan 6, 2024
1 parent b0c8cea commit 4fc5620
Show file tree
Hide file tree
Showing 57 changed files with 752 additions and 720 deletions.
6 changes: 4 additions & 2 deletions assets/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@
"productNumber" : "Product Number",
"totalShipping" : "Total Shipping : ",
"commission": "Commission",
"subtotal" : "Sub Total",
"subTotal" : "Sub Total",
"orderAmount": "Set Minimum Order Amount",
"GoogleAnalytics": "Google Analytics",
"minimumAmount": "Minimum Amount",
Expand Down Expand Up @@ -587,5 +587,7 @@
"networkConnectionError": "Network Connection Error",
"addedToCart" : "Added To Cart Successfully",
"addReviewImage" : "Please add review image",
"couponCode" : "Coupon Code"
"couponCode" : "Coupon Code",
"noShippingMsg" : "There are no shipping methods available in selected address",
"sample" : "Sample"
}
24 changes: 9 additions & 15 deletions lib/screens/add_edit_address/view/add_edit_address_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import 'package:collection/collection.dart';
import '../../../utils/app_constants.dart';
import '../../../utils/app_global_data.dart';
import '../../../utils/input_field_validators.dart';
import '../../../utils/mobikul_theme.dart';
import '../../../utils/shared_preference_helper.dart';
import '../../../utils/string_constants.dart';
import '../../../widgets/common_drop_down_field.dart';
Expand Down Expand Up @@ -91,9 +90,7 @@ class _AddNewAddressState extends State<AddNewAddress>
widget.isEdit
? zipCodeController.text = widget.addressModel?.postcode ?? ""
: "";
widget.isEdit
? countryController.text = widget.addressModel?.country ?? ""
: "";
// widget.isEdit ? countryController.text = widget.addressModel?.country ?? "" : "";
widget.isEdit
? vatIdController.text = widget.addressModel?.vatId ?? ""
: "";
Expand Down Expand Up @@ -145,14 +142,11 @@ class _AddNewAddressState extends State<AddNewAddress>
if (state is FetchEditAddressState) {
if (state.status == AddEditStatus.fail) {
Navigator.of(context).pop();
ShowMessage.showNotification(
state.error, "", Colors.red, const Icon(Icons.cancel_outlined));
ShowMessage.errorNotification(
state.error ?? "",context);
} else if (state.status == AddEditStatus.success) {
ShowMessage.showNotification(
state.updateAddressModel?.message,
"",
const Color.fromRGBO(140, 194, 74, 5),
const Icon(Icons.check_circle));
ShowMessage.successNotification(
state.updateAddressModel?.message ?? "",context);
Navigator.pop(
context,
AddressData(
Expand Down Expand Up @@ -193,11 +187,10 @@ class _AddNewAddressState extends State<AddNewAddress>
} else if (state is FetchAddAddressState) {
if (state.status == AddEditStatus.fail) {
Navigator.of(context).pop();
ShowMessage.showNotification(
state.error, "", Colors.red, const Icon(Icons.cancel_outlined));
ShowMessage.errorNotification(
state.error ?? "",context);
} else if (state.status == AddEditStatus.success) {
ShowMessage.showNotification(state.baseModel!.message, "",
const Color.fromRGBO(140, 194, 74, 5), const Icon(Icons.check_circle));
ShowMessage.successNotification(state.baseModel?.message ?? "",context);
if (countryCode != null) {
Future.delayed(const Duration(seconds: 2), () {
Navigator.pop(
Expand Down Expand Up @@ -253,6 +246,7 @@ class _AddNewAddressState extends State<AddNewAddress>
countryList = state.countryData!.data;
if (selectedCountry == null) {
if (widget.isEdit) {
countryController.text = countryList?.firstWhereOrNull((element) => element.code == widget.addressModel?.country)?.name ?? "";
} else {
if ((selectedCountry?.states?.length ?? 0) > 0) {
selectedState = selectedCountry?.states?.first;
Expand Down
1 change: 0 additions & 1 deletion lib/screens/add_review/bloc/add_review_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import 'package:bagisto_app_demo/screens/add_review/bloc/add_review_base_event.dart';
import 'package:bagisto_app_demo/screens/add_review/bloc/add_review_fetch_state.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../data_model/add_review_model.dart';
import 'add_review_repository.dart';
Expand Down
27 changes: 14 additions & 13 deletions lib/screens/address_list/view/address_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,10 @@ class _AddressScreenState extends State<AddressScreen> {
}
if (state is RemoveAddressState) {
if (state.status == AddressStatus.fail) {
ShowMessage.showNotification(StringConstants.failed.localized(), state.error,
Colors.red, const Icon(Icons.cancel_outlined));
ShowMessage.errorNotification(state.error ?? "", context);
} else if (state.status == AddressStatus.success) {
ShowMessage.showNotification(
StringConstants.success.localized(),
state.response?.message ?? "",
const Color.fromRGBO(140, 194, 74, 5),
const Icon(Icons.check_circle_outline));
ShowMessage.successNotification(
state.response?.message ?? "", context);
}
}
},
Expand Down Expand Up @@ -144,19 +140,22 @@ class _AddressScreenState extends State<AddressScreen> {
SharedPreferenceHelper.setAddressData(false);
return Column(
children: [
const SizedBox(height: AppSizes.spacingSmall,),
const SizedBox(
height: AppSizes.spacingSmall,
),
Card(
elevation: 2,
child: (widget.isFromDashboard ?? false)
? null
: Container(
padding: const EdgeInsets.symmetric(vertical: 8),
padding:
const EdgeInsets.symmetric(vertical: AppSizes.size8),
child: Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(AppSizes.size8),
child: MaterialButton(
shape: RoundedRectangleBorder(
borderRadius:
const BorderRadius.all(Radius.circular(5.0)),
borderRadius: const BorderRadius.all(
Radius.circular(AppSizes.size4)),
side: BorderSide(
width: 2,
color:
Expand All @@ -179,7 +178,9 @@ class _AddressScreenState extends State<AddressScreen> {
color: Theme.of(context).colorScheme.onPrimary,
),
Text(
StringConstants.addNewAddress.localized().toUpperCase(),
StringConstants.addNewAddress
.localized()
.toUpperCase(),
style: TextStyle(
color:
Theme.of(context).colorScheme.onPrimary),
Expand Down
3 changes: 2 additions & 1 deletion lib/screens/cart_screen/cart_model/cart_data_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ class FormattedPrice {
this.total,
this.taxTotal,
this.baseTaxTotal, this.baseTotal,
this.baseDiscount, this.adjustmentFee, this.baseAdjustmentFee, this.adjustmentRefund);
this.baseDiscount, this.adjustmentFee, this.baseAdjustmentFee, this.adjustmentRefund, this.amountRefunded,
this.baseAmountRefunded, this.basePrice, this.baseTotalInvoiced, this.discountPercent, this.taxPercent, this.totalInvoiced);


factory FormattedPrice.fromJson(Map<String, dynamic> json) {
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/cart_screen/widget/guest_checkout_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class GuestCheckoutView extends StatelessWidget {
),
],
),
SizedBox(
checkDownloadable(cartDetailsModel.items) == false ? SizedBox(
height: AppSizes.spacingWide*4,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 14.0, horizontal: 12),
Expand Down Expand Up @@ -106,7 +106,7 @@ class GuestCheckoutView extends StatelessWidget {
color: Theme.of(context).colorScheme.background),
)),
),
),
):const SizedBox.shrink(),
],
);
}
Expand Down
14 changes: 5 additions & 9 deletions lib/screens/cart_screen/widget/price_details_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class PriceDetailView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
StringConstants.subtotal.localized(),
StringConstants.subTotal.localized(),
style: const TextStyle(fontWeight: FontWeight.w500),
),
Text(
Expand All @@ -40,8 +40,7 @@ class PriceDetailView extends StatelessWidget {
],
),
),
cartDetailsModel.formattedPrice?.taxTotal != "\$0.00"
? Container(
Container(
padding: const EdgeInsets.fromLTRB(16, 5, 10, 0),
// color: Colors.white,
child: Row(
Expand All @@ -60,10 +59,8 @@ class PriceDetailView extends StatelessWidget {
),
],
),
)
: const SizedBox.shrink(),
cartDetailsModel.formattedPrice?.discount != "\$0.00"
? Padding(
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 5, 10, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expand All @@ -81,8 +78,7 @@ class PriceDetailView extends StatelessWidget {
),
],
),
)
: const SizedBox.shrink(),
),
Container(
padding: const EdgeInsets.fromLTRB(16, 5, 10, 0),
child: Row(
Expand Down
7 changes: 2 additions & 5 deletions lib/screens/cart_screen/widget/proceed_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,8 @@ class ProceedView extends StatelessWidget {
var isUser =
await SharedPreferenceHelper.getCustomerLoggedIn();
if (quantityChanged) {
ShowMessage.showNotification(
StringConstants.warning.localized(),
StringConstants.updateCartWarning.localized(),
Colors.yellow,
const Icon(Icons.warning_amber));
ShowMessage.warningNotification(
StringConstants.updateCartWarning.localized(),context);
} else if (isUser) {
if(context.mounted) {
Navigator.pushNamed(context, checkoutScreen,
Expand Down
1 change: 0 additions & 1 deletion lib/screens/categories_screen/bloc/categories_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import 'package:bagisto_app_demo/utils/application_localization.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../data_model/add_to_wishlist_model/add_wishlist_model.dart';
import '../../../data_model/categories_data_model/categories_product_model.dart';
import '../../../data_model/categories_data_model/filter_product_model.dart';
import '../../../data_model/graphql_base_model.dart';
import '../../../utils/string_constants.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import 'package:flutter/material.dart';
import '../../../data_model/add_to_wishlist_model/add_wishlist_model.dart';
import '../../../data_model/categories_data_model/categories_product_model.dart';
import '../../../data_model/categories_data_model/filter_product_model.dart';
import '../../../data_model/graphql_base_model.dart';
import '../../../services/api_client.dart';
Expand Down Expand Up @@ -75,7 +74,7 @@ class CategoriesRepo implements CategoriesRepository {
int productId,int quantity ) async {
AddToCartModel? graphQlBaseModel;

graphQlBaseModel = await ApiClient().addToCart(quantity,productId.toString(),[] ,[],[],0,[],null);
graphQlBaseModel = await ApiClient().addToCart(quantity,productId.toString(),[] ,[],[],[],null);

return graphQlBaseModel!;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SubCategoriesGridView extends StatelessWidget {
borderRadius: BorderRadius.circular(AppSizes.spacingNormal),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(children: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:bagisto_app_demo/widgets/price_widget.dart';
import 'package:bagisto_app_demo/widgets/wishlist_compare_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../../data_model/categories_data_model/categories_product_model.dart';
import '../../../../utils/app_global_data.dart';
import '../../../../utils/app_constants.dart';
import '../../../../utils/string_constants.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:bagisto_app_demo/utils/index.dart';
import 'package:flutter/material.dart';
import '../../../../../../data_model/app_route_arguments.dart';
import '../../../../../../utils/assets_constants.dart';
import '../../../../../../utils/string_constants.dart';
import '../../../../address_list/data_model/address_model.dart';

// ignore: must_be_immutable
Expand Down
Loading

0 comments on commit 4fc5620

Please sign in to comment.