Nuevos cambios hechos de diseño

This commit is contained in:
ellecio2
2023-08-23 17:33:44 -04:00
parent 7a806f84ff
commit d2e9ba53ab
3485 changed files with 691106 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
import 'package:active_ecommerce_seller_app/data_model/addon_response.dart';
import 'package:active_ecommerce_seller_app/helpers/shared_value_helper.dart';
import 'package:active_ecommerce_seller_app/repositories/addon_repository.dart';
class AddonsHelper {
setAddonsData() async {
List<AddonResponse> addonsList = await AddonRepository().getAddonList();
addonsList.forEach((element) {
print(element.uniqueIdentifier);
switch (element.uniqueIdentifier) {
case 'refund_request':
{
if (element.activated.toString() == "1") {
refund_addon.$ = true;
} else {
refund_addon.$ = false;
}
}
break;
case 'seller_subscription':
{
if (element.activated.toString() == "1") {
seller_package_addon.$ = true;
} else {
seller_package_addon.$ = false;
}
}
break;
case 'offline_payment':
{
if (element.activated.toString() == "1") {
offline_payment_addon.$ = true;
} else {
offline_payment_addon.$ = false;
}
}
break;
case 'delivery_boy':
{
if (element.activated.toString() == "1") {
delivery_boy_addon.$ = true;
} else {
delivery_boy_addon.$ = false;
}
}
break;
case 'otp_system':
{
if (element.activated.toString() == "1") {
otp_addon_installed.$ = true;
otp_addon_installed.save();
} else {
otp_addon_installed.$ = false;
}
}
break;
case 'wholesale':
{
if (element.activated.toString() == "1") {
wholesale_addon_installed.$ = true;
otp_addon_installed.save();
} else {
wholesale_addon_installed.$ = false;
}
}
break;
default:
{}
}
});
}
}

View File

@@ -0,0 +1,44 @@
import 'package:active_ecommerce_seller_app/helpers/shared_value_helper.dart';
import 'package:active_ecommerce_seller_app/repositories/auth_repository.dart';
class AuthHelper {
setUserData(loginResponse) {
if (loginResponse.result == true) {
is_logged_in.$ = true;
is_logged_in.save();
access_token.$ = loginResponse.access_token;
access_token.save();
seller_id.$ = loginResponse.user.id;
seller_id.save();
}
}
clearUserData() {
is_logged_in.$ = false;
is_logged_in.save();
access_token.$ = "";
access_token.save();
seller_id.$ = 0;
seller_id.save();
}
fetch_and_set() async {
var userByTokenResponse = await AuthRepository().getUserByTokenResponse();
if (userByTokenResponse.result == true) {
is_logged_in.$ = true;
is_logged_in.save();
seller_id.$ = userByTokenResponse.id;
seller_id.save();
}else{
is_logged_in.$ = false;
is_logged_in.save();
seller_id.$ = 0;
seller_id.save();
}
}
}

View File

@@ -0,0 +1,56 @@
import 'package:active_ecommerce_seller_app/data_model/business_setting_response.dart';
import 'package:active_ecommerce_seller_app/helpers/shared_value_helper.dart';
import 'package:active_ecommerce_seller_app/repositories/business_setting_repository.dart';
import 'package:one_context/one_context.dart';
import 'package:provider/provider.dart';
class BusinessSettingHelper {
setBusinessSettingData() async {
List<BusinessSettingListResponse> businessLists =
await BusinessSettingRepository().getBusinessSettingList();
businessLists.forEach((element) {
switch (element.type) {
case 'conversation_system':
{
if (element.value.toString() == "1") {
conversation_activation.$ = true;
} else {
conversation_activation.$ = false;
}
}
break;
case 'coupon_system':
{
if (element.value.toString() == "1") {
coupon_activation.$ = true;
} else {
coupon_activation.$ = false;
}
}
break;
case 'product_manage_by_admin':
{
if (element.value.toString() == "1") {
seller_product_manage_admin.$ = true;
} else {
seller_product_manage_admin.$ = false;
}
}
break;
case 'shipping_type':
{
if (element.value.toString() == "product_wise_shipping") {
shipping_type.$ = true;
} else {
shipping_type.$ = false;
}
}
break;
default:
{}
break;
}
});
}
}

