Initial commit

This commit is contained in:
jahongireshonqulov
2025-10-17 19:42:02 +05:00
commit 9fbdabafb4
1420 changed files with 28021 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
import 'dart:convert';
import 'dart:io';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/middlewares/middleware.dart';
import 'package:http/http.dart' as http;
class ApiRequest {
static Future<ApiResponse> post(
{required String url,
required Map<String, String> header,
required String body,
MiddleWare? middleWare}) async {
try {
Uri uri = Uri.parse(url);
var response = await http.post(uri, body: body, headers: header);
print("Hello Post=== ${response.body}==");
print("Hello Post=== ${response.statusCode}==");
if (middleWare != null) {
if (middleWare.next(response.body)) {
return ApiResponse(result: true, body: response.body, statusCode: 200);
} else {
return ApiResponse(result: false,body: "Something went wrong",statusCode: 403);
}
} else {
return ApiResponse(result: true,body: response.body ,statusCode: 200);
}
} on Exception catch (e) {
return ApiResponse(result: false,body: "Something went wrong ${e.toString()}",statusCode: 500);
}
}
static Future<ApiResponse> fileReq(
{required String url,
required Map<String, String> header,
Map<String,String>? body,
File? file,
MiddleWare? middleWare}) async {
try {
Uri uri = Uri.parse(url);
var req = http.MultipartRequest("Post",uri);
req.headers.addAll( header);
if(file !=null) {
req.files.add(await http.MultipartFile.fromPath("avatar", file.path));
}
if(body !=null){
req.fields.addAll(body);
}
var tmp = await req.send();
var response= await tmp.stream.bytesToString();
if (middleWare != null) {
if (middleWare.next(response)) {
return ApiResponse(result: true,body: response,statusCode: 200);
} else {
return ApiResponse(result: false,body: "Something went wrong",statusCode: 403);
}
} else {
return ApiResponse(result: true,body: response ,statusCode: 200);
}
} on Exception catch (e) {
return ApiResponse(result: false,body: "Something went wrong ${e.toString()}",statusCode: 500);
}
}
static Future<ApiResponse> get(String url, Map<String, String> header,
{MiddleWare? middleWare}) async {
try {
Uri uri = Uri.parse(url);
print("Uri== $uri ===");
var response = await http.get(uri, headers: header);
print("Request==== ${response.request} ==");
print("Body==== ${response.body} ==");
print("Status Info==== ${response.statusCode} ==");
if(response.statusCode != 500) {
if (middleWare != null) {
if (middleWare.next(response.body)) {
return ApiResponse(
result: true, body: response.body, statusCode: 200);
} else {
return ApiResponse(
result: false, body: "Something went wrong", statusCode: 403);
}
} else {
return ApiResponse(result: true, body: response.body, statusCode: 200);
}
}else{
access_token.$ = "";
return ApiResponse(
result: false, body: "Something went wrong", statusCode: 500);;
}
} on Exception catch (e) {
return ApiResponse(result: false, body: "Something went wrong", statusCode: 500);
}
}
}
class ApiResponse {
bool result;
String body;
int statusCode ;
ApiResponse({required this.result,required this.body,required this.statusCode});
}

View File

@@ -0,0 +1,161 @@
import 'dart:convert';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/cart_response.dart';
import 'package:grostore/models/common_response.dart';
import 'package:grostore/models/country_response.dart';
import 'package:grostore/models/edit_address_response.dart';
import 'package:grostore/models/order/order_summery_response.dart';
import 'package:grostore/models/response_model.dart';
import 'package:grostore/models/state_response.dart';
import 'package:grostore/models/user/addresses_response.dart';
import '../models/city_response.dart';
class AddressApi{
static Future<ResponseModel<CommonResponse>> addAddress({required int countryId,required int stateId,required int cityId,required int isDefault,required String address})
async{
var url = "${AppConfig.apiUrl}/address/store";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
var postBody = jsonEncode({
"country_id":countryId,
"state_id":stateId,
"city_id":cityId,
"is_default":isDefault,
"address":address
});
ApiResponse response = await ApiRequest.post(body: postBody, url: url,header: header);
if(response.result){
return ResponseModel(response.statusCode,commonResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode, CommonResponse(result: false, message: 'Failed'));
}
}
static Future<ResponseModel<CommonResponse>> updateAddress({required int id,required int countryId,required int stateId,required int cityId,required int isDefault,required String address})
async{
var url = "${AppConfig.apiUrl}/address/update";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
var postBody = jsonEncode({
"id":id,
"country_id":countryId,
"state_id":stateId,
"city_id":cityId,
"is_default":isDefault,
"address":address
});
ApiResponse response = await ApiRequest.post(body: postBody, url: url,header: header);
if(response.result){
return ResponseModel(response.statusCode,commonResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode, CommonResponse(result: false, message: 'Failed'));
}
}
static Future<ResponseModel<CommonResponse>> deleteAddress({required int id})
async{
var url = "${AppConfig.apiUrl}/address/delete/$id";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
ApiResponse response = await ApiRequest.get( url, header);
if(response.result){
return ResponseModel(response.statusCode,commonResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode, CommonResponse(result: false, message: 'Failed'));
}
}
static Future<ResponseModel<AddressesResponse>> getAddresses()async{
var url = "${AppConfig.apiUrl}/address";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
ApiResponse response = await ApiRequest.get(url, header);
if(response.result){
return ResponseModel(response.statusCode,addressesResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,AddressesResponse(data: []));
}
}
static Future<ResponseModel<EditAddressResponse>> editAddresses(id)async{
var url = "${AppConfig.apiUrl}/address/edit/$id";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
print(url.toString());
ApiResponse response = await ApiRequest.get(url, header);
if(response.result){
return ResponseModel(response.statusCode,editAddressResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,EditAddressResponse(data: Data.fromJson({}), result: false, status: 500));
}
}
static Future<ResponseModel<CountryResponse>> getCountries()async{
var url = "${AppConfig.apiUrl}/address/countries";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
ApiResponse response = await ApiRequest.get(url, header);
print(response.body);
if(response.result){
return ResponseModel(response.statusCode,countryResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,CountryResponse(data: []));
}
}
static Future<ResponseModel<StateResponse>> getState(id)async{
var url = "${AppConfig.apiUrl}/address/states?country_id=$id";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
ApiResponse response = await ApiRequest.get(url, header);
if(response.result){
return ResponseModel(response.statusCode,stateResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,StateResponse(data: []));
}
}
static Future<ResponseModel<CityResponse>> getCity(id)async{
var url = "${AppConfig.apiUrl}/address/cities?state_id=$id";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
ApiResponse response = await ApiRequest.get(url, header);
if(response.result){
return ResponseModel(response.statusCode,cityResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,CityResponse(data: []));
}
}
}

View File

@@ -0,0 +1,133 @@
import 'package:flutter/cupertino.dart';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/route.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/middlewares/banned_user_middleware.dart';
import 'package:grostore/models/auth/login_response_model.dart';
import 'package:grostore/models/auth/registration_response_model.dart';
import 'package:grostore/models/auth/token_check_response.dart';
import 'package:grostore/models/common/user_info.dart';
import 'package:grostore/screens/auth/login.dart';
class AuthApi{
/// Login
static Future<LoginResponse> login(String requestBody,BuildContext context)async{
var url = "${AppConfig.apiUrl}/login";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
};
ApiResponse response = await ApiRequest.post(url:url, header:header,body: requestBody,middleWare:BannedMiddleware(context));
debugPrint("Respons:::${response.body}:::");
if(response.result){
return loginResponseFromJson(response.body);
}else{
return loginResponseDefaultValue();
}
}
/// Token chack
static Future<TokenCheckResponse> tokenCheck(BuildContext context)async{
var url = "${AppConfig.apiUrl}/token-check";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
"Authorization": "Bearer ${access_token.$}",
};
print(access_token.$);
ApiResponse response = await ApiRequest.get(url, header,middleWare:BannedMiddleware(context));
debugPrint(response.body);
if(response.result){
return tokenCheckResponseFromJson(response.body);
}else
// if(response.statusCode != 200){
// access_token.$ = "";
// MakeRoute.goAndRemoveAll(context, Login());
// }else
{
return TokenCheckResponse(result: false, user: UserInfo.init());
}
}
// logout
static Future<TokenCheckResponse> logout(BuildContext context)async{
var url = "${AppConfig.apiUrl}/logout";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
"Authorization": "Bearer ${access_token.$}",
};
print("LogoOUt::: $url ::");
ApiResponse response = await ApiRequest.get(url, header,middleWare:BannedMiddleware(context));
debugPrint(response.body);
if(response.result){
return tokenCheckResponseFromJson(response.body);
}else{
return TokenCheckResponse(result: false, user: UserInfo.init());
}
}
/// Regster
static Future<RegistrationResponses> registration(BuildContext context,String postBody)async{
var url = "${AppConfig.apiUrl}/register";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
ApiResponse response = await ApiRequest.post(url:url, header:header, body: postBody, middleWare:BannedMiddleware(context));
debugPrint("Register response:: ${response.body} ::");
if(response.result){
return registrationResFromJson(response.body);
}else{
return registrationResponsesDefault();
}
}
/// Forget password
static Future<RegistrationResp> forgetPassword(BuildContext context,String postBody)async{
var url = "${AppConfig.apiUrl}/forgotPassword";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
print("}} $url {{");
ApiResponse response = await ApiRequest.post(url:url, header:header, body: postBody,middleWare:BannedMiddleware(context));
debugPrint("Status Info}} ${response.result} {{");
// debugPrint("}} ${response.body} {{");
if(response.result){
return registrationRespFromJson(response.body);
}else{
return registrationRespDefault();
}
}
/// Otp
static Future<RegistrationResponse> forgetOTP(BuildContext context, String postBody)async{
var url = "${AppConfig.apiUrl}/verify";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
print("URl:: $url ::");
ApiResponse response = await ApiRequest.post(url: url, header: header, body: postBody);
debugPrint("Otp::: ${response.body} :::");
if(response.result){
return registrationResponseFromJson(response.body);
}else{
return registrationResponseDefault();
}
}
}

View File

@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/home_banner_response.dart';
import 'package:grostore/models/response_model.dart';
class BannersApi{
static Future<ResponseModel<HomeBannerResponse>> homeBanner(BuildContext context)async{
var url = "${AppConfig.apiUrl}/banner/home";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
ApiResponse response = await ApiRequest.get(url, header);
debugPrint(response.body);
if(response.result){
return ResponseModel(response.statusCode,homeBannerResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,HomeBannerResponse(data: []));
}
}
}

View File

@@ -0,0 +1,89 @@
import 'dart:convert';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/cart_response.dart';
import 'package:grostore/models/response_model.dart';
class CartApi{
static Future<ResponseModel<CartResponse>> carts()async{
var url = "${AppConfig.apiUrl}/carts";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
header.addAll(getCurrencyHeader());
print(header);
ApiResponse response = await ApiRequest.get(url, header);
print(response.body);
if(response.result){
return ResponseModel(response.statusCode,cartResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,CartResponse(result: false, message: '', carts: [], cartCount: 0, subTotal: '0.0', total: '0.0', couponDiscount: ''));
}
}
static Future<ResponseModel<CartResponse>> addToCart({required variantId,required int qty})async{
var url = "${AppConfig.apiUrl}/carts/add";
Map<String,String> header = getCommonHeader();
header.addAll(getCurrencyHeader());
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
var postBody = jsonEncode({
"product_variation_id":variantId,
"quantity":qty
});
print(header);
print(postBody);
ApiResponse response = await ApiRequest.post(body: postBody, url: url,header: header);
if(response.result){
return ResponseModel(response.statusCode,cartResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode, CartResponse(result: false, message: '', carts: [], cartCount: 0, subTotal: '0.0', total: '0.0', couponDiscount: ''));
}
}
static Future<ResponseModel<CartResponse>> couponApply({required code})async{
var url = "${AppConfig.apiUrl}/coupons/coupon-apply";
Map<String,String> header = getCommonHeader();
header.addAll(getCurrencyHeader());
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
var postBody = jsonEncode({
"code":"$code"
});
ApiResponse response = await ApiRequest.post(body: postBody, url: url,header: header);
if(response.result){
return ResponseModel(response.statusCode,cartResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,CartResponse(result: false, message: '', carts: [], cartCount: 0, subTotal: '0.0', total: '0.0', couponDiscount: ''));
}
}
static Future<ResponseModel<CartResponse>> cartUpdate({required id,required String action})async{
var url = "${AppConfig.apiUrl}/carts/update";
Map<String,String> header = getCommonHeader();
header.addAll(getCurrencyHeader());
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
var postBody = jsonEncode({
"id":id,
"action":action
});
ApiResponse response = await ApiRequest.post(body: postBody, url: url,header: header);
if(response.result){
return ResponseModel(response.statusCode,cartResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,CartResponse(result: false, message: '', carts: [], cartCount: 0, subTotal: '0.0', total: '0.0', couponDiscount: ''));
}
}
}

View File

@@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/response_model.dart';
import 'package:grostore/models/category_response.dart';
class CategoryApi{
static Future<ResponseModel<CategoryResponse>> topCategory()async{
var url = "${AppConfig.apiUrl}/category/top-category";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
ApiResponse response = await ApiRequest.get(url, header);
if(response.result){
return ResponseModel(response.statusCode,categoryResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,categoryResponseFromJson(""));
}
}
static Future<ResponseModel<CategoryResponse>> getCategories(page)async{
var url = "${AppConfig.apiUrl}/category/all?page=$page";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
print(url);
ApiResponse response = await ApiRequest.get(url, header);
if(response.result){
return ResponseModel(response.statusCode,categoryResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,categoryResponseFromJson(""));
}
}
}

View File

@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/coupon_response.dart';
import 'package:grostore/models/home_banner_response.dart';
import 'package:grostore/models/response_model.dart';
class CouponsApi{
static Future<ResponseModel<CouponResponse>> getCoupons()async{
var url = "${AppConfig.apiUrl}/coupons";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header);
debugPrint(response.body);
if(response.result){
return ResponseModel(response.statusCode,couponResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,CouponResponse(data: []));
}
}
}

View File

@@ -0,0 +1,23 @@
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/currency_response.dart';
import 'package:grostore/models/response_model.dart';
class CurrencyApi {
Future<ResponseModel<CurrencyResponse>> getList() async {
var url = "${AppConfig.apiUrl}/currencies";
Map<String, String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
};
ApiResponse response = await ApiRequest.get(url, header);
if (response.result) {
return ResponseModel(response.statusCode,currencyResponseFromJson(response.body));
} else {
return ResponseModel(response.statusCode,CurrencyResponse(data: []));
}
}
}

View File

@@ -0,0 +1,23 @@
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/language_response.dart';
import 'package:grostore/models/response_model.dart';
class LanguageApi{
static Future<ResponseModel<LanguageResponse>> getLanguages()async{
var url = "${AppConfig.apiUrl}/languages";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
ApiResponse response = await ApiRequest.get(url, header);
if(response.statusCode== 200 && response.result){
return ResponseModel(response.statusCode,languageResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,languageResponseFromJson(""));
}
}
}

View File

@@ -0,0 +1,27 @@
import 'package:flutter/material.dart';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/home_banner_response.dart';
import 'package:grostore/models/locations_response.dart';
import 'package:grostore/models/response_model.dart';
class LocationApi{
static Future<ResponseModel<LocationsResponse>> getLocations(BuildContext context)async{
var url = "${AppConfig.apiUrl}/locations";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
ApiResponse response = await ApiRequest.get(url, header);
if(response.result){
return ResponseModel(response.statusCode,locationsResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode, LocationsResponse(data: []));
}
}
}

View File

@@ -0,0 +1,264 @@
import 'dart:convert';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/custom_classes/system_data.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/cart_response.dart';
import 'package:grostore/models/logistics_response.dart';
import 'package:grostore/models/order/order_details_response.dart';
import 'package:grostore/models/order/track_order_response.dart';
import 'package:grostore/models/response_model.dart';
import 'package:grostore/models/order/order_summery_response.dart';
import 'package:grostore/models/order/orders_response.dart';
import 'package:grostore/models/order_create_response.dart';
import 'package:grostore/models/payment_types_response.dart';
import 'package:grostore/models/time_slote_response.dart';
class OrderApi{
static Future<ResponseModel<OrdersResponse>> getOrders(key,page)async{
var url = "${AppConfig.apiUrl}/customer-order-history?status=$key&page=$page";
print("H5:::] $url [::::");
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header);
if(response.result){
return ResponseModel(response.statusCode,ordersResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,OrdersResponse.init());
}
}
static Future<ResponseModel<OrderDetailsResponse>> getDetails({required code})async{
var url = "${AppConfig.apiUrl}/order/invoice/$code";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header,);
if(response.result){
return ResponseModel(response.statusCode,orderDetailsResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,orderDetailsResponseFromJson(""));
}
}
static Future<ResponseModel<OrderSummeryResponse>> getSummery({required logistic_zone_id})async{
var url = "${AppConfig.apiUrl}/order/summery";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
header.addAll(getCurrencyHeader());
header.addAll(getCouponHeader());
var postBody = jsonEncode({
"logistic_zone_id":logistic_zone_id
});
ApiResponse response = await ApiRequest.post(url:url, header:header,body: postBody);
print(response.body);
if(response.result){
return ResponseModel(response.statusCode,orderSummeryResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,OrderSummeryResponse(subTotal: "", tax: "", shippingCharge: "", isFreeShipping:false, couponDiscount: "", total: ""));
}
}
static Future<ResponseModel<LogisticsResponse>> getLogistics({required cityId})async{
var url = "${AppConfig.apiUrl}/logistic-by-city";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
var postBody = jsonEncode({
"city_id":cityId
});
ApiResponse response = await ApiRequest.post(url:url, header:header,body: postBody);
print(response.body);
if(response.result){
return ResponseModel(response.statusCode,logisticsResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,LogisticsResponse(data: []));
}
}
static Future<ResponseModel<OrderCreateResponse>> createOrder({
required shippingId,
required billingId,
required phone,
required alternativePhone,
required logisticZoneId,
required tips,
required shippingDeliveryType,
required timeslot,
required scheduledData,
required paymentType
})async{
var url = "${AppConfig.apiUrl}/order/store";
Map<String,String> header = getCommonHeader();
print("Url==: $url ;==");
print("BearerToken==: ${access_token.$} ;==");
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
// header.addAll(getCouponHeader());
// header.addAll(getCurrencyHeader());
var postBody = jsonEncode({
"shipping_address_id":shippingId,
"billing_address_id":billingId,
"phone":phone,
"alternative_phone":alternativePhone,
"chosen_logistic_zone_id":logisticZoneId,
"tips":tips,
"shipping_delivery_type":shippingDeliveryType,
"timeslot":timeslot,
"scheduled_date":scheduledData,
"payment_method": paymentType,
});
ApiResponse response = await ApiRequest.post(url:url, header:header,body: postBody);
print("::: $postBody :::");
print("Order::: ${response.body}");
print("Order::: ${response.statusCode}");
if(response.result == true){
return ResponseModel(response.statusCode,orderCreateResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,OrderCreateResponse.init());
}
}
static Future<ResponseModel<OrderCreateResponse>> createOrderByCOD({required shippingId,
required billingId,
required phone,
required alternativePhone,
required logisticZoneId,
required tips,
required shippingDeliveryType,
required timeslot,
required scheduledData
})async{
var url = "${AppConfig.apiUrl}/order/cod";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
header.addAll(getCouponHeader());
header.addAll(getCurrencyHeader());
var postBody = jsonEncode({
"shipping_address_id":shippingId,
"billing_address_id":billingId,
"phone":phone,
"alternative_phone":alternativePhone,
"chosen_logistic_zone_id":logisticZoneId,
"tips":tips,
"shipping_delivery_type":shippingDeliveryType,
"timeslot":timeslot,
"scheduled_date":scheduledData,
});
ApiResponse response = await ApiRequest.post(url:url, header:header,body: postBody);
print(response.body);
if(response.result){
return ResponseModel(response.statusCode,orderCreateResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,OrderCreateResponse.init());
}
}
static Future<ResponseModel<OrderCreateResponse>> createOrderByWallet({required shippingId,
required billingId,
required phone,
required alternativePhone,
required logisticZoneId,
required tips,
required shippingDeliveryType,
required timeslot,
required scheduledData
})async{
var url = "${AppConfig.apiUrl}/order/wallet";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
header.addAll(getCouponHeader());
header.addAll(getCurrencyHeader());
var postBody = jsonEncode({
"shipping_address_id":shippingId,
"billing_address_id":billingId,
"phone":phone,
"alternative_phone":alternativePhone,
"chosen_logistic_zone_id":logisticZoneId,
"tips":tips,
"shipping_delivery_type":shippingDeliveryType,
"timeslot":timeslot,
"scheduled_date":scheduledData,
});
ApiResponse response = await ApiRequest.post(url:url, header:header,body: postBody);
print(response.body);
if(response.result){
return ResponseModel(response.statusCode,orderCreateResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,OrderCreateResponse.init());
}
}
static Future<ResponseModel<TimeSlotResponse>> getTimeSlot()async{
var url = "${AppConfig.apiUrl}/time-slot";
Map<String,String> header = getCommonHeader();
header.addAll(getCurrencyHeader());
print(":: $url ::");
ApiResponse response = await ApiRequest.get(url, header);
print("TimeSlot== ${response.statusCode}");
print("TimeSlot== ${response.body}");
if(response.result){
return ResponseModel(response.statusCode,timeSlotResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,TimeSlotResponse(days: 1,timeSlots: []));
}
}
static Future<ResponseModel<List<PaymentTypesResponse>>> getPaymentTypes()async{
var url = "${AppConfig.apiUrl}/payment-types";
Map<String,String> header = getCommonHeader();
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get( url, header);
if(response.result){
return ResponseModel(response.statusCode,paymentTypesResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,[]);
}
}
static Future<ResponseModel<TrackOrderResponse>> trackOrder(id)async{
var url = "${AppConfig.apiUrl}/order/track-order?code=$id";
Map<String,String> header = getCommonHeader();
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get( url, header);
print(response.body);
if(response.result){
return ResponseModel(response.statusCode,trackOrderResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,trackOrderResponseFromJson(''));
}
}
}

View File

@@ -0,0 +1,27 @@
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/models/page_response.dart';
import 'package:grostore/models/response_model.dart';
class PageApi{
static Future<ResponseModel<PageResponse>> getPage({required String slug})
async{
var url = "${AppConfig.apiUrl}/pages/$slug";
Map<String,String> header = getCommonHeader();
ApiResponse response = await ApiRequest.get( url, header);
if(response.result){
return ResponseModel(response.statusCode,pageResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode, pageResponseFromJson(""));
}
}
}

View File

@@ -0,0 +1,95 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/custom_classes/system_data.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/response_model.dart';
import 'package:grostore/models/product_details_response.dart';
import 'package:grostore/models/product_mini_response.dart';
class ProductApi {
static Future<ResponseModel<ProductMiniResponse>> getAllProducts({
String? categoryId='',min_price='',max_price='',search='',page
}) async {
var url = "${AppConfig.apiUrl}/products?page=$page&search=$search&min_price=$min_price&max_price=$max_price&category_id=$categoryId";
Map<String, String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
"Stock-Location-Id": stock_location_id.$
};
print("Url2:::$url:::");
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header);
print("Response::=== ${response.body}=====");
if (response.result) {
print("Respnse::=== ${response.body}=====");
return ResponseModel(
response.statusCode,
productMiniResponseFromJson(response.body));
} else {
return ResponseModel(response.statusCode, ProductMiniResponse(data: []));
}
}
static Future<ResponseModel<ProductMiniResponse>> bestSelling(
BuildContext context) async {
var url = "${AppConfig.apiUrl}/products/best-selling";
Map<String, String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
"Stock-Location-Id": stock_location_id.$
};
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header);
if (response.result) {
return ResponseModel(
response.statusCode, productMiniResponseFromJson(response.body));
} else {
return ResponseModel(response.statusCode, ProductMiniResponse(data: []));
}
}
static Future<ResponseModel<ProductMiniResponse>> relatedProducts(
BuildContext context, String slug) async {
var url = "${AppConfig.apiUrl}/products/related";
var postBody = jsonEncode({"slug": slug});
print("Releted:: ${postBody} ::");
Map<String, String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
header.addAll(getCurrencyHeader());
ApiResponse response =
await ApiRequest.post(url: url, header: header, body: postBody);
if (response.result) {
return ResponseModel(
response.statusCode, productMiniResponseFromJson(response.body));
} else {
return ResponseModel(response.statusCode, ProductMiniResponse(data: []));
}
}
static Future<ResponseModel<ProductDetailsResponse>> details(
BuildContext context, String slug) async {
var url = "${AppConfig.apiUrl}/products/$slug";
Map<String, String> header = getCommonHeader();
// header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header);
print("Details::: ${response.body}::");
if (response.result) {
return ResponseModel(
response.statusCode, productDetailsResponseFromJson(response.body));
} else {
return ResponseModel(
response.statusCode,
ProductDetailsResponse(
result: false, data: ProductDetailsInfo.init(), status: 400));
}
}
}

View File

@@ -0,0 +1,65 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/common_response.dart';
import 'package:grostore/models/coupon_response.dart';
import 'package:grostore/models/home_banner_response.dart';
import 'package:grostore/models/refund_response.dart';
import 'package:grostore/models/response_model.dart';
import 'package:grostore/models/wallet_history_response.dart';
class RefundApi{
static Future<ResponseModel<RefundResponse>> getRefundHistory(page)async{
var url = "${AppConfig.apiUrl}/refunds?page=$page";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header);
debugPrint(response.body);
if(response.statusCode== 200 && response.result){
return ResponseModel(response.statusCode,refundResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,refundResponseFromJson(""));
}
}
static Future<ResponseModel<CommonResponse>> refundRequest(order_item_id,reason)async{
var url = "${AppConfig.apiUrl}/refund/request";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
var postBody = jsonEncode({
"order_item_id":order_item_id,
"refund_reason":reason
});
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.post(url:url, body: postBody,header:header);
debugPrint(response.body);
if(response.statusCode== 200 && response.result){
return ResponseModel(response.statusCode,commonResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,commonResponseFromJson(""));
}
}
}

View File

@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/coupon_response.dart';
import 'package:grostore/models/help_center_response.dart';
import 'package:grostore/models/home_banner_response.dart';
import 'package:grostore/models/refund_response.dart';
import 'package:grostore/models/response_model.dart';
import 'package:grostore/models/setting_response.dart';
import 'package:grostore/models/wallet_history_response.dart';
class SettingApi{
static Future<ResponseModel<SettingResponse>> getSettings()async{
var url = "${AppConfig.apiUrl}/settings";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
ApiResponse response = await ApiRequest.get(url, header);
if(response.statusCode== 200 && response.result){
return ResponseModel(response.statusCode,settingResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,settingResponseFromJson(""));
}
}
static Future<ResponseModel<HelpCenterResponse>> getHelpCenter()async{
var url = "${AppConfig.apiUrl}/settings/help-center";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
ApiResponse response = await ApiRequest.get(url, header);
if(response.statusCode== 200 && response.result){
return ResponseModel(response.statusCode,helpCenterResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,helpCenterResponseFromJson(""));
}
}
}

View File

@@ -0,0 +1,71 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/cart_response.dart';
import 'package:grostore/models/order/order_summery_response.dart';
import 'package:grostore/models/response_model.dart';
import 'package:grostore/models/user/addresses_response.dart';
import '../models/common_response.dart';
class UserApi {
static Future<AddressesResponse> getAddresses() async {
var url = "${AppConfig.apiUrl}/address";
Map<String, String> header = getCommonHeader();
header.addAll({"Authorization": "Bearer ${access_token.$}"});
ApiResponse response = await ApiRequest.get(url, header);
if (response.result) {
return addressesResponseFromJson(response.body);
} else {
return AddressesResponse(data: []);
}
}
static Future<ResponseModel<CommonResponse>> updateProfile(
{File? file, String? name, String? phone}) async {
try {
var url = "${AppConfig.apiUrl}/customer-profile/update";
Map<String, String> header = getCommonHeader();
header.addAll({"Authorization": "Bearer ${access_token.$}"});
print(header);
Map<String, String>? body = {};
if (name != null && phone != null) {
body = {"name": name, "phone": phone};
}
ApiResponse response = await ApiRequest.fileReq(
url: url, header: header, body: body, file: file);
if (response.result) {
return ResponseModel(200, commonResponseFromJson(response.body));
} else {
return ResponseModel(
response.statusCode, commonResponseFromJson(response.body));
}
} catch (e) {
log("Erorrr======?>>>>>${e.toString()}");
return ResponseModel(500, commonResponseFromJson(e.toString()));
}
}
static Future<ResponseModel<CommonResponse>> updatePassword(body) async {
var url = "${AppConfig.apiUrl}/customer-profile/change-password";
Map<String, String> header = getCommonHeader();
header.addAll({"Authorization": "Bearer ${access_token.$}"});
ApiResponse response =
await ApiRequest.post(url: url, header: header, body: body);
print(response.body);
if (response.result) {
return ResponseModel(
response.statusCode, commonResponseFromJson(response.body));
} else {
return ResponseModel(
response.statusCode, commonResponseFromJson(response.body));
}
}
}

View File

@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/coupon_response.dart';
import 'package:grostore/models/home_banner_response.dart';
import 'package:grostore/models/response_model.dart';
import 'package:grostore/models/wallet_history_response.dart';
class WalletApi{
static Future<ResponseModel<WalletHistoryResponse>> getWalletHistory(page)async{
var url = "${AppConfig.apiUrl}/wallet-histories?page=$page";
Map<String,String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$
};
header.addAll({
"Authorization":"Bearer ${access_token.$}"
});
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header);
debugPrint(response.body);
if(response.statusCode== 200 && response.result){
return ResponseModel(response.statusCode,walletHistoryResponseFromJson(response.body));
}else{
return ResponseModel(response.statusCode,walletHistoryResponseFromJson(""));
}
}
}

