Compare commits
No commits in common. "e985fd194bf77719d09611cae0cae9e4acb9c54b" and "d101e8209666d7169f0caa8736c37ecbe738aae3" have entirely different histories.
e985fd194b
...
d101e82096
@ -1,12 +1,12 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.cheminova">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:label="Principal Distributor"
|
||||
android:label="cheminova"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/launcher_icon">
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 12 KiB |
@ -427,7 +427,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
@ -484,7 +484,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
|
@ -1 +1,122 @@
|
||||
{"images":[{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@3x.png","scale":"3x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"Icon-App-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"Icon-App-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}}
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 817 B After Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 462 B |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 704 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 586 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 762 B |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 1.4 KiB |
@ -9,7 +9,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.example.cheminova</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
@ -16,7 +16,7 @@ class AnnouncementController extends GetxController {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
String? token = prefs.getString('token');
|
||||
final List<AnnouncementModel>? fetchedAnnouncements =
|
||||
await _announcementService.fetchAnnouncements();
|
||||
await _announcementService.fetchAnnouncements(token!);
|
||||
announcements.assignAll(fetchedAnnouncements as Iterable<AnnouncementModel>);
|
||||
} catch (e) {
|
||||
errorMessage.value = e.toString();
|
||||
|
@ -8,16 +8,16 @@ class AnnouncementService {
|
||||
final Dio _dio = Dio();
|
||||
|
||||
|
||||
Future<List<AnnouncementModel>?> fetchAnnouncements() async {
|
||||
Future<List<AnnouncementModel>?> fetchAnnouncements(String token) async {
|
||||
try {
|
||||
String url = ApiUrls.AnnaouncementUrl; // Base URL to fetch product manuals
|
||||
|
||||
final response = await commonApiService<List<AnnouncementModel>>(
|
||||
method: "GET",
|
||||
url: url,
|
||||
// additionalHeaders: { // Pass the token here
|
||||
// 'Authorization': 'Bearer $token',
|
||||
// },
|
||||
additionalHeaders: { // Pass the token here
|
||||
'Authorization': 'Bearer $token',
|
||||
},
|
||||
fromJson: (json) {
|
||||
if (json['announcements'] != null) {
|
||||
// If the productManuals key is present, map the response to a list of ProductManualModel objects
|
||||
|
@ -49,7 +49,7 @@ class CartController extends GetxController {
|
||||
}
|
||||
// Update observable values
|
||||
subtotal.value = subTotal;
|
||||
gstTotal.value = double.parse(gstTotalAmount.toStringAsFixed(2));
|
||||
gstTotal.value = gstTotalAmount;
|
||||
grandTotal.value = subtotal.value + gstTotal.value;
|
||||
}
|
||||
// Function to increase the quantity of a product in the cart
|
||||
@ -76,15 +76,6 @@ class CartController extends GetxController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void updateQuantity(Product product, int quantity) {
|
||||
final existingProduct = cartList.firstWhereOrNull((p) => p.id == product.id);
|
||||
if (existingProduct != null) {
|
||||
existingProduct.quantity = quantity;
|
||||
updateTotalPrice();// Notify listeners
|
||||
}
|
||||
}
|
||||
// Function to remove a product from the cart
|
||||
void removeFromCart(Product product) {
|
||||
// Remove the product from the cart list
|
||||
|
@ -1,5 +1,3 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cheminova/models/user_model.dart';
|
||||
import 'package:cheminova/utils/api_urls.dart';
|
||||
import 'package:cheminova/utils/common_api_service.dart';
|
||||
@ -35,26 +33,35 @@ class HomeService {
|
||||
}
|
||||
|
||||
// Function to send FCM token to the server
|
||||
Future<Map<String, dynamic>?> fcmToken(Map<String, dynamic> data, String? token) async {
|
||||
Future<Map<String, dynamic>?> fcmToken(Map<String, dynamic> data,
|
||||
String? token) async {
|
||||
try {
|
||||
final response = await commonApiService<Map<String, dynamic>>(
|
||||
final response = await commonApiService<String>(
|
||||
// Making a POST request to send the FCM token
|
||||
url: ApiUrls.fcmUrl,
|
||||
method: 'POST',
|
||||
body: data,
|
||||
fromJson: (json) => json as Map<String, dynamic>, // Parse JSON response
|
||||
// Body data to be sent in the request
|
||||
fromJson: (json) => json as String,
|
||||
// Just return the string response
|
||||
additionalHeaders: {
|
||||
// Pass the token here
|
||||
'Authorization': 'Bearer $token',
|
||||
// Bearer token for authenticated requests
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
if (response != null) {
|
||||
return response; // Return parsed response
|
||||
// Since the response is a string, wrap it in a Map to avoid type issues
|
||||
return {
|
||||
'message': response
|
||||
}; // Return the response in a map with 'message' as the key
|
||||
}
|
||||
return null;
|
||||
} catch (e) {
|
||||
showSnackbar(e.toString());
|
||||
showSnackbar(e.toString()); // Handle any errors
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,21 +2,13 @@ import 'package:cheminova/models/kyc_model.dart';
|
||||
import 'package:cheminova/utils/api_urls.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../utils/app_interceptor.dart';
|
||||
|
||||
class KycService {
|
||||
|
||||
|
||||
|
||||
// Function to fetch KYC data from the API
|
||||
Future<List<dynamic>> getKycData(String token) async {
|
||||
try {
|
||||
// Make a GET request to the KYC API endpoint with authorization token
|
||||
|
||||
final dio = Dio();
|
||||
dio.interceptors.add(AuthInterceptor());
|
||||
|
||||
var response = await dio.get(
|
||||
var response = await Dio().get(
|
||||
ApiUrls.getKycUrl,
|
||||
// 'https://api.cnapp.co.in/api/kyc/getAll',
|
||||
options: Options(
|
||||
@ -39,8 +31,6 @@ class KycService {
|
||||
}
|
||||
|
||||
Future<bool> approveKycStatus(String token, String kycId,String status) async {
|
||||
final dio = Dio();
|
||||
dio.interceptors.add(AuthInterceptor());
|
||||
try {
|
||||
// Prepare the payload for approval directly
|
||||
var payload = {
|
||||
@ -51,7 +41,7 @@ class KycService {
|
||||
// print("Payload: $payload");
|
||||
|
||||
// Make a PATCH request to update the KYC status
|
||||
var response = await dio.patch(
|
||||
var response = await Dio().patch(
|
||||
'https://api.cnapp.co.in/api/kyc/update/$kycId', // URL with the KYC ID
|
||||
data: payload, // Payload with the status
|
||||
options: Options(
|
||||
@ -84,8 +74,6 @@ class KycService {
|
||||
}
|
||||
Future<bool> rejectKycStatus(
|
||||
String token, String kycId, String? rejectionReason, String? user, String status) async {
|
||||
final dio = Dio();
|
||||
dio.interceptors.add(AuthInterceptor());
|
||||
try {
|
||||
// Prepare the payload for the PATCH request
|
||||
var data = {
|
||||
@ -104,7 +92,7 @@ class KycService {
|
||||
print("Payload: $data");
|
||||
|
||||
// Make a PATCH request to update the KYC status
|
||||
var response = await dio.patch(
|
||||
var response = await Dio().patch(
|
||||
'https://api.cnapp.co.in/api/kyc/update/$kycId',
|
||||
data: data,
|
||||
options: Options(
|
||||
|
@ -2,17 +2,15 @@ import 'package:dio/dio.dart';
|
||||
import 'package:cheminova/models/notification_model.dart';
|
||||
|
||||
import '../utils/api_urls.dart';
|
||||
import '../utils/app_interceptor.dart';
|
||||
|
||||
class NotificationService {
|
||||
// final Dio _dio = Dio();
|
||||
final Dio _dio = Dio();
|
||||
|
||||
Future<List<NotificationModel>?> fetchNotifications(String token, String date) async {
|
||||
final String url = ApiUrls.getNotificationUrl;
|
||||
final dio = Dio();
|
||||
dio.interceptors.add(AuthInterceptor());
|
||||
|
||||
try {
|
||||
final response = await dio.get(
|
||||
final response = await _dio.get(
|
||||
url,
|
||||
options: Options(
|
||||
headers: {
|
||||
|
@ -6,18 +6,12 @@ import 'package:cheminova/utils/api_urls.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../models/oder_place_model.dart';
|
||||
import '../utils/app_interceptor.dart';
|
||||
import '../utils/log_service.dart';
|
||||
|
||||
class OrderPlacedService {
|
||||
//final Dio dio = Dio();
|
||||
// OrderPlacedService() : _dio = Dio(BaseOptions(baseUrl: 'https://api.cnapp.co.in')) {
|
||||
// _dio.interceptors.add(AuthInterceptor());
|
||||
// _dio.interceptors.add(PrettyDioLogger());
|
||||
// }
|
||||
final Dio dio = Dio();
|
||||
|
||||
Future<void> placeOrder(PlacedOrderModel orderDetails, String token) async {
|
||||
final dio = Dio();
|
||||
dio.interceptors.add(AuthInterceptor());
|
||||
//try {
|
||||
// logger.w("orderjson ${jsonEncode(orderDetails.toJson())}");
|
||||
final response = await dio.post(
|
||||
|
@ -6,23 +6,16 @@ import 'package:cheminova/utils/show_snackbar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import '../models/rd_order_item_model.dart';
|
||||
import '../utils/app_interceptor.dart';
|
||||
|
||||
|
||||
class RDOrderPlacedService {
|
||||
final Dio _dio = Dio(); // Create Dio instance
|
||||
// RDOrderPlacedService() : _dio = Dio(BaseOptions(baseUrl: 'https://api.cnapp.co.in')) {
|
||||
// _dio.interceptors.add(AuthInterceptor());
|
||||
// _dio.interceptors.add(PrettyDioLogger());
|
||||
// }
|
||||
|
||||
Future<void> placRDeOrder(PlacedOrdersProcessing orderDetails,
|
||||
String token) async {
|
||||
final dio = Dio();
|
||||
dio.interceptors.add(AuthInterceptor());
|
||||
//try {
|
||||
// logger.w("orderjson ${jsonEncode(orderDetails.toJson())}");
|
||||
final response = await dio.post(
|
||||
final response = await _dio.post(
|
||||
'https://api.cnapp.co.in/api/pd-process-order',
|
||||
// Ensure this is your correct endpoint
|
||||
data: jsonEncode(orderDetails.toJson()),
|
||||
|
@ -4,7 +4,6 @@ import 'package:cheminova/models/product_stock_model.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../utils/api_urls.dart';
|
||||
import '../utils/app_interceptor.dart';
|
||||
import '../utils/common_api_service.dart';
|
||||
import '../utils/show_snackbar.dart';
|
||||
|
||||
@ -15,10 +14,9 @@ class UpdateStockService{
|
||||
try {
|
||||
// Correct API URL with orderId passed in the URL
|
||||
final String url = ApiUrls.ProductUpdateStockUrl;
|
||||
final dio = Dio();
|
||||
dio.interceptors.add(AuthInterceptor());
|
||||
|
||||
// Make the PUT request
|
||||
final response = await dio.put(
|
||||
final response = await Dio().put(
|
||||
url, // Use the correct URL here
|
||||
data: {
|
||||
"products": stock, // Send the cancellation reason as JSON
|
||||
|
@ -1,74 +1,27 @@
|
||||
class Brand {
|
||||
final String id;
|
||||
final String brandName;
|
||||
List<BrandImage> images;
|
||||
|
||||
Brand({
|
||||
required this.id,
|
||||
required this.brandName,
|
||||
required this.images,
|
||||
});
|
||||
|
||||
factory Brand.fromJson(Map<String, dynamic> json) {
|
||||
return Brand(
|
||||
id: json['_id'],
|
||||
brandName: json['brandName'],
|
||||
// images: json["image"] != null
|
||||
// ? (json["image"] as List).map((e) => BrandImage.fromJson(e)).toList()
|
||||
// : [],
|
||||
images: json["image"] != null // Ensure you use the correct key
|
||||
? (json["image"] as List)
|
||||
.map((e) => BrandImage.fromJson(e))
|
||||
.toList()
|
||||
: [],
|
||||
|
||||
);
|
||||
}
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'_id': id,
|
||||
'brandName': brandName,
|
||||
"image": images.map((e) => e.toJson()).toList(),
|
||||
|
||||
};
|
||||
}
|
||||
@override
|
||||
String toString() {
|
||||
return 'Brand(id: $id, brandName: $brandName,images: $images)';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class BrandImage {
|
||||
String publicId;
|
||||
String url;
|
||||
String imageId;
|
||||
|
||||
BrandImage({
|
||||
required this.publicId,
|
||||
required this.url,
|
||||
required this.imageId,
|
||||
});
|
||||
|
||||
factory BrandImage.fromJson(Map<String, dynamic> json) {
|
||||
return BrandImage(
|
||||
publicId: json["public_id"] ?? "",
|
||||
url: json["url"]?.toString() ?? "",
|
||||
imageId: json["_id"] ?? "",
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"public_id": publicId,
|
||||
"url": url,
|
||||
"_id": imageId,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "BrandImage(publicId: $publicId, url: $url, imageId: $imageId)";
|
||||
return 'Brand(id: $id, brandName: $brandName,)';
|
||||
}
|
||||
}
|
@ -1,15 +1,9 @@
|
||||
|
||||
|
||||
import 'package:cheminova/models/rd_order_item_model.dart';
|
||||
|
||||
import 'brand_model.dart';
|
||||
|
||||
class GetRdCancelledModel {
|
||||
final String id;
|
||||
final String paymentMode;
|
||||
final String shipTo;
|
||||
final String billTo;
|
||||
final List<RDOrderItem> orderItems;
|
||||
final List<OrderItem> orderItems;
|
||||
final double subtotal;
|
||||
final double gstTotal;
|
||||
final double grandTotal;
|
||||
@ -57,8 +51,8 @@ class GetRdCancelledModel {
|
||||
paymentMode: json['paymentMode'],
|
||||
shipTo: json['shipTo'],
|
||||
billTo: json['billTo'],
|
||||
orderItems: (json['orderItem'] as List)
|
||||
.map((item) => RDOrderItem.fromJson(item))
|
||||
orderItems: (json['orderItem'] as List<dynamic>)
|
||||
.map((item) => OrderItem.fromJson(item))
|
||||
.toList(),
|
||||
subtotal: json['subtotal'].toDouble(),
|
||||
gstTotal: json['gstTotal'].toDouble(),
|
||||
@ -128,7 +122,7 @@ class OrderItem {
|
||||
final double gst;
|
||||
final int hsnCode;
|
||||
final String description;
|
||||
final List<BrandImage> images;
|
||||
final List<String> images;
|
||||
final int quantity;
|
||||
final int remainingQuantity;
|
||||
final String id;
|
||||
@ -160,9 +154,7 @@ class OrderItem {
|
||||
gst: json['GST'].toDouble(),
|
||||
hsnCode: json['HSN_Code'],
|
||||
description: json['description'] ?? '',
|
||||
images : (json["image"] as List)
|
||||
.map((item) => BrandImage.fromJson(item))
|
||||
.toList(),
|
||||
images: List<String>.from(json['image']),
|
||||
quantity: json['quantity'],
|
||||
remainingQuantity: json['remainingQuantity'],
|
||||
id: json['_id'],
|
||||
|
@ -64,7 +64,7 @@ class OrderItem {
|
||||
String description;
|
||||
String productStatus;
|
||||
final String addedBy;
|
||||
List<BrandImage> image;
|
||||
List<String> image;
|
||||
DateTime createdAt;
|
||||
DateTime updatedAt;
|
||||
int count;
|
||||
@ -124,9 +124,7 @@ class OrderItem {
|
||||
description: json['description'],
|
||||
productStatus: json['product_Status'],
|
||||
addedBy: json['addedBy']['name'], // Assuming addedBy has a 'name' key
|
||||
image: json['image'] is List
|
||||
? (json['image'] as List).map((e) => BrandImage.fromJson(e)).toList()
|
||||
: [BrandImage.fromJson(json['image'])],
|
||||
image: List<String>.from(json['image']),
|
||||
createdAt: DateTime.parse(json['createdAt']),
|
||||
updatedAt: DateTime.parse(json['updatedAt']),
|
||||
count: json['count'],
|
||||
|
@ -1,5 +1,3 @@
|
||||
import 'brand_model.dart';
|
||||
|
||||
class PlacedOrderList {
|
||||
final String id;
|
||||
final String paymentMode;
|
||||
@ -97,7 +95,6 @@ class OrderItem1 {
|
||||
final String brandName;
|
||||
final double price;
|
||||
final int quantity;
|
||||
List<BrandImage>? image;
|
||||
|
||||
OrderItem1({
|
||||
required this.sku,
|
||||
@ -105,7 +102,6 @@ class OrderItem1 {
|
||||
required this.categoryName,
|
||||
required this.brandName,
|
||||
required this.price,
|
||||
this.image,
|
||||
required this.quantity,
|
||||
});
|
||||
|
||||
@ -116,9 +112,6 @@ class OrderItem1 {
|
||||
categoryName: json['categoryName'],
|
||||
brandName: json['brandName'],
|
||||
price: json['price'].toDouble(),
|
||||
image : (json["image"] as List)
|
||||
.map((item) => BrandImage.fromJson(item))
|
||||
.toList(),
|
||||
quantity: json['quantity'],
|
||||
);
|
||||
}
|
||||
@ -131,14 +124,13 @@ class OrderItem1 {
|
||||
'brandName': brandName,
|
||||
'price': price,
|
||||
'quantity': quantity,
|
||||
'image':image
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'OrderItem(sku: $sku, name: $name, categoryName: $categoryName, '
|
||||
'brandName: $brandName, price: $price, quantity: $quantity,image:$image)';
|
||||
'brandName: $brandName, price: $price, quantity: $quantity)';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
|
||||
import 'brand_model.dart';
|
||||
|
||||
class RDOrderItem {
|
||||
class RDOrderItem {
|
||||
final String productId;
|
||||
final String sku;
|
||||
final String name;
|
||||
@ -11,7 +9,7 @@ class RDOrderItem {
|
||||
final int gst; // Ensure GST is int
|
||||
final int hsnCode; // Ensure HSN_Code is int
|
||||
final String description;
|
||||
final List<BrandImage> image;
|
||||
final List<String> image;
|
||||
int? quantity;
|
||||
int? remainingQuantity;
|
||||
int? processquantity;
|
||||
@ -45,13 +43,10 @@ class RDOrderItem {
|
||||
hsnCode: json['HSN_Code'] ?? 0,
|
||||
// Handle HSN_Code as int
|
||||
description: json['description'] ?? '',
|
||||
//image: List<String>.from(json['image'] ?? []),
|
||||
image : (json["image"] as List)
|
||||
.map((item) => BrandImage.fromJson(item))
|
||||
.toList(),
|
||||
image: List<String>.from(json['image'] ?? []),
|
||||
quantity: json['quantity'] ?? 0,
|
||||
// Handle quantity as int
|
||||
processquantity: json['processQuantity']??1,
|
||||
processquantity: json['processquantity']??1,
|
||||
remainingQuantity: json['remainingQuantity'] ??
|
||||
0, // Handle remainingQuantity as int
|
||||
);
|
||||
|
@ -1,121 +1,3 @@
|
||||
// import 'package:cheminova/widgets/my_drawer.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_svg/svg.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:intl/intl.dart';
|
||||
//
|
||||
// import '../../controller/annaucement_controller.dart';
|
||||
// import '../../widgets/comman_background.dart';
|
||||
// import '../../widgets/common_appbar.dart';
|
||||
//
|
||||
// class AnnouncementScreen extends StatefulWidget {
|
||||
// AnnouncementScreen({super.key});
|
||||
//
|
||||
// @override
|
||||
// State<AnnouncementScreen> createState() => _AnnouncementScreenState();
|
||||
// }
|
||||
//
|
||||
// class _AnnouncementScreenState extends State<AnnouncementScreen> {
|
||||
// // Initialize the controller
|
||||
// final AnnouncementController _announcementController = Get.put(AnnouncementController());
|
||||
//
|
||||
//
|
||||
// String formatDate(String apiDate) {
|
||||
// // Parse the API date string into a DateTime object
|
||||
// DateTime parsedDate = DateTime.parse(apiDate).toLocal(); // Convert to local time
|
||||
//
|
||||
// // Format the date and time according to your specified format
|
||||
// String formattedDate = DateFormat('EEE MMM dd yyyy').format(parsedDate);
|
||||
//
|
||||
// return formattedDate; // Return the formatted date string
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// // Fetch announcements when the screen is built
|
||||
// _announcementController.fetchAnnouncements();
|
||||
//
|
||||
// return CommonBackground(
|
||||
// child: Scaffold(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// appBar: CommonAppBar(
|
||||
// actions: [
|
||||
// IconButton(
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// icon: SvgPicture.asset('assets/svg/back_arrow.svg'),
|
||||
// padding: const EdgeInsets.only(right: 20),
|
||||
// ),
|
||||
// ],
|
||||
// title: const Text(
|
||||
// 'Announcement',
|
||||
// style: TextStyle(
|
||||
// fontSize: 20,
|
||||
// color: Colors.black,
|
||||
// fontWeight: FontWeight.w400,
|
||||
// fontFamily: 'Anek',
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor: Colors.transparent,
|
||||
// elevation: 0,
|
||||
// ),
|
||||
// drawer: MyDrawer(),
|
||||
// body: Obx(() {
|
||||
// // Show loading indicator while fetching announcements
|
||||
// if (_announcementController.isLoading.value) {
|
||||
// return Center(child: CircularProgressIndicator());
|
||||
// }
|
||||
// // Show error message if there was an error
|
||||
// if (_announcementController.errorMessage.isNotEmpty) {
|
||||
// return Center(
|
||||
// child: Text('Error: ${_announcementController.errorMessage}'),
|
||||
// );
|
||||
// }
|
||||
// // Display the list of announcements
|
||||
// return ListView.builder(
|
||||
// itemCount: _announcementController.announcements.length,
|
||||
// itemBuilder: (context, index) {
|
||||
// final announcementList = _announcementController.announcements[index];
|
||||
// print("asdf,${announcementList}");
|
||||
// return Column(
|
||||
// children: [
|
||||
// Card(
|
||||
// child: ListTile(
|
||||
// //leading:Text(_announcementController.announcements[index].id),
|
||||
// title: Row(
|
||||
//
|
||||
// children: [
|
||||
// Text("Message :",style: TextStyle(fontWeight: FontWeight.bold,fontSize: 14),),
|
||||
// Text(announcementList.message.toString(),style: TextStyle(fontSize: 12),),
|
||||
//
|
||||
// ],
|
||||
// ),
|
||||
// subtitle: Row(
|
||||
// children: [
|
||||
// Text("UniqueID :" , style: TextStyle(fontWeight: FontWeight.bold),),
|
||||
// Text(announcementList.uniqueId.toString()),
|
||||
// ],
|
||||
// ),
|
||||
// trailing: Text(formatDate(announcementList.createdAt.toString()),style: TextStyle(fontSize: 10),),
|
||||
// ),
|
||||
//
|
||||
// ),
|
||||
//
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:cheminova/widgets/my_drawer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
@ -134,15 +16,24 @@ class AnnouncementScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AnnouncementScreenState extends State<AnnouncementScreen> {
|
||||
// Initialize the controller
|
||||
final AnnouncementController _announcementController = Get.put(AnnouncementController());
|
||||
|
||||
|
||||
String formatDate(String apiDate) {
|
||||
DateTime parsedDate = DateTime.parse(apiDate).toLocal();
|
||||
return DateFormat('EEE MMM dd yyyy').format(parsedDate);
|
||||
// Parse the API date string into a DateTime object
|
||||
DateTime parsedDate = DateTime.parse(apiDate).toLocal(); // Convert to local time
|
||||
|
||||
// Format the date and time according to your specified format
|
||||
String formattedDate = DateFormat('EEE MMM dd yyyy').format(parsedDate);
|
||||
|
||||
return formattedDate; // Return the formatted date string
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Fetch announcements when the screen is built
|
||||
_announcementController.fetchAnnouncements();
|
||||
|
||||
return CommonBackground(
|
||||
@ -172,61 +63,47 @@ class _AnnouncementScreenState extends State<AnnouncementScreen> {
|
||||
),
|
||||
drawer: MyDrawer(),
|
||||
body: Obx(() {
|
||||
// Show loading indicator while fetching announcements
|
||||
if (_announcementController.isLoading.value) {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
}
|
||||
// Show error message if there was an error
|
||||
if (_announcementController.errorMessage.isNotEmpty) {
|
||||
return Center(
|
||||
child: Text('Error: ${_announcementController.errorMessage}'),
|
||||
);
|
||||
}
|
||||
// Display the list of announcements
|
||||
return ListView.builder(
|
||||
itemCount: _announcementController.announcements.length,
|
||||
itemBuilder: (context, index) {
|
||||
final announcementList = _announcementController.announcements[index];
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
child: ListTile(
|
||||
// leading: CircleAvatar(
|
||||
// backgroundColor: Colors.blue,
|
||||
// child: Text(
|
||||
// announcementList.uniqueId.toString().toUpperCase(),
|
||||
// style: TextStyle(color: Colors.white),
|
||||
// ),
|
||||
// ),
|
||||
title: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Message:",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
||||
final announcementList = _announcementController.announcements[index];
|
||||
print("asdf,${announcementList}");
|
||||
return Column(
|
||||
children: [
|
||||
Card(
|
||||
child: ListTile(
|
||||
//leading:Text(_announcementController.announcements[index].id),
|
||||
title: Row(
|
||||
|
||||
children: [
|
||||
Text("Message :",style: TextStyle(fontWeight: FontWeight.bold,fontSize: 14),),
|
||||
Text(announcementList.message.toString(),style: TextStyle(fontSize: 12),),
|
||||
|
||||
],
|
||||
),
|
||||
Text(
|
||||
announcementList.message.toString(),
|
||||
style: TextStyle(fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
subtitle: Row(
|
||||
children: [
|
||||
Text("UniqueID :" , style: TextStyle(fontWeight: FontWeight.bold),),
|
||||
Text(announcementList.uniqueId.toString()),
|
||||
],
|
||||
),
|
||||
],
|
||||
trailing: Text(formatDate(announcementList.createdAt.toString()),style: TextStyle(fontSize: 10),),
|
||||
),
|
||||
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"UniqueID:",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
announcementList.uniqueId.toString(),
|
||||
style: TextStyle(fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
trailing: Text(
|
||||
formatDate(announcementList.createdAt.toString()),
|
||||
style: TextStyle(fontSize: 10),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -20,13 +20,13 @@ class _ChangePasswordScreenState extends State<ChangePasswordScreen> {
|
||||
final authController = Get.put(AuthController());
|
||||
|
||||
|
||||
// void dispose() {
|
||||
// // Dispose of the text controllers when the screen is closed to free up resources
|
||||
// authController.currentpassController.dispose();
|
||||
// authController.newpassController.dispose();
|
||||
// authController.confirmpassController.dispose();
|
||||
// super.dispose();
|
||||
// }
|
||||
void dispose() {
|
||||
// Dispose of the text controllers when the screen is closed to free up resources
|
||||
authController.currentpassController.dispose();
|
||||
authController.newpassController.dispose();
|
||||
authController.confirmpassController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// Function to validate user input and initiate password change
|
||||
void validateAndChangePassword() async {
|
||||
|
@ -1,12 +1,9 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cheminova/controller/home_controller.dart';
|
||||
import 'package:cheminova/controller/home_service.dart';
|
||||
import 'package:cheminova/screens/authentication/controller/auth_service.dart';
|
||||
import 'package:cheminova/screens/authentication/login_screen.dart';
|
||||
import 'package:cheminova/screens/home_screen.dart';
|
||||
import 'package:cheminova/utils/show_snackbar.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@ -18,7 +15,7 @@ import '../../../utils/secure__storage_service.dart';
|
||||
|
||||
class AuthController extends GetxController {
|
||||
final authService = AuthService();
|
||||
final Dio _dio = Dio();
|
||||
|
||||
|
||||
final _storageService = SecureStorageService();
|
||||
|
||||
@ -31,7 +28,6 @@ class AuthController extends GetxController {
|
||||
final HomeController _homeController = Get.put(HomeController());
|
||||
|
||||
RxBool isLoading = false.obs;
|
||||
|
||||
@override
|
||||
void onInit(){
|
||||
super.onInit();
|
||||
@ -39,106 +35,26 @@ class AuthController extends GetxController {
|
||||
NotificationServices().requestNotificationPermission();
|
||||
}
|
||||
// Function to handle user login
|
||||
// Future<void> login() async {
|
||||
// isLoading.value = true;
|
||||
// // Call the login service with email and password
|
||||
// final response = await authService.login({
|
||||
// 'email': emailController.text,
|
||||
// 'password': passwordController.text,
|
||||
// });
|
||||
// isLoading.value = false;
|
||||
// update();
|
||||
// if (response != null) {
|
||||
// _homeController.fcmToken();
|
||||
// showSnackbar("Your Successfully logged In!");
|
||||
//
|
||||
// Get.offAll(() => const HomeScreen());
|
||||
// }
|
||||
// else if(response == null){
|
||||
// showSnackbar("Please Enter Valid Email or Password");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
Future<void> login() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
isLoading.value = true;
|
||||
|
||||
// Perform login API request
|
||||
// Call the login service with email and password
|
||||
final response = await authService.login({
|
||||
'email': emailController.text,
|
||||
'password': passwordController.text,
|
||||
});
|
||||
|
||||
isLoading.value = false;
|
||||
update();
|
||||
if (response != null) {
|
||||
_homeController.fcmToken();
|
||||
showSnackbar("Your Successfully logged In!");
|
||||
|
||||
if (response != null && response['token'] != null) {
|
||||
// Save the JWT token to SharedPreferences
|
||||
String token = response['token'];
|
||||
await prefs.setString('token', token);
|
||||
|
||||
// Fetch the FCM token and send it to the server
|
||||
final fcmToken = await NotificationServices().getDeviceToken();
|
||||
print('fcmToken: $fcmToken');
|
||||
await HomeService().fcmToken({'fcmToken': fcmToken}, token);
|
||||
|
||||
showSnackbar("You successfully logged in!");
|
||||
|
||||
// Proceed to the HomeScreen after successful login
|
||||
checkToken(); // Ensure the token is valid and the user is authenticated
|
||||
Get.offAll(() => const HomeScreen());
|
||||
} else {
|
||||
showSnackbar("Please enter a valid email or password");
|
||||
}
|
||||
else if(response == null){
|
||||
showSnackbar("Please Enter Valid Email or Password");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Future<void> checkToken() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
String? token = prefs.getString('token');
|
||||
|
||||
if (token != null) {
|
||||
// Token exists, proceed with the flow (maybe fetch user data or navigate to the home screen)
|
||||
print('Token found: $token');
|
||||
// You can also fetch the FCM token if necessary
|
||||
final fcmToken = await NotificationServices().getDeviceToken();
|
||||
print('fcmToken: $fcmToken');
|
||||
|
||||
// Optionally send the FCM token to the server if needed
|
||||
// This might be where you're getting the error
|
||||
await _homeController.fcmToken();
|
||||
|
||||
|
||||
// Navigate to HomeScreen or perform other operations
|
||||
Get.offAll(() => const HomeScreen());
|
||||
} else {
|
||||
// No token found, redirect to login screen
|
||||
Get.offAll(() => const LoginScreen());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Function to validate the token
|
||||
// Future<bool> isTokenValid(String token) async {
|
||||
// try {
|
||||
// final response = await authService.validateToken(token);
|
||||
// return response['isValid'] ?? false; // Adjust based on your API response
|
||||
// } catch (e) {
|
||||
// print("Token validation failed: $e");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Future<(bool, String)> login() async {
|
||||
// isLoading(true);
|
||||
// try {
|
||||
|
@ -1,18 +1,10 @@
|
||||
import 'package:cheminova/utils/api_urls.dart';
|
||||
import 'package:cheminova/utils/common_api_service.dart';
|
||||
import 'package:cheminova/utils/show_snackbar.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:pretty_dio_logger/pretty_dio_logger.dart';
|
||||
|
||||
import '../../../utils/app_interceptor.dart';
|
||||
|
||||
|
||||
class AuthService {
|
||||
final Dio _dio;
|
||||
AuthService() : _dio = Dio(BaseOptions(baseUrl: 'https://api.cnapp.co.in')) {
|
||||
_dio.interceptors.add(AuthInterceptor());
|
||||
_dio.interceptors.add(PrettyDioLogger());
|
||||
}
|
||||
|
||||
// Function to handle user login
|
||||
Future<Map<String, dynamic>?> login(Map<String, dynamic> data) async {
|
||||
try {
|
||||
|
@ -24,15 +24,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
// Initialize the HomeController using GetX
|
||||
final homecontroller = Get.put(HomeController());
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
homecontroller.getUser();
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Accessing the user details from the HomeController
|
||||
final user = homecontroller.user;
|
||||
final user = homecontroller!.user;
|
||||
return Stack(
|
||||
children: [
|
||||
CommonBackground(
|
||||
@ -58,10 +52,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
],
|
||||
),
|
||||
// Main content of the profile screen
|
||||
body: user == null
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
:
|
||||
SingleChildScrollView(
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
@ -79,7 +70,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
// Displaying individual profile items
|
||||
_buildProfileItem('Name', user.name),
|
||||
_buildProfileItem('Name', user!.name),
|
||||
_buildProfileItem('ID', user.uniqueId),
|
||||
_buildProfileItem('Email ID', user.email),
|
||||
_buildProfileItem('Mobile Number', user.phone),
|
||||
|
@ -184,7 +184,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
HomeCard(
|
||||
title: 'Retailer Orders',
|
||||
title: 'RD Orders',
|
||||
onTap: () => Get.to(
|
||||
() => RdOrderScreen(),
|
||||
),
|
||||
|
@ -23,8 +23,7 @@ class _InventoryManagementScreenState extends State<InventoryManagementScreen> {
|
||||
quantity: 100,
|
||||
description: 'Description 1',
|
||||
category: ProductCategory.food,
|
||||
image: "assets/images/new_product.jpeg",
|
||||
//'assets/images/product.png',
|
||||
image: 'assets/images/product.png',
|
||||
)
|
||||
];
|
||||
final List<String> _filterList = [
|
||||
|
@ -179,18 +179,13 @@ class _KycRetailerInfoScreenState extends State<KycRetailerInfoScreen> {
|
||||
),
|
||||
SizedBox(
|
||||
height: Get.height * 0.6,
|
||||
child:
|
||||
Obx(() {
|
||||
child: Obx(() {
|
||||
// Filter the list based on the selected status
|
||||
List<KycModel> filteredOrders =
|
||||
selectedStatus == "All"
|
||||
? _kycController.kycList
|
||||
: _kycController.kycList.where((kyc) => kyc.status == selectedStatus).toList();
|
||||
filteredOrders.sort((a, b) {
|
||||
DateTime dateA = DateTime.parse(filteredOrders[0].createdAt.toString()); // Assuming createdAt is a string
|
||||
DateTime dateB = DateTime.parse(filteredOrders[0].createdAt.toString());
|
||||
return dateB.compareTo(dateA); // Sort in descending order
|
||||
});
|
||||
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
|
@ -1,213 +0,0 @@
|
||||
// import 'dart:io';
|
||||
//
|
||||
// import 'package:cheminova/screens/kyc/retailer_screen.dart';
|
||||
// import 'package:cheminova/screens/kyc/upload_document_screen.dart';
|
||||
// import 'package:cheminova/screens/kyc/verify_document_screen.dart';
|
||||
// import 'package:cheminova/widgets/my_drawer.dart';
|
||||
// import 'package:flutter_svg/flutter_svg.dart';
|
||||
// import 'package:image_picker/image_picker.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
//
|
||||
// import '../../widgets/comman_background.dart';
|
||||
// import '../../widgets/common_appbar.dart';
|
||||
//
|
||||
//
|
||||
// class CollectKycScreen extends StatefulWidget {
|
||||
// const CollectKycScreen({super.key});
|
||||
//
|
||||
// @override
|
||||
// State<CollectKycScreen> createState() => CollectKycScreenState();
|
||||
// }
|
||||
//
|
||||
// class CollectKycScreenState extends State<CollectKycScreen>
|
||||
// with SingleTickerProviderStateMixin {
|
||||
// late TabController _tabController;
|
||||
// bool isLoading = false;
|
||||
//
|
||||
// final _pages = [
|
||||
// // RetailerDetailsScreen(),
|
||||
// const UploadDocumentScreen(),
|
||||
// const VerifyDocumentsScreen()
|
||||
// ];
|
||||
//
|
||||
// @override
|
||||
// void initState() {
|
||||
// _tabController = TabController(length: 3, vsync: this);
|
||||
// super.initState();
|
||||
// }
|
||||
//
|
||||
// final locationController = TextEditingController();
|
||||
// final notesController = TextEditingController();
|
||||
// final dealerController = TextEditingController();
|
||||
// final productController = TextEditingController();
|
||||
// final qualityController = TextEditingController();
|
||||
// final marketNameController = TextEditingController();
|
||||
// final districtController = TextEditingController();
|
||||
// final stateController = TextEditingController();
|
||||
// final pincodeController = TextEditingController();
|
||||
// final aadharcardController = TextEditingController();
|
||||
// final pancardController = TextEditingController();
|
||||
//
|
||||
// File? _selfieImage;
|
||||
// File? _pesticideLicenseImage;
|
||||
// File? _fertilizerLicenseImage;
|
||||
//
|
||||
// final ImagePicker _picker = ImagePicker();
|
||||
//
|
||||
// Future<void> _pickImage(ImageSource source, bool isSelfie) async {
|
||||
// final pickedFile = await _picker.pickImage(source: source);
|
||||
//
|
||||
// setState(() {
|
||||
// if (pickedFile != null) {
|
||||
// if (isSelfie) {
|
||||
// _selfieImage = File(pickedFile.path);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// Future<void> _pickLicenseImage(ImageSource source, bool isPesticide) async {
|
||||
// final pickedFile = await _picker.pickImage(source: source);
|
||||
//
|
||||
// setState(() {
|
||||
// if (pickedFile != null) {
|
||||
// if (isPesticide) {
|
||||
// _pesticideLicenseImage = File(pickedFile.path);
|
||||
// } else {
|
||||
// _fertilizerLicenseImage = File(pickedFile.path);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// void _showPicker(BuildContext context, bool isSelfie) {
|
||||
// showModalBottomSheet(
|
||||
// context: context,
|
||||
// builder: (BuildContext bc) {
|
||||
// return SafeArea(
|
||||
// child: Wrap(
|
||||
// children: <Widget>[
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.photo_library),
|
||||
// title: const Text('Photo Library'),
|
||||
// onTap: () {
|
||||
// _pickImage(ImageSource.gallery, isSelfie);
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// ),
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.photo_camera),
|
||||
// title: const Text('Camera'),
|
||||
// onTap: () {
|
||||
// _pickImage(ImageSource.camera, isSelfie);
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// void _showLicensePicker(BuildContext context, bool isPesticide) {
|
||||
// showModalBottomSheet(
|
||||
// context: context,
|
||||
// builder: (BuildContext bc) {
|
||||
// return SafeArea(
|
||||
// child: Wrap(
|
||||
// children: <Widget>[
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.photo_library),
|
||||
// title: const Text('Photo Library'),
|
||||
// onTap: () {
|
||||
// _pickLicenseImage(ImageSource.gallery, isPesticide);
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// ),
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.photo_camera),
|
||||
// title: const Text('Camera'),
|
||||
// onTap: () {
|
||||
// _pickLicenseImage(ImageSource.camera, isPesticide);
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Stack(
|
||||
// children: [
|
||||
// CommonBackground(
|
||||
// child: DefaultTabController(
|
||||
// length: 3,
|
||||
// child: Scaffold(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// appBar: PreferredSize(
|
||||
// preferredSize: const Size.fromHeight(100),
|
||||
// child: CommonAppBar(
|
||||
// actions: [
|
||||
// IconButton(
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// icon: SvgPicture.asset("assets/svg/back_arrow.svg"),
|
||||
// //Image.asset('assets/Back_attendance.png'),
|
||||
// padding: const EdgeInsets.only(right: 20),
|
||||
// ),
|
||||
// ],
|
||||
// title: const Text(
|
||||
// 'Collect KYC Data',
|
||||
// style: TextStyle(
|
||||
// fontSize: 20,
|
||||
// color: Colors.black,
|
||||
// fontWeight: FontWeight.w400,
|
||||
// fontFamily: 'Anek',
|
||||
// ),
|
||||
// ),
|
||||
// backgroundColor: Colors.transparent,
|
||||
// elevation: 0,
|
||||
// bottom: TabBar(
|
||||
// controller: _tabController,
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
// dividerColor: Colors.transparent,
|
||||
// indicatorColor: Colors.yellow,
|
||||
// labelColor: Colors.white,
|
||||
// unselectedLabelColor: Colors.black,
|
||||
// indicatorSize: TabBarIndicatorSize.tab,
|
||||
// indicator: BoxDecoration(
|
||||
// color: Colors.blue,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// tabs: const [
|
||||
// Tab(text: 'Details'),
|
||||
// Tab(text: 'Documents'),
|
||||
// Tab(text: 'Verify'),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// drawer: const MyDrawer(),
|
||||
// body: TabBarView(
|
||||
// controller: _tabController,
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// children: _pages,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// if (isLoading)
|
||||
// Container(
|
||||
// color: Colors.black.withOpacity(0.5),
|
||||
// child: const Center(child: CircularProgressIndicator()),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
// }
|
@ -67,8 +67,7 @@ class NotificationScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
drawer: MyDrawer(),
|
||||
body:
|
||||
Obx(() {
|
||||
body: Obx(() {
|
||||
// Show a loading indicator while data is being fetched
|
||||
if (notificationController.isLoading.value) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
|
@ -96,34 +96,16 @@ class _CheckoutScreenState extends State<CheckoutScreen> {
|
||||
_saveSelectedAddress();
|
||||
}
|
||||
|
||||
// void _loadSelectedAddress() async {
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// setState(() {
|
||||
// _selectedShippingAddress =
|
||||
// prefs.getString('selectedShippingAddress') ?? _addressList.first;
|
||||
// _selectedBillingAddress =
|
||||
// prefs.getString('selectedBillingAddress') ?? _addressList.first;
|
||||
// });
|
||||
// }
|
||||
|
||||
void _loadSelectedAddress() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
_addressController
|
||||
.fetchAddresses(); // Ensure address list is updated
|
||||
|
||||
setState(() {
|
||||
_selectedShippingAddress =
|
||||
(prefs.getString('selectedShippingAddress') ??
|
||||
(_addressController.addressList.isNotEmpty ? _addressController.addressList.first : null)) as String?;
|
||||
prefs.getString('selectedShippingAddress') ?? _addressList.first;
|
||||
_selectedBillingAddress =
|
||||
(prefs.getString('selectedBillingAddress') ??
|
||||
(_addressController.addressList.isNotEmpty ? _addressController.addressList.first : null)) as String?;
|
||||
prefs.getString('selectedBillingAddress') ?? _addressList.first;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _onPaymentModeChanged(String? value) {
|
||||
setState(() {
|
||||
_groupValue = value!;
|
||||
@ -156,14 +138,7 @@ class _CheckoutScreenState extends State<CheckoutScreen> {
|
||||
hsnCode: product.hsnCode,
|
||||
description: product.description,
|
||||
productStatus: product.productStatus,
|
||||
|
||||
// image:[],
|
||||
image: product.brand.images.isNotEmpty
|
||||
? product.brand.images.map((image) => BrandImage(
|
||||
publicId: image.publicId, // or any other identifier
|
||||
imageId: image.imageId, url: image.url,
|
||||
)).toList()
|
||||
:[],
|
||||
image: [],
|
||||
createdAt: product.createdAt,
|
||||
updatedAt: product.createdAt,
|
||||
count: product.quantity,
|
||||
@ -171,7 +146,7 @@ class _CheckoutScreenState extends State<CheckoutScreen> {
|
||||
//category:product.category,
|
||||
category:Category(id: product.category.id, categoryName: product.category.categoryName),
|
||||
// brand:product.brand,
|
||||
brand:Brand(id: product.brand.id, brandName: product.brand.brandName,images: product.brand.images),
|
||||
brand:Brand(id: product.brand.id, brandName: product.brand.brandName),
|
||||
v: 0, addedBy: product.addedBy,
|
||||
);
|
||||
}).toList();
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:cheminova/controller/get_order_placed_controller.dart';
|
||||
import 'package:cheminova/controller/shiptobilltoController.dart';
|
||||
import 'package:cheminova/models/oder_place_model.dart';
|
||||
@ -73,7 +72,7 @@ Future<void> adduni()async {
|
||||
.map((item) => (item.quantity))
|
||||
.join(', ');
|
||||
}
|
||||
//String? imageurl;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -224,7 +223,6 @@ Future<void> adduni()async {
|
||||
itemCount: widget.placedOrderList?.orderItem.length ?? 0,
|
||||
itemBuilder: (context, index) {
|
||||
final orderItem = widget.placedOrderList!.orderItem[index];
|
||||
final imageUrl = orderItem.image?.isNotEmpty == true ? orderItem.image![0].url : null;
|
||||
return orderItem != null
|
||||
? Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 5.0),
|
||||
@ -235,26 +233,8 @@ Future<void> adduni()async {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
// Image.asset(
|
||||
// "assets/images/new_product.jpeg",
|
||||
// // "assets/images/product.png", // Add the image URL here
|
||||
// height: 50,
|
||||
// width: 50,
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
|
||||
imageUrl != null && imageUrl.isNotEmpty && imageUrl.startsWith('http') // Check if it's a network URL/ Check if it's a network URL
|
||||
? CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const CircularProgressIndicator(), // Optional placeholder
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error), // Optional error widget
|
||||
)
|
||||
: Image.asset(
|
||||
// imageUrl!,
|
||||
'assets/images/no_image_available.jpg', // Placeholder image when URL is empty
|
||||
Image.asset(
|
||||
"assets/images/product.png", // Add the image URL here
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
|
@ -123,148 +123,146 @@ class _CartScreenState extends State<CartScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height * 0.02,
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height * 0.02,
|
||||
),
|
||||
Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 18),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(19),
|
||||
side: const BorderSide(color: Color(0xFFFDFDFD)),
|
||||
),
|
||||
Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 18),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(19),
|
||||
side: const BorderSide(color: Color(0xFFFDFDFD)),
|
||||
),
|
||||
color: const Color(0xFFB4D1E5).withOpacity(0.9),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// "Select All" Checkbox
|
||||
// Row(
|
||||
// children: [
|
||||
// Checkbox(
|
||||
// value: _selectAll,
|
||||
// onChanged: _toggleSelectAll,
|
||||
// ),
|
||||
// Text(
|
||||
// "Select All", // Label for the select all checkbox
|
||||
// style: GoogleFonts.roboto(
|
||||
// fontSize: 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
SizedBox(
|
||||
height: Get.height * 0.6,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
itemCount: _cartController.cartList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Row(
|
||||
children: [
|
||||
// Checkbox(
|
||||
// value: _cartController.selectedProducts.contains(
|
||||
// _cartController.cartList[index]), // Checkbox for individual product selection
|
||||
// onChanged: (value) {
|
||||
// _cartController.toggleProductSelection(
|
||||
// _cartController.cartList[index],
|
||||
// value!,
|
||||
// );
|
||||
// _checkIfAllSelected(); // Check if all are selected after each toggle
|
||||
// },
|
||||
// ),
|
||||
Expanded(
|
||||
child: ProductCard(
|
||||
productModel:
|
||||
_cartController.cartList[index],
|
||||
isInCart: true,
|
||||
placedOrder: widget.placedOrder,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
color: const Color(0xFFB4D1E5).withOpacity(0.9),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// "Select All" Checkbox
|
||||
Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: _selectAll,
|
||||
onChanged: _toggleSelectAll,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Subtotal ",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 15,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Text(
|
||||
"Select All", // Label for the select all checkbox
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
Obx(() =>
|
||||
Text("₹ ${_cartController.subtotal.value}")),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: Get.height * 0.6,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
itemCount: _cartController.cartList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: _cartController.selectedProducts.contains(
|
||||
_cartController.cartList[index]), // Checkbox for individual product selection
|
||||
onChanged: (value) {
|
||||
_cartController.toggleProductSelection(
|
||||
_cartController.cartList[index],
|
||||
value!,
|
||||
);
|
||||
_checkIfAllSelected(); // Check if all are selected after each toggle
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: ProductCard(
|
||||
productModel:
|
||||
_cartController.cartList[index],
|
||||
isInCart: true,
|
||||
placedOrder: widget.placedOrder,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"GST ",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 15,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Subtotal ",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 15,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Obx(() =>
|
||||
Text("₹ ${_cartController.gstTotal.value}")),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Total Amount ",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 15,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Obx(() =>
|
||||
Text("₹ ${_cartController.subtotal.value}")),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"GST ",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 15,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Obx(() => Text(
|
||||
"₹ ${_cartController.grandTotal.value}")),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Obx(() =>
|
||||
Text("₹ ${_cartController.gstTotal.value}")),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Total Amount ",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 15,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Obx(() => Text(
|
||||
"₹ ${_cartController.grandTotal.value}")),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: Get.height * 0.020),
|
||||
SizedBox(
|
||||
width: Get.width * 0.9,
|
||||
height: Get.height * 0.06,
|
||||
child: ElevatedButton(
|
||||
onPressed: () => Get.to(() => CheckoutScreen(
|
||||
selectedProducts: _cartController.selectedProducts, // Pass selected products to checkout
|
||||
)),
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: const Color(0xFF00784C),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
"Proceed to Checkout",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: Get.height * 0.020),
|
||||
SizedBox(
|
||||
width: Get.width * 0.9,
|
||||
height: Get.height * 0.06,
|
||||
child: ElevatedButton(
|
||||
onPressed: () => Get.to(() => CheckoutScreen(
|
||||
selectedProducts: _cartController.selectedProducts, // Pass selected products to checkout
|
||||
)),
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: const Color(0xFF00784C),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
"Proceed to Checkout",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:cheminova/models/product_model.dart';
|
||||
import 'package:cheminova/models/product_model1.dart';
|
||||
import 'package:cheminova/screens/order/checkout_screen.dart';
|
||||
@ -25,7 +24,6 @@ class ProductDetailScreen extends StatefulWidget {
|
||||
|
||||
class _ProductDetailScreenState extends State<ProductDetailScreen> {
|
||||
final CartController _cartController = Get.put(CartController());// Initialize CartController
|
||||
String? imageurl;
|
||||
// Function to capitalize the first letter of a string
|
||||
String capitalizeFirstLetter(String text) {
|
||||
if (text.isEmpty) return text;
|
||||
@ -33,9 +31,6 @@ class _ProductDetailScreenState extends State<ProductDetailScreen> {
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
imageurl = widget.productModel!.brand.images.isNotEmpty
|
||||
? widget.productModel!.brand.images[0].url
|
||||
: 'assets/images/no_image_available.jpg'; // Use a fallback image URL or handle it accordingly
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: AppBar(
|
||||
@ -110,21 +105,13 @@ class _ProductDetailScreenState extends State<ProductDetailScreen> {
|
||||
),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child:
|
||||
ClipRRect(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child:
|
||||
imageurl!.startsWith('http') // Check if it's a network URL
|
||||
? CachedNetworkImage(
|
||||
imageUrl: imageurl!,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const CircularProgressIndicator(), // Optional placeholder
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error), // Optional error widget
|
||||
)
|
||||
: Image.asset(
|
||||
imageurl!,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
child: Image.asset("assets/images/product.png", fit: BoxFit.cover,),
|
||||
// Image.asset(
|
||||
// widget.product.image,
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -224,7 +224,7 @@ class _PartialPendingDialogScreenState extends State<PartialPendingDialogScreen>
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text("₹ ${GstTotalAmounProcessItem.toStringAsFixed(2)}"),
|
||||
Text("₹ ${GstTotalAmounProcessItem}"),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
|
@ -368,7 +368,7 @@ class _PartialProcessingDialogScreenState extends State<PartialProcessingDialogS
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
//Get.back();
|
||||
Navigator.pop(context);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text("Cancel"),
|
||||
),
|
||||
@ -486,7 +486,7 @@ class _PartialProcessingDialogScreenState extends State<PartialProcessingDialogS
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text("₹ ${widget.placedOrderList!.gstTotal.toStringAsFixed(2) ?? 0}"),
|
||||
Text("₹ ${widget.placedOrderList!.gstTotal ?? 0}"),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
|
@ -836,7 +836,6 @@
|
||||
|
||||
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:cheminova/controller/get_order_placed_controller.dart';
|
||||
import 'package:cheminova/controller/get_rd_cancle_controller.dart';
|
||||
import 'package:cheminova/controller/get_rd_pending_controller.dart';
|
||||
@ -875,14 +874,12 @@ class RdOrderCancelledScreenDetailScreen extends StatefulWidget {
|
||||
// PlacedOrderList and PlacedOrderModel are optional parameters passed to this screen
|
||||
final SingleGetOrderModel? placedOrderList;
|
||||
// GetRdPendingModel? productpendingModel;
|
||||
//final String orderId;
|
||||
final String orderId;
|
||||
// GetInvoiceModel? placeInvoiceList;
|
||||
|
||||
// PlacedOrderModel? placedOrderModel;
|
||||
// Constructor for initializing the screen with placed order details
|
||||
RdOrderCancelledScreenDetailScreen({super.key,this.placedOrderList,
|
||||
// required this.orderId
|
||||
});
|
||||
RdOrderCancelledScreenDetailScreen({super.key,this.placedOrderList,required this.orderId});
|
||||
|
||||
@override
|
||||
State<RdOrderCancelledScreenDetailScreen> createState() =>
|
||||
@ -1058,7 +1055,7 @@ class _RdOrderCancelledScreenDetailScreenState
|
||||
),
|
||||
],
|
||||
title: const Text(
|
||||
"Retailer Cancelled Order Details",
|
||||
"RD Cancelled Order Details",
|
||||
),
|
||||
),
|
||||
body: Stack(
|
||||
@ -1195,7 +1192,7 @@ class _RdOrderCancelledScreenDetailScreenState
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text("₹ ${invoice.gstTotal.toStringAsFixed(2)}"),
|
||||
Text("₹ ${invoice.gstTotal}"),
|
||||
],
|
||||
),
|
||||
|
||||
@ -1279,7 +1276,6 @@ class _RdOrderCancelledScreenDetailScreenState
|
||||
itemCount: order.orderItem!.length ?? 0,
|
||||
itemBuilder: (context, index) {
|
||||
final orderItem =order.orderItem![index];
|
||||
final imageUrl = orderItem.image?.isNotEmpty == true ? orderItem.image![0].url : null;
|
||||
final subTotal = orderItem.price * orderItem.quantity!.toInt();
|
||||
final GstTotalAmount = (orderItem.price * orderItem.quantity!.toInt()) *(orderItem.gst/100 );
|
||||
final grandTotal = subTotal + GstTotalAmount;
|
||||
@ -1293,32 +1289,12 @@ class _RdOrderCancelledScreenDetailScreenState
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
// Image.asset(
|
||||
// "assets/images/new_product.jpeg",
|
||||
// // "assets/images/product.png",
|
||||
// height: 50,
|
||||
// width: 50,
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
|
||||
|
||||
imageUrl != null && imageUrl.isNotEmpty && imageUrl.startsWith('http') // Check if it's a network URL/ Check if it's a network URL
|
||||
? CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const CircularProgressIndicator(), // Optional placeholder
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error), // Optional error widget
|
||||
)
|
||||
: Image.asset(
|
||||
//imageUrl!,
|
||||
'assets/images/no_image_available.jpg', // Placeholder image when URL is empty
|
||||
Image.asset(
|
||||
"assets/images/product.png",
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@ -1342,7 +1318,7 @@ class _RdOrderCancelledScreenDetailScreenState
|
||||
Text("Price: ${orderItem.price}"),
|
||||
Text("Subtotal: ${subTotal}"),
|
||||
Text("GSt: ${orderItem.gst}%"),
|
||||
Text("GST Amount (₹): ${GstTotalAmount.toStringAsFixed(2)}"),
|
||||
Text("GST Amount (₹): ${GstTotalAmount}"),
|
||||
Text("Total Amount (₹): ${grandTotal}"),
|
||||
],
|
||||
),
|
||||
@ -1396,7 +1372,6 @@ class _RdOrderCancelledScreenDetailScreenState
|
||||
.toList();
|
||||
|
||||
final orderItem = filteredItems[index];
|
||||
final imageUrl = orderItem.image?.isNotEmpty == true ? orderItem.image![0].url : null;
|
||||
final subTotalProcesssItem = orderItem.price! * orderItem.remainingQuantity!.toInt();
|
||||
final GstTotalAmounProcessItem = (orderItem.price! * orderItem.remainingQuantity!.toInt()) *(orderItem.gst!/100 );
|
||||
final grandTotalProcessItem = subTotalProcesssItem + GstTotalAmounProcessItem;
|
||||
@ -1410,32 +1385,12 @@ class _RdOrderCancelledScreenDetailScreenState
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
// Image.asset(
|
||||
// "assets/images/new_product.jpeg",
|
||||
// // "assets/images/product.png",
|
||||
// height: 50,
|
||||
// width: 50,
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
|
||||
|
||||
imageUrl != null && imageUrl.isNotEmpty && imageUrl.startsWith('http') // Check if it's a network URL/ Check if it's a network URL
|
||||
? CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const CircularProgressIndicator(), // Optional placeholder
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error), // Optional error widget
|
||||
)
|
||||
: Image.asset(
|
||||
//imageUrl!,
|
||||
'assets/images/no_image_available.jpg', // Placeholder image when URL is empty
|
||||
Image.asset(
|
||||
"assets/images/product.png",
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@ -1452,7 +1407,7 @@ class _RdOrderCancelledScreenDetailScreenState
|
||||
Text("Price: ${orderItem.price}"),
|
||||
Text("Subtotal: ${subTotalProcesssItem}"),
|
||||
Text("Gst: ${orderItem.gst}%"),
|
||||
Text("GST Total: ${GstTotalAmounProcessItem.toStringAsFixed(2)}"),
|
||||
Text("GST Total: ${GstTotalAmounProcessItem}"),
|
||||
Text("Total Amount: ${grandTotalProcessItem}"),
|
||||
],
|
||||
),
|
||||
|
@ -101,8 +101,8 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
||||
if (index >= 0 && index < _getRDCancleController.productRDList.length) {
|
||||
// Get the order ID from the list based on the index
|
||||
final orderId = _getRDCancleController.productRDList[index].id;
|
||||
// final invoiceId = _getRDCancleController.productRDList[index].invoices;
|
||||
print("orderId canceeled,$orderId");
|
||||
final invoiceId = _getRDCancleController.productRDList[index].invoices[0];
|
||||
|
||||
// Retrieve the token from SharedPreferences
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
String? token = prefs.getString('token');
|
||||
@ -117,7 +117,7 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
||||
// Navigate to the details screen with the fetched order
|
||||
Get.to(() => RdOrderCancelledScreenDetailScreen(
|
||||
placedOrderList: singleOrder, // Pass the single order instance
|
||||
//orderId: orderId,
|
||||
orderId: orderId,
|
||||
|
||||
));
|
||||
} else {
|
||||
@ -144,68 +144,6 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
||||
}
|
||||
|
||||
|
||||
// void onOrderTap(int index) async {
|
||||
// try {
|
||||
// // Fetch orders and wait for it to complete
|
||||
// await _getRDCancleController.getRDCancleProduct();
|
||||
//
|
||||
// // Debugging: Check if data is actually fetched
|
||||
// print('Fetched orders count: ${_getRDCancleController.productRDList.length}');
|
||||
//
|
||||
// // Ensure the list is not empty after fetching
|
||||
// if (_getRDCancleController.productRDList.isEmpty) {
|
||||
// Get.snackbar("Error", "No orders available to display.");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // Ensure index is within range
|
||||
// if (index < 0 || index >= _getRDCancleController.productRDList.length) {
|
||||
// Get.snackbar("Error", "Invalid order selection.");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // Retrieve order details
|
||||
// final order = _getRDCancleController.productRDList[index].id;
|
||||
// // final invoice = _getRDCancleController.productRDList[index].invoices[index];
|
||||
// // Ensure invoices are available
|
||||
// if (order.isEmpty) {
|
||||
// Get.snackbar("Error", "No invoice found for this order.");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// final orderId = order;
|
||||
// //final invoiceId = invoice;
|
||||
//
|
||||
// print("Cancelled Order ID: $orderId");
|
||||
//
|
||||
// // Retrieve token
|
||||
// SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
// String? token = prefs.getString('token');
|
||||
//
|
||||
// if (token == null) {
|
||||
// Get.snackbar("Error", "User not authenticated.");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // Fetch single order details
|
||||
// final SingleGetOrderModel? singleOrder =
|
||||
// await GetSingleProductService().getSingleOrder(token, orderId);
|
||||
//
|
||||
// if (singleOrder == null) {
|
||||
// Get.snackbar("Error", "Unable to fetch order details.");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // Navigate to details screen
|
||||
// await Get.to(() => RdOrderCancelledScreenDetailScreen(
|
||||
// placedOrderList: singleOrder, // Pass fetched order
|
||||
// orderId: orderId,
|
||||
// ));
|
||||
// } catch (e) {
|
||||
// print('Error in onOrderTap: $e');
|
||||
// Get.snackbar("Error", "An unexpected error occurred.");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@override
|
||||
@ -236,7 +174,7 @@ class _RdCancelledScreenState extends State<RdCancelledScreen> {
|
||||
),
|
||||
),
|
||||
],
|
||||
title: const Text("Retailer Cancelled Order"),
|
||||
title: const Text("RD Cancelled Order"),
|
||||
),
|
||||
drawer: MyDrawer(),
|
||||
body: Stack(
|
||||
|
@ -150,7 +150,7 @@ class _RdDeliveredDetailsScreenState
|
||||
),
|
||||
],
|
||||
title: const Text(
|
||||
"Retailer Delivered Order Details",
|
||||
"RD Delivered Order Details",
|
||||
),
|
||||
),
|
||||
body: Stack(
|
||||
@ -298,7 +298,7 @@ class _RdDeliveredDetailsScreenState
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text("₹ ${widget.placedOrderList!.gstTotal.toStringAsFixed(2)}"),
|
||||
Text("₹ ${widget.placedOrderList!.gstTotal}"),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -163,7 +163,7 @@ class _RdDeliveredScreenState extends State<RdDeliveredScreen> {
|
||||
),
|
||||
),
|
||||
],
|
||||
title: const Text("Retailer Delivered Order"),
|
||||
title: const Text("RD Delivered Order"),
|
||||
),
|
||||
drawer: MyDrawer(),
|
||||
body: Stack(
|
||||
|
@ -198,10 +198,7 @@ class _RdDispatchedDetailsDetailScreenState
|
||||
SnackBar(content: Text('Please select a delivery date.')),
|
||||
);
|
||||
}
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context){
|
||||
return RdDeliveredScreen();
|
||||
}));
|
||||
// Navigator.of(context).pop(); // Close the dialog after submission
|
||||
Navigator.of(context).pop(); // Close the dialog after submission
|
||||
},
|
||||
child: Text('Confirm'),
|
||||
),
|
||||
@ -315,7 +312,7 @@ class _RdDispatchedDetailsDetailScreenState
|
||||
),
|
||||
],
|
||||
title: const Text(
|
||||
"Retailer Dispatched Order Details",
|
||||
"RD Dispatched Order Details",
|
||||
),
|
||||
),
|
||||
body: Stack(
|
||||
@ -462,7 +459,7 @@ class _RdDispatchedDetailsDetailScreenState
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text("₹ ${widget.placedOrderList!.gstTotal.toStringAsFixed(2)}"),
|
||||
Text("₹ ${widget.placedOrderList!.gstTotal}"),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -172,7 +172,7 @@ class _RdDispatchedScreenState extends State<RdDispatchedScreen> {
|
||||
),
|
||||
),
|
||||
],
|
||||
title: const Text("Retailer Dispatched Order"),
|
||||
title: const Text("RD Dispatched Order"),
|
||||
),
|
||||
drawer: MyDrawer(),
|
||||
body: Stack(
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:cheminova/controller/rd_single_order_controller.dart';
|
||||
|
||||
import 'package:cheminova/models/rd_order_item_model.dart';
|
||||
@ -27,14 +26,12 @@ class RdOrderDetailUpdateScreen extends StatefulWidget {
|
||||
//final Product? productModel;
|
||||
// PlacedOrderList and PlacedOrderModel are optional parameters passed to this screen
|
||||
SingleGetOrderModel? placedOrderList;
|
||||
//final String orderId;
|
||||
final String orderId;
|
||||
//final int orderIndex; // New parameter to receive the index
|
||||
|
||||
// PlacedOrderModel? placedOrderModel;
|
||||
// Constructor for initializing the screen with placed order details
|
||||
RdOrderDetailUpdateScreen({super.key,this.placedOrderList,
|
||||
//required this.orderId
|
||||
});
|
||||
RdOrderDetailUpdateScreen({super.key,this.placedOrderList,required this.orderId});
|
||||
|
||||
@override
|
||||
State<RdOrderDetailUpdateScreen> createState() =>
|
||||
@ -49,7 +46,6 @@ class _RdOrderDetailUpdateScreenState
|
||||
final RdSingleOrderController _getPlacedOrderController = Get.put(RdSingleOrderController());
|
||||
final GetProductRDController _getProductRDController = Get.put(GetProductRDController());
|
||||
final RDOrderPlacedController controller = Get.put(RDOrderPlacedController());
|
||||
bool isDialogClosed = false; // Flag to track if dialog is already closed
|
||||
|
||||
|
||||
String? orderId;
|
||||
@ -230,9 +226,6 @@ class _RdOrderDetailUpdateScreenState
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
if (isDialogClosed) return; // Prevent reopening the dialog
|
||||
isDialogClosed = true; // Mark dialog as closed
|
||||
|
||||
if (selectedStatus == "cancelled") {
|
||||
// Ensure the reason is provided for cancellation
|
||||
if (reasonController.text.isEmpty) {
|
||||
@ -252,9 +245,9 @@ class _RdOrderDetailUpdateScreenState
|
||||
});
|
||||
|
||||
// Close the dialog after a short delay
|
||||
// Future.delayed(Duration(seconds: 1), () {
|
||||
// // Navigator.of(context).pop(); // Close the dialog
|
||||
// });
|
||||
Future.delayed(Duration(seconds: 1), () {
|
||||
// Navigator.of(context).pop(); // Close the dialog
|
||||
});
|
||||
|
||||
return; // Exit here to prevent further processing
|
||||
}
|
||||
@ -269,33 +262,31 @@ class _RdOrderDetailUpdateScreenState
|
||||
Map<String, RDOrderItem> orderItemMap = {};
|
||||
|
||||
// Populate the map with items and their quantities
|
||||
for (var item in widget.placedOrderList!.orderItem) {
|
||||
var productId = item.productId;
|
||||
for (var item in _getProductRDController.productRDList) {
|
||||
var productId = item.orderItem[0].productId;
|
||||
|
||||
if (orderItemMap.containsKey(productId)) {
|
||||
// If the product already exists, aggregate the quantity
|
||||
var existingItem = orderItemMap[productId]!;
|
||||
// var existingItem = orderItemMap[productId]!;
|
||||
existingItem.quantity = ((existingItem.quantity ?? 0) + (item.quantity ?? 0));
|
||||
// existingItem.quantity = (existingItem.quantity ?? 0) + (item.orderItem[0].quantity ?? 0);
|
||||
// existingItem.remainingQuantity = (existingItem.remainingQuantity ?? 0) + (item.orderItem[0].remainingQuantity ?? 0);
|
||||
// existingItem.processquantity = (existingItem.processquantity ?? 0) + (item.orderItem[0].processquantity ?? 0);
|
||||
existingItem.quantity = (existingItem.quantity ?? 0) + (item.orderItem[0].quantity ?? 0);
|
||||
existingItem.remainingQuantity = (existingItem.remainingQuantity ?? 0) + (item.orderItem[0].remainingQuantity ?? 0);
|
||||
existingItem.processquantity = (existingItem.processquantity ?? 0) + (item.orderItem[0].processquantity ?? 0);
|
||||
} else {
|
||||
// If it's a new product, add it to the map
|
||||
orderItemMap[productId] = RDOrderItem(
|
||||
productId: productId,
|
||||
sku: item.sku,
|
||||
name: item.name,
|
||||
categoryName: item.categoryName,
|
||||
brandName: item.brandName,
|
||||
price: item.price,
|
||||
gst: item.gst.toInt(),
|
||||
hsnCode: item.hsnCode,
|
||||
description: item.description,
|
||||
sku: item.orderItem[0].sku,
|
||||
name: item.orderItem[0].name,
|
||||
categoryName: item.orderItem[0].categoryName,
|
||||
brandName: item.orderItem[0].brandName,
|
||||
price: item.orderItem[0].price,
|
||||
gst: item.orderItem[0].gst.toInt(),
|
||||
hsnCode: item.orderItem[0].hsnCode,
|
||||
description: item.orderItem[0].description,
|
||||
image: [], // Handle images appropriately
|
||||
quantity: item.quantity ?? 0,
|
||||
remainingQuantity: item.remainingQuantity ?? 0,
|
||||
processquantity: item.remainingQuantity ?? 0,
|
||||
quantity: item.orderItem[0].quantity ?? 0,
|
||||
remainingQuantity: item.orderItem[0].remainingQuantity ?? 0,
|
||||
processquantity: item.orderItem[0].processquantity ?? 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -318,7 +309,7 @@ class _RdOrderDetailUpdateScreenState
|
||||
showSnackbar("Order processed and invoice created successfully");
|
||||
Get.to(RdOrderProcessingScreen());
|
||||
|
||||
// Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
// Close the dialog after a short delay
|
||||
|
||||
// Close the dialog
|
||||
@ -449,7 +440,7 @@ class _RdOrderDetailUpdateScreenState
|
||||
_buildRow("Order Date:", formatDate("${widget.placedOrderList!.createdAt}"), Get.width * 0.04),
|
||||
_buildRow("Total Items:", "${widget.placedOrderList!.orderItem!.length}", Get.width * 0.04),
|
||||
_buildRow("Sub Total:", "₹ ${widget.placedOrderList!.subtotal}", Get.width * 0.04),
|
||||
_buildRow("GST:", "₹ ${widget.placedOrderList!.gstTotal.toStringAsFixed(2)}", Get.width * 0.04),
|
||||
_buildRow("GST:", "₹ ${widget.placedOrderList!.gstTotal}", Get.width * 0.04),
|
||||
_buildRow("Total Amount:", "₹ ${widget.placedOrderList!.grandTotal}", Get.width * 0.04),
|
||||
],
|
||||
),
|
||||
@ -467,7 +458,6 @@ class _RdOrderDetailUpdateScreenState
|
||||
itemCount: widget.placedOrderList!.orderItem!.length ?? 0,
|
||||
itemBuilder: (context, index) {
|
||||
final orderItem = widget.placedOrderList!.orderItem![index];
|
||||
final imageUrl = orderItem.image?.isNotEmpty == true ? orderItem.image![0].url : null;
|
||||
final subTotalProcesssItem = orderItem.price! * orderItem.quantity!.toInt();
|
||||
final GstTotalAmounProcessItem = (orderItem.price! * orderItem.quantity!.toInt()) *(orderItem.gst!/100 );
|
||||
final grandTotalProcessItem = subTotalProcesssItem + GstTotalAmounProcessItem;
|
||||
@ -481,27 +471,8 @@ class _RdOrderDetailUpdateScreenState
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
// Image.asset(
|
||||
// "assets/images/new_product.jpeg",
|
||||
// // "assets/images/product.png",
|
||||
// height: 50,
|
||||
// width: 50,
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
|
||||
|
||||
imageUrl != null && imageUrl.isNotEmpty && imageUrl.startsWith('http') // Check if it's a network URL/ Check if it's a network URL
|
||||
? CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const CircularProgressIndicator(), // Optional placeholder
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error), // Optional error widget
|
||||
)
|
||||
: Image.asset(
|
||||
//imageUrl!,
|
||||
'assets/images/no_image_available.jpg', // Placeholder image when URL is empty
|
||||
Image.asset(
|
||||
"assets/images/product.png",
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
@ -527,7 +498,7 @@ class _RdOrderDetailUpdateScreenState
|
||||
Text("Price: ${orderItem.price}"),
|
||||
Text("Subtotal : ${subTotalProcesssItem}"),
|
||||
Text("GST : ${orderItem.gst}%"),
|
||||
Text("GST Amount (₹) : ${GstTotalAmounProcessItem.toStringAsFixed(2)}"),
|
||||
Text("GST Amount (₹) : ${GstTotalAmounProcessItem}"),
|
||||
Text("Total Amount : ${grandTotalProcessItem}"),
|
||||
],
|
||||
),
|
||||
|
@ -165,7 +165,7 @@ class _RdOrderScreenState extends State<RdOrderScreen> {
|
||||
// Navigate to the details screen with the fetched order
|
||||
Get.to(() => RdOrderDetailUpdateScreen(
|
||||
placedOrderList: singleOrder,
|
||||
// orderId: orderId,
|
||||
orderId: orderId,
|
||||
));
|
||||
} else {
|
||||
// Handle the case where the single order could not be fetched
|
||||
@ -224,7 +224,7 @@ class _RdOrderScreenState extends State<RdOrderScreen> {
|
||||
),
|
||||
),
|
||||
],
|
||||
title: const Text("Retailer Order"),
|
||||
title: const Text("RD Order"),
|
||||
),
|
||||
drawer: MyDrawer(),
|
||||
body: Stack(
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:cheminova/controller/get_order_placed_controller.dart';
|
||||
import 'package:cheminova/controller/get_rd_pending_controller.dart';
|
||||
import 'package:cheminova/controller/rd_get_order_controller.dart';
|
||||
@ -25,7 +24,6 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../controller/cart_controller.dart';
|
||||
import '../../controller/get_single_invoice_controller.dart';
|
||||
import '../../controller/rd_processing_order_controller.dart';
|
||||
import '../../controller/rd_single_order_controller.dart';
|
||||
import '../../models/get_invoice_model.dart';
|
||||
import '../../models/product_model1.dart';
|
||||
import '../../models/rd_order_item_model.dart';
|
||||
@ -37,14 +35,12 @@ class RdOrderPendingScreenDetailScreen extends StatefulWidget {
|
||||
// PlacedOrderList and PlacedOrderModel are optional parameters passed to this screen
|
||||
final SingleGetOrderModel? placedOrderList;
|
||||
// GetRdPendingModel? productpendingModel;
|
||||
//final String orderId;
|
||||
final String orderId;
|
||||
// GetInvoiceModel? placeInvoiceList;
|
||||
|
||||
// PlacedOrderModel? placedOrderModel;
|
||||
// Constructor for initializing the screen with placed order details
|
||||
RdOrderPendingScreenDetailScreen({super.key,this.placedOrderList,
|
||||
// required this.orderId
|
||||
});
|
||||
RdOrderPendingScreenDetailScreen({super.key,this.placedOrderList,required this.orderId});
|
||||
|
||||
@override
|
||||
State<RdOrderPendingScreenDetailScreen> createState() =>
|
||||
@ -56,12 +52,11 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
extends State<RdOrderPendingScreenDetailScreen> {
|
||||
// Controllers for managing cart and placed orders
|
||||
final CartController _cartController = Get.put(CartController());
|
||||
final RdSingleOrderController _getPlacedOrderController = Get.put(RdSingleOrderController());
|
||||
final GetRdPendingController _getRdPendingController = Get.put(GetRdPendingController());
|
||||
final GetSingleInvoiceController _getSingleInvoiceController = Get.put(GetSingleInvoiceController());
|
||||
final GetProductRDController _getProductRDController = Get.put(GetProductRDController());
|
||||
final RDOrderPlacedController controller = Get.put(RDOrderPlacedController());
|
||||
bool isDialogClosed = false; // Flag to track if dialog is already closed
|
||||
|
||||
final List<String> statusOptions = [
|
||||
"new",
|
||||
"pending",
|
||||
@ -206,9 +201,6 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
if (isDialogClosed) return; // Prevent reopening the dialog
|
||||
isDialogClosed = true; // Mark dialog as closed
|
||||
|
||||
{
|
||||
if (selectedStatus == "cancelled") {
|
||||
// Ensure the reason is provided for cancellation
|
||||
@ -243,47 +235,35 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
Map<String, RDOrderItem> orderItemMap = {};
|
||||
|
||||
// Populate the map with items and their quantities
|
||||
for (var item in widget.placedOrderList!.orderItem) {
|
||||
var productId = item.productId;
|
||||
for (var item in _getProductRDController.productRDList) {
|
||||
var productId = item.orderItem[0].productId;
|
||||
|
||||
|
||||
if (item.remainingQuantity != null && item.remainingQuantity! > 0) {
|
||||
if (orderItemMap.containsKey(productId)) {
|
||||
// If the product already exists, aggregate the remaining quantity
|
||||
var existingItem = orderItemMap[productId]!;
|
||||
existingItem.quantity = (existingItem.quantity ?? 0) + (item.quantity ?? 0);
|
||||
existingItem.remainingQuantity = (existingItem.remainingQuantity ?? 0) + (item.remainingQuantity ?? 0);
|
||||
existingItem.processquantity = existingItem.remainingQuantity; // Process all remaining stock
|
||||
}
|
||||
|
||||
// if (orderItemMap.containsKey(productId)) {
|
||||
// // If the product already exists, aggregate the quantity
|
||||
// var existingItem = orderItemMap[productId]!;
|
||||
// // var existingItem = orderItemMap[productId]!;
|
||||
// existingItem.quantity = ((existingItem.quantity ?? 0) + (item.quantity ?? 0));
|
||||
// existingItem.quantity = (existingItem.quantity ?? 0) + (item.orderItem[0].quantity ?? 0);
|
||||
// existingItem.remainingQuantity = (existingItem.remainingQuantity ?? 0) + (item.orderItem[0].remainingQuantity ?? 0);
|
||||
// existingItem.processquantity = (existingItem.processquantity ?? 0) + (item.orderItem[0].processquantity ?? 0);
|
||||
else {
|
||||
if (orderItemMap.containsKey(productId)) {
|
||||
// If the product already exists, aggregate the quantity
|
||||
var existingItem = orderItemMap[productId]!;
|
||||
existingItem.quantity = (existingItem.quantity ?? 0) + (item.orderItem[0].quantity ?? 0);
|
||||
existingItem.remainingQuantity = (existingItem.remainingQuantity ?? 0) + (item.orderItem[0].remainingQuantity ?? 0);
|
||||
existingItem.processquantity = (existingItem.processquantity ?? 0) + (item.orderItem[0].processquantity ?? 0);
|
||||
} else {
|
||||
// If it's a new product, add it to the map
|
||||
orderItemMap[productId] = RDOrderItem(
|
||||
productId: productId,
|
||||
sku: item.sku,
|
||||
name: item.name,
|
||||
categoryName: item.categoryName,
|
||||
brandName: item.brandName,
|
||||
price: item.price,
|
||||
gst: item.gst.toInt(),
|
||||
hsnCode: item.hsnCode,
|
||||
description: item.description,
|
||||
sku: item.orderItem[0].sku,
|
||||
name: item.orderItem[0].name,
|
||||
categoryName: item.orderItem[0].categoryName,
|
||||
brandName: item.orderItem[0].brandName,
|
||||
price: item.orderItem[0].price,
|
||||
gst: item.orderItem[0].gst.toInt(),
|
||||
hsnCode: item.orderItem[0].hsnCode,
|
||||
description: item.orderItem[0].description,
|
||||
image: [], // Handle images appropriately
|
||||
quantity: item.quantity ?? 0,
|
||||
remainingQuantity: item.remainingQuantity ?? 0,
|
||||
processquantity: item.remainingQuantity ?? 0,
|
||||
quantity: item.orderItem[0].quantity ?? 0,
|
||||
remainingQuantity: item.orderItem[0].remainingQuantity ?? 0,
|
||||
processquantity: item.orderItem[0].processquantity ?? 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the map to a list
|
||||
List<RDOrderItem> orderItems = orderItemMap.values.toList();
|
||||
|
||||
@ -392,7 +372,7 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
),
|
||||
],
|
||||
title: const Text(
|
||||
"RetailerPending Order Details",
|
||||
"RDPending Order Details",
|
||||
),
|
||||
),
|
||||
body: Stack(
|
||||
@ -529,7 +509,7 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text("₹ ${invoice.gstTotal.toStringAsFixed(2)}"),
|
||||
Text("₹ ${invoice.gstTotal}"),
|
||||
],
|
||||
),
|
||||
|
||||
@ -613,7 +593,6 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
itemCount: order.orderItem!.length ?? 0,
|
||||
itemBuilder: (context, index) {
|
||||
final orderItem =order.orderItem![index];
|
||||
final imageUrl = orderItem.image?.isNotEmpty == true ? orderItem.image![0].url : null;
|
||||
final subTotal = orderItem.price * orderItem.quantity!.toInt();
|
||||
final GstTotalAmount = (orderItem.price * orderItem.quantity!.toInt()) *(orderItem.gst/100 );
|
||||
final grandTotal = subTotal + GstTotalAmount;
|
||||
@ -627,26 +606,8 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
// Image.asset(
|
||||
// "assets/images/new_product.jpeg",
|
||||
// // "assets/images/product.png",
|
||||
// height: 50,
|
||||
// width: 50,
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
|
||||
imageUrl != null && imageUrl.isNotEmpty && imageUrl.startsWith('http') // Check if it's a network URL/ Check if it's a network URL
|
||||
? CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const CircularProgressIndicator(), // Optional placeholder
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error), // Optional error widget
|
||||
)
|
||||
: Image.asset(
|
||||
//imageUrl!,
|
||||
'assets/images/no_image_available.jpg', // Placeholder image when URL is empty
|
||||
Image.asset(
|
||||
"assets/images/product.png",
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
@ -674,7 +635,7 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
Text("Price: ${orderItem.price}"),
|
||||
Text("Subtotal: ${subTotal}"),
|
||||
Text("GSt: ${orderItem.gst}%"),
|
||||
Text("GST Amount (₹): ${GstTotalAmount.toStringAsFixed(2)}"),
|
||||
Text("GST Amount (₹): ${GstTotalAmount}"),
|
||||
Text("Total Amount (₹): ${grandTotal}"),
|
||||
],
|
||||
),
|
||||
@ -728,7 +689,6 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
.toList();
|
||||
|
||||
final orderItem = filteredItems[index];
|
||||
final imageUrl = orderItem.image?.isNotEmpty == true ? orderItem.image![0].url : null;
|
||||
final subTotalProcesssItem = orderItem.price! * orderItem.remainingQuantity!.toInt();
|
||||
final GstTotalAmounProcessItem = (orderItem.price! * orderItem.remainingQuantity!.toInt()) *(orderItem.gst!/100 );
|
||||
final grandTotalProcessItem = subTotalProcesssItem + GstTotalAmounProcessItem;
|
||||
@ -742,27 +702,8 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
/* Image.asset(
|
||||
"assets/images/new_product.jpeg",
|
||||
// "assets/images/product.png",
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
),*/
|
||||
|
||||
|
||||
imageUrl != null && imageUrl.isNotEmpty && imageUrl.startsWith('http') // Check if it's a network URL/ Check if it's a network URL
|
||||
? CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => const CircularProgressIndicator(), // Optional placeholder
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error), // Optional error widget
|
||||
)
|
||||
: Image.asset(
|
||||
//imageUrl!,
|
||||
'assets/images/no_image_available.jpg', // Placeholder image when URL is empty
|
||||
Image.asset(
|
||||
"assets/images/product.png",
|
||||
height: 50,
|
||||
width: 50,
|
||||
fit: BoxFit.cover,
|
||||
@ -783,7 +724,7 @@ class _RdOrderPendingScreenDetailScreenState
|
||||
Text("Price: ${orderItem.price}"),
|
||||
Text("Subtotal: ${subTotalProcesssItem}"),
|
||||
Text("Gst: ${orderItem.gst}%"),
|
||||
Text("GST Total: ${GstTotalAmounProcessItem.toStringAsFixed(2)}"),
|
||||
Text("GST Total: ${GstTotalAmounProcessItem}"),
|
||||
Text("Total Amount: ${grandTotalProcessItem}"),
|
||||
],
|
||||
),
|
||||
|
@ -114,7 +114,7 @@ class _RdOrderPendingScreenState extends State<RdOrderPendingScreen> {
|
||||
// Navigate to the details screen with the fetched order
|
||||
Get.to(() => RdOrderPendingScreenDetailScreen(
|
||||
placedOrderList: singleOrder, // Pass the single order instance
|
||||
// orderId: orderId,
|
||||
orderId: orderId,
|
||||
|
||||
));
|
||||
} else {
|
||||
@ -171,7 +171,7 @@ class _RdOrderPendingScreenState extends State<RdOrderPendingScreen> {
|
||||
),
|
||||
),
|
||||
],
|
||||
title: const Text("Retailer Pending Order"),
|
||||
title: const Text("RD Pending Order"),
|
||||
),
|
||||
drawer: MyDrawer(),
|
||||
body: Stack(
|
||||
|
@ -123,10 +123,8 @@ class _RdOrderProcessingDetailScreenState extends State<RdOrderProcessingDetailS
|
||||
// Call the API to submit data
|
||||
_getDispatchController.RDProcessingToDispatchProduct(widget.placeInvoiceList!.id.toString(), courierName, courierTrackingId);
|
||||
showSnackbar("Order Status updated Order Dispatched");
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context){
|
||||
return RdDispatchedScreen();
|
||||
}));
|
||||
//Navigator.of(context).pop(); // Close the dialog after submission
|
||||
|
||||
Navigator.of(context).pop(); // Close the dialog after submission
|
||||
},
|
||||
child: Text('Submit'),
|
||||
),
|
||||
@ -334,7 +332,7 @@ class _RdOrderProcessingDetailScreenState extends State<RdOrderProcessingDetailS
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text("₹ ${widget.placeInvoiceList!.gstTotal?.toStringAsFixed(2)}"),
|
||||
Text("₹ ${widget.placeInvoiceList!.gstTotal}"),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -172,7 +172,7 @@ class _RdOrderProcessingScreenState extends State<RdOrderProcessingScreen> {
|
||||
),
|
||||
),
|
||||
],
|
||||
title: const Text("Retailer Processing Order"),
|
||||
title: const Text("RD Processing Order"),
|
||||
),
|
||||
drawer: MyDrawer(),
|
||||
body: Stack(
|
||||
|
@ -5,8 +5,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import 'authentication/controller/auth_controller.dart';
|
||||
|
||||
class SplashScreen extends StatefulWidget {
|
||||
const SplashScreen({super.key});
|
||||
|
||||
@ -18,9 +16,8 @@ class _SplashScreenState extends State<SplashScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Future.delayed(Duration(seconds: 2), () {
|
||||
final authController = Get.put(AuthController());
|
||||
authController.checkToken();
|
||||
Timer(const Duration(seconds: 2), () {
|
||||
Get.offAll(() => const LoginScreen());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class AuthInterceptor extends Interceptor {
|
||||
@override
|
||||
void onRequest(
|
||||
RequestOptions options, RequestInterceptorHandler handler) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final token = prefs.getString('token');
|
||||
|
||||
if (token != null) {
|
||||
debugPrint('token-->\n $token\n');
|
||||
options.headers['Authorization'] = 'Bearer $token';
|
||||
}
|
||||
|
||||
handler.next(options);
|
||||
}
|
||||
|
||||
@override
|
||||
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
||||
// Handle the response if needed
|
||||
handler.next(response);
|
||||
}
|
||||
|
||||
@override
|
||||
void onError(DioException err, ErrorInterceptorHandler handler) async {
|
||||
if (err.response?.statusCode == 401) {}
|
||||
return handler.next(err);
|
||||
}
|
||||
}
|
@ -5,18 +5,7 @@ import 'package:cheminova/utils/constants.dart';
|
||||
import 'package:cheminova/utils/show_snackbar.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'app_interceptor.dart';
|
||||
|
||||
|
||||
Dio createDio() {
|
||||
final dio = Dio();
|
||||
dio.interceptors.add((AuthInterceptor()));
|
||||
return dio;
|
||||
}
|
||||
// Generic API service function that handles API requests with optional file uploads
|
||||
|
||||
|
||||
Future<BodyType?> commonApiService<BodyType>({
|
||||
required String url,
|
||||
required String method,
|
||||
@ -29,7 +18,7 @@ Future<BodyType?> commonApiService<BodyType>({
|
||||
}) async {
|
||||
try {
|
||||
// Initialize Dio for making HTTP requests
|
||||
Dio dio = createDio();
|
||||
Dio dio = Dio();
|
||||
final Response response;
|
||||
|
||||
print("body : $body");
|
||||
|
@ -1,212 +1,3 @@
|
||||
// import 'package:cheminova/controller/home_controller.dart';
|
||||
// import 'package:cheminova/models/user_model.dart';
|
||||
// import 'package:cheminova/screens/authentication/change_password_screen.dart';
|
||||
// import 'package:cheminova/screens/authentication/login_screen.dart';
|
||||
// import 'package:cheminova/screens/authentication/profile_screen.dart';
|
||||
// import 'package:cheminova/screens/home_screen.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:get/get.dart';
|
||||
//
|
||||
// class MyDrawer extends StatefulWidget {
|
||||
// final UserModel? userModel;
|
||||
//
|
||||
// MyDrawer({super.key, this.userModel});
|
||||
//
|
||||
// @override
|
||||
// State<MyDrawer> createState() => _MyDrawerState();
|
||||
// }
|
||||
//
|
||||
// class _MyDrawerState extends State<MyDrawer> {
|
||||
// final homecontroller = Get.put(HomeController()); // Initialize HomeController
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final user = homecontroller.user; // Get the current user from HomeController
|
||||
// return Drawer(
|
||||
// child: ListView(
|
||||
// padding: EdgeInsets.zero,
|
||||
// children: <Widget>[
|
||||
// SizedBox(
|
||||
// height: 150,
|
||||
// // Drawer header displaying user information
|
||||
// child: DrawerHeader(
|
||||
// decoration: const BoxDecoration(
|
||||
// color: Colors.black87,
|
||||
// ),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// user?.name ?? "username",
|
||||
// style: const TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: 18,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// user?.uniqueId ?? 'Employee ID',
|
||||
// style: const TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: 20,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// // Navigation tile for Home
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.home),
|
||||
// title: const Text('Home'),
|
||||
// onTap: () {
|
||||
// Navigator.pushAndRemoveUntil(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) => const HomeScreen()),
|
||||
// (route) => false, // Remove all previous routes
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// // Navigation tile for Profile
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.account_circle),
|
||||
// title: const Text('Profile'),
|
||||
// onTap: () {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) => ProfileScreen()),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// // Navigation tile for Change Password
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.settings),
|
||||
// title: const Text('Change Password'),
|
||||
// onTap: () {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) => ChangePasswordScreen()),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// // Navigation tile for Logout
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.exit_to_app),
|
||||
// title: const Text('Logout'),
|
||||
// onTap: () {
|
||||
// logoutBox(context);
|
||||
// },
|
||||
// ),
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// SizedBox(
|
||||
// height: 700,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// 'Version 2.0.0',
|
||||
// style: TextStyle(color: Colors.grey[600], fontSize: 12),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// // Function to display logout confirmation dialog
|
||||
// Future logoutBox(BuildContext context) {
|
||||
// Size size = MediaQuery.of(context).size;
|
||||
// return showDialog(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertDialog(
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(6.0),
|
||||
// ),
|
||||
// backgroundColor: Colors.white,
|
||||
// alignment: Alignment.center,
|
||||
// title: const Text('Are you sure you want to log out?'),
|
||||
// titleTextStyle: const TextStyle(
|
||||
// fontSize: 20, fontWeight: FontWeight.w400, color: Colors.black),
|
||||
// actionsAlignment: MainAxisAlignment.center,
|
||||
// actionsPadding: const EdgeInsets.only(left: 10, right: 10, bottom: 20),
|
||||
// actions: [
|
||||
// Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: SizedBox(
|
||||
// height: (size.height / 50.52) * 2,
|
||||
// child: ElevatedButton(
|
||||
// style: ButtonStyle(
|
||||
// elevation: MaterialStateProperty.all(0),
|
||||
// backgroundColor: MaterialStateProperty.all<Color>(
|
||||
// Colors.black),
|
||||
// shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
// RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(6.0),
|
||||
// )),
|
||||
// ),
|
||||
// onPressed: () async {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// child: const Text(
|
||||
// "No",
|
||||
// style: TextStyle(
|
||||
// fontSize: 17,
|
||||
// color: Colors.white,
|
||||
// fontWeight: FontWeight.w500),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(width: 5),
|
||||
// Expanded(
|
||||
// child: SizedBox(
|
||||
// height: (size.height / 50.52) * 2,
|
||||
// child: ElevatedButton(
|
||||
// style: ButtonStyle(
|
||||
// elevation: MaterialStateProperty.all(0),
|
||||
// backgroundColor:
|
||||
// MaterialStateProperty.all<Color>(Colors.white),
|
||||
// shape:
|
||||
// MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
// RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(6.0),
|
||||
// side: const BorderSide(
|
||||
// color: Colors.purple, width: 1))),
|
||||
// ),
|
||||
// onPressed: () async {
|
||||
// Navigator.pushAndRemoveUntil(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) => LoginScreen()),
|
||||
// (route) => false,
|
||||
// );
|
||||
// },
|
||||
// child: const Text(
|
||||
// "Yes",
|
||||
// style: TextStyle(
|
||||
// fontSize: 17,
|
||||
// color: Colors.purple,
|
||||
// fontWeight: FontWeight.w500),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
|
||||
import 'package:cheminova/controller/home_controller.dart';
|
||||
import 'package:cheminova/models/user_model.dart';
|
||||
import 'package:cheminova/screens/authentication/change_password_screen.dart';
|
||||
@ -215,7 +6,6 @@ import 'package:cheminova/screens/authentication/profile_screen.dart';
|
||||
import 'package:cheminova/screens/home_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
class MyDrawer extends StatefulWidget {
|
||||
final UserModel? userModel;
|
||||
@ -228,34 +18,17 @@ class MyDrawer extends StatefulWidget {
|
||||
|
||||
class _MyDrawerState extends State<MyDrawer> {
|
||||
final homecontroller = Get.put(HomeController()); // Initialize HomeController
|
||||
String _appVersion = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_getAppVersion();
|
||||
}
|
||||
|
||||
Future<void> _getAppVersion() async {
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform(
|
||||
|
||||
);
|
||||
setState(() {
|
||||
_appVersion = packageInfo.version; // 1.0.0
|
||||
});
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final user = homecontroller.user; // Get the current user from HomeController
|
||||
return Drawer(
|
||||
child: Column(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 150,
|
||||
width: double.infinity,
|
||||
// Drawer header displaying user information
|
||||
child: DrawerHeader(
|
||||
//padding: EdgeInsets.zero,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.black87,
|
||||
),
|
||||
@ -263,7 +36,6 @@ class _MyDrawerState extends State<MyDrawer> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Text(
|
||||
user?.name ?? "username",
|
||||
style: const TextStyle(
|
||||
@ -324,23 +96,11 @@ class _MyDrawerState extends State<MyDrawer> {
|
||||
logoutBox(context);
|
||||
},
|
||||
),
|
||||
// Spacer to push the version text to the bottom
|
||||
const Spacer(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Version: $_appVersion',
|
||||
style: TextStyle(color: Colors.grey[600], fontSize: 12),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Function to display logout confirmation dialog
|
||||
Future logoutBox(BuildContext context) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
@ -428,4 +188,3 @@ Future logoutBox(BuildContext context) {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:cheminova/controller/cart_controller.dart';
|
||||
import 'package:cheminova/models/oder_place_model.dart';
|
||||
import 'package:cheminova/models/order_item_model.dart';
|
||||
import 'package:cheminova/models/place_order_list_model.dart';
|
||||
import 'package:cheminova/models/product_model.dart';
|
||||
import 'package:cheminova/models/rd_get_order_model.dart';
|
||||
import 'package:cheminova/screens/product/product_detail_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -18,7 +16,6 @@ class ProductCard extends StatefulWidget {
|
||||
PlacedOrderModel? placedOrder;
|
||||
PlacedOrderList? placedOrderList;
|
||||
PlaceOrderItem1? placeorderItem;
|
||||
PlacedOrdersResponse ? placeRDOrder;
|
||||
ProductModel? product;
|
||||
final bool isInCart;
|
||||
final bool isCheckout;
|
||||
@ -33,7 +30,6 @@ class ProductCard extends StatefulWidget {
|
||||
this.placedOrder,
|
||||
this.placedOrderList,
|
||||
this.placeorderItem,
|
||||
this.placeRDOrder,
|
||||
this.isInCart = false,
|
||||
this.isCheckout = false,
|
||||
this.isConfirmation = false,
|
||||
@ -48,7 +44,6 @@ class _ProductCardState extends State<ProductCard> {
|
||||
if (text.isEmpty) return text;
|
||||
return text[0].toUpperCase() + text.substring(1).toLowerCase();
|
||||
}
|
||||
String? imageurl;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -58,83 +53,155 @@ class _ProductCardState extends State<ProductCard> {
|
||||
// Get the current quantity of the product, either from the cart or the default value
|
||||
int currentQuantity = isProductInCart
|
||||
? _cartController.cartList.firstWhere((p) => p.id == widget.productModel!.id).quantity
|
||||
: widget.productModel!.quantity ??1;
|
||||
TextEditingController quantityController =
|
||||
TextEditingController(text: currentQuantity.toString());
|
||||
imageurl = widget.productModel!.brand.images.isNotEmpty
|
||||
? widget.productModel!.brand.images[0].url
|
||||
: 'assets/images/no_image_available.jpg'; // Use a fallback image URL or handle it accordingly
|
||||
: widget.productModel!.quantity;
|
||||
|
||||
return GestureDetector(
|
||||
// Navigate to the ProductDetailScreen on tap unless the product is in cart or checkout
|
||||
onTap: () => widget.isInCart || widget.isCheckout
|
||||
? null
|
||||
: Get.to(() => ProductDetailScreen(productModel: widget.productModel)),
|
||||
child: SizedBox(
|
||||
// height: Get.height * 0.21,
|
||||
// width: Get.width *0.20,
|
||||
child: Card(
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(15.0),
|
||||
child:
|
||||
Container(
|
||||
height: Get.height * 0.18,
|
||||
width: Get.width * 0.32,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: imageurl!.startsWith('http')
|
||||
? CachedNetworkImageProvider(imageurl!) as ImageProvider
|
||||
: AssetImage(imageurl!),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
|
||||
child: Card(
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(15.0),
|
||||
child: Container(
|
||||
height: Get.height * 0.15,
|
||||
width: Get.width * 0.31,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/product.png"),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Display the product name with the first letter capitalized
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 3.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Display the product name with the first letter capitalized
|
||||
Text(
|
||||
capitalizeFirstLetter(widget.productModel!.name),
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
// Display the category name of the product
|
||||
Text(
|
||||
capitalizeFirstLetter(widget.productModel!.category!.categoryName),
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
// Display the price of the product
|
||||
Text(
|
||||
"₹ ${widget.productModel!.price.toString()}",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
if (showQuantity)
|
||||
Text(
|
||||
capitalizeFirstLetter(widget.productModel!.name),
|
||||
"Quantity: ${currentQuantity}",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
// Display the category name of the product
|
||||
Text(
|
||||
capitalizeFirstLetter(widget.productModel!.category!.categoryName),
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
// Display the price of the product
|
||||
if (!widget.isCheckout)
|
||||
widget.isInCart
|
||||
?
|
||||
Row(
|
||||
// Display quantity adjustment buttons and remove button if the product is in cart
|
||||
if (!widget.isCheckout)
|
||||
widget.isInCart
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"₹ ${widget.productModel!.price.toString()}",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
Container(
|
||||
height: Get.height * 0.04,
|
||||
width: Get.width * 0.21,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF004791),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 24,
|
||||
width: 24,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
_cartController.decreaseQuantity(widget.productModel!);
|
||||
setState(() {
|
||||
currentQuantity = _cartController
|
||||
.cartList
|
||||
.firstWhere((p) => p.id == widget.productModel!.id)
|
||||
.quantity;
|
||||
});
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'-',
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"${currentQuantity}",
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 22,
|
||||
width: 22,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
_cartController.increaseQuantity(widget.productModel!);
|
||||
setState(() {
|
||||
currentQuantity = _cartController
|
||||
.cartList
|
||||
.firstWhere((p) => p.id == widget.productModel!.id)
|
||||
.quantity;
|
||||
});
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'+',
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// SizedBox(
|
||||
// width: 60,
|
||||
// ),
|
||||
SizedBox(
|
||||
width: 2.0,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
_cartController.removeFromCart(widget.productModel!);
|
||||
@ -150,462 +217,38 @@ class _ProductCardState extends State<ProductCard> {
|
||||
),
|
||||
],
|
||||
)
|
||||
:SizedBox(),
|
||||
if (showQuantity)
|
||||
SizedBox(
|
||||
height: Get.height * 0.04,
|
||||
child: Text(
|
||||
"Quantity: ${currentQuantity}",
|
||||
style: GoogleFonts.roboto(
|
||||
color: Color(0xFF004791),
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
: ElevatedButton(
|
||||
onPressed: () {
|
||||
if (isProductInCart) {
|
||||
showSnackbar("Product already added to cart");
|
||||
} else {
|
||||
_cartController.addToCart(widget.productModel!);
|
||||
showSnackbar("Product successfully added to your cart");
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: const Color(0xFF00784C),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 8),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
),
|
||||
// Display quantity adjustment buttons and remove button if the product is in cart
|
||||
if (!widget.isCheckout)
|
||||
widget.isInCart
|
||||
?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.05,
|
||||
width: Get.width * 0.40,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF004791),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 25,
|
||||
width: 25,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
_cartController.decreaseQuantity(widget.productModel!);
|
||||
setState(() {
|
||||
currentQuantity = _cartController
|
||||
.cartList
|
||||
.firstWhere((p) => p.id == widget.productModel!.id)
|
||||
.quantity;
|
||||
});
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
backgroundColor:Color(0xFF004791),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'-',
|
||||
style: GoogleFonts.roboto(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Text(
|
||||
// "${currentQuantity}",
|
||||
// style: const TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: 16,
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: TextFormField(
|
||||
// // decoration:InputDecoration(
|
||||
// // border: InputBorder.none,
|
||||
// // ),
|
||||
//
|
||||
// controller: quantityController,
|
||||
// style: TextStyle(color: Color(0xFF004791),fontWeight: FontWeight.bold),
|
||||
// keyboardType: TextInputType.number,
|
||||
//
|
||||
// textAlign: TextAlign.center,
|
||||
// onFieldSubmitted: (value) {
|
||||
// int enteredQuantity = int.tryParse(value) ?? currentQuantity;
|
||||
// if (enteredQuantity <= 0) {
|
||||
// showSnackbar("Quantity must be at least 1");
|
||||
// enteredQuantity = 1;
|
||||
// }
|
||||
// setState(() {
|
||||
// currentQuantity = enteredQuantity;
|
||||
// _cartController.updateQuantity(
|
||||
// widget.productModel!, currentQuantity);
|
||||
// });
|
||||
// },
|
||||
// decoration: const InputDecoration(
|
||||
//
|
||||
// contentPadding: EdgeInsets.only(left: 8.0,right: 8.0,bottom: 8.0),
|
||||
// border: OutlineInputBorder(
|
||||
// //
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
SizedBox(width: 5,),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
controller: quantityController,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF004791),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
textAlign: TextAlign.center,
|
||||
onFieldSubmitted: (value) {
|
||||
int enteredQuantity = int.tryParse(value) ?? currentQuantity;
|
||||
if (enteredQuantity <= 0) {
|
||||
showSnackbar("Quantity must be at least 1");
|
||||
enteredQuantity = 1;
|
||||
}
|
||||
setState(() {
|
||||
currentQuantity = enteredQuantity;
|
||||
_cartController.updateQuantity(widget.productModel!, currentQuantity);
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
labelText: "Enter Quantity",
|
||||
labelStyle: const TextStyle(
|
||||
color: Color(0xFF004791),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
hintText: "",
|
||||
hintStyle: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 16.0),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0xFF004791),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0xFF004791),
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.red,
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.red,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5,),
|
||||
SizedBox(
|
||||
height: 25,
|
||||
width: 25,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
_cartController.increaseQuantity(widget.productModel!);
|
||||
setState(() {
|
||||
currentQuantity = _cartController
|
||||
.cartList
|
||||
.firstWhere((p) => p.id == widget.productModel!.id)
|
||||
.quantity;
|
||||
});
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color(0xFF004791),
|
||||
padding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'+',
|
||||
style: GoogleFonts.roboto(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 1.0,
|
||||
),
|
||||
// IconButton(
|
||||
// onPressed: () {
|
||||
// _cartController.removeFromCart(widget.productModel!);
|
||||
// showSnackbar("Product has been removed successfully!");
|
||||
// setState(() {
|
||||
// currentQuantity = 1;
|
||||
// });
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// Icons.delete_outline_rounded,
|
||||
// color: Colors.red,
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
)
|
||||
: ElevatedButton(
|
||||
onPressed: () {
|
||||
if (isProductInCart) {
|
||||
showSnackbar("Product already added to cart");
|
||||
} else {
|
||||
_cartController.addToCart(widget.productModel!);
|
||||
showSnackbar("Product successfully added to your cart");
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: const Color(0xFF00784C),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 8),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
"Add To Cart",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
child: Text(
|
||||
"Add To Cart",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// class ProductCard extends StatefulWidget {
|
||||
// final Product? productModel;
|
||||
// PlacedOrderModel? placedOrder;
|
||||
// PlacedOrderList? placedOrderList;
|
||||
// PlaceOrderItem1? placeorderItem;
|
||||
// PlacedOrdersResponse ? placeRDOrder;
|
||||
// ProductModel? product;
|
||||
// final bool isInCart;
|
||||
// final bool isCheckout;
|
||||
// final bool isConfirmation;
|
||||
// int? quantity;
|
||||
//
|
||||
// ProductCard({
|
||||
// super.key,
|
||||
// this.product,
|
||||
// this.quantity = 1,
|
||||
// this.productModel,
|
||||
// this.placedOrder,
|
||||
// this.placedOrderList,
|
||||
// this.placeorderItem,
|
||||
// this.placeRDOrder,
|
||||
// this.isInCart = false,
|
||||
// this.isCheckout = false,
|
||||
// this.isConfirmation = false,
|
||||
// });
|
||||
//
|
||||
// @override
|
||||
// State<ProductCard> createState() => _ProductCardState();
|
||||
// }
|
||||
//
|
||||
// class _ProductCardState extends State<ProductCard> {
|
||||
// final CartController _cartController = Get.put(CartController());
|
||||
//
|
||||
// String capitalizeFirstLetter(String text) {
|
||||
// if (text.isEmpty) return text;
|
||||
// return text[0].toUpperCase() + text.substring(1).toLowerCase();
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// bool showQuantity = widget.isInCart || widget.isCheckout || widget.isConfirmation;
|
||||
// bool isProductInCart = _cartController.cartList.any((p) => p.id == widget.productModel!.id);
|
||||
//
|
||||
// // Get the current quantity of the product
|
||||
// int currentQuantity = isProductInCart
|
||||
// ? _cartController.cartList.firstWhere((p) => p.id == widget.productModel!.id).quantity
|
||||
// : widget.productModel!.quantity ?? 1;
|
||||
//
|
||||
// TextEditingController quantityController =
|
||||
// TextEditingController(text: currentQuantity.toString());
|
||||
//
|
||||
// return GestureDetector(
|
||||
// onTap: () => widget.isInCart || widget.isCheckout
|
||||
// ? null
|
||||
// : Get.to(() => ProductDetailScreen(productModel: widget.productModel)),
|
||||
// child: Card(
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(8.0),
|
||||
// child: ClipRRect(
|
||||
// borderRadius: BorderRadius.circular(15.0),
|
||||
// child: Container(
|
||||
// height: Get.height * 0.15,
|
||||
// width: Get.width * 0.31,
|
||||
// decoration: const BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: AssetImage("assets/images/product.png"),
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 3.0),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// capitalizeFirstLetter(widget.productModel!.name),
|
||||
// style: GoogleFonts.roboto(
|
||||
// fontSize: 16,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// capitalizeFirstLetter(widget.productModel!.category!.categoryName),
|
||||
// style: GoogleFonts.roboto(
|
||||
// fontSize: 14,
|
||||
// fontWeight: FontWeight.w400,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// "₹ ${widget.productModel!.price.toString()}",
|
||||
// style: GoogleFonts.roboto(
|
||||
// fontSize: 22,
|
||||
// fontWeight: FontWeight.w700,
|
||||
// ),
|
||||
// ),
|
||||
// if (showQuantity)
|
||||
// Row(
|
||||
// children: [
|
||||
// SizedBox(
|
||||
// width: 50,
|
||||
// child: TextFormField(
|
||||
// controller: quantityController,
|
||||
// keyboardType: TextInputType.number,
|
||||
// textAlign: TextAlign.center,
|
||||
// onFieldSubmitted: (value) {
|
||||
// int enteredQuantity = int.tryParse(value) ?? currentQuantity;
|
||||
// if (enteredQuantity <= 0) {
|
||||
// showSnackbar("Quantity must be at least 1");
|
||||
// enteredQuantity = 1;
|
||||
// }
|
||||
// setState(() {
|
||||
// currentQuantity = enteredQuantity;
|
||||
// _cartController.updateQuantity(
|
||||
// widget.productModel!, currentQuantity);
|
||||
// });
|
||||
// },
|
||||
// decoration: const InputDecoration(
|
||||
// contentPadding: EdgeInsets.all(8),
|
||||
// border: OutlineInputBorder(),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// IconButton(
|
||||
// onPressed: () {
|
||||
// _cartController.decreaseQuantity(widget.productModel!);
|
||||
// setState(() {
|
||||
// currentQuantity = _cartController
|
||||
// .cartList
|
||||
// .firstWhere((p) => p.id == widget.productModel!.id)
|
||||
// .quantity;
|
||||
// quantityController.text = currentQuantity.toString();
|
||||
// });
|
||||
// },
|
||||
// icon: const Icon(Icons.remove),
|
||||
// ),
|
||||
// IconButton(
|
||||
// onPressed: () {
|
||||
// _cartController.increaseQuantity(widget.productModel!);
|
||||
// setState(() {
|
||||
// currentQuantity = _cartController
|
||||
// .cartList
|
||||
// .firstWhere((p) => p.id == widget.productModel!.id)
|
||||
// .quantity;
|
||||
// quantityController.text = currentQuantity.toString();
|
||||
// });
|
||||
// },
|
||||
// icon: const Icon(Icons.add),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// if (!widget.isCheckout)
|
||||
// widget.isInCart
|
||||
// ? Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// ElevatedButton(
|
||||
// onPressed: () {
|
||||
// _cartController.removeFromCart(widget.productModel!);
|
||||
// showSnackbar("Product removed successfully!");
|
||||
// setState(() {
|
||||
// currentQuantity = 1;
|
||||
// quantityController.text = currentQuantity.toString();
|
||||
// });
|
||||
// },
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: Colors.red,
|
||||
// ),
|
||||
// child: const Text("Remove"),
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
// : ElevatedButton(
|
||||
// onPressed: () {
|
||||
// if (isProductInCart) {
|
||||
// showSnackbar("Product already added to cart");
|
||||
// } else {
|
||||
// _cartController.addToCart(widget.productModel!);
|
||||
// showSnackbar("Product added to cart successfully!");
|
||||
// }
|
||||
// },
|
||||
// child: const Text("Add To Cart"),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:cheminova/controller/cart_controller.dart';
|
||||
import 'package:cheminova/controller/rd_get_order_controller.dart';
|
||||
import 'package:cheminova/models/rd_get_order_model.dart';
|
||||
@ -6,8 +5,6 @@ import 'package:cheminova/models/rd_order_item_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import '../utils/show_snackbar.dart';
|
||||
class ProductCard1 extends StatefulWidget {
|
||||
final RDOrderItem productModel; // The specific product to be displayed
|
||||
int? quantity;
|
||||
@ -27,20 +24,16 @@ class _ProductCard1State extends State<ProductCard1> {
|
||||
if (text.isEmpty) return text;
|
||||
return text[0].toUpperCase() + text.substring(1).toLowerCase();
|
||||
}
|
||||
String? imageurl;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final CartController _cartController = Get.put(CartController());
|
||||
TextEditingController quantityController =
|
||||
TextEditingController();
|
||||
|
||||
// Current quantity the user wants to process
|
||||
int processQuantity = widget.productModel.processquantity ?? 1;
|
||||
|
||||
// Total available quantity
|
||||
int availableQuantity = widget.productModel.remainingQuantity ?? 1;
|
||||
imageurl = widget.productModel.image.isNotEmpty
|
||||
? widget.productModel.image[0].url
|
||||
: 'assets/images/no_image_available.jpg';
|
||||
|
||||
return Card(
|
||||
child: Row(
|
||||
@ -52,12 +45,9 @@ class _ProductCard1State extends State<ProductCard1> {
|
||||
child: Container(
|
||||
height: Get.height * 0.15,
|
||||
width: Get.width * 0.31,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image:
|
||||
imageurl!.startsWith('http')
|
||||
? CachedNetworkImageProvider(imageurl!) as ImageProvider
|
||||
: AssetImage(imageurl!),
|
||||
image: AssetImage("assets/images/product.png"),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
@ -168,39 +158,6 @@ class _ProductCard1State extends State<ProductCard1> {
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
|
||||
// Expanded(
|
||||
// child: TextFormField(
|
||||
// // decoration:InputDecoration(
|
||||
// // border: InputBorder.none,
|
||||
// // ),
|
||||
//
|
||||
// controller: quantityController,
|
||||
// style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold),
|
||||
// keyboardType: TextInputType.number,
|
||||
//
|
||||
// textAlign: TextAlign.center,
|
||||
// onFieldSubmitted: (value) {
|
||||
// int enteredQuantity = int.tryParse(value) ?? processQuantity;
|
||||
// if (enteredQuantity <= 0) {
|
||||
// showSnackbar("Quantity must be at least 1");
|
||||
// enteredQuantity = 1;
|
||||
// }
|
||||
// // setState(() {
|
||||
// // // widget.productModel.processquantity = enteredQuantity;
|
||||
// // // // _cartController.updateQuantity(
|
||||
// // // // widget.productModel.processquantity!, processQuantity);
|
||||
// // processQuantity = enteredQuantity;
|
||||
// // widget.productModel.processquantity = processQuantity;
|
||||
// // });
|
||||
// },
|
||||
// decoration: const InputDecoration(
|
||||
//
|
||||
// contentPadding: EdgeInsets.only(left: 8.0,right: 8.0,bottom: 8.0),
|
||||
// // border: OutlineInputBorder(),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Increase quantity button
|
||||
SizedBox(
|
||||
height: 22,
|
||||
|
@ -12,10 +12,8 @@ import firebase_core
|
||||
import firebase_crashlytics
|
||||
import firebase_messaging
|
||||
import flutter_local_notifications
|
||||
import package_info_plus
|
||||
import path_provider_foundation
|
||||
import shared_preferences_foundation
|
||||
import sqflite
|
||||
import syncfusion_pdfviewer_macos
|
||||
import url_launcher_macos
|
||||
|
||||
@ -27,10 +25,8 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
FLTFirebaseCrashlyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCrashlyticsPlugin"))
|
||||
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
||||
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||
SyncfusionFlutterPdfViewerPlugin.register(with: registry.registrar(forPlugin: "SyncfusionFlutterPdfViewerPlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
}
|
||||
|
160
pubspec.lock
@ -9,14 +9,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.44"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: archive
|
||||
sha256: "6199c74e3db4fbfbd04f66d739e72fe11c8a8957d5f219f1f4482dbde6420b5a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -49,30 +41,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
cached_network_image:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cached_network_image
|
||||
sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.4.1"
|
||||
cached_network_image_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cached_network_image_platform_interface
|
||||
sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.1"
|
||||
cached_network_image_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cached_network_image_web
|
||||
sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -81,22 +49,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
checked_yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: checked_yaml
|
||||
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_util
|
||||
sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.2"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -350,22 +302,14 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_cache_manager:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_cache_manager
|
||||
sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.4.1"
|
||||
flutter_launcher_icons:
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_launcher_icons
|
||||
sha256: bfa04787c85d80ecb3f8777bde5fc10c3de809240c48fa061a2c2bf15ea5211c
|
||||
name: flutter_lints
|
||||
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.14.3"
|
||||
version: "3.0.2"
|
||||
flutter_local_notifications:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -480,14 +424,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
image:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image
|
||||
sha256: "8346ad4b5173924b5ddddab782fc7d8a6300178c8b1dc427775405a01701c4a6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.5.2"
|
||||
image_picker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -568,14 +504,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.1"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.9.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -600,6 +528,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
logger:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -640,30 +576,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.6"
|
||||
octo_image:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: octo_image
|
||||
sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
package_info_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: package_info_plus
|
||||
sha256: "739e0a5c3c4055152520fa321d0645ee98e932718b4c8efeeb51451968fe0790"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.1.3"
|
||||
package_info_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_info_plus_platform_interface
|
||||
sha256: a5ef9986efc7bf772f2696183a3992615baa76c1ffb1189318dd8803778fb05b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -760,14 +672,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.8"
|
||||
posix:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: posix
|
||||
sha256: a0117dc2167805aa9125b82eee515cc891819bac2f538c83646d355b16f58b9a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.1"
|
||||
pretty_dio_logger:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -776,14 +680,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
rxdart:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: rxdart
|
||||
sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.28.0"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -861,22 +757,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
sqflite:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqflite
|
||||
sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.3+1"
|
||||
sqflite_common:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sqflite_common
|
||||
sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.4"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -965,14 +845,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "26.2.14"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: synchronized
|
||||
sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.0+1"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1157,14 +1029,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.5.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml
|
||||
sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.3"
|
||||
sdks:
|
||||
dart: ">=3.4.1 <4.0.0"
|
||||
flutter: ">=3.22.0"
|
||||
|
15
pubspec.yaml
@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 2.0.2+1
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=3.4.1 <4.0.0"
|
||||
@ -56,28 +56,17 @@ dependencies:
|
||||
firebase_analytics: ^11.2.1
|
||||
flutter_secure_storage: ^4.2.1
|
||||
pretty_dio_logger: ^1.4.0
|
||||
package_info_plus: ^8.1.3
|
||||
cached_network_image: ^3.4.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_launcher_icons: ^0.14.3
|
||||
|
||||
|
||||
|
||||
|
||||
flutter_launcher_icons:
|
||||
android: "launcher_icon"
|
||||
ios: true
|
||||
image_path: "assets/images/app-icon-principal-distributor.png"
|
||||
|
||||
# The "flutter_lints" package below contains a set of recommended lints to
|
||||
# encourage good coding practices. The lint set provided by the package is
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^3.0.0
|
||||
flutter_lints: ^3.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|