View File

@@ -0,0 +1,12 @@
import 'dart:convert';
import 'dart:io';
class FileHelper {
static String getBase64FormateFile(String path) {
File file = File(path);
print('File is = ' + file.toString());
List<int> fileInByte = file.readAsBytesSync();
String fileInBase64 = base64Encode(fileInByte);
return fileInBase64;
}
}

View File

@@ -0,0 +1,45 @@
import 'package:flutter/services.dart';
class RegExInputFormatter implements TextInputFormatter {
final RegExp _regExp;
RegExInputFormatter._(this._regExp);
factory RegExInputFormatter.withRegex(String regexString) {
try {
final regex = RegExp(regexString);
return RegExInputFormatter._(regex);
} catch (e) {
// Something not right with regex string.
assert(false, e.toString());
return RegExInputFormatter._("" as RegExp);
}
}
@override
TextEditingValue formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) {
final oldValueValid = _isValid(oldValue.text);
final newValueValid = _isValid(newValue.text);
if (oldValueValid && !newValueValid) {
return oldValue;
}
return newValue;
}
bool _isValid(String value) {
try {
final matches = _regExp.allMatches(value);
for (Match match in matches) {
if (match.start == 0 && match.end == value.length) {
return true;
}
}
return false;
} catch (e) {
// Invalid regex
assert(false, e.toString());
return true;
}
}
}

View File

@@ -0,0 +1,20 @@
import 'package:active_ecommerce_seller_app/helpers/shared_value_helper.dart';
class ResetHelper{
clean(){
// seller_package_addon.save();
// refund_addon.$= false;
// refund_addon.save();
// conversation_activation.$= false;
// conversation_activation.save();
// coupon_activation.$= false;
// coupon_activation.save();
// offline_payment_addon.$= false;
// offline_payment_addon.save();
// seller_product_manage_admin.$= false;
// seller_product_manage_admin.save();
}
}

View File

@@ -0,0 +1,108 @@
import 'package:active_ecommerce_seller_app/data_model/shop_info_response.dart';
import 'package:shared_value/shared_value.dart';
final SharedValue<bool> is_logged_in = SharedValue(
value: false, // initial value
key: "is_logged_in", // disk storage key for shared_preferences
);
final SharedValue<String?> access_token = SharedValue(
value: "", // initial value
key: "access_token", // disk storage key for shared_preferences
);
final SharedValue<int?> seller_id = SharedValue(
value: 0, // initial value
key: "seller_id", // disk storage key for shared_preferences
);
final SharedValue<String?> app_language = SharedValue(
value: "en", // initial value
key: "app_language", // disk storage key for shared_preferences
);
final SharedValue<String?> app_mobile_language = SharedValue(
value: "en", // initial value
key: "app_mobile_language", // disk storage key for shared_preferences
);
final SharedValue<bool?> app_language_rtl = SharedValue(
value: false, // initial value
key: "app_language_rtl", // disk storage key for shared_preferences
);
final SharedValue<bool> seller_product_manage_admin = SharedValue(
value: false, // initial value
key: "seller_product_manage_admin", // disk storage key for shared_preferences
);
final SharedValue<bool> shipping_type = SharedValue(
value: false, // initial value
key: "shipping_type", // disk storage key for shared_preferences
);
// Addons
final SharedValue<bool> seller_package_addon = SharedValue(
value: false, // initial value
key: "package_addon", // disk storage key for shared_preferences
);
final SharedValue<bool> refund_addon = SharedValue(
value: false, // initial value
key: "refund_addon", // disk storage key for shared_preferences
);
final SharedValue<bool> offline_payment_addon = SharedValue(
value: false, // initial value
key: "offline_payment_addon", // disk storage key for shared_preferences
);
final SharedValue<bool> delivery_boy_addon = SharedValue(
value: false, // initial value
key: "delivery_boy_addon", // disk storage key for shared_preferences
);
final SharedValue<bool> otp_addon_installed = SharedValue(
value: false, // initial value
key: "otp_addon_installed", // disk storage key for shared_preferences
);
final SharedValue<bool> wholesale_addon_installed = SharedValue(
value: false, // initial value
key: "wholesale_addon_installed", // disk storage key for shared_preferences
);
// setting
final SharedValue<bool> conversation_activation = SharedValue(
value: false, // initial value
key: "conversation_activation", // disk storage key for shared_preferences
);
final SharedValue<bool> coupon_activation = SharedValue(
value: false, // initial value
key: "coupon_activation", // disk storage key for shared_preferences
);
// Shop info
final SharedValue<String> shop_name = SharedValue(
value: "", // initial value
key: "shop_name", // disk storage key for shared_preferences
);
final SharedValue<String> seller_email = SharedValue(
value: "", // initial value
key: "seller_email", // disk storage key for shared_preferences
);
final SharedValue<String> shop_logo = SharedValue(
value: "", // initial value
key: "shop_logo", // disk storage key for shared_preferences
);
final SharedValue<String> shop_rating = SharedValue(
value: "", // initial value
key: "shop_rating", // disk storage key for shared_preferences
);
final SharedValue<bool> shop_verify = SharedValue(
value: false, // initial value
key: "shop_verify", // disk storage key for shared_preferences
);
final SharedValue<bool> verify_form_submitted = SharedValue(
value: true, // initial value
key: "verify_form_submitted", // disk storage key for shared_preferences
);