View File

@@ -0,0 +1,99 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:grostore/api_request.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/custom_classes/system_data.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/common_response.dart';
import 'package:grostore/models/response_model.dart';
import 'package:grostore/models/product_details_response.dart';
import 'package:grostore/models/product_mini_response.dart';
import 'package:grostore/models/wishlist_response.dart';
class WishlistApi {
static Future<ResponseModel<WishlistResponse>> getWishlist() async {
var url = "${AppConfig.apiUrl}/wishlist";
Map<String, String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
"Stock-Location-Id": stock_location_id.$
};
header.addAll({"Authorization": "Bearer ${access_token.$}"});
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header);
if (response.result) {
return ResponseModel(
response.statusCode, wishlistResponseFromJson(response.body));
} else {
return ResponseModel(response.statusCode, WishlistResponse(data: []));
}
}
static Future<ResponseModel<CommonResponse>> checkWishlist(id) async {
var url = "${AppConfig.apiUrl}/wishlist/check/$id";
Map<String, String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
"Stock-Location-Id": stock_location_id.$
};
header.addAll({"Authorization": "Bearer ${access_token.$}"});
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header);
if (response.result) {
return ResponseModel(
response.statusCode, commonResponseFromJson(response.body));
} else {
return ResponseModel(
response.statusCode, CommonResponse(result: false, message: ""));
}
}
static Future<ResponseModel<CommonResponse>> deleteWishlist(id) async {
var url = "${AppConfig.apiUrl}/delete-wishlist/$id";
Map<String, String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
"Stock-Location-Id": stock_location_id.$
};
header.addAll({"Authorization": "Bearer ${access_token.$}"});
header.addAll(getCurrencyHeader());
ApiResponse response = await ApiRequest.get(url, header);
if (response.result) {
return ResponseModel(
response.statusCode, commonResponseFromJson(response.body));
} else {
return ResponseModel(
response.statusCode, CommonResponse(result: false, message: ""));
}
}
static Future<ResponseModel<CommonResponse>> addWishlist(id) async {
var url = "${AppConfig.apiUrl}/add-to-wishlist";
Map<String, String> header = {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
"Stock-Location-Id": stock_location_id.$
};
header.addAll({"Authorization": "Bearer ${access_token.$}"});
header.addAll(getCurrencyHeader());
var postBody = jsonEncode({"product_id": id});
ApiResponse response =
await ApiRequest.post(body: postBody, url: url, header: header);
if (response.result) {
return ResponseModel(
response.statusCode, commonResponseFromJson(response.body));
} else {
return ResponseModel(
response.statusCode, CommonResponse(result: false, message: ""));
}
}
}

214
app_code/lib/app_lang.dart Normal file
View File

@@ -0,0 +1,214 @@
import 'package:flutter/material.dart';
import 'l10n/app_localizations.dart';
class AppLang {
static const langList = [
'ab',
'aa',
'af',
'ak',
'sq',
'am',
'ar',
'an',
'hy',
'as',
'av',
'ae',
'ay',
'az',
'bm',
'ba',
'eu',
'be',
'bn',
'bh',
'bi',
'bs',
'br',
'bg',
'my',
'ca',
'km',
'ch',
'ce',
'ny',
'zh',
'cu',
'cv',
'kw',
'co',
'cr',
'hr',
'cs',
'da',
'dv',
'nl',
'dz',
'en',
'eo',
'et',
'ee',
'fo',
'fj',
'fi',
'fr',
'ff',
'gd',
'gl',
'lg',
'ka',
'de',
'ki',
'el',
'kl',
'gn',
'gu',
'ht',
'ha',
'he',
'hz',
'hi',
'ho',
'hu',
'is',
'io',
'ig',
'id',
'ia',
'ie',
'iu',
'ik',
'ga',
'it',
'ja',
'jv',
'kn',
'kr',
'ks',
'kk',
'rw',
'kv',
'kg',
'ko',
'kj',
'ku',
'ky',
'lo',
'la',
'lv',
'lb',
'li',
'ln',
'lt',
'lu',
'mk',
'mg',
'ms',
'ml',
'mt',
'gv',
'mi',
'mr',
'mh',
'ro',
'mn',
'na',
'nv',
'nd',
'ng',
'ne',
'se',
'no',
'nb',
'nn',
'ii',
'oc',
'oj',
'or',
'om',
'os',
'pi',
'pa',
'ps',
'fa',
'pl',
'pt',
'qu',
'rm',
'rn',
'ru',
'sm',
'sg',
'sa',
'sc',
'sr',
'sn',
'sd',
'si',
'sk',
'sl',
'so',
'st',
'nr',
'es',
'su',
'sw',
'ss',
'sv',
'tl',
'ty',
'tg',
'ta',
'tt',
'te',
'th',
'bo',
'ti',
'to',
'ts',
'tn',
'tr',
'tk',
'tw',
'ug',
'uk',
'ur',
'uz',
've',
'vi',
'vo',
'wa',
'cy',
'fy',
'wo',
'xh',
'yi',
'yo',
'za',
'zu'
];
List<Locale> localList = [];
List<Locale> supportedLocales() {
langList.forEach((lang) {
var local =[Locale(lang, 'en'),Locale(lang, 'uz'),Locale(lang, 'ru')];
localList.addAll(local);
});
return localList;
}
static late BuildContext _context;
static setContext(BuildContext context){
_context = context;
}
static AppLocalizations getLocal(){
return AppLocalizations.of(_context)!;
}
static AppLocalizations local (BuildContext context)=> AppLocalizations.of(context)!;
}

View File

@@ -0,0 +1,19 @@
class AppConfig{
static String appName ="KarvonMarket.uz";//Rename it with your app name
static const bool https = true;//Make it true if your domain support https otherwise make it false
// static const domain = "192.168.31.237/enmart-laravel"; //If you want to connect with local host provide your ip address instead localhost.
// static const domain = "domain.com"; //If you want to connect with your server replace it with your domain name
// static const domain = "grostore.themetags.com"; //If you want to connect with your server replace it with your domain name
static const domain = "karvonmarket.uz"; //If you want to connect with your server replace it with your domain name
//Don't try change below values
static const String apiEndPath = "api";
static const String protocol = https ? "https://" : "http://";
static const String baseUrl = protocol+ domain;
static const String apiUrl = "$baseUrl/$apiEndPath";
}

View File

@@ -0,0 +1,118 @@
import 'package:flutter/material.dart';
import 'package:grostore/configs/theme_config.dart';
class StyleConfig {
static double get padding => 18.0;
static double get padding14 => 14.0;
static double get xsSectionSpacer => 10.0;//Extra Small section separator
static double get smSectionSpacer => 14.0;//Small section separator
static double get mSectionSpacer => 24.0;//Medium section separator
static RoundedRectangleBorder buttonRadius(radius) => RoundedRectangleBorder(
borderRadius: BorderRadius.circular(radius.toDouble()));
static TextStyle fs30fwEBold() {
return TextStyle(
fontSize: 30,
color: ThemeConfig.fontColor,
fontWeight: FontWeight.w800);
}
static TextStyle get fs8 => TextStyle(
fontSize: 8, color: ThemeConfig.fontColor, fontWeight: FontWeight.normal);
static TextStyle get fs10 => TextStyle(
fontSize: 10,
color: ThemeConfig.fontColor,
fontWeight: FontWeight.normal);
static TextStyle get fs10Black => TextStyle(
fontSize: 9,
color: ThemeConfig.fontColor,
fontWeight: FontWeight.normal);
static TextStyle get fs11 => TextStyle(
fontSize: 11,
color: ThemeConfig.fontColor,
fontWeight: FontWeight.normal);
static TextStyle get fs12 => TextStyle(
fontSize: 12,
color: ThemeConfig.fontColor,
fontWeight: FontWeight.normal);
static TextStyle get fs12Red => TextStyle(
fontSize: 12,
color: ThemeConfig.red,
fontWeight: FontWeight.normal);
static TextStyle get fs12cWhitefwBold => TextStyle(
fontSize: 12, color: ThemeConfig.white, fontWeight: FontWeight.bold);
static TextStyle get fs12cWhite => TextStyle(
fontSize: 12, color: ThemeConfig.white, fontWeight: FontWeight.normal);
static TextStyle get fs12cGrey => TextStyle(
fontSize: 12, color: ThemeConfig.grey, fontWeight: FontWeight.normal);
static TextStyle get fs12cLightfwEBold => TextStyle(
fontSize: 12,
color: ThemeConfig.lightFontColor,
fontWeight: FontWeight.bold);
static TextStyle get fs12cLightfwNormal => TextStyle(
fontSize: 12,
color: ThemeConfig.lightFontColor,
fontWeight: FontWeight.normal);
static TextStyle get fs14fwNormal => TextStyle(
fontSize: 14,
color: ThemeConfig.fontColor,
fontWeight: FontWeight.normal);
static TextStyle get fs14fwBold => TextStyle(
fontSize: 14, color: ThemeConfig.fontColor, fontWeight: FontWeight.bold);
static TextStyle get fs14cSecondryfwNormal => TextStyle(
fontSize: 14, color: ThemeConfig.secondaryColor, fontWeight: FontWeight.bold);
static TextStyle get fs14cSecondryfwBold => TextStyle(
fontSize: 14, color: ThemeConfig.secondaryColor, fontWeight: FontWeight.bold);
static TextStyle get fs14cRedfwBold => TextStyle(
fontSize: 14, color: ThemeConfig.red, fontWeight: FontWeight.bold);
static TextStyle get fs14cRedfwNormal => TextStyle(
fontSize: 14, color: ThemeConfig.red, fontWeight: FontWeight.normal);
static TextStyle get fs14cWhitefwNormal => TextStyle(
fontSize: 14, color: ThemeConfig.white, fontWeight: FontWeight.normal);
static TextStyle get fs14cWhitefwBold => TextStyle(
fontSize: 14, color: ThemeConfig.white, fontWeight: FontWeight.bold);
static TextStyle get fs16 => TextStyle(
fontSize: 16, color: ThemeConfig.fontColor, fontWeight: FontWeight.normal);
static TextStyle get fs16fwBold => TextStyle(
fontSize: 16, color: ThemeConfig.fontColor, fontWeight: FontWeight.bold);
static TextStyle get fs16cWhitefwBold => TextStyle(
fontSize: 16, color: ThemeConfig.white, fontWeight: FontWeight.bold);
static TextStyle get fs16cRedfwBold => TextStyle(
fontSize: 16, color: ThemeConfig.red, fontWeight: FontWeight.bold);
static TextStyle get fs18BlackfwBold => TextStyle(
fontSize: 18, color: ThemeConfig.fontColor, fontWeight: FontWeight.bold);
static TextStyle get fs20fwBold => TextStyle(
fontSize: 20, color: ThemeConfig.fontColor, fontWeight: FontWeight.bold);
static TextStyle get fs20cWhitefwBold => const TextStyle(
fontSize: 20, color: ThemeConfig.white, fontWeight: FontWeight.bold);
static TextStyle get fs22fwEBold => TextStyle(
fontSize: 22, color: ThemeConfig.fontColor, fontWeight: FontWeight.bold);
static TextStyle get fs24fwBold => TextStyle(
fontSize: 24, color: ThemeConfig.fontColor, fontWeight: FontWeight.bold);
}

View File

@@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
class ThemeConfig{
static Color accentColor=const Color.fromRGBO(78, 181, 41,1);// main theme color
static Color accentDarkColor=const Color.fromRGBO(18, 104, 13,1);// deep theme color
static Color splashBackground =const Color.fromRGBO(237, 248, 234, 1);
static Color fontColor=const Color.fromRGBO(33, 43, 54, 1);
static Color lightFontColor=const Color.fromRGBO(67, 78, 88, 1);
//Optional Color
static Color secondaryColor=const Color.fromRGBO(255, 124, 8,1);
//DO NOT TRY TO CHANGE THIS COLOR'S
static const Color white = Color.fromRGBO(255,255,255, 1);
static Color noColor = Color.fromRGBO(255,255,255, 0);
static Color xxlightGrey = Color.fromRGBO(243, 245, 247, 1.0);
static Color xlightGrey = Color.fromRGBO(239,239,239, 1);
static Color lightGrey = Color.fromRGBO(209,209,209, 1);
static Color mediumGrey = Color.fromRGBO(167,175,179, 1);
static Color blueGrey = Color.fromRGBO(168,175,179, 1);
static Color grey = Color.fromRGBO(153,153,153, 1);
static Color darkGrey = Color.fromRGBO(107,115,119, 1);
static Color extraDarkGrey = Color.fromRGBO(62,68,71, 1);
static Color amberLight = Color.fromRGBO(254, 234, 209, 1);
static Color amberMedium = Color.fromRGBO(254, 240, 215, 1);
static Color amber = Color.fromRGBO(228, 0, 43, 1.0);
static Color amberShadow = Color.fromRGBO(255, 168, 0, .4);
static Color red = Color.fromRGBO(236, 9, 44, 1);
static Color green = Colors.green;
static Color blue = Colors.blue;
static Color shimmer_base = Colors.grey.shade50;
static Color shimmer_highlighted = Colors.grey.shade200;
static MaterialColor accentMaterialColor= MaterialColor(ThemeConfig.accentColor.value,{
50 : ThemeConfig.accentColor.withOpacity(0.05),
100 : ThemeConfig.accentColor.withOpacity(0.1),
200 : ThemeConfig.accentColor.withOpacity(0.2),
300 : ThemeConfig.accentColor.withOpacity(0.3),
400 : ThemeConfig.accentColor.withOpacity(0.4),
500 : ThemeConfig.accentColor.withOpacity(0.5),
600 : ThemeConfig.accentColor.withOpacity(0.6),
700 : ThemeConfig.accentColor.withOpacity(0.7),
800 : ThemeConfig.accentColor.withOpacity(0.8),
900 : ThemeConfig.accentColor.withOpacity(0.9),
});
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
import 'package:grostore/constant/country_code.dart';
class CountrySearchDialog extends StatefulWidget {
@override
_CountrySearchDialogState createState() => _CountrySearchDialogState();
}
class _CountrySearchDialogState extends State<CountrySearchDialog> {
List<Country> country = CountryCode().get();
List<Country> filteredCountry = [];
@override
void initState() {
filteredCountry = country;
super.initState();
}
void filtercountry(String query) {
query = query.toLowerCase();
setState(() {
filteredCountry = country
.where((product) => product.name.toLowerCase().contains(query))
.toList();
});
}
@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text('Search Product'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
TextField(
onChanged: filtercountry,
decoration: InputDecoration(
labelText: 'Search',
),
),
SizedBox(height: 16.0),
Expanded(
child: ListView.builder(
itemCount: filteredCountry.length,
itemBuilder: (context, index) {
final country = filteredCountry[index];
return ListTile(
title: Text(country.name),
onTap: () {
Navigator.of(context).pop(country);
},
);
},
),
),
],
),
);
}
}

View File

@@ -0,0 +1,28 @@
class ProductVariationData{
String name;
int id;
List<ProductVariationValue> values;
ProductVariationData({
required this.id,
required this.name,
required this.values,
});
}
class ProductVariationValue {
var id;
String name;
var code;
bool isChosen;
ProductVariationValue({
required this.id,
required this.isChosen,
required this.name,
this.code,
});
}

View File

@@ -0,0 +1,12 @@
import 'package:grostore/models/common/user_info.dart';
import 'package:grostore/models/currency_response.dart';
import 'package:grostore/models/setting_response.dart';
class SystemData {
// static CurrencyInfo? systemCurrency;
static SettingResponse? settings;
static bool isLogIn = false;
static UserInfo userInfo =
UserInfo(name: "", phone: "", balance: "", avatar: "");
static String couponCode = "";
}

View File

@@ -0,0 +1,81 @@
import 'package:flutter/material.dart';
import 'package:grostore/configs/theme_config.dart';
class Button extends StatelessWidget {
final Color? color;
final OutlinedBorder? shape;
final Widget child;
final EdgeInsetsGeometry? padding;
final dynamic? minWidth;
final dynamic? minHeight;
final dynamic? onPressed;
final AlignmentGeometry alignment;
const Button({Key? key, this.color = const Color.fromARGB(0, 0, 0, 0),
this.shape = const RoundedRectangleBorder(),
required this.child,
this.alignment = Alignment.center,
this.padding = EdgeInsets.zero,
this.minHeight,
this.minWidth,
this.onPressed}) : super(key: key);
@override
Widget build(BuildContext context) {
return _basic();
}
Widget _basic() {
//if (width != null && height != null)
return TextButton(
style: TextButton.styleFrom(
foregroundColor: ThemeConfig.fontColor,
padding: padding,
backgroundColor: color,
minimumSize: minWidth == null ? null : Size(minWidth.toDouble(),minHeight?? 10),
alignment: alignment,
shape: shape),
onPressed: onPressed,
child: child,
);
}
static Widget minSize(
{required width,
required double height,
color,
shape,
child,
EdgeInsetsGeometry padding=EdgeInsets.zero,
dynamic onPressed}) {
return TextButton(
style: TextButton.styleFrom(
padding: padding,
foregroundColor: ThemeConfig.noColor,
minimumSize: Size(width.toDouble(), height.toDouble()),
backgroundColor: onPressed != null ? color : ThemeConfig.grey,
shape: shape,
disabledForegroundColor: Colors.blue),
child: child,
onPressed: onPressed,
);
}
static Widget maxSize(
{width, height, color, shape, child, dynamic onPressed}) {
return TextButton(
style: TextButton.styleFrom(
foregroundColor: ThemeConfig.noColor,
maximumSize: Size(width, height),
backgroundColor: color,
shape: shape),
child: child,
onPressed: onPressed,
);
}
}

View File

@@ -0,0 +1,144 @@
import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:grostore/helpers/common_functions.dart';
class ImageView extends StatelessWidget {
late String url;
double? width, height;
double radius;
BoxFit? fit;
ImageView({Key? key, required this.url, this.fit, this.width, this.height ,this.radius = 10.0, })
: super(key: key);
@override
Widget build(BuildContext context) {
return
ClipRRect(
borderRadius: BorderRadius.circular(radius),
clipBehavior: Clip.antiAlias,
child:url.isNotEmpty?
CachedNetworkImage(
alignment: Alignment.center,
imageUrl: url,
height: height,
width: width,
fit: fit,
placeholder: (context, url) => Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,fit: fit,),
errorWidget: (context, url, error) => _placeHolder(),
):
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,),
),
);
/// #Eski kod
// ClipRRect(
// borderRadius: BorderRadius.circular(radius!),
// child:url.isNotEmpty?
// CachedNetworkImage(
// imageUrl: url,
// height: height,
// width: width,
// fit: BoxFit.cover,
// placeholder: (context, url) => Image.asset(getAssetLogo("logo.png"),color: ThemeConfig.xxlightGrey,),
// errorWidget: (context, url, error) => _placeHolder(),
// ):
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: Image.asset(getAssetLogo("logo.png"),color: ThemeConfig.xxlightGrey,),
// ),
// );
}
show(BuildContext context) {
return CachedNetworkImage(
imageUrl: url,
height: height,
width: width,
fit: BoxFit.cover,
placeholder: (context, url) => const Row(
children: [
CircularProgressIndicator(),
SizedBox(
width: 10,
height: 10,
)
],
),
errorWidget: (context, url, error) => _placeHolder(),
);
}
static round({
required BuildContext context,
required double radius,
required url,
required height,
required width,
}) {
return Container(
height:double.parse(height.toString()) ,
width: double.parse(width.toString()),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(double.parse(radius.toString())),
image:url!=null? DecorationImage(image: NetworkImage(url)):DecorationImage(image:AssetImage(getAssetIcon("profile.png"))),
),
);
//CircleAvatar()
}
static svg({required String url,double height=40,double width=40}){
if( url.isEmpty){
return Container(
child: _staticPlaceHolder());
}
return SvgPicture.network(
url,
height:height ,
width: width,
fit: BoxFit.contain,
placeholderBuilder: (BuildContext context) => Container(
child: _staticPlaceHolder(),
),
);
}
static roundFileImage({
required BuildContext context,
required double radius,
required File file,
required height,
required width,
}){
return Container(
height:double.parse(height.toString()) ,
width: double.parse(width.toString()),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(double.parse(radius.toString())),
image:file !=null? DecorationImage(image: FileImage(file)):DecorationImage(image:AssetImage(getAssetIcon("profile.png"))),
),
);
}
Widget _placeHolder(){
return SizedBox(
height: height,
width: width,
child: Image.asset(getAssetLogo("logo_a.png",),fit: BoxFit.cover,color: ThemeConfig.xxlightGrey,));
}
static Widget _staticPlaceHolder(){
return Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,);
}
}

View File

@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
import 'package:grostore/configs/style_config.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/device_info_helper.dart';
class AuthScreen{
static Widget buildScreen(BuildContext context,Widget child){
return Scaffold(
backgroundColor: Colors.white,
body:Container(
alignment: Alignment.center,
height: getHeight(context),
decoration: BoxDecoration(
image: DecorationImage(image: AssetImage(getAssetImage("auth_background.png")))
),
child: CustomScrollView(
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics()),
slivers: [
SliverList(
delegate: SliverChildListDelegate(
[
Padding(
padding: const EdgeInsets.only(top: 50.0),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 8,vertical: 12),
width: 150,
height: 150,
decoration: BoxDecoration(
color: ThemeConfig.white,
borderRadius: BorderRadius.circular(8)),
child: Image.asset(getAssetLogo("img_logo2.png")),
),
),
Container(
// alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: StyleConfig.padding),
child: child,),
],
),
)
],
),
),
);
}
}

View File

@@ -0,0 +1,55 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:grostore/configs/theme_config.dart';
class BoxDecorations{
static BoxDecoration basic(){
return BoxDecoration(
border:Border.all(
color: ThemeConfig.lightGrey,
width: 1) ,
borderRadius: const BorderRadius.all(
const Radius.circular(2.0),
)
);
}
static BoxDecoration image({required String url,radius =0}){
return BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(double.parse(radius.toString())),
),
image:DecorationImage(image: CachedNetworkImageProvider(url),
fit: BoxFit.cover
)
);
}
static BoxDecoration shadow({double radius=0.0, }){
return BoxDecoration(
borderRadius : BorderRadius.all(Radius.circular(radius)),
boxShadow : [
BoxShadow(
color: ThemeConfig.xlightGrey.withOpacity(0.5),
offset: Offset(0,1),
blurRadius: 2
)],
color : ThemeConfig.white,
);
}
static BoxDecoration customRadius({required BorderRadiusGeometry radius,Color color = ThemeConfig.white }){
return BoxDecoration(
borderRadius : radius,
boxShadow : [
BoxShadow(
color: ThemeConfig.xlightGrey.withOpacity(0.5),
offset: Offset(0,1),
blurRadius: 2
)],
color : color,
);
}
}

View File

@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:grostore/configs/style_config.dart';
import 'package:grostore/custom_ui/Button.dart';
import 'package:grostore/custom_ui/Image_view.dart';
import 'package:grostore/custom_ui/BoxDecorations.dart';
import 'package:grostore/helpers/device_info_helper.dart';
class CategoryUi extends StatelessWidget {
late String img,name;
CategoryUi({Key? key,required this.img,required this.name}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
decoration:BoxDecorations.shadow(radius: 6.0) ,
width: getWidth(context),
padding: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 3,
child: ImageView(url: img,width:40.0,height: 40.0,)),
const SizedBox(height: 8,),
Expanded(
flex: 2,
child: Text(name,style: StyleConfig.fs12,maxLines: 1,textAlign: TextAlign.center,))
],
)
);
}
}

View File

@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:grostore/configs/style_config.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:grostore/custom_ui/Boxdecorations.dart';
import 'package:grostore/custom_ui/Button.dart';
import 'package:grostore/helpers/route.dart';
import 'package:grostore/screens/main.dart';
class CommonAppbar {
static AppBar show(
{required String title,
required BuildContext context,
bool showBackButton = true,
bool gotoMain = false,
PreferredSizeWidget? bottom}) {
return AppBar(
backgroundColor: ThemeConfig.white,
elevation: 0,
title: Text(
title,
style: StyleConfig.fs16fwBold,
),
centerTitle: true,
leading: showBackButton
? IconButton(
onPressed: (){
if (gotoMain) {
MakeRoute.goAndRemoveAll(context, const Main());
} else {
Navigator.pop(context);
}
},
icon: Icon(
Icons.arrow_back,
size: 26,
color: ThemeConfig.darkGrey,
),
)
: const SizedBox.shrink(),
bottom: bottom,
);
}
}

View File

@@ -0,0 +1,122 @@
import 'package:flutter/material.dart';
import 'package:grostore/helpers/device_info_helper.dart';
class FilterDropDown extends StatefulWidget {
late List<DropDownFilterModel> model;
late Function onSelected;
FilterDropDown({super.key, required this.onSelected, required this.model});
@override
State<FilterDropDown> createState() => _FilterDropDownState();
}
class _FilterDropDownState extends State<FilterDropDown> {
TextEditingController controller=TextEditingController();
List<DropDownFilterModel> data = [];
DropDownFilterModel? selected;
@override
void initState() {
// TODO: implement initState
data.addAll(widget.model);
super.initState();
}
@override
Widget build(BuildContext context) {
return DropdownButton<DropDownFilterModel>(
value: selected,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (DropDownFilterModel? value) {
widget.onSelected(value);
},
items: [
DropdownMenuItem<DropDownFilterModel>(
child: Container(
width: getWidth(context)*0.5,
height: 40,
child: TextField(
controller: controller,
onChanged: (text)async{
if(text.isNotEmpty){
List<DropDownFilterModel> tmp =[];
for(DropDownFilterModel mo in widget.model){
if(mo.name.contains(text)){
tmp.add(mo);
}
}
data.clear();
data.addAll(tmp);
}else{
data.clear();
data.addAll(widget.model);
}
},
),
),
),
DropdownMenuItem<DropDownFilterModel>(
child: Container(
width: getWidth(context)*0.5,
height: 40,
child: TextField(
//controller: controller,
onChanged: (text)async{
if(text.isNotEmpty){
List<DropDownFilterModel> tmp =[];
for(DropDownFilterModel mo in widget.model){
if(mo.name.contains(text)){
tmp.add(mo);
}
}
data.clear();
data.addAll(tmp);
}else{
data.clear();
data.addAll(widget.model);
}
},
),
),
),
//...item(data),
],
);
}
List<DropdownMenuItem<DropDownFilterModel>> item(List<DropDownFilterModel> data) {
// data.insert(0, DropDownFilterModel(key: "_search", name: ""));
List<DropdownMenuItem<DropDownFilterModel>> items = [];
for (DropDownFilterModel model in data) {
items.add(
DropdownMenuItem<DropDownFilterModel>(
child: Text(model.name),
)
);
}
return items;
}
}
class DropDownFilterModel {
late String key;
late String name;
DropDownFilterModel({required this.key, required this.name});
}

View File

@@ -0,0 +1,141 @@
import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:grostore/helpers/common_functions.dart';
class ImageView2 extends StatelessWidget {
late String url;
double? width, height;
double? radius;
ImageView2({Key? key, required this.url, this.width, this.height ,this.radius = 0.0})
: super(key: key);
@override
Widget build(BuildContext context) {
return
ClipRRect(
borderRadius: BorderRadius.circular(radius!),
child:url.isNotEmpty?
CachedNetworkImage(
imageUrl: url,
height: height,
width: width,
fit: BoxFit.cover,
// placeholder: (context, url) => Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,fit: BoxFit.contain,),
errorWidget: (context, url, error) => _placeHolder(),
):
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,),
),
);
/// #Eski kod
// ClipRRect(
// borderRadius: BorderRadius.circular(radius!),
// child:url.isNotEmpty?
// CachedNetworkImage(
// imageUrl: url,
// height: height,
// width: width,
// fit: BoxFit.cover,
// placeholder: (context, url) => Image.asset(getAssetLogo("logo.png"),color: ThemeConfig.xxlightGrey,),
// errorWidget: (context, url, error) => _placeHolder(),
// ):
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: Image.asset(getAssetLogo("logo.png"),color: ThemeConfig.xxlightGrey,),
// ),
// );
}
show(BuildContext context) {
return CachedNetworkImage(
imageUrl: url,
height: height,
width: width,
fit: BoxFit.cover,
placeholder: (context, url) => const Row(
children: [
CircularProgressIndicator(),
SizedBox(
width: 10,
height: 10,
)
],
),
errorWidget: (context, url, error) => _placeHolder(),
);
}
static round({
required BuildContext context,
required double radius,
required url,
required height,
required width,
}) {
return Container(
height:double.parse(height.toString()) ,
width: double.parse(width.toString()),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(double.parse(radius.toString())),
image:url!=null? DecorationImage(image: NetworkImage(url)):DecorationImage(image:AssetImage(getAssetIcon("profile.png"))),
),
);
//CircleAvatar()
}
static svg({required String url,double height=40,double width=40}){
if( url.isEmpty){
return Container(
child: _staticPlaceHolder());
}
return SvgPicture.network(
url,
height:height ,
width: width,
fit: BoxFit.contain,
placeholderBuilder: (BuildContext context) => Container(
child: _staticPlaceHolder(),
),
);
}
static roundFileImage({
required BuildContext context,
required double radius,
required File file,
required height,
required width,
}){
return Container(
height:double.parse(height.toString()) ,
width: double.parse(width.toString()),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(double.parse(radius.toString())),
image:file !=null? DecorationImage(image: FileImage(file)):DecorationImage(image:AssetImage(getAssetIcon("profile.png"))),
),
);
}
Widget _placeHolder(){
return SizedBox(
height: height,
width: width,
child: Image.asset(getAssetLogo("logo_a.png",),fit: BoxFit.cover,color: ThemeConfig.xxlightGrey,));
}
static Widget _staticPlaceHolder(){
return Image.asset(getAssetLogo("logo_a.png"),color: ThemeConfig.xxlightGrey,);
}
}