View File

@@ -0,0 +1,106 @@
import 'package:active_ecommerce_seller_app/my_theme.dart';
import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';
class ShimmerHelper {
buildBasicShimmer(
{double height = double.infinity, double width = double.infinity}) {
return Shimmer.fromColors(
baseColor: MyTheme.shimmer_base,
highlightColor: MyTheme.shimmer_highlighted,
child: Container(
height: height,
width: width,
color: Colors.white,
),
);
}
buildBoxShimmer(
{double height = double.infinity, double width = double.infinity}) {
return Shimmer.fromColors(
baseColor: MyTheme.app_accent_color_extra_light,
highlightColor: MyTheme.shimmer_highlighted,
child: Container(
height: height,
width: width,
color: Colors.white,
),
);
}
buildListShimmer({item_count = 10,item_height = 100.0}) {
return ListView.builder(
itemCount: item_count,
scrollDirection: Axis.vertical,
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(
top: 0.0, left: 16.0, right: 16.0, bottom: 16.0),
child: ShimmerHelper().buildBasicShimmer(height: item_height),
);
},
);
}
buildProductGridShimmer({scontroller, item_count = 10}) {
return GridView.builder(
itemCount: item_count,
controller: scontroller,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 0.7),
padding: EdgeInsets.all(8),
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Shimmer.fromColors(
baseColor: MyTheme.shimmer_base,
highlightColor: MyTheme.shimmer_highlighted,
child: Container(
height: 120,
width: double.infinity,
color: Colors.white,
),
),
);
},
);
}
buildSquareGridShimmer({scontroller, item_count = 10}) {
return GridView.builder(
itemCount: item_count,
controller: scontroller,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 1),
padding: EdgeInsets.all(8),
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Shimmer.fromColors(
baseColor: MyTheme.shimmer_base,
highlightColor: MyTheme.shimmer_highlighted,
child: Container(
height: 120,
width: double.infinity,
color: Colors.white,
),
),
);
},
);
}
}

View File

@@ -0,0 +1,49 @@
import 'dart:convert';
import 'package:active_ecommerce_seller_app/data_model/shop_info_response.dart';
import 'package:active_ecommerce_seller_app/helpers/shared_value_helper.dart';
import 'package:active_ecommerce_seller_app/repositories/shop_repository.dart';
class ShopInfoHelper{
setShopInfo()async{
var _shopInfo = await ShopRepository().getShopInfo();
shop_name.$=_shopInfo.shopInfo!.name!;
shop_name.save();
shop_logo.$=_shopInfo.shopInfo!.logo!;
shop_logo.save();
seller_email.$=_shopInfo.shopInfo!.email!;
seller_email.save();
shop_rating.$=_shopInfo.shopInfo!.rating.toString();
shop_rating.save();
shop_verify.$=_shopInfo.shopInfo!.verified!;
shop_verify.save();
verify_form_submitted.$=_shopInfo.shopInfo!.is_submitted_form!;
verify_form_submitted.save();
}
static loadShopInfo(){
shop_name.load();
shop_logo.load();
seller_email.load();
shop_rating.load();
shop_verify.load();
}
}