View File

@@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:grostore/configs/theme_config.dart';
class InputDecorations {
static InputDecoration basic({hint_text = "",Widget? prefixIcon}) {
return InputDecoration(
prefixIcon: prefixIcon,
hintText: hint_text,
filled: true,
fillColor: ThemeConfig.white,
hintStyle: TextStyle(fontSize: 12.0, color: ThemeConfig.lightGrey),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: ThemeConfig.lightGrey,
width: 1),
borderRadius: const BorderRadius.all(
const Radius.circular(2.0),
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: ThemeConfig.lightGrey,
width: 1),
borderRadius: const BorderRadius.all(
const Radius.circular(2.0),
),
),
contentPadding: const EdgeInsets.symmetric(horizontal: 16.0));
}
static InputDecoration phone({hint_text = "",Widget?prefixIcon}) {
return InputDecoration(
// prefixIcon: prefixIcon,
hintText: hint_text,
hintStyle: TextStyle(fontSize: 12.0, color: ThemeConfig.lightGrey),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: ThemeConfig.lightGrey, width: 1),
borderRadius: const BorderRadius.all(Radius.circular(10)),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: ThemeConfig.red, width: 1),
borderRadius: const BorderRadius.all(Radius.circular(10))),
contentPadding: const EdgeInsets.symmetric(horizontal: 16.0));
}
}

View File

@@ -0,0 +1,31 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:grostore/app_lang.dart';
class Loading{
static BuildContext? _context;
static show(BuildContext context){
Loading._context=context;
showDialog(context: context, builder: (context){
return AlertDialog(content: Container(
child: Row(
children: [
CircularProgressIndicator(),
SizedBox(width: 20,),
Text(AppLang.local(context).please_wait_ucf),
],
),
),);
});
}
static close(){
if(Loading._context!=null){
Navigator.pop(_context!);
}
}
}

View File

@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:grostore/app_lang.dart';
import 'package:grostore/helpers/device_info_helper.dart';
class NoData extends StatefulWidget {
const NoData({super.key});
@override
State<NoData> createState() => _NoDataState();
}
class _NoDataState extends State<NoData> {
@override
Widget build(BuildContext context) {
return SizedBox(
height: getHeight(context),
child: Center(
child: Text(AppLang.local(context).data_is_not_available),
),
);
}
}

View File

@@ -0,0 +1,144 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:grostore/app_lang.dart';
import 'package:grostore/configs/style_config.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:grostore/custom_ui/BoxDecorations.dart';
import 'package:grostore/custom_ui/Button.dart';
import 'package:grostore/custom_ui/Image_view.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/device_info_helper.dart';
import 'package:grostore/models/order/order_details_response.dart';
import 'package:grostore/presenters/refund_presenter.dart';
import 'package:provider/provider.dart';
class OrderItem extends StatelessWidget {
Item item;
RefundResult? onReq;
BuildContext context;
OrderItem({super.key, required this.item, required this.context,this.onReq});
TextEditingController controller = TextEditingController();
@override
Widget build(BuildContext context) {
return Container(
//width: (getWidth(context)*0.5)-24,
height: 160,
decoration: BoxDecorations.shadow(radius: 8),
//padding: EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Container(
width: 160,
// height: 50,
// padding: EdgeInsets.only(top: 10),
alignment: Alignment.center,
child: ImageView(
url: item.product?.thumbnailImage ?? "",
width: 134,
height: 92,
)),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 12.0, top: 12),
child: Text(
item.product?.categories.first.name ?? "",
style: StyleConfig.fs10,
),
),
Padding(
padding: const EdgeInsets.only(left: 12.0, top: 4),
child: Text(
item.product?.name ?? "",
style: StyleConfig.fs14fwBold,
maxLines: 1,
),
),
Padding(
padding: const EdgeInsets.only(left: 12.0, top: 8),
child: Text(
"${item.qty} x ${showPrice(item.product?.price ?? '')}",
style: StyleConfig.fs14cRedfwBold,
),
),
Padding(
padding: const EdgeInsets.only(left: 12.0, top: 8),
child: Text(
showPrice(item.totalPrice ?? ""),
style: StyleConfig.fs14cRedfwBold,
),
),
if(item.refund_status!="off")
Container(
margin: EdgeInsets.only(top: 5),
alignment: Alignment.center,
child: Button(
onPressed: item.refund_status == "request"
? (){
refundDialog();
}:null,
shape: StyleConfig.buttonRadius(5),
padding: EdgeInsets.symmetric(horizontal: 10),
color: item.refund_status == "request"
? ThemeConfig.accentColor
: null,
child: Text(
"Refund ${item.refund_status.toString()}".toUpperCase(),
style: item.refund_status == "request"
? StyleConfig.fs12cWhite
: StyleConfig.fs12,
)
),
)
],
),
),
],
),
);
}
refundDialog() {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text("Refund Reason"),
content: Container(
padding: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
decoration: BoxDecorations.basic().copyWith(border: Border.all(color: ThemeConfig.grey)),
height: 100,
width: getWidth(context) * 0.5,
child: TextField(
controller: controller,
decoration: InputDecoration.collapsed(hintText: "reason"),
),
),
actions: [
Button(
color: ThemeConfig.accentColor,
onPressed:() {
Navigator.pop(context);
Provider.of<RefundPresenter>(context, listen: false)
.refundReq(this.context,item.id,controller.text.trim()).then((value) => onReq != null?onReq!(value):null);
},
child: Text(AppLang.local(context).submit,style: StyleConfig.fs12cWhite,))
],
));
}
}
typedef RefundResult = Function(bool value);

View File

@@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:grostore/configs/style_config.dart';
import 'package:grostore/custom_ui/BoxDecorations.dart';
import 'package:grostore/custom_ui/Button.dart';
import 'package:grostore/custom_ui/Image_view.dart';
import 'package:grostore/helpers/device_info_helper.dart';
import 'package:grostore/helpers/route.dart';
import 'package:grostore/models/order/orders_response.dart';
import 'package:grostore/screens/order/order_details.dart';
class OrderViewModel extends StatelessWidget {
OrderViewModel({Key? key ,required this.orderInfo,required this.context}) : super(key: key);
OrderInfo orderInfo;
// int orderId;
BuildContext context;
@override
Widget build(BuildContext context) {
return Container(
width: getWidth(this.context),
height: 100,
padding: EdgeInsets.symmetric(horizontal: StyleConfig.padding),
decoration: BoxDecorations.shadow(radius: 2),
child: Button(
onPressed: (){
print("} ${orderInfo.id} {");
MakeRoute.go(this.context, OrderDetails(code: orderInfo.group_id,));
},
child: Row(
children: [
Expanded(
flex: 1,
child: Image(image: AssetImage("assets/logos/logo_a.png"),)
),
Expanded(
flex:3,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
width: getWidth(this.context)*0.50,
child: Text("Buyurtma raqami: ${orderInfo.group_id}",style: StyleConfig.fs16,)),
// SizedBox(
// width: getWidth(this.context)*0.50,
// child: Text(orderInfo.item.product?.categories.first.name??"",style: StyleConfig.fs14fwNormal,)),
SizedBox(
width: getWidth(this.context)*0.50,
child: Text("Umumiy summa: ${orderInfo.item.totalPrice}",style: StyleConfig.fs14fwBold,)),
SizedBox(
width: getWidth(this.context)*0.50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Buyurtma sanasi:",style: StyleConfig.fs12,maxLines: 1,),
Flexible(
flex: 1,
child: Text("${orderInfo.date.year}/0${orderInfo.date.day}/0${orderInfo.date.month}",style: StyleConfig.fs11,maxLines: 1,textAlign: TextAlign.right,)),
],
),
),
],
),
)
],
),
),
);
}
}

View File

@@ -0,0 +1,192 @@
import 'package:flutter/material.dart';
import 'package:grostore/configs/style_config.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:grostore/custom_classes/system_data.dart';
import 'package:grostore/custom_ui/Button.dart';
import 'package:grostore/custom_ui/Image_view.dart';
import 'package:grostore/custom_ui/BoxDecorations.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/helpers/route.dart';
import 'package:grostore/models/product_mini_response.dart';
import 'package:grostore/presenters/cart_presenter.dart';
import 'package:grostore/screens/auth/login.dart';
import 'package:grostore/screens/product_details.dart';
import 'package:provider/provider.dart';
class ProductCard extends StatelessWidget {
late ProductMini product;
late BuildContext context;
ProductCard({Key? key,required this.product ,required this.context}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: 160,
height: 160,
alignment: Alignment.center,
decoration: BoxDecorations.shadow(radius: 8),
//padding: EdgeInsets.all(8),
child: Stack(
children: [
ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(8)),
clipBehavior: Clip.antiAlias,
child: Button(
minWidth: MediaQuery.sizeOf(context).width,
onPressed: (){
MakeRoute.productRoute(this.context, ProductDetails(slug: product.slug));
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
flex:7,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Hero(
tag: product,
child: ImageView(url: product.thumbnailImage,fit: BoxFit.contain,)),
),
),
),
Expanded(
flex: 6,
child: Padding(
padding: const EdgeInsets.only(bottom: 8,left: 8,right: 28,top: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex:6,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(product.categories.first.name,style: StyleConfig.fs10,overflow: TextOverflow.ellipsis,),
SizedBox(width: MediaQuery.sizeOf(context).width,child: Text(product.name,style: StyleConfig.fs14fwBold,maxLines: 2,overflow: TextOverflow.ellipsis,)),
],
),
),
Expanded(
flex: 3,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(showPrice(product.price),style: StyleConfig.fs14cRedfwBold,),
],
),
),
],
),
),
),
],
),
),
),
/// #Add Button
Positioned(
bottom: -4,
right: -4,
child: Button.minSize(
color: ThemeConfig.fontColor,
onPressed: (){
if(SystemData.isLogIn){
if(product.variations.length==1) {
Provider.of<CartPresenter>(context, listen: false)
.addToCart(product.variations.first.id, 1, context);
}else{
MakeRoute.productRoute(this.context, ProductDetails(slug: product.slug));
}
}else{
MakeRoute.productRoute(this.context, const Login());
}
},
width: 40,
height: 40,
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(8),bottomRight: Radius.circular(8))),
child: const Icon(Icons.add,color: ThemeConfig.white,),
)),
],
),
);
/// #Eski kod
// Container(
// width: 160,
// height: 160,
// decoration: BoxDecorations.shadow(radius: 8),
// //padding: EdgeInsets.all(8),
// child: Stack(
// children: [
// Button(
// minWidth: 160,
// onPressed: (){
// MakeRoute.productRoute(this.context, ProductDetails(slug: product.slug));
// },
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Container(
// width: 160,
// // padding: EdgeInsets.only(top: 10),
// alignment: Alignment.center,
// child: Hero(
// tag: product,
// child: ImageView(url: product.thumbnailImage,width: 134,height: 92,))),
// Padding(
// padding: const EdgeInsets.only(left: 12.0,top: 12),
// child: Text(product.categories.first.name,style: StyleConfig.fs10,),
// ),
// Padding(
// padding: const EdgeInsets.only(left: 12.0,top: 4),
// child: Text(product.name,style: StyleConfig.fs14fwBold,maxLines: 2,),
// ),
// Padding(
// padding: const EdgeInsets.only(left: 12.0,top: 8),
// child: Text(showPrice(product.price),style: StyleConfig.fs14cRedfwBold,),
// ),
//
// ],
// ),
// ),
// Positioned(
// bottom: -4,
// right: -4,
// child: Button.minSize(
// color: ThemeConfig.fontColor,
// onPressed: (){
// if(SystemData.isLogIn){
// if(product.variations.length==1) {
// Provider.of<CartPresenter>(context, listen: false)
// .addToCart(product.variations.first.id, 1, context);
// }else{
// MakeRoute.productRoute(this.context, ProductDetails(slug: product.slug));
//
// }
// }else{
// MakeRoute.productRoute(this.context, Login());
//
// }
//
// },
// width: 40,
// height: 40,
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(8),bottomRight: Radius.circular(8))),
// child: Icon(Icons.add,color: ThemeConfig.white,),
// )),
// ],
// ),
//
// );
}
}

View File

@@ -0,0 +1,84 @@
import 'package:flutter/material.dart';
import 'package:grostore/configs/style_config.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:shimmer/shimmer.dart';
class Shimmers extends StatelessWidget {
late double width, height;
double? radius;
Shimmers(
{Key? key, required this.width, required this.height, this.radius = 0})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: width,
height: height,
child: Shimmer.fromColors(
baseColor: ThemeConfig.xlightGrey,
highlightColor: ThemeConfig.lightGrey,
child: Container(
decoration: BoxDecoration(
color: ThemeConfig.mediumGrey,
borderRadius:
radius != null ? BorderRadius.circular(radius!) : null,
),
width: width,
height: height),
),
);
}
static list(int items, double width, double height) {
return ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
return Shimmers(width: width, height: height);
},
separatorBuilder: (context, index) {
return const SizedBox(
height: 10,
);
},
itemCount: items);
}
static horizontalList(int items, double width, double height) {
return ListView.separated(
padding: EdgeInsets.symmetric(horizontal: StyleConfig.padding),
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return Shimmers(width: width, height: height);
},
separatorBuilder: (context, index) {
return const SizedBox(
width: 10,
);
},
itemCount: items);
}
static gridShimmer(int crossAxisCount, int items,
{double width = 160, double height = 186, double radius = 8}) {
return GridView.builder(
padding: EdgeInsets.symmetric(horizontal: StyleConfig.padding),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: crossAxisCount,
crossAxisSpacing: 16,
mainAxisSpacing: 16,
childAspectRatio: 0.8),
itemCount: items,
itemBuilder: (context, index) {
return Shimmers(
width: double.parse(width.toString()),
height: double.parse(height.toString()),
radius: double.parse(radius.toString()),
);
});
}
}

View File

@@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:grostore/configs/style_config.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:grostore/helpers/route.dart';
import 'package:grostore/screens/cart.dart';
import 'package:toast/toast.dart';
class ToastUi{
static simpleToast(context,message){
ToastContext().init(context);
return Toast.show(
message,
border: Border.all(color: ThemeConfig.fontColor,width: 1),
backgroundColor: ThemeConfig.white,
textStyle: StyleConfig.fs14fwNormal,
duration: Toast.lengthLong,gravity: Toast.center);
}
static show(BuildContext mainContext,message){
showDialog(
context: mainContext, builder: (context){
Future.delayed(const Duration(milliseconds: 250)).then((value) => Navigator.pop(mainContext));
return AlertDialog(
content: Text(message,style: StyleConfig.fs14fwNormal,),);
});
}
static show3(BuildContext mainContext,message){
showDialog(
context: mainContext, builder: (context){
Future.delayed(const Duration(milliseconds: 1200)).then((value) => Navigator.pop(mainContext));
return AlertDialog(
backgroundColor: Colors.white,
content: Text(message,style: StyleConfig.fs14fwNormal,),);
});
}
static showAdd(BuildContext mainContext,message){
showDialog(
useSafeArea: false,
barrierDismissible: true,
barrierColor: Colors.transparent,
context: mainContext, builder: (context){
Future.delayed(const Duration(milliseconds: 250)).then((value) => Navigator.pop(mainContext));
return AlertDialog(
elevation: 0,
content: InkWell(
onTap: (){
Navigator.of(context).push(MaterialPageRoute(builder: (_)=> const Cart()));
},
child: SizedBox(
height: 20,
child: Text(message,style: StyleConfig.fs14fwNormal,))),);
});
}
static showAdd2(BuildContext mainContext,message){
showDialog(
// useSafeArea: false,
// barrierDismissible: true,
// barrierColor: Colors.transparent,
context: mainContext, builder: (context){
// Future.delayed(const Duration(milliseconds: 200)).then((value) => Navigator.pop(mainContext));
return AlertDialog(
// elevation: 0,
content: InkWell(
onTap: (){},
child: Text(message,style: StyleConfig.fs14fwNormal,)),);
});
}
}

View File

@@ -0,0 +1,76 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:grostore/custom_classes/system_data.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/presenters/main_persenter.dart';
import 'package:grostore/screens/main.dart';
import 'package:provider/provider.dart';
// bool isEmail(String input){
// return RegExp(r'^.+@[a-zA-Z]+\.{1}[a-zA-Z]+(\.{0,1}[a-zA-Z]+)$').hasMatch(input);
// }
resetApp(BuildContext context){
Provider.of<MainPresenter>(context, listen: false).dispose();
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>Main()), (route) => false);
}
getAssetImage(String img){
return "assets/images/$img";
}
getAssetIcon(String icon){
return "assets/icons/$icon";
}
String getAssetLogo(String logo){
return "assets/logos/$logo";
}
getAssetFlag(String name){
return "assets/flags/$name";
}
String getQueryParameter(BuildContext context , String key){
String value = "";
final path = ModalRoute.of(context);
if(path !=null) {
String url = path.settings.name!;
List route = url.split("?");
if (route.isNotEmpty && route[1] != "") {
List qParameters = route[1].split("&");
qParameters.forEach((element) {
List tmp = element.split("=");
if (tmp.isNotEmpty && tmp[0]==key) {
value = tmp[1];
}
});
}
}
return value;
}
Map<String,String> getCurrencyHeader(){
return system_currency.$.isNotEmpty?{
"Currency-Code": system_currency.$
}:{};
}
Map<String,String> getCommonHeader(){
return {
"Accept": "application/json",
"Content-Type": "application/json",
"App-Language": app_language.$,
"Stock-Location-Id":stock_location_id.$
};
}
Map<String,String> getCouponHeader(){
return {
"Coupon-Code":SystemData.couponCode
};
}
String showPrice(String price){
return price;
//price.replaceAll(SystemData.systemCurrency?.code??"", SystemData.systemCurrency?.symbol??"");
}

View File

@@ -0,0 +1,8 @@
import 'package:flutter/material.dart';
double getWidth(context){
return MediaQuery.of(context).size.width;
}
double getHeight(context){
return MediaQuery.of(context).size.height;
}

View File

@@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:grostore/presenters/cart_presenter.dart';
import 'package:grostore/presenters/check_out_presenter.dart';
import 'package:grostore/screens/product_details.dart';
import 'package:provider/provider.dart';
class MakeRoute{
static Navigator route = const Navigator();
static go(BuildContext context,dynamic newRoute){
Navigator.push(context, MaterialPageRoute<ProductDetails>(builder: (context)=>newRoute));
}
static goAndRemoveAll(context,dynamic newRoute){
MakeRoute.clearProviders(context);
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>newRoute),(route)=>false);
}
static productRoute(BuildContext context,Widget route){
if(context.widget.runtimeType == ProductDetails){
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)=>route));
}else{
Navigator.push(context, MaterialPageRoute(builder: (context)=>route));
}
}
static goName(BuildContext context, String route){
Navigator.pushNamed( context, route);
}
static clearProviders(BuildContext context){
Provider.of<CartPresenter>(context,listen: false).clearAll();
Provider.of<CheckOutPresenter>(context,listen: false).clearAll();
}
}

View File

@@ -0,0 +1,42 @@
import 'package:shared_value/shared_value.dart';
final SharedValue<bool> show_landing_page = SharedValue(
value: true, // initial value
key: "show_landing_page",
autosave: true// disk storage key for shared_preferences
);
final SharedValue<String> access_token = SharedValue(
value: "", // initial value
key: "access_token",
autosave: true// disk storage key for shared_preferences
);
final SharedValue<String> app_language = SharedValue(
// initial value
key: "app_mobile_language",
value: "en",
autosave: true
);
final SharedValue<bool> language_is_rtl = SharedValue(
// initial value
key: "language_is_rtl",
value: false,
autosave: true
);
final SharedValue<String> server_app_language = SharedValue(
value: "en", // initial value
key: "server_app_language",
autosave: true// disk storage key for shared_preferences
);
final SharedValue<String> system_currency = SharedValue(
key: "system_currency",
value: '',
);
final SharedValue<String> stock_location_id = SharedValue(
key: "stock_location_id",
value: '',
autosave: true,
);

View File

@@ -0,0 +1,6 @@
import 'package:intl/intl.dart';
class Utils {
static formatPrice(double price) => '\$ ${price.toStringAsFixed(2)}';
static formatDate(DateTime date) => DateFormat.yMd().format(date);
}

View File

@@ -0,0 +1,166 @@
{
"hellow": "hellow",
"please_enter_email": "Please enter email",
"please_enter_name": "Please enter name",
"please_enter_phone": "Please enter phone number",
"please_enter_valid_email": "Please enter valid email",
"please_enter_confirm_password": "Please enter confirm password",
"password_and_confirm_password_is_not_matching": "Password and Confirm password do not match",
"please_enter_password": "Please enter password",
"password_must_be_at_last_6_digit": "Password must be at last 6 digit.",
"welcome_to_online_fresh_food_grocery_application": "Welcome to\nOnline Fresh Food Grocery\nApplication",
"energetically_streamline_one_to_one_web_readiness_before_extensive_meta_services": "Energetically streamline one-to-one web-readiness before extensive meta-services.",
"best_quality_organic_grocery_app_platform_ucf": "Best Quality Organic Grocery App Platform",
"easy_payment_method": "Easy Payment Method",
"skip": "Skip",
"welcome_to_back": "Welcome to Back!",
"login": "Login",
"register": "Register",
"register_now_ucf": "Register Now",
"create_new_account_ucf": "Create New Account",
"email": "Email",
"name": "Name",
"phone": "Phone",
"password": "Password",
"new_password_ucf": "New Password",
"confirm_password_ucf": "Confirm Password",
"sign_up_ucf": "Sign Up",
"already_have_an_account": "Already Have an Account?",
"not_a_member": "Not a member?",
"forgot_password_q_ucf": "Forgot Password?",
"forgot_password_ucf": "Forgot Password",
"send": "Send",
"enter_otp_code": "Enter OTP code",
"reset_password_ucf": "Reset Password",
"otp_all_cap": "OTP",
"resend_otp_all_cap": "Resend OTP",
"home": "Home",
"categories": "Categories",
"cart": "Cart",
"profile": "Profile",
"search_product_ucf": "Search Product",
"top_categories_ucf": "Top Categories",
"best_selling_products_ucf": "Best Selling Products",
"description": "Description",
"price": "Price",
"related_product_ucf": "Related Product",
"edit_profile_ucf": "Edit Profile",
"voucher_n_offers_ucf": "Vouchers & Offers",
"favorite": "Favorite",
"order_n_recording_ucf": "Order & Recording",
"my_profile_ucf": "My Profile",
"help_center_ucf": "Help Center",
"address": "Address",
"notification": "Notification",
"security": "Security",
"track_my_order_ucf": "Track My Order",
"wallet_history_ucf": "Wallet History",
"refund_history_ucf": "Refund History",
"settings": "Settings",
"terms_n_conditions_ucf": "Terms & Conditions",
"log_out_ucf": "Log Out",
"add_to_cart": "Add to cart",
"pick_a_location": "Pick a location",
"locations": "Locations",
"data_is_not_available": "Data is not available",
"product_stock_not_available": "Product stock not available",
"out_of_stock_ucf": "Out of stock",
"order_info_ucf": "Order Info",
"subtotal": "Subtotal",
"delivery_fee_ucf": "Delivery Fee",
"total": "Total",
"review_n_payment_ucf": "Review & Payment",
"promo_code_ucf": "Promo Code",
"apply": "Apply",
"coupon_discount_ucf": "Coupon Discount",
"check_out_ucf": "Check Out",
"delivery_address_ucf": "Delivery Address",
"billing_address_ucf": "Billing Address",
"alternative_phone_ucf": "Alternative Phone",
"additional_info_ucf": "Additional Info",
"tax": "Tax",
"available_logistics_ucf": "Available Logistics",
"please_wait_ucf": "Please Wait...",
"something_went_wrong": "Something went wrong",
"orders": "Orders",
"empty": "Empty!",
"all_order": "All Order",
"pending": "Pending",
"processing": "Processing",
"delivered": "Delivered",
"filter": "Filter",
"price_range_ucf": "Price Range",
"to": "To",
"next": "Next",
"coupons": "Coupons",
"days": "Days",
"hours": "Hours",
"min": "Min",
"sec": "Sec",
"copy_code_ucf": "Copy Code",
"wishlist": "Wishlist",
"add": "Add",
"add_new_address_ucf": "Add New Address",
"update_address": "Update Address",
"select_country": "Select country",
"select_state": "Select state",
"select_city": "Select city",
"country": "Country",
"state": "State",
"city": "City",
"default_address": "Default address",
"select_one": "Select one",
"save": "Save",
"close": "Close",
"please_select_a_country": "Please select a country",
"please_select_a_state": "Please select a state",
"please_select_a_city": "Please select a city",
"please_enter_address": "Please enter address",
"date": "Date",
"note": "Note",
"order_has_been_placed": "Order has been placed",
"order_tracking": "Order Tracking",
"currency": "Currency",
"order_details": "Order details",
"password_change_ucf": "Password Change",
"update_password_ucf": "Update Password",
"basic_info": "Basic info",
"update_profile_ucf": "Update Profile",
"cancelled": "Cancelled",
"submit": "Submit",
"go_to_cart": "Go to cart",
"all_products_ucf": "All Products",
"no_more_data": "No more data",
"place_order": "Place Order",
"reg_delivery": "Regular delivery",
"we_will_deliver_your_products_soon": "We will deliver your products soon.",
"we_are_not_shipping_to_your_city_now": "We are not shipping to your city now.",
"preferred_delivery_time": "Preferred delivery time",
"payment_method": "Payment Method",
"personal_information": "Personal Information",
"tips": "Comment",
"add_tips_for_deliveryman": "Add tips for deliveryman",
"order_summary": "Order Summary",
"when_receiving_by_cash": "When receiving by cash",
"when_receiving_by_card": "When receiving by card",
"add_to_cart": "Add to cart",
"update": "Update",
"order_accepted": "Order accepted",
"success_login": "Logged in successfully",
"success_register": "Successfully registered",
"no_such_user_exists": "No such user exists",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"download_invoice":"Download invoice",
"image_mustbe_less_1_mb": "Image size must be less than 1 MB"
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,473 @@
// ignore: unused_import
import 'package:intl/intl.dart' as intl;
import 'app_localizations.dart';
// ignore_for_file: type=lint
/// The translations for English (`en`).
class AppLocalizationsEn extends AppLocalizations {
AppLocalizationsEn([String locale = 'en']) : super(locale);
@override
String get hellow => 'hellow';
@override
String get please_enter_email => 'Please enter email';
@override
String get please_enter_name => 'Please enter name';
@override
String get please_enter_phone => 'Please enter phone number';
@override
String get please_enter_valid_email => 'Please enter valid email';
@override
String get please_enter_confirm_password => 'Please enter confirm password';
@override
String get password_and_confirm_password_is_not_matching =>
'Password and Confirm password do not match';
@override
String get please_enter_password => 'Please enter password';
@override
String get password_must_be_at_last_6_digit =>
'Password must be at last 6 digit.';
@override
String get welcome_to_online_fresh_food_grocery_application =>
'Welcome to\nOnline Fresh Food Grocery\nApplication';
@override
String get energetically_streamline_one_to_one_web_readiness_before_extensive_meta_services =>
'Energetically streamline one-to-one web-readiness before extensive meta-services.';
@override
String get best_quality_organic_grocery_app_platform_ucf =>
'Best Quality Organic Grocery App Platform';
@override
String get easy_payment_method => 'Easy Payment Method';
@override
String get skip => 'Skip';
@override
String get welcome_to_back => 'Welcome to Back!';
@override
String get login => 'Login';
@override
String get register => 'Register';
@override
String get register_now_ucf => 'Register Now';
@override
String get create_new_account_ucf => 'Create New Account';
@override
String get email => 'Email';
@override
String get name => 'Name';
@override
String get phone => 'Phone';
@override
String get password => 'Password';
@override
String get new_password_ucf => 'New Password';
@override
String get confirm_password_ucf => 'Confirm Password';
@override
String get sign_up_ucf => 'Sign Up';
@override
String get already_have_an_account => 'Already Have an Account?';
@override
String get not_a_member => 'Not a member?';
@override
String get forgot_password_q_ucf => 'Forgot Password?';
@override
String get forgot_password_ucf => 'Forgot Password';
@override
String get send => 'Send';
@override
String get enter_otp_code => 'Enter OTP code';
@override
String get reset_password_ucf => 'Reset Password';
@override
String get otp_all_cap => 'OTP';
@override
String get resend_otp_all_cap => 'Resend OTP';
@override
String get home => 'Home';
@override
String get categories => 'Categories';
@override
String get cart => 'Cart';
@override
String get profile => 'Profile';
@override
String get search_product_ucf => 'Search Product';
@override
String get top_categories_ucf => 'Top Categories';
@override
String get best_selling_products_ucf => 'Best Selling Products';
@override
String get description => 'Description';
@override
String get price => 'Price';
@override
String get related_product_ucf => 'Related Product';
@override
String get edit_profile_ucf => 'Edit Profile';
@override
String get voucher_n_offers_ucf => 'Vouchers & Offers';
@override
String get favorite => 'Favorite';
@override
String get order_n_recording_ucf => 'Order & Recording';
@override
String get my_profile_ucf => 'My Profile';
@override
String get help_center_ucf => 'Help Center';
@override
String get address => 'Address';
@override
String get notification => 'Notification';
@override
String get security => 'Security';
@override
String get track_my_order_ucf => 'Track My Order';
@override
String get wallet_history_ucf => 'Wallet History';
@override
String get refund_history_ucf => 'Refund History';
@override
String get settings => 'Settings';
@override
String get terms_n_conditions_ucf => 'Terms & Conditions';
@override
String get log_out_ucf => 'Log Out';
@override
String get add_to_cart => 'Add to cart';
@override
String get pick_a_location => 'Pick a location';
@override
String get locations => 'Locations';
@override
String get data_is_not_available => 'Data is not available';
@override
String get product_stock_not_available => 'Product stock not available';
@override
String get out_of_stock_ucf => 'Out of stock';
@override
String get order_info_ucf => 'Order Info';
@override
String get subtotal => 'Subtotal';
@override
String get delivery_fee_ucf => 'Delivery Fee';
@override
String get total => 'Total';
@override
String get review_n_payment_ucf => 'Review & Payment';
@override
String get promo_code_ucf => 'Promo Code';
@override
String get apply => 'Apply';
@override
String get coupon_discount_ucf => 'Coupon Discount';
@override
String get check_out_ucf => 'Check Out';
@override
String get delivery_address_ucf => 'Delivery Address';
@override
String get billing_address_ucf => 'Billing Address';
@override
String get alternative_phone_ucf => 'Alternative Phone';
@override
String get additional_info_ucf => 'Additional Info';
@override
String get tax => 'Tax';
@override
String get available_logistics_ucf => 'Available Logistics';
@override
String get please_wait_ucf => 'Please Wait...';
@override
String get something_went_wrong => 'Something went wrong';
@override
String get orders => 'Orders';
@override
String get empty => 'Empty!';
@override
String get all_order => 'All Order';
@override
String get pending => 'Pending';
@override
String get processing => 'Processing';
@override
String get delivered => 'Delivered';
@override
String get filter => 'Filter';
@override
String get price_range_ucf => 'Price Range';
@override
String get to => 'To';
@override
String get next => 'Next';
@override
String get coupons => 'Coupons';
@override
String get days => 'Days';
@override
String get hours => 'Hours';
@override
String get min => 'Min';
@override
String get sec => 'Sec';
@override
String get copy_code_ucf => 'Copy Code';
@override
String get wishlist => 'Wishlist';
@override
String get add => 'Add';
@override
String get add_new_address_ucf => 'Add New Address';
@override
String get update_address => 'Update Address';
@override
String get select_country => 'Select country';
@override
String get select_state => 'Select state';
@override
String get select_city => 'Select city';
@override
String get country => 'Country';
@override
String get state => 'State';
@override
String get city => 'City';
@override
String get default_address => 'Default address';
@override
String get select_one => 'Select one';
@override
String get save => 'Save';
@override
String get close => 'Close';
@override
String get please_select_a_country => 'Please select a country';
@override
String get please_select_a_state => 'Please select a state';
@override
String get please_select_a_city => 'Please select a city';
@override
String get please_enter_address => 'Please enter address';
@override
String get date => 'Date';
@override
String get note => 'Note';
@override
String get order_has_been_placed => 'Order has been placed';
@override
String get order_tracking => 'Order Tracking';
@override
String get currency => 'Currency';
@override
String get order_details => 'Order details';
@override
String get password_change_ucf => 'Password Change';
@override
String get update_password_ucf => 'Update Password';
@override
String get basic_info => 'Basic info';
@override
String get update_profile_ucf => 'Update Profile';
@override
String get cancelled => 'Cancelled';
@override
String get submit => 'Submit';
@override
String get go_to_cart => 'Go to cart';
@override
String get all_products_ucf => 'All Products';
@override
String get no_more_data => 'No more data';
@override
String get place_order => 'Place Order';
@override
String get reg_delivery => 'Regular delivery';
@override
String get we_will_deliver_your_products_soon =>
'We will deliver your products soon.';
@override
String get we_are_not_shipping_to_your_city_now =>
'We are not shipping to your city now.';
@override
String get preferred_delivery_time => 'Preferred delivery time';
@override
String get payment_method => 'Payment Method';
@override
String get personal_information => 'Personal Information';
@override
String get tips => 'Comment';
@override
String get add_tips_for_deliveryman => 'Add tips for deliveryman';
@override
String get order_summary => 'Order Summary';
@override
String get when_receiving_by_cash => 'When receiving by cash';
@override
String get when_receiving_by_card => 'When receiving by card';
@override
String get update => 'Update';
@override
String get order_accepted => 'Order accepted';
@override
String get success_login => 'Logged in successfully';
@override
String get success_register => 'Successfully registered';
@override
String get no_such_user_exists => 'No such user exists';
@override
String get a => '_';
@override
String get download_invoice => 'Download invoice';
@override
String get image_mustbe_less_1_mb => 'Image size must be less than 1 MB';
}

View File

@@ -0,0 +1,477 @@
// ignore: unused_import
import 'package:intl/intl.dart' as intl;
import 'app_localizations.dart';
// ignore_for_file: type=lint
/// The translations for Russian (`ru`).
class AppLocalizationsRu extends AppLocalizations {
AppLocalizationsRu([String locale = 'ru']) : super(locale);
@override
String get hellow => 'Здравствуйте';
@override
String get please_enter_email =>
'Пожалуйста, введите адрес электронной почты';
@override
String get please_enter_name => 'Пожалуйста, введите имя';
@override
String get please_enter_phone => 'Пожалуйста, введите номер телефона';
@override
String get please_enter_valid_email =>
'Пожалуйста, введите действительный адрес электронной почты';
@override
String get please_enter_confirm_password =>
'Пожалуйста, введите подтверждающий пароль';
@override
String get password_and_confirm_password_is_not_matching =>
'Пароль и пароль подтверждения не совпадают';
@override
String get please_enter_password => 'Пожалуйста, введите пароль';
@override
String get password_must_be_at_last_6_digit =>
'Пароль должен состоять как минимум из 6 цифр.';
@override
String get welcome_to_online_fresh_food_grocery_application =>
'Добро пожаловать в Интернет-магазин свежих продуктов питания Приложение';
@override
String get energetically_streamline_one_to_one_web_readiness_before_extensive_meta_services =>
'Энергично оптимизируйте индивидуальную веб-готовность перед обширными мета-сервисами.';
@override
String get best_quality_organic_grocery_app_platform_ucf =>
'Платформа приложений для органических продуктов лучшего качества';
@override
String get easy_payment_method => 'Простой способ оплаты';
@override
String get skip => 'Пропускать';
@override
String get welcome_to_back => 'С возвращением!';
@override
String get login => 'Авторизоваться';
@override
String get register => 'Регистр';
@override
String get register_now_ucf => 'Зарегистрироваться';
@override
String get create_new_account_ucf => 'Создать новый аккаунт';
@override
String get email => 'Электронная почта';
@override
String get name => 'Имя';
@override
String get phone => 'Телефон';
@override
String get password => 'Пароль';
@override
String get new_password_ucf => 'Новый пароль';
@override
String get confirm_password_ucf => 'Подтвердите пароль';
@override
String get sign_up_ucf => 'Зарегистрироваться';
@override
String get already_have_an_account => 'У вас уже есть учетная запись?';
@override
String get not_a_member => 'Не являетесь членом?';
@override
String get forgot_password_q_ucf => 'Забыли пароль?';
@override
String get forgot_password_ucf => 'Забыли пароль';
@override
String get send => 'Отправлять';
@override
String get enter_otp_code => 'Введите OTP-код';
@override
String get reset_password_ucf => 'Сброс пароля';
@override
String get otp_all_cap => 'Одноразовый пароль';
@override
String get resend_otp_all_cap => 'Повторно отправить одноразовый пароль';
@override
String get home => 'Основной';
@override
String get categories => 'Категории';
@override
String get cart => 'Корзина';
@override
String get profile => 'Профиль';
@override
String get search_product_ucf => 'Поиск продукта';
@override
String get top_categories_ucf => 'Лучшие категории';
@override
String get best_selling_products_ucf => 'Самые продаваемые продукты';
@override
String get description => 'Описание';
@override
String get price => 'Цена';
@override
String get related_product_ucf => 'Похожий продукт';
@override
String get edit_profile_ucf => 'Редактировать профиль';
@override
String get voucher_n_offers_ucf => 'Ваучеры и предложения';
@override
String get favorite => 'Любимый';
@override
String get order_n_recording_ucf => 'Заказ и запись';
@override
String get my_profile_ucf => 'Мой профайл';
@override
String get help_center_ucf => 'Центр помощи';
@override
String get address => 'Адрес';
@override
String get notification => 'Уведомление';
@override
String get security => 'Безопасность';
@override
String get track_my_order_ucf => 'Отслеживать свой заказ';
@override
String get wallet_history_ucf => 'История кошелька';
@override
String get refund_history_ucf => 'История возвратов';
@override
String get settings => 'Настройки';
@override
String get terms_n_conditions_ucf => 'Условия использования';
@override
String get log_out_ucf => 'Выйти';
@override
String get add_to_cart => 'Добавить в корзину';
@override
String get pick_a_location => 'Выберите место';
@override
String get locations => 'Локации';
@override
String get data_is_not_available => 'Данные недоступны';
@override
String get product_stock_not_available => 'На складе товара нет в наличии';
@override
String get out_of_stock_ucf => 'Распродано';
@override
String get order_info_ucf => 'Информация о заказе';
@override
String get subtotal => 'Промежуточный итог';
@override
String get delivery_fee_ucf => 'Плата за доставку';
@override
String get total => 'Общий';
@override
String get review_n_payment_ucf => 'Обзор и оплата';
@override
String get promo_code_ucf => 'Промо-код';
@override
String get apply => 'Применять';
@override
String get coupon_discount_ucf => 'Купон Скидка';
@override
String get check_out_ucf => 'Проверить';
@override
String get delivery_address_ucf => 'Адрес доставки';
@override
String get billing_address_ucf => 'Адрес для выставления счета';
@override
String get alternative_phone_ucf => 'Альтернативный телефон';
@override
String get additional_info_ucf => 'Дополнительная информация';
@override
String get tax => 'Налог';
@override
String get available_logistics_ucf => 'Доступная логистика';
@override
String get please_wait_ucf => 'Пожалуйста, подождите...';
@override
String get something_went_wrong => 'Что-то пошло не так';
@override
String get orders => 'Заказы';
@override
String get empty => 'Пустой!';
@override
String get all_order => 'Весь заказ';
@override
String get pending => 'В ожидании';
@override
String get processing => 'Обработка';
@override
String get delivered => 'Доставленный';
@override
String get filter => 'Фильтр';
@override
String get price_range_ucf => 'Ценовой диапазон';
@override
String get to => 'К';
@override
String get next => 'Следующий';
@override
String get coupons => 'Купоны';
@override
String get days => 'Дни';
@override
String get hours => 'Часы';
@override
String get min => 'Минут';
@override
String get sec => 'Секунд';
@override
String get copy_code_ucf => 'Копировать код';
@override
String get wishlist => 'Список желаний';
@override
String get add => 'Добавлять';
@override
String get add_new_address_ucf => 'Добавить новый адрес';
@override
String get update_address => 'Обновить адрес';
@override
String get select_country => 'Выберите страну';
@override
String get select_state => 'Выберите штат';
@override
String get select_city => 'Выберите город';
@override
String get country => 'Страна';
@override
String get state => 'Штат';
@override
String get city => 'Город';
@override
String get default_address => 'Адрес по умолчанию';
@override
String get select_one => 'Выбери один';
@override
String get save => 'Сохранять';
@override
String get close => 'Закрывать';
@override
String get please_select_a_country => 'Пожалуйста, выберите страну';
@override
String get please_select_a_state => 'Пожалуйста, выберите штат';
@override
String get please_select_a_city => 'Пожалуйста, выберите город';
@override
String get please_enter_address => 'Пожалуйста, введите адрес';
@override
String get date => 'Дата';
@override
String get note => 'Примечание';
@override
String get order_has_been_placed => 'Заказ размещен';
@override
String get order_tracking => 'Отслеживание заказа';
@override
String get currency => 'Валюта';
@override
String get order_details => 'Информация для заказа';
@override
String get password_change_ucf => 'Изменение пароля';
@override
String get update_password_ucf => 'Обновить пароль';
@override
String get basic_info => 'Базовая информация';
@override
String get update_profile_ucf => 'Обновить профиль';
@override
String get cancelled => 'Отменено';
@override
String get submit => 'Представлять на рассмотрение';
@override
String get go_to_cart => 'Перейти в корзину';
@override
String get all_products_ucf => 'Все продукты';
@override
String get no_more_data => 'Больше нет данных';
@override
String get place_order => 'Заказать';
@override
String get reg_delivery => 'Доставка';
@override
String get we_will_deliver_your_products_soon =>
'Мы доставим вашу продукцию в ближайшее время.';
@override
String get we_are_not_shipping_to_your_city_now =>
'В настоящее время мы не осуществляем доставку по вашему адресу..';
@override
String get preferred_delivery_time => 'Предпочтительное время доставки';
@override
String get payment_method => 'Способ оплаты';
@override
String get personal_information => 'Персональная информация';
@override
String get tips => 'Комментарий';
@override
String get add_tips_for_deliveryman => 'Добавить чаевые для Доставщик';
@override
String get order_summary => 'Итог заказа';
@override
String get when_receiving_by_cash => 'При получении наличными.';
@override
String get when_receiving_by_card => 'При получении на карту.';
@override
String get update => 'обновлять';
@override
String get order_accepted => 'Заказ принят';
@override
String get success_login => 'Вы успешно вошли в систему';
@override
String get success_register => 'Успешная регистрация';
@override
String get no_such_user_exists => 'Tакого пользователя не существует';
@override
String get a => '_';
@override
String get download_invoice => 'Скачать чек';
@override
String get image_mustbe_less_1_mb =>
'Размер изображения должен быть меньше 1 МБ';
}

View File

@@ -0,0 +1,480 @@
// ignore: unused_import
import 'package:intl/intl.dart' as intl;
import 'app_localizations.dart';
// ignore_for_file: type=lint
/// The translations for Uzbek (`uz`).
class AppLocalizationsUz extends AppLocalizations {
AppLocalizationsUz([String locale = 'uz']) : super(locale);
@override
String get hellow => 'Salom';
@override
String get please_enter_email =>
'Iltimos, elektron pochta manzilini kiriting';
@override
String get please_enter_name => 'Iltimos, ismni kiriting';
@override
String get please_enter_phone => 'Iltimos, telefon raqamingizni kiriting';
@override
String get please_enter_valid_email =>
'Yaroqli elektron pochta manzilini kiriting';
@override
String get please_enter_confirm_password =>
'Iltimos, tasdiqlash parolini kiriting';
@override
String get password_and_confirm_password_is_not_matching =>
'Parol va parolni tasdiqlash mos kelmaydi';
@override
String get please_enter_password => 'Iltimos, parolni kiriting';
@override
String get password_must_be_at_last_6_digit =>
'Parol oxirgi 6 ta raqamdan oshmasligi kerak.';
@override
String get welcome_to_online_fresh_food_grocery_application =>
'Karvon marketning yangi onlayn oziq-ovqat mahsulotlari do\'koniga xush kelibsiz';
@override
String get energetically_streamline_one_to_one_web_readiness_before_extensive_meta_services =>
'Keng ko\'lamli mahsulotlar katalogidan o\'zingizga kerakli mahsulotlarnig uyingizdan chiqmay turib buyurtma bering';
@override
String get best_quality_organic_grocery_app_platform_ucf =>
'Eng yaxshi sifatli oziq-ovqat mahsulotlarni jamlagan onlayn buyurtma platformasi';
@override
String get easy_payment_method => 'Oson to\'lov usuli';
@override
String get skip => 'Oʻtkazib yuborish';
@override
String get welcome_to_back => 'Karvonmarketga xush kelibsiz!';
@override
String get login => 'Tizimga kirish';
@override
String get register => 'Roʻyxatdan oʻtish';
@override
String get register_now_ucf => 'Hozir roʻyxatdan oʻting';
@override
String get create_new_account_ucf => 'Yangi hisob yaratish';
@override
String get email => 'Elektron pochta';
@override
String get name => 'Ism';
@override
String get phone => 'Telefon';
@override
String get password => 'Parol';
@override
String get new_password_ucf => 'Yangi parol';
@override
String get confirm_password_ucf => 'Parolni tasdiqlang';
@override
String get sign_up_ucf => 'Ro\'yxatdan o\'tish';
@override
String get already_have_an_account => 'Hisobingiz bormi?';
@override
String get not_a_member => 'Aʼzo emasmisiz?';
@override
String get forgot_password_q_ucf => 'Parolni unutdingizmi?';
@override
String get forgot_password_ucf => 'Parolni unutdingizmi';
@override
String get send => 'Yuborish';
@override
String get enter_otp_code => 'Tasdiqlash kodini kiriting';
@override
String get reset_password_ucf => 'Parolni tiklash';
@override
String get otp_all_cap => 'Bir martalik parol';
@override
String get resend_otp_all_cap => 'Bir martalik parolni qayta yuborish';
@override
String get home => 'Asosiy';
@override
String get categories => 'Kategoriyalar';
@override
String get cart => 'Savatcha';
@override
String get profile => 'Profil';
@override
String get search_product_ucf => 'Mahsulotni qidirish';
@override
String get top_categories_ucf => 'Eng yaxshi kategoriyalar';
@override
String get best_selling_products_ucf => 'Eng ko\'p sotiladigan mahsulotlar';
@override
String get description => 'Tavsif';
@override
String get price => 'Narxi';
@override
String get related_product_ucf => 'O\'xshash mahsulotlar';
@override
String get edit_profile_ucf => 'Profilni tahrirlash';
@override
String get voucher_n_offers_ucf => 'Voucherlar va takliflar';
@override
String get favorite => 'Sevimli';
@override
String get order_n_recording_ucf => 'Buyurtma va yozib olish';
@override
String get my_profile_ucf => 'Mening profilim';
@override
String get help_center_ucf => 'Yordam markazi';
@override
String get address => 'Manzil';
@override
String get notification => 'Bildirishnoma';
@override
String get security => 'Xavfsizlik';
@override
String get track_my_order_ucf => 'Buyurtmani kuzatish';
@override
String get wallet_history_ucf => 'Hamyon tarixi';
@override
String get refund_history_ucf => 'To\'lovni qaytarish tarixi';
@override
String get settings => 'Sozlamalar';
@override
String get terms_n_conditions_ucf => 'Foydalanish shartlari';
@override
String get log_out_ucf => 'Chiqish';
@override
String get add_to_cart => 'Savatga qo\'shish';
@override
String get pick_a_location => 'Joyni tanlang';
@override
String get locations => 'Joylar';
@override
String get data_is_not_available => 'Maʼlumotlar mavjud emas';
@override
String get product_stock_not_available => 'Ushbu mahsulotdan afsuski qolmadi';
@override
String get out_of_stock_ucf => 'Sotuvda yo\'q';
@override
String get order_info_ucf => 'Buyurtma haqida ma\'lumot';
@override
String get subtotal => 'Oraliq jami';
@override
String get delivery_fee_ucf => 'Yetkazib berish toʻlovi';
@override
String get total => 'Jami';
@override
String get review_n_payment_ucf => 'Ko\'rib chiqish va to\'lash';
@override
String get promo_code_ucf => 'Kupon kodi';
@override
String get apply => 'Foydalanish';
@override
String get coupon_discount_ucf => 'Kupon chegirmasi';
@override
String get check_out_ucf => 'Ro\'yxatdan o\'chirish';
@override
String get delivery_address_ucf => 'Yetkazib berish manzili';
@override
String get billing_address_ucf =>
'To\'lovchi; to\'lovni qabul qiladigan manzil';
@override
String get alternative_phone_ucf => 'Qo\'shimcha telefon';
@override
String get additional_info_ucf => 'Qo\'shimcha ma\'lumot';
@override
String get tax => 'Soliq';
@override
String get available_logistics_ucf => 'Mavjud yetkazib berish usuli';
@override
String get please_wait_ucf => 'Iltimos kuting...';
@override
String get something_went_wrong => 'Nimadir noto\'g\'ri bajarildi';
@override
String get orders => 'Buyurtmalar';
@override
String get empty => 'Bo\'sh!';
@override
String get all_order => 'Hamma buyurtmalar';
@override
String get pending => 'Kutilmoqda';
@override
String get processing => 'Qayta ishlash';
@override
String get delivered => 'Yetkazib berildi';
@override
String get filter => 'Filtr';
@override
String get price_range_ucf => 'Narx diapazoni';
@override
String get to => 'Kimga';
@override
String get next => 'Keyingisi';
@override
String get coupons => 'Kuponlar';
@override
String get days => 'Kunlar';
@override
String get hours => 'Soat';
@override
String get min => 'Daqiqa';
@override
String get sec => 'Soniya';
@override
String get copy_code_ucf => 'Kodni nusxalash';
@override
String get wishlist => 'Istaklar roʻyxati';
@override
String get add => 'Qo\'shish';
@override
String get add_new_address_ucf => 'Yangi manzil qo\'shing';
@override
String get update_address => 'Manzilni yangilash';
@override
String get select_country => 'Mamlakatni tanlang';
@override
String get select_state => 'Davlatni tanlang';
@override
String get select_city => 'Shaharni tanlang';
@override
String get country => 'Mamlakat';
@override
String get state => 'Davlat';
@override
String get city => 'Shahar';
@override
String get default_address => 'Birlamchi manzil';
@override
String get select_one => 'Birini tanlang';
@override
String get save => 'Saqlash';
@override
String get close => 'Yopish';
@override
String get please_select_a_country => 'Iltimos, mamlakatni tanlang';
@override
String get please_select_a_state => 'Iltimos, davlatni tanlang';
@override
String get please_select_a_city => 'Iltimos, shaharni tanlang';
@override
String get please_enter_address => 'Iltimos, manzilni kiriting';
@override
String get date => 'Sana';
@override
String get note => 'Eslatma';
@override
String get order_has_been_placed => 'Buyurtma berildi';
@override
String get order_tracking => 'Buyurtmani kuzatish';
@override
String get currency => 'Valyuta';
@override
String get order_details => 'Buyurtma tafsilotlari';
@override
String get password_change_ucf => 'Parolni o\'zgartirish';
@override
String get update_password_ucf => 'Parolni yangilash';
@override
String get basic_info => 'Asosiy ma\'lumot';
@override
String get update_profile_ucf => 'Profilni yangilash';
@override
String get cancelled => 'Bekor qilingan';
@override
String get submit => 'Yuborish';
@override
String get go_to_cart => 'Savatga borish';
@override
String get all_products_ucf => 'Barcha mahsulotlar';
@override
String get no_more_data => 'Boshqa maʼlumot yoʻq';
@override
String get place_order => 'Buyurtma qilish';
@override
String get reg_delivery => 'Yetkazib berish';
@override
String get we_will_deliver_your_products_soon =>
'Mahsulotlaringizni tez orada yetkazib beramiz.';
@override
String get we_are_not_shipping_to_your_city_now =>
'Siz ko\'rsatayotgan manzilgan hozircha yetkazib berish mavjud emas';
@override
String get preferred_delivery_time =>
'Maqul yetkazib berish muddatini belgilang';
@override
String get payment_method => 'To\'lov usuli';
@override
String get personal_information => 'Shaxsiy ma\'lumotlar';
@override
String get tips => 'Izoh';
@override
String get add_tips_for_deliveryman =>
'Yetkazib beruvchi uchun qo\'shimcha izoh';
@override
String get order_summary => 'Buyurtma haqida qisqacha';
@override
String get when_receiving_by_cash => 'Naqd pul orqali qabul qilganda';
@override
String get when_receiving_by_card => 'Karta orqali qabul qilganda';
@override
String get update => 'Yangilandi';
@override
String get order_accepted => 'Buyurtma qabul qilindi';
@override
String get success_login => 'Muvaffaqiyatli tizimga kirildi';
@override
String get success_register => 'Muvaffaqiyatli ro\'yxatdan o\'tildi';
@override
String get no_such_user_exists => 'Bunday foydalanuvchi mavjud emas';
@override
String get a => '_';
@override
String get download_invoice => 'Chekni yuklab olish';
@override
String get image_mustbe_less_1_mb =>
'Rasm hajmi 1 mb dan kam bo\'lishi kerak';
}

View File

@@ -0,0 +1,165 @@
{
"hellow": "Здравствуйте",
"please_enter_email": "Пожалуйста, введите адрес электронной почты",
"please_enter_name": "Пожалуйста, введите имя",
"please_enter_phone": "Пожалуйста, введите номер телефона",
"please_enter_valid_email": "Пожалуйста, введите действительный адрес электронной почты",
"please_enter_confirm_password": "Пожалуйста, введите подтверждающий пароль",
"password_and_confirm_password_is_not_matching": "Пароль и пароль подтверждения не совпадают",
"please_enter_password": "Пожалуйста, введите пароль",
"password_must_be_at_last_6_digit": "Пароль должен состоять как минимум из 6 цифр.",
"welcome_to_online_fresh_food_grocery_application": "Добро пожаловать в Интернет-магазин свежих продуктов питания Приложение",
"energetically_streamline_one_to_one_web_readiness_before_extensive_meta_services": "Энергично оптимизируйте индивидуальную веб-готовность перед обширными мета-сервисами.",
"best_quality_organic_grocery_app_platform_ucf": "Платформа приложений для органических продуктов лучшего качества",
"easy_payment_method": "Простой способ оплаты",
"skip": "Пропускать",
"welcome_to_back": "С возвращением!",
"login": "Авторизоваться",
"register": "Регистр",
"register_now_ucf": "Зарегистрироваться",
"create_new_account_ucf": "Создать новый аккаунт",
"email": "Электронная почта",
"name": "Имя",
"phone": "Телефон",
"password": "Пароль",
"new_password_ucf": "Новый пароль",
"confirm_password_ucf": "Подтвердите пароль",
"sign_up_ucf": "Зарегистрироваться",
"already_have_an_account": "У вас уже есть учетная запись?",
"not_a_member": "Не являетесь членом?",
"forgot_password_q_ucf": "Забыли пароль?",
"forgot_password_ucf": "Забыли пароль",
"send": "Отправлять",
"enter_otp_code": "Введите OTP-код",
"reset_password_ucf": "Сброс пароля",
"otp_all_cap": "Одноразовый пароль",
"resend_otp_all_cap": "Повторно отправить одноразовый пароль",
"home": "Основной",
"categories": "Категории",
"cart": "Корзина",
"profile": "Профиль",
"search_product_ucf": "Поиск продукта",
"top_categories_ucf": "Лучшие категории",
"best_selling_products_ucf": "Самые продаваемые продукты",
"description": "Описание",
"price": "Цена",
"related_product_ucf": "Похожий продукт",
"edit_profile_ucf": "Редактировать профиль",
"voucher_n_offers_ucf": "Ваучеры и предложения",
"favorite": "Любимый",
"order_n_recording_ucf": "Заказ и запись",
"my_profile_ucf": "Мой профайл",
"help_center_ucf": "Центр помощи",
"address": "Адрес",
"notification": "Уведомление",
"security": "Безопасность",
"track_my_order_ucf": "Отслеживать свой заказ",
"wallet_history_ucf": "История кошелька",
"refund_history_ucf": "История возвратов",
"settings": "Настройки",
"terms_n_conditions_ucf": "Условия использования",
"log_out_ucf": "Выйти",
"add_to_cart": "Добавить в корзину",
"pick_a_location": "Выберите место",
"locations": "Локации",
"data_is_not_available": "Данные недоступны",
"product_stock_not_available": "На складе товара нет в наличии",
"out_of_stock_ucf": "Распродано",
"order_info_ucf": "Информация о заказе",
"subtotal": "Промежуточный итог",
"delivery_fee_ucf": "Плата за доставку",
"total": "Общий",
"review_n_payment_ucf": "Обзор и оплата",
"promo_code_ucf": "Промо-код",
"apply": "Применять",
"coupon_discount_ucf": "Купон Скидка",
"check_out_ucf": "Проверить",
"delivery_address_ucf": "Адрес доставки",
"billing_address_ucf": "Адрес для выставления счета",
"alternative_phone_ucf": "Альтернативный телефон",
"additional_info_ucf": "Дополнительная информация",
"tax": "Налог",
"available_logistics_ucf": "Доступная логистика",
"please_wait_ucf": "Пожалуйста, подождите...",
"something_went_wrong": "Что-то пошло не так",
"orders": "Заказы",
"empty": "Пустой!",
"all_order": "Весь заказ",
"pending": "В ожидании",
"processing": "Обработка",
"delivered": "Доставленный",
"filter": "Фильтр",
"price_range_ucf": "Ценовой диапазон",
"to": "К",
"next": "Следующий",
"coupons": "Купоны",
"days": "Дни",
"hours": "Часы",
"min": "Минут",
"sec": "Секунд",
"copy_code_ucf": "Копировать код",
"wishlist": "Список желаний",
"add": "Добавлять",
"add_new_address_ucf": "Добавить новый адрес",
"update_address": "Обновить адрес",
"select_country": "Выберите страну",
"select_state": "Выберите штат",
"select_city": "Выберите город",
"country": "Страна",
"state": "Штат",
"city": "Город",
"default_address": "Адрес по умолчанию",
"select_one": "Выбери один",
"save": "Сохранять",
"close": "Закрывать",
"please_select_a_country": "Пожалуйста, выберите страну",
"please_select_a_state": "Пожалуйста, выберите штат",
"please_select_a_city": "Пожалуйста, выберите город",
"please_enter_address": "Пожалуйста, введите адрес",
"date": "Дата",
"note": "Примечание",
"order_has_been_placed": "Заказ размещен",
"order_tracking": "Отслеживание заказа",
"currency": "Валюта",
"order_details": "Информация для заказа",
"password_change_ucf": "Изменение пароля",
"update_password_ucf": "Обновить пароль",
"basic_info": "Базовая информация",
"update_profile_ucf": "Обновить профиль",
"cancelled": "Отменено",
"submit": "Представлять на рассмотрение",
"go_to_cart": "Перейти в корзину",
"all_products_ucf": "Все продукты",
"no_more_data": "Больше нет данных",
"place_order": "Заказать",
"reg_delivery": "Доставка",
"we_will_deliver_your_products_soon": "Мы доставим вашу продукцию в ближайшее время.",
"we_are_not_shipping_to_your_city_now": "В настоящее время мы не осуществляем доставку по вашему адресу..",
"preferred_delivery_time": "Предпочтительное время доставки",
"payment_method": "Способ оплаты",
"personal_information": "Персональная информация",
"tips": "Комментарий",
"add_tips_for_deliveryman": "Добавить чаевые для Доставщик",
"order_summary": "Итог заказа",
"when_receiving_by_cash": "При получении наличными.",
"when_receiving_by_card": "При получении на карту.",
"update": "обновлять",
"order_accepted": "Заказ принят",
"success_login": "Вы успешно вошли в систему",
"success_register": "Успешная регистрация",
"no_such_user_exists": "Tакого пользователя не существует",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"download_invoice":"Скачать чек",
"image_mustbe_less_1_mb": "Размер изображения должен быть меньше 1 МБ"
}

View File

@@ -0,0 +1,164 @@
{
"hellow": "Salom",
"please_enter_email": "Iltimos, elektron pochta manzilini kiriting",
"please_enter_name": "Iltimos, ismni kiriting",
"please_enter_phone": "Iltimos, telefon raqamingizni kiriting",
"please_enter_valid_email": "Yaroqli elektron pochta manzilini kiriting",
"please_enter_confirm_password": "Iltimos, tasdiqlash parolini kiriting",
"password_and_confirm_password_is_not_matching": "Parol va parolni tasdiqlash mos kelmaydi",
"please_enter_password": "Iltimos, parolni kiriting",
"password_must_be_at_last_6_digit": "Parol oxirgi 6 ta raqamdan oshmasligi kerak.",
"welcome_to_online_fresh_food_grocery_application": "Karvon marketning yangi onlayn oziq-ovqat mahsulotlari do'koniga xush kelibsiz",
"energetically_streamline_one_to_one_web_readiness_before_extensive_meta_services": "Keng ko'lamli mahsulotlar katalogidan o'zingizga kerakli mahsulotlarnig uyingizdan chiqmay turib buyurtma bering",
"best_quality_organic_grocery_app_platform_ucf": "Eng yaxshi sifatli oziq-ovqat mahsulotlarni jamlagan onlayn buyurtma platformasi",
"easy_payment_method": "Oson to'lov usuli",
"skip": "Oʻtkazib yuborish",
"welcome_to_back": "Karvonmarketga xush kelibsiz!",
"login": "Tizimga kirish",
"register": "Roʻyxatdan oʻtish",
"register_now_ucf": "Hozir roʻyxatdan oʻting",
"create_new_account_ucf": "Yangi hisob yaratish",
"email": "Elektron pochta",
"name": "Ism",
"phone": "Telefon",
"password": "Parol",
"new_password_ucf": "Yangi parol",
"confirm_password_ucf": "Parolni tasdiqlang",
"sign_up_ucf": "Ro'yxatdan o'tish",
"already_have_an_account": "Hisobingiz bormi?",
"not_a_member": "Aʼzo emasmisiz?",
"forgot_password_q_ucf": "Parolni unutdingizmi?",
"forgot_password_ucf": "Parolni unutdingizmi",
"send": "Yuborish",
"enter_otp_code": "Tasdiqlash kodini kiriting",
"reset_password_ucf": "Parolni tiklash",
"otp_all_cap": "Bir martalik parol",
"resend_otp_all_cap": "Bir martalik parolni qayta yuborish",
"home": "Asosiy",
"categories": "Kategoriyalar",
"cart": "Savatcha",
"profile": "Profil",
"search_product_ucf": "Mahsulotni qidirish",
"top_categories_ucf": "Eng yaxshi kategoriyalar",
"best_selling_products_ucf": "Eng ko'p sotiladigan mahsulotlar",
"description": "Tavsif",
"price": "Narxi",
"related_product_ucf": "O'xshash mahsulotlar",
"edit_profile_ucf": "Profilni tahrirlash",
"voucher_n_offers_ucf": "Voucherlar va takliflar",
"favorite": "Sevimli",
"order_n_recording_ucf": "Buyurtma va yozib olish",
"my_profile_ucf": "Mening profilim",
"help_center_ucf": "Yordam markazi",
"address": "Manzil",
"notification": "Bildirishnoma",
"security": "Xavfsizlik",
"track_my_order_ucf": "Buyurtmani kuzatish",
"wallet_history_ucf": "Hamyon tarixi",
"refund_history_ucf": "To'lovni qaytarish tarixi",
"settings": "Sozlamalar",
"terms_n_conditions_ucf": "Foydalanish shartlari",
"log_out_ucf": "Chiqish",
"add_to_cart": "Savatga qo'shildi",
"pick_a_location": "Joyni tanlang",
"locations": "Joylar",
"data_is_not_available": "Maʼlumotlar mavjud emas",
"product_stock_not_available": "Ushbu mahsulotdan afsuski qolmadi",
"out_of_stock_ucf": "Sotuvda yo'q",
"order_info_ucf": "Buyurtma haqida ma'lumot",
"subtotal": "Oraliq jami",
"delivery_fee_ucf": "Yetkazib berish toʻlovi",
"total": "Jami",
"review_n_payment_ucf": "Ko'rib chiqish va to'lash",
"promo_code_ucf": "Kupon kodi",
"apply": "Foydalanish",
"coupon_discount_ucf": "Kupon chegirmasi",
"check_out_ucf": "Ro'yxatdan o'chirish",
"delivery_address_ucf": "Yetkazib berish manzili",
"billing_address_ucf": "To'lovchi; to'lovni qabul qiladigan manzil",
"alternative_phone_ucf": "Qo'shimcha telefon",
"additional_info_ucf": "Qo'shimcha ma'lumot",
"tax": "Soliq",
"available_logistics_ucf": "Mavjud yetkazib berish usuli",
"please_wait_ucf": "Iltimos kuting...",
"something_went_wrong": "Nimadir noto'g'ri bajarildi",
"orders": "Buyurtmalar",
"empty": "Bo'sh!",
"all_order": "Hamma buyurtmalar",
"pending": "Kutilmoqda",
"processing": "Qayta ishlash",
"delivered": "Yetkazib berildi",
"filter": "Filtr",
"price_range_ucf": "Narx diapazoni",
"to": "Kimga",
"next": "Keyingisi",
"coupons": "Kuponlar",
"days": "Kunlar",
"hours": "Soat",
"min": "Daqiqa",
"sec": "Soniya",
"copy_code_ucf": "Kodni nusxalash",
"wishlist": "Istaklar roʻyxati",
"add": "Qo'shish",
"add_new_address_ucf": "Yangi manzil qo'shing",
"update_address": "Manzilni yangilash",
"select_country": "Mamlakatni tanlang",
"select_state": "Davlatni tanlang",
"select_city": "Shaharni tanlang",
"country": "Mamlakat",
"state": "Davlat",
"city": "Shahar",
"default_address": "Birlamchi manzil",
"select_one": "Birini tanlang",
"save": "Saqlash",
"close": "Yopish",
"please_select_a_country": "Iltimos, mamlakatni tanlang",
"please_select_a_state": "Iltimos, davlatni tanlang",
"please_select_a_city": "Iltimos, shaharni tanlang",
"please_enter_address": "Iltimos, manzilni kiriting",
"date": "Sana",
"note": "Eslatma",
"order_has_been_placed": "Buyurtma berildi",
"order_tracking": "Buyurtmani kuzatish",
"currency": "Valyuta",
"order_details": "Buyurtma tafsilotlari",
"password_change_ucf": "Parolni o'zgartirish",
"update_password_ucf": "Parolni yangilash",
"basic_info": "Asosiy ma'lumot",
"update_profile_ucf": "Profilni yangilash",
"cancelled": "Bekor qilingan",
"submit": "Yuborish",
"go_to_cart": "Savatga borish",
"all_products_ucf": "Barcha mahsulotlar",
"no_more_data": "Boshqa maʼlumot yoʻq",
"place_order": "Buyurtma qilish",
"reg_delivery": "Yetkazib berish",
"we_will_deliver_your_products_soon": "Mahsulotlaringizni tez orada yetkazib beramiz.",
"we_are_not_shipping_to_your_city_now": "Siz ko'rsatayotgan manzilgan hozircha yetkazib berish mavjud emas",
"preferred_delivery_time": "Maqul yetkazib berish muddatini belgilang",
"payment_method": "To'lov usuli",
"personal_information": "Shaxsiy ma'lumotlar",
"tips": "Izoh",
"add_tips_for_deliveryman": "Yetkazib beruvchi uchun qo'shimcha izoh",
"order_summary": "Buyurtma haqida qisqacha",
"when_receiving_by_cash": "Naqd pul orqali qabul qilganda",
"when_receiving_by_card": "Karta orqali qabul qilganda",
"add_to_cart": "Savatga qo'shish",
"update": "Yangilandi",
"order_accepted": "Buyurtma qabul qilindi",
"success_login": "Muvaffaqiyatli tizimga kirildi",
"success_register": "Muvaffaqiyatli ro'yxatdan o'tildi",
"no_such_user_exists": "Bunday foydalanuvchi mavjud emas",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"a": "_",
"download_invoice":"Chekni yuklab olish",
"image_mustbe_less_1_mb":"Rasm hajmi 1 mb dan kam bo'lishi kerak"
}

View File

@@ -0,0 +1,13 @@
import 'dart:ui';
import 'package:grostore/screens/auth/login.dart';
class L10n{
static final all = [
Locale('en'),
Locale('uz'),
Locale('ru'),
];
}

157
app_code/lib/main.dart Normal file
View File

@@ -0,0 +1,157 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:grostore/app_lang.dart';
import 'package:grostore/configs/app_config.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/l10n/l10n.dart';
import 'package:grostore/presenters/address_presenter.dart';
import 'package:grostore/presenters/auth/auth_presenter.dart';
import 'package:grostore/presenters/bloc/lang/lang_bloc.dart';
import 'package:grostore/presenters/cart_presenter.dart';
import 'package:grostore/presenters/categories_presenter.dart';
import 'package:grostore/presenters/check_out_presenter.dart';
import 'package:grostore/presenters/coupon_presenter.dart';
import 'package:grostore/presenters/filter_presenter.dart';
import 'package:grostore/presenters/home_presenter.dart';
import 'package:grostore/presenters/landing_page_presenter.dart';
import 'package:grostore/presenters/order_details_presenter.dart';
import 'package:grostore/presenters/setting_presenter.dart';
import 'package:grostore/presenters/main_persenter.dart';
import 'package:grostore/presenters/order_presenter.dart';
import 'package:grostore/presenters/product_details_presenter.dart';
import 'package:grostore/presenters/refund_presenter.dart';
import 'package:grostore/presenters/stock_locations_presenter.dart';
import 'package:grostore/presenters/user_presenter.dart';
import 'package:grostore/presenters/wallet_presenter.dart';
import 'package:grostore/presenters/wishlist_presenter.dart';
import 'package:grostore/screens/home.dart';
import 'package:grostore/screens/landing_pages/landing_page.dart';
import 'package:grostore/screens/main.dart';
import 'package:grostore/screens/splash.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:provider/provider.dart';
import 'package:shared_value/shared_value.dart';
import 'l10n/app_localizations.dart';
void main() {
runApp(SharedValue.wrapApp(
const MyApp(),
));
}
/// The route configuration.
final GoRouter router = GoRouter(
routes: <RouteBase>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) {
return const Splash();
},
),
GoRoute(
path: '/landing-page',
builder: (BuildContext context, GoRouterState state) {
return const LandingPage();
},
),
],
);
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
Locale locale = const Locale("uz");
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => SettingPresenter()),
ChangeNotifierProvider(create: (context) => AuthPresenter()),
ChangeNotifierProvider(create: (context) => MainPresenter()),
ChangeNotifierProvider(create: (context) => LandingPagePresenter()),
ChangeNotifierProvider(create: (context) => CartPresenter()),
ChangeNotifierProvider(create: (context) => HomePresenter()),
ChangeNotifierProvider(create: (context) => ProductDetailsPresenter()),
ChangeNotifierProvider(create: (context) => StockLocationsPresenter()),
ChangeNotifierProvider(create: (context) => UserPresenter(),),
ChangeNotifierProvider(create: (context) => OrderPresenter()),
ChangeNotifierProvider(create: (context) => CheckOutPresenter()),
ChangeNotifierProvider(create: (context) => CategoriesPresenter()),
ChangeNotifierProvider(create: (context) => FilterPresenter()),
ChangeNotifierProvider(create: (context) => CouponPresenter()),
ChangeNotifierProvider(create: (context) => WishlistPresenter()),
ChangeNotifierProvider(create: (context) => AddressPresenter()),
ChangeNotifierProvider(create: (context) => WalletPresenter()),
ChangeNotifierProvider(create: (context) => RefundPresenter()),
ChangeNotifierProvider(create: (context) => OrderDetailsPresenter()),
],
child: Consumer<SettingPresenter>(
builder: (context, data, child) {
return BlocProvider(
create: (context) => LangBloc(),
child: BlocBuilder<LangBloc, LangState>(
builder: (context, state) {
if(state is LangSuccess){
locale = state.locale;
}
return MaterialApp(
debugShowCheckedModeBanner: false,
title: AppConfig.appName,
theme: ThemeData(
//primaryTextTheme:GoogleFonts.lobsterTextTheme() ,
primaryColor: ThemeConfig.accentMaterialColor,
primarySwatch: ThemeConfig.accentMaterialColor,
textTheme: GoogleFonts.interTextTheme().copyWith(
),
//textTheme:
),
//builder: OneContext().builder,
themeMode: ThemeMode.light,
locale: locale,
// localeResolutionCallback: (deviceLocale, supportedLocales) {
// if (AppLocalizations.delegate.isSupported(deviceLocale!)) {
// return deviceLocale;
// }
// return const Locale('uz');
// },
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: L10n.all,
// AppLang().supportedLocales(),
// home: Splash(),
initialRoute: '/',
routes: {
"/": (context) => const Splash(),
"/home": (context) =>
Home(id: getQueryParameter(context, "id"),),
"/main": (context) => const Main(),
"/landing_page": (context) => const LandingPage(),
},
);
},
),
);
}
),
);
}
}

View File

@@ -0,0 +1,29 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:grostore/custom_ui/toast_ui.dart';
import 'package:grostore/helpers/common_functions.dart';
import 'package:grostore/screens/main.dart';
import 'middleware.dart';
class BannedMiddleware extends MiddleWare{
BuildContext context;
BannedMiddleware(this.context);
@override
bool next(String response) {
var jsonResponse = jsonDecode(response);
if(!jsonResponse['result'] && jsonResponse['is_banned'] !=null && jsonResponse['is_banned']){
ToastUi.show(context, jsonResponse['message']);
resetApp(context);
return false;
}
return true;
}
}

View File

@@ -0,0 +1,7 @@
abstract class MiddleWare{
bool next(String response);
}

View File

@@ -0,0 +1,46 @@
// To parse this JSON data, do
//
// final loginResponse = loginResponseFromJson(jsonString);
import 'dart:convert';
import 'package:grostore/models/common/user_info.dart';
LoginResponse loginResponseFromJson(String str) => LoginResponse.fromJson(json.decode(str));
LoginResponse loginResponseDefaultValue() => LoginResponse(result: false, message: "Faild", accessToken: "", tokenType: "",user: UserInfo.init());
String loginResponseToJson(LoginResponse data) => json.encode(data.toJson());
class LoginResponse {
bool result;
String message;
String accessToken;
String tokenType;
UserInfo user;
LoginResponse({
required this.result,
required this.message,
required this.accessToken,
required this.tokenType,
required this.user
});
factory LoginResponse.fromJson(Map<String, dynamic> json) => LoginResponse(
result: json["result"],
message: json["message"],
accessToken: json["access_token"],
tokenType: json["token_type"],
user: UserInfo.fromJson(json["user"]),
);
Map<String, dynamic> toJson() => {
"result": result,
"message": message,
"access_token": accessToken,
"token_type": tokenType,
"user": user.toJson(),
};
}

View File

@@ -0,0 +1,117 @@
// To parse this JSON data, do
//
// final registrationResponse = registrationResponseFromJson(jsonString);
import 'dart:convert';
import 'package:grostore/models/common/user_info.dart';
RegistrationResponse registrationResponseFromJson(String str) =>RegistrationResponse.fromJson(json.decode(str));
RegistrationResponses registrationResFromJson(String str) =>RegistrationResponses.fromJson(json.decode(str));
RegistrationResp registrationRespFromJson(String str) =>RegistrationResp.fromJson(json.decode(str));
RegistrationResp registrationRespDefault() =>RegistrationResp.fromJson(json.decode('''{
"result": false,
"message": "",
"code":1}'''));
RegistrationResponse registrationResponseDefault() =>RegistrationResponse.fromJson(json.decode('''{
"result": false,
"message": "",
"access_token": "",
"token_type": ""
}'''));
RegistrationResponses registrationResponsesDefault() => RegistrationResponses.fromJson(json.decode('''{
"result": false,
"message": "",
"access_token": "",
"token_type": ""
}'''));
String registrationResponseToJson(RegistrationResponse data) =>json.encode(data.toJson());
class RegistrationResponse {
bool result;
String message;
String accessToken;
String tokenType;
UserInfo user;
RegistrationResponse(
{required this.result,
required this.message,
required this.accessToken,
required this.tokenType,
required this.user});
factory RegistrationResponse.fromJson(Map<String, dynamic> json) =>
RegistrationResponse(
result: json["result"],
message: json["message"],
accessToken: json["access_token"],
tokenType: json["token_type"],
user: UserInfo.fromJson(json["user"]),
);
Map<String, dynamic> toJson() => {
"result": result,
"message": message,
"access_token": accessToken,
"token_type": tokenType,
"user": user.toJson(),
};
}
class RegistrationResponses {
bool result;
var message;
String accessToken;
String tokenType;
RegistrationResponses({
required this.result,
required this.message,
required this.accessToken,
required this.tokenType,
});
factory RegistrationResponses.fromJson(Map<String, dynamic> json) =>
RegistrationResponses(
result: json["result"],
message: json["message"],
accessToken: json["access_token"],
tokenType: json["token_type"],
);
Map<String, dynamic> toJson() => {
"result": result,
"message": message,
"access_token": accessToken,
"token_type": tokenType,
};
}
class RegistrationResp {
bool result;
String message;
int code;
RegistrationResp({required this.result, required this.message, required this.code});
factory RegistrationResp.fromJson(Map<String, dynamic> json) =>
RegistrationResp(
result: json["result"],
message: json["message"],
code: json["code"],
);
Map<String, dynamic> toJson() => {
"result": result,
"message": message,
"code": code,
};
}

View File

@@ -0,0 +1,34 @@
// To parse this JSON data, do
//
// final tokenCheckResponse = tokenCheckResponseFromJson(jsonString);
import 'dart:convert';
import 'package:grostore/models/common/user_info.dart';
TokenCheckResponse tokenCheckResponseFromJson(String str) => TokenCheckResponse.fromJson(json.decode(str));
String tokenCheckResponseToJson(TokenCheckResponse data) => json.encode(data.toJson());
class TokenCheckResponse {
bool result;
UserInfo user;
TokenCheckResponse({
required this.result,
required this.user,
});
factory TokenCheckResponse.fromJson(Map<String, dynamic> json) => TokenCheckResponse(
result: json["result"],
user: UserInfo.fromJson(json["user"]),
);
Map<String, dynamic> toJson() => {
"result": result,
"user": user.toJson(),
};
}

View File

@@ -0,0 +1,93 @@
// To parse this JSON data, do
//
// final cartResponse = cartResponseFromJson(jsonString);
import 'dart:convert';
CartResponse cartResponseFromJson(String str) => CartResponse.fromJson(json.decode(str));
String cartResponseToJson(CartResponse data) => json.encode(data.toJson());
class CartResponse {
bool result;
String message;
List<Cart> carts;
var cartCount;
String subTotal;
String total;
String couponDiscount;
CartResponse({
required this.result,
required this.message,
required this.carts,
required this.cartCount,
required this.subTotal,
required this.total,
required this.couponDiscount,
});
factory CartResponse.fromJson(Map<String, dynamic> json) => CartResponse(
result: json["result"],
message: json["message"],
carts: List<Cart>.from(json["carts"].map((x) => Cart.fromJson(x))),
cartCount: json["cartCount"],
subTotal: json["subTotal"],
total: json["total"],
couponDiscount: json["couponDiscount"],
);
Map<String, dynamic> toJson() => {
"result": result,
"message": message,
"carts": List<dynamic>.from(carts.map((x) => x.toJson())),
"cartCount": cartCount,
"subTotal": subTotal,
"total": total,
"couponDiscount": couponDiscount,
};
}
class Cart {
var id;
String slug;
String name;
var quantity;
String thumbnailImage;
String unit;
String price;
String category;
Cart({
required this.id,
required this.slug,
required this.name,
required this.quantity,
required this.thumbnailImage,
required this.unit,
required this.price,
required this.category,
});
factory Cart.fromJson(Map<String, dynamic> json) => Cart(
id: json["id"],
slug: json["slug"],
name: json["name"],
quantity: json["quantity"],
thumbnailImage: json["thumbnail_image"],
unit: json["unit"],
price: json["price"],
category: json["category"],
);
Map<String, dynamic> toJson() => {
"id": id,
"slug": slug,
"name": name,
"quantity": quantity,
"thumbnail_image": thumbnailImage,
"unit": unit,
"price": price,
"category": category,
};
}

View File

@@ -0,0 +1,129 @@
import 'dart:convert';
import 'package:grostore/models/common/category_info.dart';
CategoryResponse categoryResponseFromJson(String str) => CategoryResponse.fromJson(json.decode(str));
String categoryResponseToJson(CategoryResponse data) => json.encode(data.toJson());
class CategoryResponse {
List<CategoryInfo> data;
Links links;
Meta meta;
CategoryResponse({
required this.data,
required this.links,
required this.meta,
});
factory CategoryResponse.fromJson(Map<String, dynamic> json) => CategoryResponse(
data: List<CategoryInfo>.from(json["data"].map((x) => CategoryInfo.fromJson(x))),
links: Links.fromJson(json["links"]),
meta: Meta.fromJson(json["meta"]),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
"links": links.toJson(),
"meta": meta.toJson(),
};
}
class Links {
String first;
String last;
dynamic prev;
dynamic next;
Links({
required this.first,
required this.last,
this.prev,
this.next,
});
factory Links.fromJson(Map<String, dynamic> json) => Links(
first: json["first"],
last: json["last"],
prev: json["prev"],
next: json["next"],
);
Map<String, dynamic> toJson() => {
"first": first,
"last": last,
"prev": prev,
"next": next,
};
}
class Meta {
var currentPage;
var from;
var lastPage;
List<Link> links;
String path;
var perPage;
var to;
var total;
Meta({
required this.currentPage,
required this.from,
required this.lastPage,
required this.links,
required this.path,
required this.perPage,
required this.to,
required this.total,
});
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
currentPage: json["current_page"],
from: json["from"],
lastPage: json["last_page"],
links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))),
path: json["path"],
perPage: json["per_page"],
to: json["to"],
total: json["total"],
);
Map<String, dynamic> toJson() => {
"current_page": currentPage,
"from": from,
"last_page": lastPage,
"links": List<dynamic>.from(links.map((x) => x.toJson())),
"path": path,
"per_page": perPage,
"to": to,
"total": total,
};
}
class Link {
String? url;
String label;
bool active;
Link({
this.url,
required this.label,
required this.active,
});
factory Link.fromJson(Map<String, dynamic> json) => Link(
url: json["url"],
label: json["label"],
active: json["active"],
);
Map<String, dynamic> toJson() => {
"url": url,
"label": label,
"active": active,
};
}

View File

@@ -0,0 +1,53 @@
// To parse this JSON data, do
//
// final cityResponse = cityResponseFromJson(jsonString);
import 'dart:convert';
CityResponse cityResponseFromJson(String str) => CityResponse.fromJson(json.decode(str));
String cityResponseToJson(CityResponse data) => json.encode(data.toJson());
class CityResponse {
List<CityInfo> data;
CityResponse({
required this.data,
});
factory CityResponse.fromJson(Map<String, dynamic> json) => CityResponse(
data: List<CityInfo>.from(json["data"].map((x) => CityInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class CityInfo {
int stateId;
int id;
String name;
bool isActive;
CityInfo({
required this.stateId,
required this.id,
required this.name,
required this.isActive,
});
factory CityInfo.fromJson(Map<String, dynamic> json) => CityInfo(
stateId: json["state_id"],
id: json["id"],
name: json["name"],
isActive: json["is_active"],
);
Map<String, dynamic> toJson() => {
"state_id": stateId,
"id": id,
"name": name,
"is_active": isActive,
};
}

View File

@@ -0,0 +1,27 @@
class CategoryInfo {
var id;
String name;
var products;
String thumbnailImage;
CategoryInfo({
required this.id,
required this.name,
required this.products,
required this.thumbnailImage,
});
factory CategoryInfo.fromJson(Map<String, dynamic> json) => CategoryInfo(
id: json["id"],
name: json["name"],
products: json["products"],
thumbnailImage: json["thumbnail_image"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"products": products,
"thumbnail_image": thumbnailImage,
};
}

View File

@@ -0,0 +1,39 @@
class UserInfo {
String name;
String? email;
String phone;
var balance;
String avatar;
UserInfo({
required this.name,
this.email,
required this.phone,
required this.balance,
required this.avatar,
});
factory UserInfo.fromJson(Map<String, dynamic> json) => UserInfo(
name: json["name"],
email: json["email"],
phone: json["phone"],
balance: json["balance"],
avatar: json["avatar"],
);
factory UserInfo.init() => UserInfo(
name: '',
email: '',
phone: '',
balance:'',
avatar: ''
);
Map<String, dynamic> toJson() => {
"name": name,
"email": email,
"phone": phone,
"balance": balance,
"avatar": avatar,
};
}

View File

@@ -0,0 +1,29 @@
// To parse this JSON data, do
//
// final commonResponse = commonResponseFromJson(jsonString);
import 'dart:convert';
CommonResponse commonResponseFromJson(String str) => CommonResponse.fromJson(json.decode(str));
String commonResponseToJson(CommonResponse data) => json.encode(data.toJson());
class CommonResponse {
bool result;
var message;
CommonResponse({
required this.result,
required this.message,
});
factory CommonResponse.fromJson(Map<String, dynamic> json) => CommonResponse(
result: json["result"],
message: json["message"],
);
Map<String, dynamic> toJson() => {
"result": result,
"message": message,
};
}

View File

@@ -0,0 +1,53 @@
// To parse this JSON data, do
//
// final countryResponse = countryResponseFromJson(jsonString);
import 'dart:convert';
CountryResponse countryResponseFromJson(String str) => CountryResponse.fromJson(json.decode(str));
String countryResponseToJson(CountryResponse data) => json.encode(data.toJson());
class CountryResponse {
List<CountryInfo> data;
CountryResponse({
required this.data,
});
factory CountryResponse.fromJson(Map<String, dynamic> json) => CountryResponse(
data: List<CountryInfo>.from(json["data"].map((x) => CountryInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class CountryInfo {
int id;
String code;
String name;
bool isActive;
CountryInfo({
required this.id,
required this.code,
required this.name,
required this.isActive,
});
factory CountryInfo.fromJson(Map<String, dynamic> json) => CountryInfo(
id: json["id"],
code: json["code"],
name: json["name"],
isActive: json["is_active"],
);
Map<String, dynamic> toJson() => {
"id": id,
"code": code,
"name": name,
"is_active": isActive,
};
}

View File

@@ -0,0 +1,93 @@
// To parse this JSON data, do
//
// final couponResponse = couponResponseFromJson(jsonString);
import 'dart:convert';
CouponResponse couponResponseFromJson(String str) => CouponResponse.fromJson(json.decode(str));
String couponResponseToJson(CouponResponse data) => json.encode(data.toJson());
class CouponResponse {
List<CouponInfo> data;
CouponResponse({
required this.data,
});
factory CouponResponse.fromJson(Map<String, dynamic> json) => CouponResponse(
data: List<CouponInfo>.from(json["data"].map((x) => CouponInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class CouponInfo {
var id;
var shopId;
String banner;
String code;
String discountType;
var discountValue;
var isFreeShipping;
String startDate;
String endDate;
var minSpend;
var maxDiscountAmount;
var customerUsageLimit;
String? productIds;
String? categoryIds;
CouponInfo({
required this.id,
required this.shopId,
required this.banner,
required this.code,
required this.discountType,
required this.discountValue,
required this.isFreeShipping,
required this.startDate,
required this.endDate,
required this.minSpend,
required this.maxDiscountAmount,
required this.customerUsageLimit,
this.productIds,
this.categoryIds,
});
factory CouponInfo.fromJson(Map<String, dynamic> json) => CouponInfo(
id: json["id"],
shopId: json["shop_id"],
banner: json["banner"],
code: json["code"],
discountType: json["discount_type"],
discountValue: json["discount_value"],
isFreeShipping: json["is_free_shipping"],
startDate: json["start_date"],
endDate: json["end_date"],
minSpend: json["min_spend"],
maxDiscountAmount: json["max_discount_amount"],
customerUsageLimit: json["customer_usage_limit"],
productIds: json["product_ids"],
categoryIds: json["category_ids"],
);
Map<String, dynamic> toJson() => {
"id": id,
"shop_id": shopId,
"banner": banner,
"code": code,
"discount_type": discountType,
"discount_value": discountValue,
"is_free_shipping": isFreeShipping,
"start_date": startDate,
"end_date": endDate,
"min_spend": minSpend,
"max_discount_amount": maxDiscountAmount,
"customer_usage_limit": customerUsageLimit,
"product_ids": productIds,
"category_ids": categoryIds,
};
}

View File

@@ -0,0 +1,61 @@
// To parse this JSON data, do
//
// final currencyResponse = currencyResponseFromJson(jsonString);
import 'dart:convert';
CurrencyResponse currencyResponseFromJson(String str) => CurrencyResponse.fromJson(json.decode(str));
String currencyResponseToJson(CurrencyResponse data) => json.encode(data.toJson());
class CurrencyResponse {
List<CurrencyInfo> data;
CurrencyResponse({
required this.data,
});
factory CurrencyResponse.fromJson(Map<String, dynamic> json) => CurrencyResponse(
data: List<CurrencyInfo>.from(json["data"].map((x) => CurrencyInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class CurrencyInfo {
String code;
String name;
String symbol;
var rate;
var alignment;
bool isDefault;
CurrencyInfo({
required this.code,
required this.name,
required this.symbol,
required this.rate,
required this.alignment,
required this.isDefault,
});
factory CurrencyInfo.fromJson(Map<String, dynamic> json) => CurrencyInfo(
code: json["code"],
name: json["name"],
symbol: json["symbol"],
alignment: json["alignment"],
rate: json["rate"],
isDefault: json["is_default"],
);
Map<String, dynamic> toJson() => {
"code": code,
"name": name,
"symbol": symbol,
"rate": rate,
"alignment": alignment,
"is_default": isDefault,
};
}

View File

@@ -0,0 +1,9 @@
class Customer {
final String name;
final String address;
const Customer({
required this.name,
required this.address,
});
}

View File

@@ -0,0 +1,88 @@
// To parse this JSON data, do
//
// final editAddressResponse = editAddressResponseFromJson(jsonString);
import 'dart:convert';
EditAddressResponse editAddressResponseFromJson(String str) =>
EditAddressResponse.fromJson(json.decode(str));
String editAddressResponseToJson(EditAddressResponse data) =>
json.encode(data.toJson());
class EditAddressResponse {
Data data;
bool result;
int status;
EditAddressResponse({
required this.data,
required this.result,
required this.status,
});
factory EditAddressResponse.fromJson(Map<String, dynamic> json) =>
EditAddressResponse(
data: Data.fromJson(json["data"]),
result: json["result"],
status: json["status"],
);
Map<String, dynamic> toJson() => {
"data": data.toJson(),
"result": result,
"status": status,
};
}
class Data {
int id;
int userId;
int countryId;
String countryName;
int stateId;
String stateName;
int cityId;
String cityName;
String address;
int isDefault;
Data({
required this.id,
required this.userId,
required this.countryId,
required this.countryName,
required this.stateId,
required this.stateName,
required this.cityId,
required this.cityName,
required this.address,
required this.isDefault,
});
factory Data.fromJson(Map<String, dynamic> json) => Data(
id: json["id"],
userId: json["user_id"],
countryId: json["country_id"],
countryName: json["country_name"],
stateId: json["state_id"],
stateName: json["state_name"],
cityId: json["city_id"],
cityName: json["city_name"],
address: json["address"],
isDefault: json["is_default"],
);
Map<String, dynamic> toJson() => {
"id": id,
"user_id": userId,
"country_id": countryId,
"country_name": countryName,
"state_id": stateId,
"state_name": stateName,
"city_id": cityId,
"city_name": cityName,
"address": address,
"is_default": isDefault,
};
}

View File

@@ -0,0 +1,33 @@
// To parse this JSON data, do
//
// final helpCenterResponse = helpCenterResponseFromJson(jsonString);
import 'dart:convert';
HelpCenterResponse helpCenterResponseFromJson(String str) => HelpCenterResponse.fromJson(json.decode(str));
String helpCenterResponseToJson(HelpCenterResponse data) => json.encode(data.toJson());
class HelpCenterResponse {
String location;
String contactNumber;
String email;
HelpCenterResponse({
required this.location,
required this.contactNumber,
required this.email,
});
factory HelpCenterResponse.fromJson(Map<String, dynamic> json) => HelpCenterResponse(
location: json["location"],
contactNumber: json["contact_number"],
email: json["email"],
);
Map<String, dynamic> toJson() => {
"location": location,
"contact_number": contactNumber,
"email": email,
};
}

View File

@@ -0,0 +1,45 @@
// To parse this JSON data, do
//
// final homeBannerResponse = homeBannerResponseFromJson(jsonString);
import 'dart:convert';
HomeBannerResponse homeBannerResponseFromJson(String str) => HomeBannerResponse.fromJson(json.decode(str));
String homeBannerResponseToJson(HomeBannerResponse data) => json.encode(data.toJson());
class HomeBannerResponse {
List<BannerData> data;
HomeBannerResponse({
required this.data,
});
factory HomeBannerResponse.fromJson(Map<String, dynamic> json) => HomeBannerResponse(
data: List<BannerData>.from(json["data"].map((x) => BannerData.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class BannerData {
String image;
String link;
BannerData({
required this.image,
required this.link,
});
factory BannerData.fromJson(Map<String, dynamic> json) => BannerData(
image: json["image"],
link: json["link"],
);
Map<String, dynamic> toJson() => {
"image": image,
"link": link,
};
}

View File

@@ -0,0 +1,48 @@
import 'package:grostore/models/supplire.dart';
import 'customer.dart';
class Invoice {
final InvoiceInfo info;
final Supplier supplier;
final Customer customer;
final List<InvoiceItem> items;
const Invoice({
required this.info,
required this.supplier,
required this.customer,
required this.items,
});
}
class InvoiceInfo {
final String description;
final String number;
final DateTime date;
final DateTime dueDate;
const InvoiceInfo({
required this.description,
required this.number,
required this.date,
required this.dueDate,
});
}
class InvoiceItem {
final String description;
final DateTime date;
final int quantity;
final double vat;
final double unitPrice;
const InvoiceItem({
required this.description,
required this.date,
required this.quantity,
required this.vat,
required this.unitPrice,
});
}

View File

@@ -0,0 +1,61 @@
// To parse this JSON data, do
//
// final languageResponse = languageResponseFromJson(jsonString);
import 'dart:convert';
LanguageResponse languageResponseFromJson(String str) => LanguageResponse.fromJson(json.decode(str));
String languageResponseToJson(LanguageResponse data) => json.encode(data.toJson());
class LanguageResponse {
List<LanguageInfo> data;
LanguageResponse({
required this.data,
});
factory LanguageResponse.fromJson(Map<String, dynamic> json) => LanguageResponse(
data: List<LanguageInfo>.from(json["data"].map((x) => LanguageInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class LanguageInfo {
int id;
String name;
String flag;
String code;
var isRtl;
var isActive;
LanguageInfo({
required this.id,
required this.name,
required this.flag,
required this.code,
required this.isRtl,
required this.isActive,
});
factory LanguageInfo.fromJson(Map<String, dynamic> json) => LanguageInfo(
id: json["id"],
name: json["name"],
flag: json["flag"],
code: json["code"],
isRtl: json["is_rtl"],
isActive: json["is_active"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"flag": flag,
"code": code,
"is_rtl": isRtl,
"is_active": isActive,
};
}

View File

@@ -0,0 +1,65 @@
// To parse this JSON data, do
//
// final locationsResponse = locationsResponseFromJson(jsonString);
import 'dart:convert';
LocationsResponse locationsResponseFromJson(String str) => LocationsResponse.fromJson(json.decode(str));
String locationsResponseToJson(LocationsResponse data) => json.encode(data.toJson());
class LocationsResponse {
List<LocationInfo> data;
LocationsResponse({
required this.data,
});
factory LocationsResponse.fromJson(Map<String, dynamic> json) => LocationsResponse(
data: List<LocationInfo>.from(json["data"].map((x) => LocationInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class LocationInfo {
int id;
String name;
String image;
String address;
dynamic lat;
dynamic lng;
bool isDefault;
LocationInfo({
required this.id,
required this.name,
required this.image,
required this.address,
this.lat,
this.lng,
required this.isDefault,
});
factory LocationInfo.fromJson(Map<String, dynamic> json) => LocationInfo(
id: json["id"],
name: json["name"],
image: json["image"],
address: json["address"],
lat: json["lat"],
lng: json["lng"],
isDefault: json["is_default"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"image": image,
"address": address,
"lat": lat,
"lng": lng,
"is_default": isDefault,
};
}

View File

@@ -0,0 +1,57 @@
// To parse this JSON data, do
//
// final logisticsResponse = logisticsResponseFromJson(jsonString);
import 'dart:convert';
LogisticsResponse logisticsResponseFromJson(String str) => LogisticsResponse.fromJson(json.decode(str));
String logisticsResponseToJson(LogisticsResponse data) => json.encode(data.toJson());
class LogisticsResponse {
List<LogisticInfo> data;
LogisticsResponse({
required this.data,
});
factory LogisticsResponse.fromJson(Map<String, dynamic> json) => LogisticsResponse(
data: List<LogisticInfo>.from(json["data"].map((x) => LogisticInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class LogisticInfo {
int id;
String name;
int logisticId;
String price;
String image;
LogisticInfo({
required this.id,
required this.name,
required this.logisticId,
required this.price,
required this.image,
});
factory LogisticInfo.fromJson(Map<String, dynamic> json) => LogisticInfo(
id: json["id"],
name: json["name"],
logisticId: json["logistic_id"],
price: json["price"],
image: json["image"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"logistic_id": logisticId,
"price": price,
"image": image,
};
}

View File

@@ -0,0 +1,177 @@
// To parse this JSON data, do
//
// final orderDetailsResponse = orderDetailsResponseFromJson(jsonString);
import 'dart:convert';
import 'package:grostore/models/product_mini_response.dart';
OrderDetailsResponse orderDetailsResponseFromJson(String str) => OrderDetailsResponse.fromJson(json.decode(str));
String orderDetailsResponseToJson(OrderDetailsResponse data) => json.encode(data.toJson());
class OrderDetailsResponse {
OrderDetailsInfo data;
OrderDetailsResponse({
required this.data,
});
factory OrderDetailsResponse.fromJson(Map<String, dynamic> json) => OrderDetailsResponse(
data: OrderDetailsInfo.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"data": data.toJson(),
};
}
class OrderDetailsInfo {
int id;
String code;
String date;
IngAddress? shippingAddress;
IngAddress? billingAddress;
List<Item> items;
String status;
String payment_method;
String subTotalAmount;
String totalTips;
String totalShippingCost;
String couponDiscountAmount;
String totalPrice;
OrderDetailsInfo({
required this.id,
required this.code,
required this.date,
this.shippingAddress,
this.billingAddress,
required this.items,
required this.status,
required this.payment_method,
required this.subTotalAmount,
required this.totalTips,
required this.totalShippingCost,
required this.totalPrice,
required this.couponDiscountAmount
});
factory OrderDetailsInfo.fromJson(Map<String, dynamic> json) => OrderDetailsInfo(
id: json["id"],
code: json["order_code"],
date: json["date"],
shippingAddress:json["shipping_address"]==null?null: IngAddress.fromJson(json["shipping_address"]),
billingAddress: json["billing_address"]==null?null:IngAddress.fromJson(json["billing_address"]),
items: List<Item>.from(json["items"].map((x) => Item.fromJson(x))),
status: json["status"],
payment_method: json["payment_method"],
subTotalAmount: json["sub_total_amount"],
totalTips: json["total_tips"],
totalShippingCost: json["total_shipping_cost"],
couponDiscountAmount: json["coupon_discount_amount"],
totalPrice: json["total_price"],
);
Map<String, dynamic> toJson() => {
"id": id,
"date": date,
"shipping_address": shippingAddress?.toJson(),
"billing_address": billingAddress?.toJson(),
"items": List<dynamic>.from(items.map((x) => x.toJson())),
"status": status,
"sub_total_amount": subTotalAmount,
"total_tips": totalTips,
"total_shipping_cost": totalShippingCost,
"total_price": totalPrice,
};
}
class IngAddress {
var id;
var userId;
var countryId;
String countryName;
var stateId;
String stateName;
var cityId;
String cityName;
String address;
var isDefault;
IngAddress({
required this.id,
required this.userId,
required this.countryId,
required this.countryName,
required this.stateId,
required this.stateName,
required this.cityId,
required this.cityName,
required this.address,
required this.isDefault,
});
factory IngAddress.fromJson(Map<String, dynamic> json) => IngAddress(
id: json["id"],
userId: json["user_id"],
countryId: json["country_id"],
countryName: json["country_name"],
stateId: json["state_id"],
stateName: json["state_name"],
cityId: json["city_id"],
cityName: json["city_name"],
address: json["address"],
isDefault: json["is_default"],
);
Map<String, dynamic> toJson() => {
"id": id,
"user_id": userId,
"country_id": countryId,
"country_name": countryName,
"state_id": stateId,
"state_name": stateName,
"city_id": cityId,
"city_name": cityName,
"address": address,
"is_default": isDefault,
};
}
class Item {
var id;
ProductMini? product;
var qty;
String unitPrice;
String totalPrice;
var refund_status;
Item({
required this.id,
this.product,
required this.qty,
required this.unitPrice,
required this.totalPrice,
required this.refund_status,
});
factory Item.fromJson(Map<String, dynamic> json) => Item(
id: json["id"],
product: ProductMini.fromJson(json["product"]),
qty: json["qty"],
unitPrice: json["unit_price"],
totalPrice: json["total_price"],
refund_status: json["refund_status"],
);
Map<String, dynamic> toJson() => {
"id":id,
"product": product?.toJson(),
"qty": qty,
"unit_price": unitPrice,
"total_price": totalPrice,
"refund_status": refund_status,
};
}

View File

@@ -0,0 +1,45 @@
// To parse this JSON data, do
//
// final orderSummeryResponse = orderSummeryResponseFromJson(jsonString);
import 'dart:convert';
OrderSummeryResponse orderSummeryResponseFromJson(String str) => OrderSummeryResponse.fromJson(json.decode(str));
String orderSummeryResponseToJson(OrderSummeryResponse data) => json.encode(data.toJson());
class OrderSummeryResponse {
String subTotal;
String tax;
String shippingCharge;
bool isFreeShipping;
String couponDiscount;
String total;
OrderSummeryResponse({
required this.subTotal,
required this.tax,
required this.shippingCharge,
required this.isFreeShipping,
required this.couponDiscount,
required this.total,
});
factory OrderSummeryResponse.fromJson(Map<String, dynamic> json) => OrderSummeryResponse(
subTotal: json["sub_total"],
tax: json["tax"],
shippingCharge: json["shipping_charge"],
isFreeShipping: json["is_free_shipping"],
couponDiscount: json["coupon_discount"],
total: json["total"],
);
Map<String, dynamic> toJson() => {
"sub_total": subTotal,
"tax": tax,
"shipping_charge": shippingCharge,
"is_free_shipping": isFreeShipping,
"coupon_discount": couponDiscount,
"total": total,
};
}

View File

@@ -0,0 +1,233 @@
// To parse this JSON data, do
//
// final ordersResponse = ordersResponseFromJson(jsonString);
import 'dart:convert';
import 'package:grostore/models/product_mini_response.dart';
OrdersResponse ordersResponseFromJson(String str) => OrdersResponse.fromJson(json.decode(str));
String ordersResponseToJson(OrdersResponse data) => json.encode(data.toJson());
class OrdersResponse {
List<OrderInfo> data;
Links links;
Meta meta;
OrdersResponse({
required this.data,
required this.links,
required this.meta,
});
factory OrdersResponse.init(){
return OrdersResponse(data: [], links: Links.fromJson({}), meta: Meta.fromJson({}),);
}
factory OrdersResponse.fromJson(Map<String, dynamic> json) => OrdersResponse(
data: List<OrderInfo>.from(json["data"].map((x) => OrderInfo.fromJson(x))),
links: Links.fromJson(json["links"]),
meta: Meta.fromJson(json["meta"]),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
"links": links.toJson(),
"meta": meta.toJson(),
};
}
class OrderInfo{
int id;
int group_id;
Item item;
String status;
DateTime date;
OrderInfo({
required this.id,
required this.group_id,
required this.item,
required this.status,
required this.date,
});
factory OrderInfo.fromJson(Map<String, dynamic> json)
{
return OrderInfo(
id: json["id"],
group_id: json["group_id"],
item: Item.fromJson(json["items"]),
status: json["status"],
date: DateTime.parse(json["date"]),
);
}
Map<String, dynamic> toJson() => {
"id": id,
"group_id": group_id,
"items": item.toJson(),
"status": statusValues.reverse[status],
"date": date.toIso8601String(),
};
}
class Item {
int id;
ProductMini? product;
var qty;
String unitPrice;
String totalPrice;
var isRefunded;
Item({
required this.id,
required this.product,
required this.qty,
required this.unitPrice,
required this.totalPrice,
required this.isRefunded,
});
factory Item.fromJson(Map<String, dynamic> json) => Item(
id: json["id"],
product: ProductMini.fromJson(json["product"]),
qty: json["qty"],
unitPrice: json["unit_price"],
totalPrice: json["total_price"],
isRefunded: json["is_refunded"],
);
Map<String, dynamic> toJson() => {
"id": id,
"product": product?.toJson(),
"qty": qty,
"unit_price": unitPrice,
"total_price": totalPrice,
"is_refunded": isRefunded,
};
}
enum Status { ORDER_PLACED, DELIVERED, PROCESSING }
final statusValues = EnumValues({
"delivered": Status.DELIVERED,
"order_placed": Status.ORDER_PLACED,
"processing": Status.PROCESSING
});
class Links {
String first;
String last;
dynamic prev;
dynamic next;
Links({
required this.first,
required this.last,
this.prev,
this.next,
});
factory Links.fromJson(Map<String, dynamic> json) => Links(
first: json["first"],
last: json["last"],
prev: json["prev"],
next: json["next"],
);
Map<String, dynamic> toJson() => {
"first": first,
"last": last,
"prev": prev,
"next": next,
};
}
class Meta {
int currentPage;
int? from;
int lastPage;
List<Link> links;
String path;
int perPage;
int? to;
int total;
Meta({
required this.currentPage,
this.from,
required this.lastPage,
required this.links,
required this.path,
required this.perPage,
this.to,
required this.total,
});
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
currentPage: json["current_page"],
from: json["from"],
lastPage: json["last_page"],
links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))),
path: json["path"],
perPage: json["per_page"],
to: json["to"],
total: json["total"],
);
Map<String, dynamic> toJson() => {
"current_page": currentPage,
"from": from,
"last_page": lastPage,
"links": List<dynamic>.from(links.map((x) => x.toJson())),
"path": path,
"per_page": perPage,
"to": to,
"total": total,
};
}
class Link {
String? url;
String label;
bool active;
Link({
this.url,
required this.label,
required this.active,
});
factory Link.fromJson(Map<String, dynamic> json) => Link(
url: json["url"],
label: json["label"],
active: json["active"],
);
Map<String, dynamic> toJson() => {
"url": url,
"label": label,
"active": active,
};
}
class EnumValues<T> {
Map<String, T> map;
late Map<T, String> reverseMap;
EnumValues(this.map);
Map<T, String> get reverse {
reverseMap = map.map((k, v) => MapEntry(v, k));
return reverseMap;
}
}

View File

@@ -0,0 +1,69 @@
// To parse this JSON TrackInfo, do
//
// final trackOrderResponse = trackOrderResponseFromJson(jsonString);
import 'dart:convert';
TrackOrderResponse trackOrderResponseFromJson(String str) => TrackOrderResponse.fromJson(json.decode(str));
String trackOrderResponseToJson(TrackOrderResponse data) => json.encode(data.toJson());
class TrackOrderResponse {
TrackInfo? data;
TrackOrderResponse({
this.data,
});
factory TrackOrderResponse.fromJson(Map<String, dynamic> json) => TrackOrderResponse(
data:json["data"]==null?null: TrackInfo.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"data": data?.toJson(),
};
}
class TrackInfo {
int id;
List<OrderUpdate> orderUpdates;
String createdDate;
TrackInfo({
required this.id,
required this.orderUpdates,
required this.createdDate,
});
factory TrackInfo.fromJson(Map<String, dynamic> json) => TrackInfo(
id: json["id"],
orderUpdates: List<OrderUpdate>.from(json["order_updates"].map((x) => OrderUpdate.fromJson(x))),
createdDate: json["created_date"],
);
Map<String, dynamic> toJson() => {
"id": id,
"order_updates": List<dynamic>.from(orderUpdates.map((x) => x.toJson())),
"created_date": createdDate,
};
}
class OrderUpdate {
String date;
String note;
OrderUpdate({
required this.date,
required this.note,
});
factory OrderUpdate.fromJson(Map<String, dynamic> json) => OrderUpdate(
date: json["date"],
note: json["note"],
);
Map<String, dynamic> toJson() => {
"date": date,
"note": note,
};
}

View File

@@ -0,0 +1,39 @@
// To parse this JSON data, do
//
// final orderCreateResponse = orderCreateResponseFromJson(jsonString);
import 'dart:convert';
OrderCreateResponse orderCreateResponseFromJson(String str) => OrderCreateResponse.fromJson(json.decode(str));
String orderCreateResponseToJson(OrderCreateResponse data) => json.encode(data.toJson());
class OrderCreateResponse {
bool result;
int orderCode;
String message;
factory OrderCreateResponse.init(){
return OrderCreateResponse(message: "",orderCode: 0,result: false);
}
OrderCreateResponse({
required this.result,
required this.orderCode,
required this.message,
});
factory OrderCreateResponse.fromJson(Map<String, dynamic> json) => OrderCreateResponse(
result: json["result"],
orderCode: json["order_code"],
message: json["message"],
);
Map<String, dynamic> toJson() => {
"result": result,
"order_code": orderCode,
"message": message,
};
}

View File

@@ -0,0 +1,125 @@
// To parse this JSON data, do
//
// final pageResponse = pageResponseFromJson(jsonString);
import 'dart:convert';
PageResponse pageResponseFromJson(String str) => PageResponse.fromJson(json.decode(str));
String pageResponseToJson(PageResponse data) => json.encode(data.toJson());
class PageResponse {
PageInfo data;
PageResponse({
required this.data,
});
factory PageResponse.fromJson(Map<String, dynamic> json) => PageResponse(
data: PageInfo.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"data": data.toJson(),
};
}
class PageInfo {
int id;
String title;
String slug;
String content;
String metaTitle;
String metaImage;
String metaDescription;
DateTime createdAt;
DateTime updatedAt;
dynamic deletedAt;
List<PageLocalization> pageLocalizations;
PageInfo({
required this.id,
required this.title,
required this.slug,
required this.content,
required this.metaTitle,
required this.metaImage,
required this.metaDescription,
required this.createdAt,
required this.updatedAt,
this.deletedAt,
required this.pageLocalizations,
});
factory PageInfo.fromJson(Map<String, dynamic> json) => PageInfo(
id: json["id"],
title: json["title"],
slug: json["slug"],
content: json["content"],
metaTitle: json["meta_title"],
metaImage: json["meta_image"],
metaDescription: json["meta_description"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
pageLocalizations: List<PageLocalization>.from(json["page_localizations"].map((x) => PageLocalization.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"id": id,
"title": title,
"slug": slug,
"content": content,
"meta_title": metaTitle,
"meta_image": metaImage,
"meta_description": metaDescription,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
"deleted_at": deletedAt,
"page_localizations": List<dynamic>.from(pageLocalizations.map((x) => x.toJson())),
};
}
class PageLocalization {
int id;
var pageId;
String title;
String content;
String langKey;
DateTime createdAt;
DateTime updatedAt;
dynamic deletedAt;
PageLocalization({
required this.id,
required this.pageId,
required this.title,
required this.content,
required this.langKey,
required this.createdAt,
required this.updatedAt,
this.deletedAt,
});
factory PageLocalization.fromJson(Map<String, dynamic> json) => PageLocalization(
id: json["id"],
pageId: json["page_id"],
title: json["title"],
content: json["content"],
langKey: json["lang_key"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
);
Map<String, dynamic> toJson() => {
"id": id,
"page_id": pageId,
"title": title,
"content": content,
"lang_key": langKey,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
"deleted_at": deletedAt,
};
}

View File

@@ -0,0 +1,33 @@
// To parse this JSON data, do
//
// final paymentTypesResponse = paymentTypesResponseFromJson(jsonString);
import 'dart:convert';
List<PaymentTypesResponse> paymentTypesResponseFromJson(String str) => List<PaymentTypesResponse>.from(json.decode(str).map((x) => PaymentTypesResponse.fromJson(x)));
String paymentTypesResponseToJson(List<PaymentTypesResponse> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class PaymentTypesResponse {
String key;
String name;
String image;
PaymentTypesResponse({
required this.key,
required this.name,
required this.image,
});
factory PaymentTypesResponse.fromJson(Map<String, dynamic> json) => PaymentTypesResponse(
key: json["key"],
name: json["name"],
image: json["image"],
);
Map<String, dynamic> toJson() => {
"key": key,
"name": name,
"image": image,
};
}

View File

@@ -0,0 +1,255 @@
// To parse this JSON data, do
//
// final productDetailsResponse = productDetailsResponseFromJson(jsonString);
import 'dart:convert';
ProductDetailsResponse productDetailsResponseFromJson(String str) => ProductDetailsResponse.fromJson(json.decode(str));
String productDetailsResponseToJson(ProductDetailsResponse data) => json.encode(data.toJson());
class ProductDetailsResponse {
ProductDetailsInfo data;
bool result;
var status;
ProductDetailsResponse({
required this.data,
required this.result,
required this.status,
});
factory ProductDetailsResponse.fromJson(Map<String, dynamic> json) => ProductDetailsResponse(
data: ProductDetailsInfo.fromJson(json["data"]),
result: json["result"],
status: json["status"],
);
Map<String, dynamic> toJson() => {
"data": data.toJson(),
"result": result,
"status": status,
};
}
class ProductDetailsInfo {
var id;
List<Variation> variations;
List<VariationMaterial> variationMaterials;
String slug;
String name;
String thumbnailImage;
List<String> galleryImages;
String price;
double mainPrice;
bool isDiscounted;
var discount;
String? shortDescription;
String? description;
String? brand;
String? unit;
var stock;
var rewardPovars;
List<Category> categories;
ProductDetailsInfo({
required this.id,
required this.variations,
required this.variationMaterials,
required this.slug,
required this.name,
required this.thumbnailImage,
required this.galleryImages,
required this.price,
required this.mainPrice,
required this.isDiscounted,
required this.discount,
this.shortDescription,
this.description,
this.brand,
this.unit,
required this.stock,
required this.rewardPovars,
required this.categories,
});
factory ProductDetailsInfo.fromJson(Map<String, dynamic> json) => ProductDetailsInfo(
id: json["id"],
variations:json["variations"]==[]?[]: List<Variation>.from(json["variations"].map((x) => Variation.fromJson(x))),
variationMaterials:json["variation_materials"]==[]?[]: List<VariationMaterial>.from(json["variation_materials"].map((x) => VariationMaterial.fromJson(x))),
slug: json["slug"],
name: json["name"],
thumbnailImage: json["thumbnail_image"],
galleryImages: List<String>.from(json["gallery_images"].map((x) => x)),
price: json["price"],
mainPrice: json["main_price"]?.toDouble(),
isDiscounted: json["is_discounted"],
discount: json["discount"],
shortDescription: json["short_description"],
description: json["description"],
brand: json["brand"],
unit: json["unit"],
stock: json["stock"],
rewardPovars: json["reward_povars"],
categories: List<Category>.from(json["categories"].map((x) => Category.fromJson(x))),
);
factory ProductDetailsInfo.init() => ProductDetailsInfo(
id: 0,
variations: [],
variationMaterials: [],
slug:"",
name: '',
thumbnailImage: '',
galleryImages:[],
price: "",
mainPrice: 0.0,
isDiscounted: false,
discount: "",
shortDescription: "",
description: "",
brand: "",
unit: "",
stock: "",
rewardPovars: "",
categories: []
);
Map<String, dynamic> toJson() => {
"id": id,
"variations": List<dynamic>.from(variations.map((x) => x.toJson())),
"variation_materials": List<dynamic>.from(variationMaterials.map((x) => x.toJson())),
"slug": slug,
"name": name,
"thumbnail_image": thumbnailImage,
"gallery_images": List<dynamic>.from(galleryImages.map((x) => x)),
"price": price,
"main_price": mainPrice,
"is_discounted": isDiscounted,
"discount": discount,
"short_description": shortDescription,
"description": description,
"brand": brand,
"unit": unit,
"stock": stock,
"reward_povars": rewardPovars,
"categories": List<dynamic>.from(categories.map((x) => x.toJson())),
};
}
class Category {
var id;
String name;
var products;
String thumbnailImage;
Category({
required this.id,
required this.name,
required this.products,
required this.thumbnailImage,
});
factory Category.fromJson(Map<String, dynamic> json) => Category(
id: json["id"],
name: json["name"],
products: json["products"],
thumbnailImage: json["thumbnail_image"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"products": products,
"thumbnail_image": thumbnailImage,
};
}
class VariationMaterial {
var id;
String name;
List<Value> values;
VariationMaterial({
required this.id,
required this.name,
required this.values,
});
factory VariationMaterial.fromJson(Map<String, dynamic> json) => VariationMaterial(
id: json["id"],
name: json["name"],
values: List<Value>.from(json["values"].map((x) => Value.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"values": List<dynamic>.from(values.map((x) => x.toJson())),
};
}
class Value {
var id;
String name;
String? code;
Value({
required this.id,
required this.name,
this.code,
});
factory Value.fromJson(Map<String, dynamic> json) => Value(
id: json["id"],
name: json["name"],
code: json["code"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"code": code,
};
}
class Variation {
var id;
var productId;
String? variationKey;
String? sku;
String? code;
int sock;
var price;
Variation({
required this.id,
required this.productId,
this.variationKey,
this.sku,
this.code,
required this.sock,
required this.price,
});
factory Variation.fromJson(Map<String, dynamic> json) => Variation(
id: json["id"],
productId: json["product_id"],
variationKey: json["variation_key"],
sku: json["sku"],
sock: json["stock"],
code: json["code"],
price: json["price"],
);
Map<String, dynamic> toJson() => {
"id": id,
"product_id": productId,
"variation_key": variationKey,
"sku": sku,
"stock": sock,
"code": code,
"price": price,
};
}

View File

@@ -0,0 +1,87 @@
// To parse this JSON data, do
//
// final productMiniResponse = productMiniResponseFromJson(jsonString);
import 'dart:convert';
import 'package:grostore/models/common/category_info.dart';
import 'product_details_response.dart';
ProductMiniResponse productMiniResponseFromJson(String str) => ProductMiniResponse.fromJson(json.decode(str));
String productMiniResponseToJson(ProductMiniResponse data) => json.encode(data.toJson());
class ProductMiniResponse {
List<ProductMini> data;
ProductMiniResponse({
required this.data,
});
factory ProductMiniResponse.fromJson(Map<String, dynamic> json) => ProductMiniResponse(
data: List<ProductMini>.from(json["data"].map((x) => ProductMini.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class ProductMini {
var id;
String name;
String slug;
String? brand;
String unit;
String thumbnailImage;
String price;
var discount;
bool isDiscounted;
var rewardPovars;
List<CategoryInfo> categories;
List<Variation> variations;
ProductMini({
required this.id,
required this.variations,
required this.name,
required this.slug,
required this.brand,
required this.unit,
required this.thumbnailImage,
required this.price,
required this.discount,
required this.isDiscounted,
required this.rewardPovars,
required this.categories,
});
factory ProductMini.fromJson(Map<String, dynamic> json) => ProductMini(
id: json["id"],
name: json["name"],
variations:json["variations"]==[]?[]: List<Variation>.from(json["variations"].map((x) => Variation.fromJson(x))),
slug: json["slug"],
brand: json["brand"],
unit: json["unit"],
thumbnailImage: json["thumbnail_image"],
price: json["price"],
discount: json["discount"],
isDiscounted: json["is_discounted"],
rewardPovars: json["reward_points"],
categories: List<CategoryInfo>.from(json["categories"].map((x) => CategoryInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"name": name,
"slug": slug,
"brand": brand,
"unit": unit,
"thumbnail_image": thumbnailImage,
"price": price,
"is_discounted": isDiscounted,
"discount": discount,
"reward_povars": rewardPovars,
"categories": List<dynamic>.from(categories.map((x) => x.toJson())),
};
}

View File

@@ -0,0 +1,169 @@
// To parse this JSON data, do
//
// final refundResponse = refundResponseFromJson(jsonString);
import 'dart:convert';
RefundResponse refundResponseFromJson(String str) => RefundResponse.fromJson(json.decode(str));
String refundResponseToJson(RefundResponse data) => json.encode(data.toJson());
class RefundResponse {
List<RefundInfo> data;
Links links;
Meta meta;
RefundResponse({
required this.data,
required this.links,
required this.meta,
});
factory RefundResponse.fromJson(Map<String, dynamic> json) => RefundResponse(
data: List<RefundInfo>.from(json["data"].map((x) => RefundInfo.fromJson(x))),
links: Links.fromJson(json["links"]),
meta: Meta.fromJson(json["meta"]),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
"links": links.toJson(),
"meta": meta.toJson(),
};
}
class RefundInfo {
int id;
String orderCode;
String amount;
String productName;
String status;
dynamic reson;
String date;
RefundInfo({
required this.id,
required this.orderCode,
required this.amount,
required this.productName,
required this.status,
this.reson,
required this.date,
});
factory RefundInfo.fromJson(Map<String, dynamic> json) => RefundInfo(
id: json["id"],
orderCode: json["order_code"],
amount: json["amount"],
productName: json["product_name"],
status: json["status"],
reson: json["reson"],
date: json["date"],
);
Map<String, dynamic> toJson() => {
"id": id,
"order_code": orderCode,
"amount": amount,
"product_name": productName,
"status": status,
"reson": reson,
"date": date,
};
}
class Links {
String first;
String last;
dynamic prev;
dynamic next;
Links({
required this.first,
required this.last,
this.prev,
this.next,
});
factory Links.fromJson(Map<String, dynamic> json) => Links(
first: json["first"],
last: json["last"],
prev: json["prev"],
next: json["next"],
);
Map<String, dynamic> toJson() => {
"first": first,
"last": last,
"prev": prev,
"next": next,
};
}
class Meta {
int currentPage;
int? from;
int lastPage;
List<Link> links;
String path;
String perPage;
int? to;
int total;
Meta({
required this.currentPage,
this.from,
required this.lastPage,
required this.links,
required this.path,
required this.perPage,
this.to,
required this.total,
});
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
currentPage: json["current_page"],
from: json["from"],
lastPage: json["last_page"],
links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))),
path: json["path"],
perPage: json["per_page"],
to: json["to"],
total: json["total"],
);
Map<String, dynamic> toJson() => {
"current_page": currentPage,
"from": from,
"last_page": lastPage,
"links": List<dynamic>.from(links.map((x) => x.toJson())),
"path": path,
"per_page": perPage,
"to": to,
"total": total,
};
}
class Link {
String? url;
String label;
bool active;
Link({
this.url,
required this.label,
required this.active,
});
factory Link.fromJson(Map<String, dynamic> json) => Link(
url: json["url"],
label: json["label"],
active: json["active"],
);
Map<String, dynamic> toJson() => {
"url": url,
"label": label,
"active": active,
};
}

View File

@@ -0,0 +1,5 @@
class ResponseModel<T>{
late int statusCode;
late T object ;
ResponseModel(this.statusCode, this.object);
}

View File

@@ -0,0 +1,25 @@
// To parse this JSON data, do
//
// final settingResponse = settingResponseFromJson(jsonString);
import 'dart:convert';
SettingResponse settingResponseFromJson(String str) => SettingResponse.fromJson(json.decode(str));
String settingResponseToJson(SettingResponse data) => json.encode(data.toJson());
class SettingResponse {
String orderCodePrefix;
SettingResponse({
required this.orderCodePrefix,
});
factory SettingResponse.fromJson(Map<String, dynamic> json) => SettingResponse(
orderCodePrefix: json["order_code_prefix"],
);
Map<String, dynamic> toJson() => {
"order_code_prefix": orderCodePrefix,
};
}

View File

@@ -0,0 +1,53 @@
// To parse this JSON data, do
//
// final stateResponse = stateResponseFromJson(jsonString);
import 'dart:convert';
StateResponse stateResponseFromJson(String str) => StateResponse.fromJson(json.decode(str));
String stateResponseToJson(StateResponse data) => json.encode(data.toJson());
class StateResponse {
List<StateInfo> data;
StateResponse({
required this.data,
});
factory StateResponse.fromJson(Map<String, dynamic> json) => StateResponse(
data: List<StateInfo>.from(json["data"].map((x) => StateInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class StateInfo {
int countryId;
int id;
String name;
bool isActive;
StateInfo({
required this.countryId,
required this.id,
required this.name,
required this.isActive,
});
factory StateInfo.fromJson(Map<String, dynamic> json) => StateInfo(
countryId: json["country_id"],
id: json["id"],
name: json["name"],
isActive: json["is_active"],
);
Map<String, dynamic> toJson() => {
"country_id": countryId,
"id": id,
"name": name,
"is_active": isActive,
};
}

View File

@@ -0,0 +1,11 @@
class Supplier {
final String name;
final String address;
final String paymentInfo;
const Supplier({
required this.name,
required this.address,
required this.paymentInfo,
});
}

View File

@@ -0,0 +1,57 @@
// To parse this JSON data, do
//
// final timeSlotResponse = timeSlotResponseFromJson(jsonString);
import 'dart:convert';
import 'package:grostore/models/product_details_response.dart';
TimeSlotResponse timeSlotResponseFromJson(String str) => TimeSlotResponse.fromJson(json.decode(str));
String timeSlotResponseToJson(TimeSlotResponse data) => json.encode(data.toJson());
class TimeSlotResponse {
int days;
List<TimeSlot> timeSlots;
TimeSlotResponse({
required this.days,
required this.timeSlots,
});
factory TimeSlotResponse.fromJson(Map<String, dynamic> json) => TimeSlotResponse(
days: json["days"],
timeSlots: List<TimeSlot>.from(json["time_slots"].map((x) => TimeSlot.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"days": days,
"time_slots": List<dynamic>.from(timeSlots.map((x) => x.toJson())),
};
}
class TimeSlot {
var id;
String timeline;
var sortingOrder;
TimeSlot({
required this.id,
required this.timeline,
required this.sortingOrder,
});
factory TimeSlot.fromJson(Map<String, dynamic> json) => TimeSlot(
id: json["id"],
timeline: json["timeline"],
sortingOrder: json["sorting_order"],
);
Map<String, dynamic> toJson() => {
"id": id,
"timeline": timeline,
"sorting_order": sortingOrder,
};
}

View File

@@ -0,0 +1,77 @@
// To parse this JSON data, do
//
// final addressesResponse = addressesResponseFromJson(jsonString);
import 'dart:convert';
AddressesResponse addressesResponseFromJson(String str) => AddressesResponse.fromJson(json.decode(str));
String addressesResponseToJson(AddressesResponse data) => json.encode(data.toJson());
class AddressesResponse {
List<AddressInfo> data;
AddressesResponse({
required this.data,
});
factory AddressesResponse.fromJson(Map<String, dynamic> json) => AddressesResponse(
data: List<AddressInfo>.from(json["data"].map((x) => AddressInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class AddressInfo {
var id;
var userId;
var countryId;
String countryName;
var stateId;
String stateName;
var cityId;
String cityName;
String address;
var isDefault;
AddressInfo({
required this.id,
required this.userId,
required this.countryId,
required this.countryName,
required this.stateId,
required this.stateName,
required this.cityId,
required this.cityName,
required this.address,
required this.isDefault,
});
factory AddressInfo.fromJson(Map<String, dynamic> json) => AddressInfo(
id: json["id"],
userId: json["user_id"],
countryId: json["country_id"],
countryName: json["country_name"],
stateId: json["state_id"],
stateName: json["state_name"],
cityId: json["city_id"],
cityName: json["city_name"],
address: json["address"],
isDefault: json["is_default"],
);
Map<String, dynamic> toJson() => {
"id": id,
"user_id": userId,
"country_id": countryId,
"country_name": countryName,
"state_id": stateId,
"state_name": stateName,
"city_id": cityId,
"city_name": cityName,
"address": address,
"is_default": isDefault,
};
}

View File

@@ -0,0 +1,50 @@
// To parse this JSON data, do
//
// final userInfoResponse = userInfoResponseFromJson(jsonString);
import 'dart:convert';
import 'common/user_info.dart';
UserInfoResponse userInfoResponseFromJson(String str) => UserInfoResponse.fromJson(json.decode(str));
UserInfoResponse userInfoResponseDefault() => UserInfoResponse.fromJson(json.decode('''
{
"data": {
"name": "",
"email": "",
"phone": "",
"balance": 0,
"avatar": ""
},
"result": false,
"message": "failed"
}
'''));
String userInfoResponseToJson(UserInfoResponse data) => json.encode(data.toJson());
class UserInfoResponse {
UserInfo data;
bool result;
String message;
UserInfoResponse({
required this.data,
required this.result,
required this.message,
});
factory UserInfoResponse.fromJson(Map<String, dynamic> json) => UserInfoResponse(
data: UserInfo.fromJson(json["data"]),
result: json["result"],
message: json["message"],
);
Map<String, dynamic> toJson() => {
"data": data.toJson(),
"result": result,
"message": message,
};
}

View File

@@ -0,0 +1,161 @@
// To parse this JSON data, do
//
// final walletHistoryResponse = walletHistoryResponseFromJson(jsonString);
import 'dart:convert';
WalletHistoryResponse walletHistoryResponseFromJson(String str) => WalletHistoryResponse.fromJson(json.decode(str));
String walletHistoryResponseToJson(WalletHistoryResponse data) => json.encode(data.toJson());
class WalletHistoryResponse {
List<WalletInfo> data;
Links links;
Meta meta;
WalletHistoryResponse({
required this.data,
required this.links,
required this.meta,
});
factory WalletHistoryResponse.fromJson(Map<String, dynamic> json) => WalletHistoryResponse(
data: List<WalletInfo>.from(json["data"].map((x) => WalletInfo.fromJson(x))),
links: Links.fromJson(json["links"]),
meta: Meta.fromJson(json["meta"]),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
"links": links.toJson(),
"meta": meta.toJson(),
};
}
class WalletInfo {
int id;
String amount;
String paymentMethod;
String status;
String date;
WalletInfo({
required this.id,
required this.amount,
required this.paymentMethod,
required this.status,
required this.date,
});
factory WalletInfo.fromJson(Map<String, dynamic> json) => WalletInfo(
id: json["id"],
amount: json["amount"],
paymentMethod: json["payment_method"],
status: json["status"],
date: json["date"],
);
Map<String, dynamic> toJson() => {
"id": id,
"amount": amount,
"payment_method": paymentMethod,
"status": status,
"date": date,
};
}
class Links {
String first;
String last;
dynamic prev;
dynamic next;
Links({
required this.first,
required this.last,
this.prev,
this.next,
});
factory Links.fromJson(Map<String, dynamic> json) => Links(
first: json["first"],
last: json["last"],
prev: json["prev"],
next: json["next"],
);
Map<String, dynamic> toJson() => {
"first": first,
"last": last,
"prev": prev,
"next": next,
};
}
class Meta {
int currentPage;
int? from;
int lastPage;
List<Link> links;
String path;
String perPage;
int? to;
int total;
Meta({
required this.currentPage,
this.from,
required this.lastPage,
required this.links,
required this.path,
required this.perPage,
this.to,
required this.total,
});
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
currentPage: json["current_page"],
from: json["from"],
lastPage: json["last_page"],
links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))),
path: json["path"],
perPage: json["per_page"],
to: json["to"],
total: json["total"],
);
Map<String, dynamic> toJson() => {
"current_page": currentPage,
"from": from,
"last_page": lastPage,
"links": List<dynamic>.from(links.map((x) => x.toJson())),
"path": path,
"per_page": perPage,
"to": to,
"total": total,
};
}
class Link {
String? url;
String label;
bool active;
Link({
this.url,
required this.label,
required this.active,
});
factory Link.fromJson(Map<String, dynamic> json) => Link(
url: json["url"],
label: json["label"],
active: json["active"],
);
Map<String, dynamic> toJson() => {
"url": url,
"label": label,
"active": active,
};
}

View File

@@ -0,0 +1,50 @@
// To parse this JSON data, do
//
// final wishlistResponse = wishlistResponseFromJson(jsonString);
import 'dart:convert';
import 'package:grostore/models/product_mini_response.dart';
WishlistResponse wishlistResponseFromJson(String str) => WishlistResponse.fromJson(json.decode(str));
String wishlistResponseToJson(WishlistResponse data) => json.encode(data.toJson());
class WishlistResponse {
List<WishlistInfo> data;
WishlistResponse({
required this.data,
});
factory WishlistResponse.fromJson(Map<String, dynamic> json) => WishlistResponse(
data: List<WishlistInfo>.from(json["data"].map((x) => WishlistInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class WishlistInfo {
int id;
ProductMini product;
WishlistInfo({
required this.id,
required this.product,
});
factory WishlistInfo.fromJson(Map<String, dynamic> json) => WishlistInfo(
id: json["id"],
product: ProductMini.fromJson(json["product"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"product": product.toJson(),
};
}

View File

@@ -0,0 +1,283 @@
import 'package:flutter/cupertino.dart';
import 'package:grostore/apis/address_api.dart';
import 'package:grostore/app_lang.dart';
import 'package:grostore/custom_ui/loading.dart';
import 'package:grostore/custom_ui/toast_ui.dart';
import 'package:grostore/models/city_response.dart';
import 'package:grostore/models/country_response.dart';
import 'package:grostore/models/edit_address_response.dart';
import 'package:grostore/models/state_response.dart';
import 'package:grostore/models/user/addresses_response.dart';
class AddressPresenter extends ChangeNotifier {
static BuildContext? context;
setContext(BuildContext context) {
AddressPresenter.context = context;
}
List<AddressInfo> addresses = [];
List<CountryInfo> countries = [];
List<StateInfo> states = [];
List<CityInfo> cities = [];
List<CountryInfo> filteredCountries = [];
List<StateInfo> filteredStates = [];
List<CityInfo> filteredCities = [];
String defaultAddress = "No";
EditAddressResponse? editAddress;
CountryInfo? selectedCountry;
StateInfo? selectedState;
CityInfo? selectedCity;
bool isFetchAddress = false;
TextEditingController addressController = TextEditingController();
fetchAddresses() async {
var res = await AddressApi.getAddresses();
addresses.clear();
addresses.addAll(res.object.data);
isFetchAddress = true;
notifyListeners();
}
initState() {
fetchAddresses();
}
Future<void> onRefresh()async{
return await fetchAddresses();
}
clear(){
addresses.clear();
isFetchAddress = false;
notifyListeners();
}
filterCountry(String text) {
filteredCountries.clear();
if (text.isNotEmpty) {
filteredCountries.addAll(countries.where((element) {
return element.name.toLowerCase().contains(text.toLowerCase());
}));
} else {
filteredCountries.addAll(countries);
}
notifyListeners();
}
filterState(String text) {
filteredStates.clear();
if (text.isNotEmpty) {
filteredStates.addAll(states.where((element) {
return element.name.toLowerCase().contains(text.toLowerCase());
}));
} else {
filteredStates.addAll(states);
}
notifyListeners();
}
filterCity(String text) {
filteredCities.clear();
if (text.isNotEmpty) {
filteredCities.addAll(cities.where((element) {
return element.name.toLowerCase().contains(text.toLowerCase());
}));
} else {
filteredCities.addAll(cities);
}
notifyListeners();
}
getCountries() async {
var response = await AddressApi.getCountries();
countries.addAll(response.object.data);
if(editAddress!=null){
countries.forEach((element) {
if(element.id==editAddress!.data.countryId){
setSelectedCountry(element);
}
});
}
filteredCountries.addAll(countries);
notifyListeners();
}
getStates(id) async {
var response = await AddressApi.getState(id);
states.addAll(response.object.data);
if(editAddress!=null){
states.forEach((element) {
if(element.id==editAddress!.data.stateId){
setSelectedState(element);
}
});
}
filteredStates.addAll(states);
notifyListeners();
}
getCities(id) async {
var response = await AddressApi.getCity(id);
cities.addAll(response.object.data);
if(editAddress!=null){
cities.forEach((element) {
print(element.id);
print(editAddress!.data.cityId);
if(element.id==editAddress!.data.cityId){
setSelectedCity(element);
}
});
}
notifyListeners();
}
setSelectedCountry(CountryInfo countryInfo) {
selectedCountry = countryInfo;
selectedState = null;
selectedCity = null;
getStates(countryInfo.id);
notifyListeners();
}
setSelectedState(StateInfo stateInfo) {
selectedState = stateInfo;
selectedCity = null;
getCities(stateInfo.id);
notifyListeners();
}
setSelectedCity(CityInfo cityInfo) {
selectedCity = cityInfo;
notifyListeners();
}
setDefaultAddress(String? value) {
if (value != null) {
defaultAddress = value;
notifyListeners();
}
}
addAddress(BuildContext context,
{required CountryInfo? countryInfo,
required StateInfo? stateInfo,
required CityInfo? cityInfo,
required String? fullAddress,
required int? isDefault}) async {
if (!checkAddressValidation(context,
countryInfo: countryInfo,
stateInfo: stateInfo,
cityInfo: cityInfo,
fullAddress: fullAddress,
isDefault: isDefault)) {
return;
}
Loading.show(context);
var response = await AddressApi.addAddress(
countryId: countryInfo!.id,
stateId: stateInfo!.id,
cityId: cityInfo!.id,
isDefault: isDefault!,
address: fullAddress!);
Loading.close();
if (!context.mounted) return;
ToastUi.show(context, response.object.message);
if (response.object.result) {
Navigator.pop(context);
}
}
updateAddress(BuildContext context,
{
required int id,
required CountryInfo? countryInfo,
required StateInfo? stateInfo,
required CityInfo? cityInfo,
required String? fullAddress,
required int? isDefault}) async {
if (!checkAddressValidation(context,
countryInfo: countryInfo,
stateInfo: stateInfo,
cityInfo: cityInfo,
fullAddress: fullAddress,
isDefault: isDefault)) {
return;
}
Loading.show(context);
var response = await AddressApi.updateAddress(
id: id,
countryId: countryInfo!.id,
stateId: stateInfo!.id,
cityId: cityInfo!.id,
isDefault: isDefault!,
address: fullAddress!);
Loading.close();
if (!context.mounted) return;
ToastUi.show(context, response.object.message);
if (response.object.result) {
Navigator.pop(context);
}
}
bool checkAddressValidation(BuildContext context,
{required CountryInfo? countryInfo,
required StateInfo? stateInfo,
required CityInfo? cityInfo,
required String? fullAddress,
required int? isDefault}) {
if (countryInfo == null) {
ToastUi.show(context, AppLang.local(context).please_select_a_country);
return false;
}
if (stateInfo == null) {
ToastUi.show(context, AppLang.local(context).please_select_a_state);
return false;
}
if (cityInfo == null) {
ToastUi.show(context, AppLang.local(context).please_select_a_city);
return false;
}
if (fullAddress == null || fullAddress.trim().isEmpty) {
ToastUi.show(context, AppLang.local(context).please_enter_address);
return false;
}
return true;
}
getEditAddressData(id,BuildContext context)async{
Loading.show(context);
var response =await AddressApi.editAddresses(id);
Loading.close();
if(response.statusCode==200 && response.object.result){
editAddress= response.object;
getCountries();
//setSelectedCountry(CountryInfo(id: response.object.data.countryId, code: "0", name: response.object.data.countryName, isActive: true));
//setSelectedState(StateInfo(id: response.object.data.stateId,name: response.object.data.stateName, isActive: true, countryId: response.object.data.countryId));
//setSelectedCity(CityInfo(id: response.object.data.cityId,name: response.object.data.cityName, isActive: true, stateId: response.object.data.stateId));
setDefaultAddress(editAddress!.data.isDefault==1?"Set Default":"No");
addressController.text=response.object.data.address;
notifyListeners();
}
}
deleteAddress(id,BuildContext context)async{
Loading.show(context);
var response = await AddressApi.deleteAddress(id: id);
Loading.close();
ToastUi.show(context, response.object.message);
onRefresh();
}
}

View File

@@ -0,0 +1,715 @@
import 'dart:convert';
// import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:grostore/apis/auth_api.dart';
import 'package:grostore/app_lang.dart';
import 'package:grostore/constant/country_code.dart';
import 'package:grostore/custom_classes/system_data.dart';
import 'package:grostore/custom_ui/loading.dart';
import 'package:grostore/custom_ui/toast_ui.dart';
import 'package:grostore/helpers/route.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/auth/login_response_model.dart';
import 'package:grostore/models/common/user_info.dart';
import 'package:grostore/models/user_info_response_model.dart';
import 'package:grostore/screens/auth/password_otp.dart';
import 'package:grostore/screens/main.dart';
class AuthPresenterf extends ChangeNotifier {
UserInfo userInfo = userInfoResponseDefault().data;
static BuildContext? _context;
static BuildContext get getContext => _context!;
setContext(BuildContext context) {
AuthPresenterf._context = context;
}
List<Country> country = CountryCode().get();
List<Country> filteredCountry = CountryCode().get();
void filterCountry(String query) {
query = query.toLowerCase();
filteredCountry = country.where((product) {
if (product.name.toLowerCase().contains(query)) {
return true;
} else {
return false;
}
}).toList();
notifyListeners();
}
//controllers
TextEditingController loginPhoneNumberController = TextEditingController();
TextEditingController loginEmailController = TextEditingController();
TextEditingController loginPasswordController = TextEditingController();
String loginBy = "phone"; //phone or email
String initialCountry = 'US';
var countriesCode = <String>[];
Country regCountry = CountryCode().get().last;
String loginPhone = "";
late String loginEmail, loginPassword;
/// Registration variables
String registerBy = "email"; //phone or email
String regPhone = "";
bool isAgree = false;
//controllers
TextEditingController regNameController = TextEditingController();
TextEditingController regPhoneNumberController = TextEditingController();
TextEditingController regPasswordController = TextEditingController();
TextEditingController regPasswordConfirmController = TextEditingController();
fetch_country() async {
// var data = await AddressRepository().getCountryList();
// data.countries.forEach((c) => countries_code.add(c.code));
}
String makeLoginPostBody(login,pass) {
return jsonEncode({
"phone": login,
"password": pass,
});
}
onPressedLogin() async {
loginPhone = loginPhoneNumberController.text.toString().trim();
loginPassword = loginPasswordController.text.toString().trim();
loginPhone = "+998$loginPhone";
print("Loginn::: $loginPhone");
print("Password::: $loginPassword");
if (loginPhone == "") {
ToastUi.show(_context!, AppLang
.local(_context!)
.please_enter_phone);
return;
} else if (loginPassword == "") {
ToastUi.show(_context!, AppLang
.local(_context!)
.please_enter_password);
return;
}
var body = makeLoginPostBody(loginPhone, loginPassword);
print("JsonBody::: $body");
Loading.show(_context!);
var response =await AuthApi.login(body, _context!);
Loading.close();
if (response.result == false) {
var message = "";
if (response.message.runtimeType == List) {
// response.message.forEach((key, value) {
// value.forEach((messages) {
// message += messages + "\n";
// });
// }
// )
message = response.message;
} else {
message = response.message;
}
ToastUi.show(_context!, message);
} else {
ToastUi.show(_context!, response.message);
loginPasswordController.text == '';
loginPasswordController.text == '';
SystemData.isLogIn = true;
// MakeRoute.clearProviders(_context!);
Navigator.pushReplacement(_context!, MaterialPageRoute(builder: (_)=> const Main()));
}
}
tokenCheck(BuildContext context) async {
var response = await AuthApi.tokenCheck(context);
if (response.result) {
SystemData.isLogIn = response.result;
SystemData.userInfo = response.user;
}
notifyListeners();
}
logout(BuildContext context) async {
var response = await AuthApi.logout(context);
if (response.result) {
SystemData.isLogIn = false;
SystemData.userInfo = response.user;
}
notifyListeners();
}
///registration methods
onChangeCountry(Country country) {
regCountry = country;
notifyListeners();
}
String makeRegBody(name, phone, password, confirmPassword) {
return jsonEncode({
"name": name,
"phone": phone,
"password": password,
"password_confirmation": confirmPassword
});
}
onPressSignUp() async {
var name = regNameController.text.toString();
var password = regPasswordController.text.toString();
var passwordConfirm = regPasswordConfirmController.text.toString();
regPhone = regPhoneNumberController.value.text.toString();
String valu = '';
String value = '';
if (regPhone.isNotEmpty) {
// valu = regPhone.substring(0,2);
// value = regPhone.substring(2);
regPhone = "+998$regPhone";
// regPhone = "+998($valu)$value";
}
if (name == "") {
ToastUi.show(_context!, AppLang
.local(_context!)
.please_enter_phone);
return;
} else if (password == "") {
ToastUi.show(_context!, AppLang
.local(_context!)
.please_enter_password);
return;
} else if (passwordConfirm == "") {
ToastUi.show(
_context!, AppLang
.local(_context!)
.please_enter_confirm_password);
return;
} else if (password.length < 6) {
ToastUi.show(
_context!, AppLang
.local(_context!)
.password_must_be_at_last_6_digit);
return;
} else if (password != passwordConfirm) {
ToastUi.show(
_context!,
AppLang
.local(_context!)
.password_and_confirm_password_is_not_matching);
return;
}
var body = makeRegBody(
name,
regPhone,
password,
passwordConfirm);
Loading.show(_context!);
var signupResponse = await AuthApi.registration(_context!, body);
Loading.close();
if (signupResponse == false) {
var message = "";
if (signupResponse.message.runtimeType == List) {
signupResponse.message.forEach((key, value) {
value.forEach((messages) {
message += messages + "\n";
});
});
} else {
message = signupResponse.message;
}
ToastUi.show(_context!, message);
} else {
ToastUi.show(_context!, signupResponse.message);
regPasswordController.text = "";
// SystemData.isLogIn = true;
// MakeRoute.clearProviders(_context!);
Navigator.pushReplacement(_context!, MaterialPageRoute(builder: (_)=>PasswordOtp()));
}
// notifyListeners();
}
///
/// ForgetPassword
///
//controllers
TextEditingController forgetEmailController = TextEditingController();
TextEditingController forgetPhoneNumberController = TextEditingController();
onPressSendCode() async {
var email = forgetEmailController.text.toString();
if (email == "") {
ToastUi.show(_context!, AppLang.local(_context!).please_enter_email);
return;
}
var passwordForgetResponse = await AuthApi.forgetPassword(_context!, email);
if (passwordForgetResponse.result == false) {
ToastUi.show(_context!, passwordForgetResponse.message);
} else {
ToastUi.show(_context!, passwordForgetResponse.message);
// Navigator.push(context, MaterialPageRoute(builder: (context) {
// return PasswordOtp(
// verify_by: _send_code_by,
// );
// }));
}
}
String makeRegOTP(code) {
return jsonEncode({
"code": code
});
}
TextEditingController otpController = TextEditingController();
/// Otp
onPressOTP() async {
var code = otpCodeController.text.toString();
if (code == "") {
ToastUi.show(
_context!,
AppLang.local(_context!).enter_otp_code,
);
return;
}
var otp = makeRegOTP(code);
var passwordConfirmResponse =await AuthApi.forgetOTP(_context!, otp);
if (passwordConfirmResponse.result == false) {
ToastUi.show(_context!, passwordConfirmResponse.message);
} else {
ToastUi.show(_context!, passwordConfirmResponse.message);
// MakeRoute.clearProviders(_context!);
SystemData.isLogIn = true;
Navigator.pushReplacement(_context!, MaterialPageRoute(builder: (_)=> const Main()));
}
// notifyListeners();
}
//controllers
TextEditingController otpCodeController = TextEditingController();
TextEditingController otpPasswordController = TextEditingController();
TextEditingController otpPasswordConfirmController = TextEditingController();
bool otpResetPasswordSuccess = false;
onPressConfirm() async {
var code = otpCodeController.text.toString();
var password = otpPasswordController.text.toString();
var password_confirm = otpPasswordConfirmController.text.toString();
if (code == "") {
ToastUi.show(
_context!,
AppLang.local(_context!).enter_otp_code,
);
return;
} else if (password == "") {
ToastUi.show(_context!, AppLang.local(_context!).please_enter_password);
return;
} else if (password_confirm == "") {
ToastUi.show(
_context!, AppLang.local(_context!).please_enter_confirm_password);
return;
} else if (password.length < 6) {
ToastUi.show(
_context!, AppLang.local(_context!).password_must_be_at_last_6_digit);
return;
} else if (password != password_confirm) {
ToastUi.show(
_context!,
AppLang.local(_context!)
.password_and_confirm_password_is_not_matching);
return;
}
var passwordConfirmResponse =
await AuthApi.forgetPassword(_context!, password);
if (passwordConfirmResponse.result == false) {
ToastUi.show(_context!, passwordConfirmResponse.message);
} else {
ToastUi.show(_context!, passwordConfirmResponse.message);
}
}
onTapResend() async {
var passwordResendCodeResponse =
await AuthApi.forgetPassword(_context!, "");
if (passwordResendCodeResponse.result == false) {
ToastUi.show(_context!, passwordResendCodeResponse.message);
} else {
ToastUi.show(_context!, passwordResendCodeResponse.message);
}
}
}
// import 'dart:convert';
//
// import 'package:flutter/cupertino.dart';
// import 'package:grostore/apis/auth_api.dart';
// import 'package:grostore/app_lang.dart';
// import 'package:grostore/constant/country_code.dart';
// import 'package:grostore/custom_classes/system_data.dart';
// import 'package:grostore/custom_ui/loading.dart';
// import 'package:grostore/custom_ui/toast_ui.dart';
// import 'package:grostore/helpers/common_functions.dart';
// import 'package:grostore/helpers/route.dart';
// import 'package:grostore/helpers/shared_value_helper.dart';
// import 'package:grostore/models/auth/login_response_model.dart';
// import 'package:grostore/models/common/user_info.dart';
// import 'package:grostore/models/user_info_response_model.dart';
// import 'package:grostore/screens/main.dart';
//
// class AuthPresenter extends ChangeNotifier {
// UserInfo userInfo = userInfoResponseDefault().data;
// static BuildContext? _context;
//
// static BuildContext get getContext => _context!;
//
// setContext(BuildContext context) {
// AuthPresenter._context = context;
// }
//
// List<Country> country = CountryCode().get();
//
// List<Country> filteredCountry = CountryCode().get();
//
// void filterCountry(String query) {
// query = query.toLowerCase();
//
// filteredCountry = country.where((product) {
// if (product.name.toLowerCase().contains(query)) {
// return true;
// } else {
// return false;
// }
// }).toList();
// notifyListeners();
// }
//
// //controllers
// TextEditingController loginPhoneNumberController = TextEditingController();
// TextEditingController loginEmailController = TextEditingController();
// TextEditingController loginPasswordController = TextEditingController();
//
// String loginBy = "email"; //phone or email
// String initialCountry = 'US';
// var countriesCode = <String>[];
// Country regCountry = CountryCode().get().last;
// String loginPhone = "";
// late String loginEmail, loginPassword;
//
// /// Registration variables
// String registerBy = "email"; //phone or email
// String regPhone = "";
// bool isAgree = false;
//
// //controllers
// TextEditingController regNameController = TextEditingController();
// TextEditingController regEmailController = TextEditingController();
// TextEditingController regPhoneNumberController = TextEditingController();
// TextEditingController regPasswordController = TextEditingController();
// TextEditingController regPasswordConfirmController = TextEditingController();
//
// fetch_country() async {
// // var data = await AddressRepository().getCountryList();
// // data.countries.forEach((c) => countries_code.add(c.code));
// }
//
// onPressedLogin() async {
// if (checkLoginValidation()) {
// makeLogin();
// }
// }
//
// String makeLoginPostBody() {
// return jsonEncode({
// "email": loginEmail,
// "type": "customer",
// "password": loginPassword,
// });
// }
//
// bool checkLoginValidation() {
// loginEmail = loginEmailController.text.toString().trim();
// loginPassword = loginPasswordController.text.toString().trim();
// if (loginBy == "email") {
// if (loginEmail.isEmpty || !isEmail(loginEmail)) {
// ToastUi.show(_context!, AppLang.getLocal().please_enter_valid_email);
// return false;
// }
// } else {
// ///todo phone no validation
// return false;
// }
//
// if (loginPassword.isEmpty) {
// return false;
// }
// return true;
// }
//
// makeLogin() async {
// Loading.show(_context!);
// LoginResponse response =
// await AuthApi.login(makeLoginPostBody(), _context!);
// Loading.close();
// if (response.result) {
// access_token.update((p0) => response.accessToken);
// access_token.save();
// loginEmailController.clear();
// loginPasswordController.clear();
// SystemData.isLogIn = true;
// SystemData.userInfo = response.user;
// MakeRoute.goAndRemoveAll(_context!, Main());
// //UserInfo(name: response.name, email: response.email, phone: response.phone, balance: response.balance, avatar: response.avatar);
// }
// ToastUi.show(_context!, response.message);
// }
//
// tokenCheck(BuildContext context) async {
// var response = await AuthApi.tokenCheck(context);
// if (response.result) {
// SystemData.isLogIn = response.result;
// SystemData.userInfo = response.user;
// }
// notifyListeners();
// }
//
// logout(BuildContext context) async {
// var response = await AuthApi.logout(context);
// if (response.result) {
// SystemData.isLogIn = false;
// SystemData.userInfo = response.user;
// }
// notifyListeners();
// }
//
// ///registration methods
//
// onChangeCountry(Country country) {
// regCountry = country;
// notifyListeners();
// }
//
// String makeRegBody(name, email, phone, password, confirmPassword) {
// return jsonEncode({
// "name": name,
// "email": email,
// "phone": phone,
// "password": password,
// "password_confirmation": confirmPassword
// });
// }
//
// onPressSignUp() async {
// var name = regNameController.text.toString();
// var email = regEmailController.text.toString();
// var password = regPasswordController.text.toString();
// var password_confirm = regPasswordConfirmController.text.toString();
// regPhone = regPhoneNumberController.text.trim();
// if (regPhone.isNotEmpty) {
// regPhone = regCountry.dial_code + regPhone;
// }
//
// if (name == "") {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_name);
// return;
// } else if (registerBy == 'email' && (email == "" || !isEmail(email))) {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_email);
// return;
// } else if (registerBy == 'phone' && regPhone == "") {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_phone);
// return;
// } else if (password == "") {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_password);
// return;
// } else if (password_confirm == "") {
// ToastUi.show(
// _context!, AppLang.local(_context!).please_enter_confirm_password);
// return;
// } else if (password.length < 6) {
// ToastUi.show(
// _context!, AppLang.local(_context!).password_must_be_at_last_6_digit);
// return;
// } else if (password != password_confirm) {
// ToastUi.show(
// _context!,
// AppLang.local(_context!)
// .password_and_confirm_password_is_not_matching);
// return;
// }
//
// var body = makeRegBody(name, email, regPhone, password, password_confirm);
// Loading.show(_context!);
// var signupResponse = await AuthApi.registration(_context!, body);
// Loading.close();
// print(signupResponse.toJson());
// if (signupResponse.result == false) {
// var message = "";
// if (signupResponse.message.runtimeType == List) {
// signupResponse.message.forEach((key, value) {
// value.forEach((messages) {
// message += messages + "\n";
// });
// });
// } else {
// message = signupResponse.message;
// }
//
// ToastUi.show(_context!, message);
// } else {
// ToastUi.show(_context!, signupResponse.message);
// access_token.update((p0) => signupResponse.accessToken);
// access_token.save();
// loginEmailController.clear();
// loginPasswordController.clear();
// SystemData.isLogIn = true;
// SystemData.userInfo = signupResponse.user;
// MakeRoute.goAndRemoveAll(_context!, Main());
//
// // if ((mail_verification_status.$ && _register_by == "email") ||
// // _register_by == "phone") {
// // Navigator.push(context, MaterialPageRoute(builder: (context) {
// // return Otp(
// // verify_by: _register_by,
// // user_id: signupResponse.user_id,
// // );
// // }));
// //
// // } else {
// // Navigator.push(context, MaterialPageRoute(builder: (context) {
// // return Login();
// // }));
// // }
// }
// }
//
// ///
//
// /// ForgetPassword
// ///
//
// //controllers
// TextEditingController forgetEmailController = TextEditingController();
// TextEditingController forgetPhoneNumberController = TextEditingController();
//
// onPressSendCode() async {
// var email = forgetEmailController.text.toString();
//
// if (email == "") {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_email);
// return;
// }
//
// var passwordForgetResponse = await AuthApi.forgetPassword(_context!, email);
//
// if (passwordForgetResponse.result == false) {
// ToastUi.show(_context!, passwordForgetResponse.message);
// } else {
// ToastUi.show(_context!, passwordForgetResponse.message);
//
// // Navigator.push(context, MaterialPageRoute(builder: (context) {
// // return PasswordOtp(
// // verify_by: _send_code_by,
// // );
// // }));
// }
// }
//
// /// Otp
// ///
//
// //controllers
// TextEditingController otpCodeController = TextEditingController();
// TextEditingController otpPasswordController = TextEditingController();
// TextEditingController otpPasswordConfirmController = TextEditingController();
// bool otpResetPasswordSuccess = false;
//
// onPressConfirm() async {
// var code = otpCodeController.text.toString();
// var password = otpPasswordController.text.toString();
// var password_confirm = otpPasswordConfirmController.text.toString();
//
// if (code == "") {
// ToastUi.show(
// _context!,
// AppLang.local(_context!).enter_otp_code,
// );
// return;
// } else if (password == "") {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_password);
// return;
// } else if (password_confirm == "") {
// ToastUi.show(
// _context!, AppLang.local(_context!).please_enter_confirm_password);
// return;
// } else if (password.length < 6) {
// ToastUi.show(
// _context!, AppLang.local(_context!).password_must_be_at_last_6_digit);
// return;
// } else if (password != password_confirm) {
// ToastUi.show(
// _context!,
// AppLang.local(_context!)
// .password_and_confirm_password_is_not_matching);
// return;
// }
//
// var passwordConfirmResponse =
// await AuthApi.forgetPassword(_context!, password);
//
// if (passwordConfirmResponse.result == false) {
// ToastUi.show(_context!, passwordConfirmResponse.message);
// } else {
// ToastUi.show(_context!, passwordConfirmResponse.message);
// }
// }
//
// onTapResend() async {
// var passwordResendCodeResponse =
// await AuthApi.forgetPassword(_context!, "");
//
// if (passwordResendCodeResponse.result == false) {
// ToastUi.show(_context!, passwordResendCodeResponse.message);
// } else {
// ToastUi.show(_context!, passwordResendCodeResponse.message);
// }
// }
// }

View File

@@ -0,0 +1,713 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:grostore/apis/auth_api.dart';
import 'package:grostore/app_lang.dart';
import 'package:grostore/constant/country_code.dart';
import 'package:grostore/custom_classes/system_data.dart';
import 'package:grostore/custom_ui/loading.dart';
import 'package:grostore/custom_ui/toast_ui.dart';
import 'package:grostore/helpers/route.dart';
import 'package:grostore/helpers/shared_value_helper.dart';
import 'package:grostore/models/auth/login_response_model.dart';
import 'package:grostore/models/common/user_info.dart';
import 'package:grostore/models/user_info_response_model.dart';
import 'package:grostore/screens/auth/password_otp.dart';
import 'package:grostore/screens/main.dart';
class AuthPresenter extends ChangeNotifier {
UserInfo userInfo = userInfoResponseDefault().data;
static BuildContext? _context;
static BuildContext get getContext => _context!;
setContext(BuildContext context) {
AuthPresenter._context = context;
}
List<Country> country = CountryCode().get();
List<Country> filteredCountry = CountryCode().get();
void filterCountry(String query) {
query = query.toLowerCase();
filteredCountry = country.where((product) {
if (product.name.toLowerCase().contains(query)) {
return true;
} else {
return false;
}
}).toList();
notifyListeners();
}
//controllers
TextEditingController loginPhoneNumberController = TextEditingController();
TextEditingController loginEmailController = TextEditingController();
TextEditingController loginPasswordController = TextEditingController();
String loginBy = "phone"; //phone or email
String initialCountry = 'US';
var countriesCode = <String>[];
Country regCountry = CountryCode().get().last;
String loginPhone = "";
late String loginEmail, loginPassword;
/// Registration variables
String registerBy = "email"; //phone or email
String regPhone = "";
bool isAgree = false;
//controllers
TextEditingController regNameController = TextEditingController();
TextEditingController regPhoneNumberController = TextEditingController();
TextEditingController regPasswordController = TextEditingController();
TextEditingController regPasswordConfirmController = TextEditingController();
fetch_country() async {
// var data = await AddressRepository().getCountryList();
// data.countries.forEach((c) => countries_code.add(c.code));
}
onPressedLogin() async {
if (checkLoginValidation()) {
makeLogin();
}
}
String makeLoginPostBody(phone,pass) {
return jsonEncode({
"phone": phone,
"password": pass,
});
}
bool checkLoginValidation() {
loginPhone = loginPhoneNumberController.text.toString().trim();
loginPassword = loginPasswordController.text.toString().trim();
loginPhone = "+998$loginPhone";
if (loginBy == "phone") {
if (loginPhone.isEmpty) {
ToastUi.show(_context!, AppLang.getLocal().please_enter_valid_email);
return false;
}
} else {
return false;
}
if (loginPassword.isEmpty) {
return false;
}
return true;
}
makeLogin() async {
loginPhone = loginPhoneNumberController.text.toString().trim();
loginPassword = loginPasswordController.text.toString().trim();
loginPhone = "+998$loginPhone";
print("Hello==$loginPhone");
print("Hello==$loginPassword");
Loading.show(_context!);
LoginResponse response = await AuthApi.login(makeLoginPostBody(loginPhone,loginPassword), _context!);
Loading.close();
if (response.result == true) {
access_token.update((p0) => response.accessToken);
access_token.save();
loginPhoneNumberController.text = '';
loginPasswordController.text = '';
SystemData.isLogIn = true;
MakeRoute.goAndRemoveAll(_context!, const Main());
//UserInfo(name: response.name, email: response.email, phone: response.phone, balance: response.balance, avatar: response.avatar);
ToastUi.show(_context!, AppLang.local(_context!).success_login);
}
ToastUi.show(_context!, AppLang.local(_context!).no_such_user_exists);
notifyListeners();
}
tokenCheck(BuildContext context) async {
var response = await AuthApi.tokenCheck(context);
if (response.result) {
SystemData.isLogIn = response.result;
SystemData.userInfo = response.user;
}
notifyListeners();
}
logout(BuildContext context) async {
var response = await AuthApi.logout(context);
if (response.result) {
SystemData.isLogIn = false;
SystemData.userInfo = response.user;
}
notifyListeners();
}
///registration methods
onChangeCountry(Country country) {
regCountry = country;
notifyListeners();
}
String makeRegBody(name, phone, password, confirmPassword) {
return jsonEncode({
"name": name,
"phone": phone,
"password": password,
"password_confirmation": confirmPassword
});
}
onPressSignUp() async {
var name = regNameController.text.toString();
var password = regPasswordController.text.toString();
var passwordConfirm = regPasswordConfirmController.text.toString();
regPhone = regPhoneNumberController.value.text.toString();
String valu = '';
String value = '';
if (regPhone.isNotEmpty) {
// valu = regPhone.substring(0,2);
// value = regPhone.substring(2);
regPhone = "+998$regPhone";
// regPhone = "+998($valu)$value";
}
if (name == "") {
ToastUi.show(_context!, AppLang
.local(_context!)
.please_enter_phone);
return;
} else if (password == "") {
ToastUi.show(_context!, AppLang
.local(_context!)
.please_enter_password);
return;
} else if (passwordConfirm == "") {
ToastUi.show(
_context!, AppLang
.local(_context!)
.please_enter_confirm_password);
return;
} else if (password.length < 6) {
ToastUi.show(
_context!, AppLang
.local(_context!)
.password_must_be_at_last_6_digit);
return;
} else if (password != passwordConfirm) {
ToastUi.show(
_context!,
AppLang
.local(_context!)
.password_and_confirm_password_is_not_matching);
return;
}
var body = makeRegBody(
name,
regPhone,
password,
passwordConfirm);
Loading.show(_context!);
var signupResponse = await AuthApi.registration(_context!, body);
Loading.close();
if (signupResponse.result == false) {
var message = "";
if (signupResponse.message.runtimeType == List) {
signupResponse.message.forEach((key, value) {
value.forEach((messages) {
message += messages + "\n";
});
});
} else {
message = signupResponse.message;
}
await ToastUi.show(_context!, message);
} else {
// loginPasswordController.clear();
// SystemData.isLogIn = true;
MakeRoute.go(_context!, PasswordOtp());
}
notifyListeners();
}
///
String makePhone(code) {
return jsonEncode({
"phone": code
});
}
//controllers
TextEditingController forgetPhoneNumberController = TextEditingController();
onPressSendCode() async {
var phoneNum = forgetPhoneNumberController.text.toString();
phoneNum = "+998$phoneNum";
if (phoneNum == "") {
ToastUi.show(_context!, AppLang.local(_context!).please_enter_phone);
return;
}
var passwordForgetResponse = await AuthApi.forgetPassword(_context!, makePhone(phoneNum));
if (passwordForgetResponse.result == false) {
ToastUi.show(_context!, passwordForgetResponse.message);
} else {
// ToastUi.show(_context!, passwordForgetResponse.message);
// MakeRoute.goAndRemoveAll(_context!, PasswordOtp(phone_num: phoneNum));
Navigator.push(_context!, MaterialPageRoute(builder: (context) {
return PasswordOtp(
verify_by: phoneNum,
);
}));
forgetPhoneNumberController.text = "";
}
}
/// Otp
String makeRegOTP(code) {
return jsonEncode({
"code": code
});
}
/// #OTP
TextEditingController otpController = TextEditingController();
onPressOTP() async {
var code = otpCodeController.text.toString();
if (code == "") {
ToastUi.show(
_context!,
AppLang.local(_context!).enter_otp_code,
);
return;
}
var confirmOTP =await AuthApi.forgetOTP(_context!, makeRegOTP(code));
if (confirmOTP.result == false) {
ToastUi.show(_context!, confirmOTP.message);
}else{
access_token.update((p0) => confirmOTP.accessToken);
access_token.save();
SystemData.isLogIn = true;
MakeRoute.goAndRemoveAll(_context!, const Main());
otpController.text = "";
// ToastUi.show(_context!, AppLang.local(_context!).success_register);
}
notifyListeners();
}
//controllers
TextEditingController otpCodeController = TextEditingController();
TextEditingController otpPasswordController = TextEditingController();
TextEditingController otpPasswordConfirmController = TextEditingController();
bool otpResetPasswordSuccess = false;
onPressConfirm() async {
var code = otpCodeController.text.toString();
var password = otpPasswordController.text.toString();
var password_confirm = otpPasswordConfirmController.text.toString();
if (code == "") {
ToastUi.show(
_context!,
AppLang.local(_context!).enter_otp_code,
);
return;
} else if (password == "") {
ToastUi.show(_context!, AppLang.local(_context!).please_enter_password);
return;
} else if (password_confirm == "") {
ToastUi.show(
_context!, AppLang.local(_context!).please_enter_confirm_password);
return;
} else if (password.length < 6) {
ToastUi.show(
_context!, AppLang.local(_context!).password_must_be_at_last_6_digit);
return;
} else if (password != password_confirm) {
ToastUi.show(
_context!,
AppLang.local(_context!)
.password_and_confirm_password_is_not_matching);
return;
}
var passwordConfirmResponse =
await AuthApi.forgetPassword(_context!, password);
if (passwordConfirmResponse.result == false) {
ToastUi.show(_context!, passwordConfirmResponse.message);
} else {
ToastUi.show(_context!, passwordConfirmResponse.message);
}
}
onTapResend() async {
var passwordResendCodeResponse =
await AuthApi.forgetPassword(_context!, "");
if (passwordResendCodeResponse.result == false) {
ToastUi.show(_context!, passwordResendCodeResponse.message);
} else {
ToastUi.show(_context!, passwordResendCodeResponse.message);
}
}
}
// import 'dart:convert';
//
// import 'package:flutter/cupertino.dart';
// import 'package:grostore/apis/auth_api.dart';
// import 'package:grostore/app_lang.dart';
// import 'package:grostore/constant/country_code.dart';
// import 'package:grostore/custom_classes/system_data.dart';
// import 'package:grostore/custom_ui/loading.dart';
// import 'package:grostore/custom_ui/toast_ui.dart';
// import 'package:grostore/helpers/common_functions.dart';
// import 'package:grostore/helpers/route.dart';
// import 'package:grostore/helpers/shared_value_helper.dart';
// import 'package:grostore/models/auth/login_response_model.dart';
// import 'package:grostore/models/common/user_info.dart';
// import 'package:grostore/models/user_info_response_model.dart';
// import 'package:grostore/screens/main.dart';
//
// class AuthPresenter extends ChangeNotifier {
// UserInfo userInfo = userInfoResponseDefault().data;
// static BuildContext? _context;
//
// static BuildContext get getContext => _context!;
//
// setContext(BuildContext context) {
// AuthPresenter._context = context;
// }
//
// List<Country> country = CountryCode().get();
//
// List<Country> filteredCountry = CountryCode().get();
//
// void filterCountry(String query) {
// query = query.toLowerCase();
//
// filteredCountry = country.where((product) {
// if (product.name.toLowerCase().contains(query)) {
// return true;
// } else {
// return false;
// }
// }).toList();
// notifyListeners();
// }
//
// //controllers
// TextEditingController loginPhoneNumberController = TextEditingController();
// TextEditingController loginEmailController = TextEditingController();
// TextEditingController loginPasswordController = TextEditingController();
//
// String loginBy = "email"; //phone or email
// String initialCountry = 'US';
// var countriesCode = <String>[];
// Country regCountry = CountryCode().get().last;
// String loginPhone = "";
// late String loginEmail, loginPassword;
//
// /// Registration variables
// String registerBy = "email"; //phone or email
// String regPhone = "";
// bool isAgree = false;
//
// //controllers
// TextEditingController regNameController = TextEditingController();
// TextEditingController regEmailController = TextEditingController();
// TextEditingController regPhoneNumberController = TextEditingController();
// TextEditingController regPasswordController = TextEditingController();
// TextEditingController regPasswordConfirmController = TextEditingController();
//
// fetch_country() async {
// // var data = await AddressRepository().getCountryList();
// // data.countries.forEach((c) => countries_code.add(c.code));
// }
//
// onPressedLogin() async {
// if (checkLoginValidation()) {
// makeLogin();
// }
// }
//
// String makeLoginPostBody() {
// return jsonEncode({
// "email": loginEmail,
// "type": "customer",
// "password": loginPassword,
// });
// }
//
// bool checkLoginValidation() {
// loginEmail = loginEmailController.text.toString().trim();
// loginPassword = loginPasswordController.text.toString().trim();
// if (loginBy == "email") {
// if (loginEmail.isEmpty || !isEmail(loginEmail)) {
// ToastUi.show(_context!, AppLang.getLocal().please_enter_valid_email);
// return false;
// }
// } else {
// ///todo phone no validation
// return false;
// }
//
// if (loginPassword.isEmpty) {
// return false;
// }
// return true;
// }
//
// makeLogin() async {
// Loading.show(_context!);
// LoginResponse response =
// await AuthApi.login(makeLoginPostBody(), _context!);
// Loading.close();
// if (response.result) {
// access_token.update((p0) => response.accessToken);
// access_token.save();
// loginEmailController.clear();
// loginPasswordController.clear();
// SystemData.isLogIn = true;
// SystemData.userInfo = response.user;
// MakeRoute.goAndRemoveAll(_context!, Main());
// //UserInfo(name: response.name, email: response.email, phone: response.phone, balance: response.balance, avatar: response.avatar);
// }
// ToastUi.show(_context!, response.message);
// }
//
// tokenCheck(BuildContext context) async {
// var response = await AuthApi.tokenCheck(context);
// if (response.result) {
// SystemData.isLogIn = response.result;
// SystemData.userInfo = response.user;
// }
// notifyListeners();
// }
//
// logout(BuildContext context) async {
// var response = await AuthApi.logout(context);
// if (response.result) {
// SystemData.isLogIn = false;
// SystemData.userInfo = response.user;
// }
// notifyListeners();
// }
//
// ///registration methods
//
// onChangeCountry(Country country) {
// regCountry = country;
// notifyListeners();
// }
//
// String makeRegBody(name, email, phone, password, confirmPassword) {
// return jsonEncode({
// "name": name,
// "email": email,
// "phone": phone,
// "password": password,
// "password_confirmation": confirmPassword
// });
// }
//
// onPressSignUp() async {
// var name = regNameController.text.toString();
// var email = regEmailController.text.toString();
// var password = regPasswordController.text.toString();
// var password_confirm = regPasswordConfirmController.text.toString();
// regPhone = regPhoneNumberController.text.trim();
// if (regPhone.isNotEmpty) {
// regPhone = regCountry.dial_code + regPhone;
// }
//
// if (name == "") {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_name);
// return;
// } else if (registerBy == 'email' && (email == "" || !isEmail(email))) {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_email);
// return;
// } else if (registerBy == 'phone' && regPhone == "") {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_phone);
// return;
// } else if (password == "") {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_password);
// return;
// } else if (password_confirm == "") {
// ToastUi.show(
// _context!, AppLang.local(_context!).please_enter_confirm_password);
// return;
// } else if (password.length < 6) {
// ToastUi.show(
// _context!, AppLang.local(_context!).password_must_be_at_last_6_digit);
// return;
// } else if (password != password_confirm) {
// ToastUi.show(
// _context!,
// AppLang.local(_context!)
// .password_and_confirm_password_is_not_matching);
// return;
// }
//
// var body = makeRegBody(name, email, regPhone, password, password_confirm);
// Loading.show(_context!);
// var signupResponse = await AuthApi.registration(_context!, body);
// Loading.close();
// print(signupResponse.toJson());
// if (signupResponse.result == false) {
// var message = "";
// if (signupResponse.message.runtimeType == List) {
// signupResponse.message.forEach((key, value) {
// value.forEach((messages) {
// message += messages + "\n";
// });
// });
// } else {
// message = signupResponse.message;
// }
//
// ToastUi.show(_context!, message);
// } else {
// ToastUi.show(_context!, signupResponse.message);
// access_token.update((p0) => signupResponse.accessToken);
// access_token.save();
// loginEmailController.clear();
// loginPasswordController.clear();
// SystemData.isLogIn = true;
// SystemData.userInfo = signupResponse.user;
// MakeRoute.goAndRemoveAll(_context!, Main());
//
// // if ((mail_verification_status.$ && _register_by == "email") ||
// // _register_by == "phone") {
// // Navigator.push(context, MaterialPageRoute(builder: (context) {
// // return Otp(
// // verify_by: _register_by,
// // user_id: signupResponse.user_id,
// // );
// // }));
// //
// // } else {
// // Navigator.push(context, MaterialPageRoute(builder: (context) {
// // return Login();
// // }));
// // }
// }
// }
//
// ///
//
// /// ForgetPassword
// ///
//
// //controllers
// TextEditingController forgetEmailController = TextEditingController();
// TextEditingController forgetPhoneNumberController = TextEditingController();
//
// onPressSendCode() async {
// var email = forgetEmailController.text.toString();
//
// if (email == "") {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_email);
// return;
// }
//
// var passwordForgetResponse = await AuthApi.forgetPassword(_context!, email);
//
// if (passwordForgetResponse.result == false) {
// ToastUi.show(_context!, passwordForgetResponse.message);
// } else {
// ToastUi.show(_context!, passwordForgetResponse.message);
//
// // Navigator.push(context, MaterialPageRoute(builder: (context) {
// // return PasswordOtp(
// // verify_by: _send_code_by,
// // );
// // }));
// }
// }
//
// /// Otp
// ///
//
// //controllers
// TextEditingController otpCodeController = TextEditingController();
// TextEditingController otpPasswordController = TextEditingController();
// TextEditingController otpPasswordConfirmController = TextEditingController();
// bool otpResetPasswordSuccess = false;
//
// onPressConfirm() async {
// var code = otpCodeController.text.toString();
// var password = otpPasswordController.text.toString();
// var password_confirm = otpPasswordConfirmController.text.toString();
//
// if (code == "") {
// ToastUi.show(
// _context!,
// AppLang.local(_context!).enter_otp_code,
// );
// return;
// } else if (password == "") {
// ToastUi.show(_context!, AppLang.local(_context!).please_enter_password);
// return;
// } else if (password_confirm == "") {
// ToastUi.show(
// _context!, AppLang.local(_context!).please_enter_confirm_password);
// return;
// } else if (password.length < 6) {
// ToastUi.show(
// _context!, AppLang.local(_context!).password_must_be_at_last_6_digit);
// return;
// } else if (password != password_confirm) {
// ToastUi.show(
// _context!,
// AppLang.local(_context!)
// .password_and_confirm_password_is_not_matching);
// return;
// }
//
// var passwordConfirmResponse =
// await AuthApi.forgetPassword(_context!, password);
//
// if (passwordConfirmResponse.result == false) {
// ToastUi.show(_context!, passwordConfirmResponse.message);
// } else {
// ToastUi.show(_context!, passwordConfirmResponse.message);
// }
// }
//
// onTapResend() async {
// var passwordResendCodeResponse =
// await AuthApi.forgetPassword(_context!, "");
//
// if (passwordResendCodeResponse.result == false) {
// ToastUi.show(_context!, passwordResendCodeResponse.message);
// } else {
// ToastUi.show(_context!, passwordResendCodeResponse.message);
// }
// }
// }

Some files were not shown because too many files have changed in this diff Show More