|
|
import 'dart:convert';
|
|
|
import 'dart:io';
|
|
|
import 'dart:math';
|
|
|
import 'package:auto_size_text/auto_size_text.dart';
|
|
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter/services.dart';
|
|
|
import 'package:geolocator/geolocator.dart';
|
|
|
import 'package:intl/intl.dart';
|
|
|
import 'package:bookatanker/common/settings.dart';
|
|
|
import 'package:bookatanker/supplier/book_a_tanker.dart';
|
|
|
import 'package:bookatanker/supplier/my_orders.dart';
|
|
|
import 'package:bookatanker/supplier/my_suppliers.dart';
|
|
|
import 'package:bookatanker/supplier/order_details.dart';
|
|
|
import 'package:bookatanker/supplier/order_requests.dart';
|
|
|
import 'package:bookatanker/supplier/payment_example.dart';
|
|
|
import 'package:bookatanker/supplier/paymnets/payments_main.dart';
|
|
|
import 'package:bookatanker/supplier/plans/plan_details.dart';
|
|
|
import 'package:bookatanker/supplier/plans/plan_request_screen.dart';
|
|
|
import 'package:bookatanker/supplier/plans/plan_requests.dart';
|
|
|
import 'package:bookatanker/supplier/profile.dart';
|
|
|
import 'package:bookatanker/supplier/supplier_calendar.dart';
|
|
|
import 'package:bookatanker/supplier/supplier_orders_model.dart';
|
|
|
import 'package:image_picker/image_picker.dart';
|
|
|
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
|
|
import 'package:bookatanker/supplier/todaysprice/todays_price.dart';
|
|
|
import '../models/connected_suppliers_model.dart';
|
|
|
import 'order_arrived.dart';
|
|
|
import 'order_status_overlay.dart';
|
|
|
import 'order_tracking_page.dart';
|
|
|
import 'my_orders_model.dart';
|
|
|
import 'paln_requests_model.dart';
|
|
|
|
|
|
class SupplierLanding extends StatefulWidget {
|
|
|
const SupplierLanding({super.key});
|
|
|
|
|
|
@override
|
|
|
State<SupplierLanding> createState() => _SupplierLandingState();
|
|
|
}
|
|
|
|
|
|
class _SupplierLandingState extends State<SupplierLanding> {
|
|
|
final GlobalKey<_SupplierHomeState> _supplierHomeKey =
|
|
|
GlobalKey<_SupplierHomeState>();
|
|
|
int _currentIndex = 0;
|
|
|
final ImagePicker _picker = ImagePicker();
|
|
|
final storage = FlutterSecureStorage(
|
|
|
aOptions: AndroidOptions(
|
|
|
resetOnError: true,
|
|
|
encryptedSharedPreferences: true,
|
|
|
),
|
|
|
);
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
TextEditingController searchController1 = new TextEditingController();
|
|
|
List cart = [];
|
|
|
final ValueNotifier<List<MyOrdersModel>> activeOrdersNotifier =
|
|
|
ValueNotifier<List<MyOrdersModel>>([]);
|
|
|
|
|
|
// List of bottom navigation bar items
|
|
|
final List<BottomNavigationBarItem> _bottomNavItems = [
|
|
|
BottomNavigationBarItem(
|
|
|
icon: Padding(
|
|
|
padding:
|
|
|
EdgeInsets.fromLTRB(0, 5, 0, 0), // Adjust height to control spacing
|
|
|
child: ImageIcon(AssetImage('images/homeBottomIcon.png')),
|
|
|
),
|
|
|
label: "Home",
|
|
|
),
|
|
|
BottomNavigationBarItem(
|
|
|
icon: Padding(
|
|
|
padding:
|
|
|
EdgeInsets.fromLTRB(0, 5, 0, 0), // Adjust height to control spacing
|
|
|
child: ImageIcon(AssetImage('images/ordersBottomIcon.png')),
|
|
|
),
|
|
|
// Replace with your image path
|
|
|
|
|
|
label: "Orders",
|
|
|
),
|
|
|
BottomNavigationBarItem(
|
|
|
icon: Padding(
|
|
|
padding:
|
|
|
EdgeInsets.fromLTRB(0, 5, 0, 0), // Adjust height to control spacing
|
|
|
child: ImageIcon(AssetImage('images/calenderBottomIcon.png')),
|
|
|
),
|
|
|
// Replace with your image path
|
|
|
|
|
|
label: "Calendar",
|
|
|
),
|
|
|
BottomNavigationBarItem(
|
|
|
icon: Padding(
|
|
|
padding:
|
|
|
EdgeInsets.fromLTRB(0, 5, 0, 0), // Adjust height to control spacing
|
|
|
child: ImageIcon(AssetImage('images/suppliersBottomIcon.png')),
|
|
|
), // Replace with your image path
|
|
|
|
|
|
label: "Suppliers",
|
|
|
),
|
|
|
BottomNavigationBarItem(
|
|
|
icon: Padding(
|
|
|
padding:
|
|
|
EdgeInsets.fromLTRB(0, 5, 0, 0), // Adjust height to control spacing
|
|
|
child: ImageIcon(AssetImage('images/paymentsBottomIcon.png')),
|
|
|
),
|
|
|
|
|
|
// Replace with your image path
|
|
|
|
|
|
label: "Payments",
|
|
|
),
|
|
|
];
|
|
|
|
|
|
void _onItemTapped(int index) {
|
|
|
setState(() {
|
|
|
_currentIndex = index;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
Widget _buildBody() {
|
|
|
switch (_currentIndex) {
|
|
|
case 0:
|
|
|
return SupplierHome(
|
|
|
key: _supplierHomeKey,
|
|
|
activeDeliveryNotifier: activeOrdersNotifier,
|
|
|
);
|
|
|
case 1:
|
|
|
return const MyOrders(navigationFrom: 'bottom_bar');
|
|
|
case 2:
|
|
|
return PaymentsMainScreen();
|
|
|
case 3:
|
|
|
return MySuppliers(navigationFrom: 'bottom_bar');
|
|
|
case 4:
|
|
|
return const PaymentsMainScreen();
|
|
|
default:
|
|
|
return SupplierHome(activeDeliveryNotifier: activeOrdersNotifier);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
_showLocationBottomSheet(BuildContext context) {
|
|
|
showModalBottomSheet(
|
|
|
context: context,
|
|
|
isScrollControlled: true, // Makes it go full screen if needed
|
|
|
shape: RoundedRectangleBorder(
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
|
|
),
|
|
|
builder: (context) {
|
|
|
return DraggableScrollableSheet(
|
|
|
expand: false,
|
|
|
builder: (context, scrollController) {
|
|
|
return Container(
|
|
|
padding: EdgeInsets.all(16),
|
|
|
decoration: BoxDecoration(
|
|
|
color: Colors.white,
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
|
|
),
|
|
|
child: Column(
|
|
|
mainAxisSize:
|
|
|
MainAxisSize.min, // Ensures it doesn't take full height
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
/// 🔹 Drag Handle (Line at the top)
|
|
|
Align(
|
|
|
alignment: Alignment.center,
|
|
|
child: Container(
|
|
|
width: 53,
|
|
|
height: 2,
|
|
|
decoration: BoxDecoration(
|
|
|
color: Color(0XFF757575),
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .012,
|
|
|
),
|
|
|
Text(
|
|
|
"Location",
|
|
|
style:
|
|
|
fontTextStyle(14, Color(0XFF2D2E30), FontWeight.w600),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .012,
|
|
|
),
|
|
|
Container(
|
|
|
child: TextFormField(
|
|
|
controller: searchController1,
|
|
|
decoration: searchTextFormFieldDecoration(
|
|
|
'images/search.png', 'Search'),
|
|
|
style:
|
|
|
fontTextStyle(14, Color(0XFF101214), FontWeight.w400),
|
|
|
cursorColor: Color(0XFF1D7AFC),
|
|
|
|
|
|
//TextStyle(color: Colors.black,fontWeight: FontWeight.bold),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .024,
|
|
|
),
|
|
|
GestureDetector(
|
|
|
onTap: () {},
|
|
|
child: Row(
|
|
|
children: [
|
|
|
Image.asset(
|
|
|
'images/add_icon.png',
|
|
|
width: 24, // Adjust size
|
|
|
height: 24,
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .024,
|
|
|
),
|
|
|
Text(
|
|
|
"Add New Address",
|
|
|
style: fontTextStyle(
|
|
|
12, Color(0XFF2D2E30), FontWeight.w600),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .012,
|
|
|
),
|
|
|
Divider(
|
|
|
color: Colors.grey.shade300,
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .012,
|
|
|
),
|
|
|
GestureDetector(
|
|
|
onTap: () {},
|
|
|
child: Row(
|
|
|
children: [
|
|
|
Image.asset(
|
|
|
'images/gps_current_location.png',
|
|
|
width: 24, // Adjust size
|
|
|
height: 24,
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .024,
|
|
|
),
|
|
|
Text(
|
|
|
"Use Current Location",
|
|
|
style: fontTextStyle(
|
|
|
12, Color(0XFF2D2E30), FontWeight.w600),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .012,
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
},
|
|
|
);
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
|
|
|
double _calculateDistance(lat1, lon1, lat2, lon2) {
|
|
|
var p = 0.017453292519943295;
|
|
|
var a = 0.5 -
|
|
|
cos((lat2 - lat1) * p) / 2 +
|
|
|
cos(lat1 * p) * cos(lat2 * p) * (1 - cos((lon2 - lon1) * p)) / 2;
|
|
|
return 12742 * asin(sqrt(a));
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return WillPopScope(
|
|
|
onWillPop: () async {
|
|
|
if (_currentIndex == 0) {
|
|
|
Navigator.pop(context, true);
|
|
|
return true;
|
|
|
} else {
|
|
|
setState(() {
|
|
|
_currentIndex = 0;
|
|
|
});
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
|
child: Scaffold(
|
|
|
backgroundColor: Colors.white,
|
|
|
appBar: (_currentIndex == 2 ||
|
|
|
_currentIndex == 3 ||
|
|
|
_currentIndex == 1) // 👈 index of Profile page
|
|
|
? null
|
|
|
: AppBar(
|
|
|
backgroundColor: Color(0XFFFFFFFF),
|
|
|
elevation: 0,
|
|
|
scrolledUnderElevation: 0,
|
|
|
titleSpacing: 0,
|
|
|
title: GestureDetector(
|
|
|
onTap: () {
|
|
|
_showLocationBottomSheet(context);
|
|
|
},
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
children: [
|
|
|
Row(
|
|
|
mainAxisSize: MainAxisSize
|
|
|
.min, // Ensures it doesn't take extra space
|
|
|
children: [
|
|
|
Text(
|
|
|
'Home',
|
|
|
style: fontTextStyle(
|
|
|
16, Color(0XFF232527), FontWeight.w600),
|
|
|
),
|
|
|
SizedBox(width: 5), // Space between text and icon
|
|
|
Image.asset(
|
|
|
'images/arrow_down.png', // Replace with your arrow image
|
|
|
width: 24, // Adjust size
|
|
|
height: 24,
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
Text(
|
|
|
AppSettings.userAddress,
|
|
|
style: fontTextStyle(
|
|
|
10, Color(0XFF515253), FontWeight.w400),
|
|
|
),
|
|
|
],
|
|
|
)),
|
|
|
iconTheme: IconThemeData(color: Color(0XFF2A2A2A)),
|
|
|
actions: [
|
|
|
Row(
|
|
|
children: [
|
|
|
Padding(
|
|
|
padding: EdgeInsets.fromLTRB(0, 10, 10, 10),
|
|
|
child: IconButton(
|
|
|
icon: Image.asset(
|
|
|
'images/notification_appbar.png', // Example URL image
|
|
|
),
|
|
|
onPressed: () {},
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
leading: IconButton(
|
|
|
icon: Image.asset(
|
|
|
'images/bookatanker_profile.png', // Replace with your image path
|
|
|
width: 24, // Adjust size as needed
|
|
|
height: 24,
|
|
|
), //
|
|
|
onPressed: () {
|
|
|
Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(builder: (context) => Profile()),
|
|
|
);
|
|
|
},
|
|
|
),
|
|
|
),
|
|
|
body: Stack(
|
|
|
children: [
|
|
|
_buildBody(),
|
|
|
// 🔐 Listen to the notifier to show/hide overlay
|
|
|
ValueListenableBuilder<List<MyOrdersModel>>(
|
|
|
valueListenable: activeOrdersNotifier,
|
|
|
builder: (context, activeOrders, _) {
|
|
|
final isVisible = activeOrders.isNotEmpty;
|
|
|
return OrderStatusOverlayMulti(
|
|
|
isVisible: isVisible,
|
|
|
activeOrders: activeOrders,
|
|
|
onTap: (order) async {
|
|
|
// 0.05 km = 50 meters
|
|
|
const double arrivalRadiusKm = 0.05;
|
|
|
|
|
|
double dist = _calculateDistance(
|
|
|
AppSettings.userLatitude,
|
|
|
AppSettings.userLongitude,
|
|
|
17.41670599999999,
|
|
|
78.4519569,
|
|
|
);
|
|
|
|
|
|
if (dist <= arrivalRadiusKm) {
|
|
|
// 👇 Pass ONLY the tapped order
|
|
|
final result = await Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) =>
|
|
|
ArrivalScreen(orderDetails: order),
|
|
|
),
|
|
|
);
|
|
|
|
|
|
// If result indicates API reload
|
|
|
if (result == true) {
|
|
|
_supplierHomeKey.currentState?.getOrdersData();
|
|
|
}
|
|
|
} else {
|
|
|
// 👇 Pass ONLY the tapped order
|
|
|
Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => OrderTrackingPage(
|
|
|
lat: AppSettings.userLatitude,
|
|
|
lng: AppSettings.userLongitude,
|
|
|
d_lat: 17.41670599999999,
|
|
|
d_lng: 78.4519569,
|
|
|
u_address: order.displayAddress,
|
|
|
orderDetails:
|
|
|
order, // <---- ADD THIS (you must add this parameter in the page)
|
|
|
),
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
},
|
|
|
);
|
|
|
},
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
/*_body(),,*/
|
|
|
bottomNavigationBar: SizedBox(
|
|
|
//height: 123, // 56 (top message) + 56 (BottomNavigationBar)
|
|
|
child: Column(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
children: [
|
|
|
BottomNavigationBar(
|
|
|
backgroundColor: Color(0XFFFFFFFF),
|
|
|
items: _bottomNavItems,
|
|
|
selectedItemColor:
|
|
|
primaryColor, // Color of selected icon and text
|
|
|
unselectedItemColor:
|
|
|
Color(0XFF939495), // Color of unselected icon and text
|
|
|
selectedLabelStyle: fontTextStyleHeight(
|
|
|
10,
|
|
|
primaryColor,
|
|
|
FontWeight.w400,
|
|
|
MediaQuery.of(context).size.height * .0032,
|
|
|
),
|
|
|
unselectedLabelStyle: fontTextStyleHeight(
|
|
|
10,
|
|
|
Color(0XFF939495),
|
|
|
FontWeight.w400,
|
|
|
MediaQuery.of(context).size.height * .0032,
|
|
|
),
|
|
|
currentIndex: _currentIndex,
|
|
|
onTap: _onItemTapped,
|
|
|
type: BottomNavigationBarType
|
|
|
.fixed, // Ensures all 6 items are visible
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
|
|
|
/*Padding(
|
|
|
padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
child: BottomNavigationBar(
|
|
|
backgroundColor: Color(0XFFFFFFFF),
|
|
|
items: _bottomNavItems,
|
|
|
selectedItemColor: primaryColor, // Color of selected icon and text
|
|
|
unselectedItemColor:
|
|
|
Color(0XFF939495), // Color of unselected icon and text
|
|
|
selectedLabelStyle: fontTextStyleHeight(
|
|
|
10,
|
|
|
primaryColor,
|
|
|
FontWeight.w400,
|
|
|
MediaQuery.of(context).size.height * .0032,
|
|
|
),
|
|
|
unselectedLabelStyle: fontTextStyleHeight(
|
|
|
10,
|
|
|
Color(0XFF939495),
|
|
|
FontWeight.w400,
|
|
|
MediaQuery.of(context).size.height * .0032,
|
|
|
),
|
|
|
currentIndex: _currentIndex,
|
|
|
onTap: _onItemTapped,
|
|
|
type: BottomNavigationBarType.fixed, // Ensures all 6 items are visible
|
|
|
),
|
|
|
)*/
|
|
|
));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
class SupplierHome extends StatefulWidget {
|
|
|
const SupplierHome({super.key, required this.activeDeliveryNotifier});
|
|
|
final ValueNotifier<List<MyOrdersModel>> activeDeliveryNotifier;
|
|
|
|
|
|
@override
|
|
|
State<SupplierHome> createState() => _SupplierHomeState();
|
|
|
}
|
|
|
|
|
|
class _SupplierHomeState extends State<SupplierHome> {
|
|
|
bool isConnectedDataLoading = false;
|
|
|
bool isOrdersDataLoading = false;
|
|
|
bool isSupplierOrdersDataLoading = false;
|
|
|
bool isPlanRequestsDataLoading = false;
|
|
|
List<ConnectedSuppliersModel> connectedSuppliersList = [];
|
|
|
List<MyOrdersModel> ordersList = [];
|
|
|
List<SupplierOrdersModel> supplierOrdersList = [];
|
|
|
List<PlanRequestModel> planRequestsList = [];
|
|
|
List<MyOrdersModel> upcomingOrders = [];
|
|
|
double lat = 0;
|
|
|
double lng = 0;
|
|
|
final PageController _pageController = PageController();
|
|
|
final PageController _pageController1 = PageController();
|
|
|
final PageController _pageControllerForPlans = PageController();
|
|
|
|
|
|
Future<void> getConnectedSuppliersData() async {
|
|
|
isConnectedDataLoading = true;
|
|
|
|
|
|
try {
|
|
|
var response = await AppSettings.getConnetcedSuppliers();
|
|
|
|
|
|
setState(() {
|
|
|
connectedSuppliersList =
|
|
|
((jsonDecode(response)['data']) as List).map((dynamic model) {
|
|
|
return ConnectedSuppliersModel.fromJson(model);
|
|
|
}).toList();
|
|
|
connectedSuppliersList.forEach((element) async {
|
|
|
var distanceInM;
|
|
|
double distanceInMeters = await Geolocator.distanceBetween(
|
|
|
element.lat, element.lng, lat, lng);
|
|
|
});
|
|
|
isConnectedDataLoading = false;
|
|
|
});
|
|
|
} catch (e) {
|
|
|
setState(() {
|
|
|
isConnectedDataLoading = false;
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Future<void> getOrdersData() async {
|
|
|
setState(() => isOrdersDataLoading = true);
|
|
|
|
|
|
try {
|
|
|
final response1 = await AppSettings.getAllOrders();
|
|
|
final decoded = jsonDecode(response1);
|
|
|
|
|
|
print("🔹 API RESPONSE (getOrdersData): $decoded");
|
|
|
|
|
|
if (decoded == null || decoded['data'] == null) {
|
|
|
print("⚠️ No 'data' found in response");
|
|
|
setState(() {
|
|
|
ordersList = [];
|
|
|
upcomingOrders = [];
|
|
|
isOrdersDataLoading = false;
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
final List<dynamic> data = decoded['data'];
|
|
|
if (data.isEmpty) {
|
|
|
print("⚠️ Empty data list");
|
|
|
setState(() {
|
|
|
ordersList = [];
|
|
|
upcomingOrders = [];
|
|
|
isOrdersDataLoading = false;
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
final parsedOrders = data.map((e) => MyOrdersModel.fromJson(e)).toList();
|
|
|
|
|
|
// 🔹 Flexible filter for upcoming deliveries
|
|
|
final filtered = parsedOrders.where((order) {
|
|
|
final s = order.orderStatus.toLowerCase();
|
|
|
return s != "pending" ||
|
|
|
s == "advance_paid" ||
|
|
|
s == "assigned" ||
|
|
|
s == "deliveryboy_assigned";
|
|
|
}).toList();
|
|
|
|
|
|
print(
|
|
|
"✅ Total orders: ${parsedOrders.length}, Upcoming: ${filtered.length}");
|
|
|
|
|
|
setState(() {
|
|
|
ordersList = parsedOrders;
|
|
|
upcomingOrders = filtered;
|
|
|
isOrdersDataLoading = false;
|
|
|
});
|
|
|
|
|
|
// ✅ Update the global overlay flag (deliverboystarted anywhere?)
|
|
|
final excludedStatuses = {
|
|
|
'deliveryboy_assigned',
|
|
|
'completed',
|
|
|
'cancelled',
|
|
|
'advance_paid'
|
|
|
};
|
|
|
|
|
|
final activeOrders = parsedOrders.where((o) {
|
|
|
final s = (o.orderStatus ?? '').toLowerCase().replaceAll(' ', '');
|
|
|
|
|
|
return !excludedStatuses.contains(s);
|
|
|
}).toList();
|
|
|
|
|
|
// ✅ publish full list to the notifier
|
|
|
widget.activeDeliveryNotifier.value = activeOrders;
|
|
|
|
|
|
// You can OR-in other active states if needed:
|
|
|
// || (o.orderStatus ?? '').toLowerCase() == 'deliveryboy_assigned'
|
|
|
} catch (e) {
|
|
|
print("❌ Error in getOrdersData(): $e");
|
|
|
setState(() => isOrdersDataLoading = false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Future<void> getAcceptedOrdersFromSupplier() async {
|
|
|
isSupplierOrdersDataLoading = true;
|
|
|
var response1 = await AppSettings.getAcceptedOrdersDataFromSupplier();
|
|
|
var json = jsonDecode(response1);
|
|
|
|
|
|
setState(() {
|
|
|
supplierOrdersList = (json['data'] as List)
|
|
|
.map((model) => SupplierOrdersModel.fromJson(model))
|
|
|
.where((order) => order.status.toLowerCase() == 'accept')
|
|
|
.toList();
|
|
|
isSupplierOrdersDataLoading = false;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
Future<void> getAcceptedPlansFromSupplier() async {
|
|
|
isPlanRequestsDataLoading = true;
|
|
|
var response1 = await AppSettings.getAcceptedPlansFromSupplier();
|
|
|
var json = jsonDecode(response1);
|
|
|
|
|
|
setState(() {
|
|
|
planRequestsList = (json['data'] as List)
|
|
|
.map((model) => PlanRequestModel.fromJson(model))
|
|
|
.where((order) => order.status.toLowerCase() == 'accepted')
|
|
|
.toList();
|
|
|
|
|
|
isPlanRequestsDataLoading = false;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
Map<String, dynamic> getOrderStatus(String orderTimeStr, String dbStatus) {
|
|
|
String status = "Invalid time";
|
|
|
Color color = Colors.grey;
|
|
|
|
|
|
final dbLower = (dbStatus ?? "").toLowerCase().trim();
|
|
|
|
|
|
// ✅ Statuses that ignore time
|
|
|
if (dbLower == "reject")
|
|
|
return {"status": "Rejected", "color": const Color(0XFFE2483D)};
|
|
|
if (dbLower == "accept")
|
|
|
return {"status": "Accepted", "color": const Color(0XFF0A9E04)};
|
|
|
if (dbLower == "delivered")
|
|
|
return {"status": "Delivered", "color": const Color(0XFF2E7D32)};
|
|
|
if (dbLower == "cancelled" ||
|
|
|
dbLower == "cancelled_by_user" ||
|
|
|
dbLower == "cancelled_by_supplier") {
|
|
|
return {"status": "Cancelled", "color": const Color(0XFF757575)};
|
|
|
}
|
|
|
|
|
|
// ✅ Time-based status (only if not rejected/accepted/etc.)
|
|
|
if (orderTimeStr.isEmpty) {
|
|
|
// fallback for pending without time
|
|
|
return {"status": "Pending", "color": const Color(0XFFE56910)};
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
final format = DateFormat("dd-MM-yyyy HH:mm");
|
|
|
final orderTime = format.parse(orderTimeStr);
|
|
|
final now = DateTime.now();
|
|
|
final difference = now.difference(orderTime);
|
|
|
|
|
|
if (difference.inMinutes < 2) {
|
|
|
status = "New";
|
|
|
color = const Color(0XFF1D7AFC); // Blue
|
|
|
} else if (difference.inMinutes < 30) {
|
|
|
final remaining = 30 - difference.inMinutes;
|
|
|
status = "Expires in ${remaining}m"; // show time for pending
|
|
|
color = difference.inMinutes < 10
|
|
|
? const Color(0XFFE56910)
|
|
|
: const Color(0XFFE2483D);
|
|
|
} else {
|
|
|
// Expired overrides pending
|
|
|
status = "Expired";
|
|
|
color = const Color(0XFF757575);
|
|
|
}
|
|
|
} catch (e) {
|
|
|
debugPrint("⚠️ Error parsing time: $e");
|
|
|
status = "Invalid time";
|
|
|
color = Colors.grey;
|
|
|
}
|
|
|
|
|
|
return {"status": status, "color": color};
|
|
|
}
|
|
|
|
|
|
String getOrderTimeOnly(String orderTimeStr) {
|
|
|
if (orderTimeStr.isEmpty) return "";
|
|
|
|
|
|
try {
|
|
|
final format = DateFormat("dd-MM-yyyy HH:mm");
|
|
|
final orderTime = format.parse(orderTimeStr);
|
|
|
final now = DateTime.now();
|
|
|
final difference = now.difference(orderTime);
|
|
|
|
|
|
if (difference.inDays < 2) {
|
|
|
return "New";
|
|
|
} else if (difference.inDays < 20) {
|
|
|
final remaining = 20 - difference.inDays;
|
|
|
return "Expires in ${remaining}d";
|
|
|
} else {
|
|
|
return "Expired";
|
|
|
}
|
|
|
} catch (e) {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
// TODO: implement initState
|
|
|
super.initState();
|
|
|
widget.activeDeliveryNotifier.value = [];
|
|
|
getConnectedSuppliersData();
|
|
|
getOrdersData();
|
|
|
getAcceptedOrdersFromSupplier();
|
|
|
getAcceptedPlansFromSupplier();
|
|
|
lat = AppSettings.userLatitude;
|
|
|
lng = AppSettings.userLongitude;
|
|
|
}
|
|
|
|
|
|
showRejectOrdersDialog(var object) async {
|
|
|
return showDialog(
|
|
|
context: context,
|
|
|
barrierDismissible: false,
|
|
|
builder: (BuildContext context) {
|
|
|
return StatefulBuilder(
|
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
|
return AlertDialog(
|
|
|
backgroundColor:
|
|
|
Color(0XFFFFFFFF), // Set your desired background color
|
|
|
shape: RoundedRectangleBorder(
|
|
|
borderRadius:
|
|
|
BorderRadius.circular(12), // Optional: Rounded corners
|
|
|
),
|
|
|
title: Center(
|
|
|
child: Text(
|
|
|
'Reject Order Request',
|
|
|
style: fontTextStyle(16, Color(0XFF3B3B3B), FontWeight.w600),
|
|
|
),
|
|
|
),
|
|
|
content: SingleChildScrollView(
|
|
|
child: ListBody(
|
|
|
children: <Widget>[
|
|
|
Container(
|
|
|
child: Text(
|
|
|
'Do u want to reject order request',
|
|
|
style:
|
|
|
fontTextStyle(14, Color(0XFF101214), FontWeight.w600),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
actions: <Widget>[
|
|
|
Center(
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
children: [
|
|
|
Expanded(
|
|
|
child: GestureDetector(
|
|
|
onTap: () {
|
|
|
Navigator.pop(context);
|
|
|
},
|
|
|
child: Container(
|
|
|
decoration: BoxDecoration(
|
|
|
shape: BoxShape.rectangle,
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
border: Border.all(
|
|
|
width: 1, color: Color(0XFF1D7AFC)),
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
12,
|
|
|
)),
|
|
|
alignment: Alignment.center,
|
|
|
child: Visibility(
|
|
|
visible: true,
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 12),
|
|
|
child: Text('Cancel',
|
|
|
style: fontTextStyle(
|
|
|
12, Color(0XFF1D7AFC), FontWeight.w600)),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .016,
|
|
|
),
|
|
|
Expanded(
|
|
|
child: GestureDetector(
|
|
|
onTap: () async {
|
|
|
var payload = <String, dynamic>{};
|
|
|
payload["supplierId"] = object.supplierId;
|
|
|
payload["action"] = 'reject';
|
|
|
payload["paymentId"] = '';
|
|
|
|
|
|
try {
|
|
|
bool status =
|
|
|
await AppSettings.acceptOrderRequests(
|
|
|
payload, object.dbId);
|
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
|
if (status) {
|
|
|
AppSettings.longSuccessToast('Rejected');
|
|
|
Navigator.pop(context);
|
|
|
getAcceptedOrdersFromSupplier();
|
|
|
} else {
|
|
|
AppSettings.longFailedToast(
|
|
|
'Failed to reject order request');
|
|
|
}
|
|
|
} catch (e) {
|
|
|
AppSettings.longFailedToast('Error: $e');
|
|
|
}
|
|
|
},
|
|
|
child: Container(
|
|
|
decoration: BoxDecoration(
|
|
|
shape: BoxShape.rectangle,
|
|
|
color: Color(0XFFE2483D),
|
|
|
border: Border.all(
|
|
|
width: 1, color: Color(0XFFE2483D)),
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
12,
|
|
|
)),
|
|
|
alignment: Alignment.center,
|
|
|
child: Visibility(
|
|
|
visible: true,
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 12),
|
|
|
child: Text('Reject',
|
|
|
style: fontTextStyle(12, Color(0XFFFFFFFF),
|
|
|
FontWeight.w600)),
|
|
|
),
|
|
|
),
|
|
|
)),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
);
|
|
|
});
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
|
|
|
showAcceptOrdersDialog(var object) async {
|
|
|
return showDialog(
|
|
|
context: context,
|
|
|
barrierDismissible: false,
|
|
|
builder: (BuildContext context) {
|
|
|
return StatefulBuilder(
|
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
|
return AlertDialog(
|
|
|
backgroundColor:
|
|
|
Color(0XFFFFFFFF), // Set your desired background color
|
|
|
shape: RoundedRectangleBorder(
|
|
|
borderRadius:
|
|
|
BorderRadius.circular(12), // Optional: Rounded corners
|
|
|
),
|
|
|
title: Center(
|
|
|
child: Text(
|
|
|
'Accept Order Request',
|
|
|
style: fontTextStyle(16, Color(0XFF3B3B3B), FontWeight.w600),
|
|
|
),
|
|
|
),
|
|
|
content: SingleChildScrollView(
|
|
|
child: ListBody(
|
|
|
children: <Widget>[
|
|
|
Container(
|
|
|
child: Text(
|
|
|
'Do u want to Accept the order request?',
|
|
|
style:
|
|
|
fontTextStyle(14, Color(0XFF101214), FontWeight.w600),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
actions: <Widget>[
|
|
|
Center(
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
children: [
|
|
|
Expanded(
|
|
|
child: GestureDetector(
|
|
|
onTap: () {
|
|
|
Navigator.pop(context);
|
|
|
},
|
|
|
child: Container(
|
|
|
decoration: BoxDecoration(
|
|
|
shape: BoxShape.rectangle,
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
border: Border.all(
|
|
|
width: 1, color: Color(0XFFE2483D)),
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
12,
|
|
|
)),
|
|
|
alignment: Alignment.center,
|
|
|
child: Visibility(
|
|
|
visible: true,
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 12),
|
|
|
child: Text('Cancel',
|
|
|
style: fontTextStyle(
|
|
|
12, Color(0XFFE2483D), FontWeight.w600)),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .016,
|
|
|
),
|
|
|
Expanded(
|
|
|
child: GestureDetector(
|
|
|
onTap: () async {
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
final result = await Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => OrderDetails(
|
|
|
supplierDetails: object,
|
|
|
),
|
|
|
),
|
|
|
);
|
|
|
|
|
|
// If result indicates API reload
|
|
|
if (result == true) {
|
|
|
getAcceptedOrdersFromSupplier();
|
|
|
}
|
|
|
},
|
|
|
child: Container(
|
|
|
decoration: BoxDecoration(
|
|
|
shape: BoxShape.rectangle,
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
border: Border.all(
|
|
|
width: 1, color: Color(0XFF1D7AFC)),
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
12,
|
|
|
)),
|
|
|
alignment: Alignment.center,
|
|
|
child: Visibility(
|
|
|
visible: true,
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 12),
|
|
|
child: Text('Accept',
|
|
|
style: fontTextStyle(12, Color(0XFF1D7AFC),
|
|
|
FontWeight.w600)),
|
|
|
),
|
|
|
),
|
|
|
)),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
);
|
|
|
});
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
|
|
|
showAcceptPlanDialog(var object) async {
|
|
|
return showDialog(
|
|
|
context: context,
|
|
|
barrierDismissible: false,
|
|
|
builder: (BuildContext context) {
|
|
|
return StatefulBuilder(
|
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
|
return AlertDialog(
|
|
|
backgroundColor:
|
|
|
Color(0XFFFFFFFF), // Set your desired background color
|
|
|
shape: RoundedRectangleBorder(
|
|
|
borderRadius:
|
|
|
BorderRadius.circular(12), // Optional: Rounded corners
|
|
|
),
|
|
|
title: Center(
|
|
|
child: Text(
|
|
|
'Accept Plan Request',
|
|
|
style: fontTextStyle(16, Color(0XFF3B3B3B), FontWeight.w600),
|
|
|
),
|
|
|
),
|
|
|
content: SingleChildScrollView(
|
|
|
child: ListBody(
|
|
|
children: <Widget>[
|
|
|
Container(
|
|
|
child: Text(
|
|
|
'Do u want to Accept the plan request?',
|
|
|
style:
|
|
|
fontTextStyle(14, Color(0XFF101214), FontWeight.w600),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
actions: <Widget>[
|
|
|
Center(
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
children: [
|
|
|
Expanded(
|
|
|
child: GestureDetector(
|
|
|
onTap: () {
|
|
|
Navigator.pop(context);
|
|
|
},
|
|
|
child: Container(
|
|
|
decoration: BoxDecoration(
|
|
|
shape: BoxShape.rectangle,
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
border: Border.all(
|
|
|
width: 1, color: Color(0XFFE2483D)),
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
12,
|
|
|
)),
|
|
|
alignment: Alignment.center,
|
|
|
child: Visibility(
|
|
|
visible: true,
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 12),
|
|
|
child: Text('Cancel',
|
|
|
style: fontTextStyle(
|
|
|
12, Color(0XFFE2483D), FontWeight.w600)),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .016,
|
|
|
),
|
|
|
Expanded(
|
|
|
child: GestureDetector(
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
|
var payload = {
|
|
|
"action": "accept",
|
|
|
"ref_number": '',
|
|
|
"payment_type":object.paymentType
|
|
|
};
|
|
|
|
|
|
try {
|
|
|
bool status = await AppSettings.acceptPlanRequestsWithPayment(payload, object.dbId);
|
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
|
if (status) {
|
|
|
AppSettings.longSuccessToast('Accepted');
|
|
|
Navigator.pop(context);
|
|
|
getAcceptedPlansFromSupplier();
|
|
|
|
|
|
|
|
|
// Use Navigator safely
|
|
|
/* Navigator.pushReplacement(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => OrderDetails(supplierDetails: object),
|
|
|
),
|
|
|
);*/
|
|
|
} else {
|
|
|
AppSettings.longFailedToast('Failed to accept order request');
|
|
|
}
|
|
|
} catch (e) {
|
|
|
AppSettings.longFailedToast('Error: $e');
|
|
|
}
|
|
|
},
|
|
|
child: Container(
|
|
|
decoration: BoxDecoration(
|
|
|
shape: BoxShape.rectangle,
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
border: Border.all(
|
|
|
width: 1, color: Color(0XFF1D7AFC)),
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
12,
|
|
|
)),
|
|
|
alignment: Alignment.center,
|
|
|
child: Visibility(
|
|
|
visible: true,
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 12),
|
|
|
child: Text('Accept',
|
|
|
style: fontTextStyle(12, Color(0XFF1D7AFC),
|
|
|
FontWeight.w600)),
|
|
|
),
|
|
|
),
|
|
|
)),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
);
|
|
|
});
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
|
|
|
showRejectPlanDialog(var object) async {
|
|
|
return showDialog(
|
|
|
context: context,
|
|
|
barrierDismissible: false,
|
|
|
builder: (BuildContext context) {
|
|
|
return StatefulBuilder(
|
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
|
return AlertDialog(
|
|
|
backgroundColor:
|
|
|
Color(0XFFFFFFFF), // Set your desired background color
|
|
|
shape: RoundedRectangleBorder(
|
|
|
borderRadius:
|
|
|
BorderRadius.circular(12), // Optional: Rounded corners
|
|
|
),
|
|
|
title: Center(
|
|
|
child: Text(
|
|
|
'Reject Plan Request',
|
|
|
style: fontTextStyle(16, Color(0XFF3B3B3B), FontWeight.w600),
|
|
|
),
|
|
|
),
|
|
|
content: SingleChildScrollView(
|
|
|
child: ListBody(
|
|
|
children: <Widget>[
|
|
|
Container(
|
|
|
child: Text(
|
|
|
'Do u want to Reject the plan request?',
|
|
|
style:
|
|
|
fontTextStyle(14, Color(0XFF101214), FontWeight.w600),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
actions: <Widget>[
|
|
|
Center(
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
children: [
|
|
|
Expanded(
|
|
|
child: GestureDetector(
|
|
|
onTap: () {
|
|
|
Navigator.pop(context);
|
|
|
},
|
|
|
child: Container(
|
|
|
decoration: BoxDecoration(
|
|
|
shape: BoxShape.rectangle,
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
border: Border.all(
|
|
|
width: 1, color: Color(0XFF1D7AFC)),
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
12,
|
|
|
)),
|
|
|
alignment: Alignment.center,
|
|
|
child: Visibility(
|
|
|
visible: true,
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 12),
|
|
|
child: Text('Cancel',
|
|
|
style: fontTextStyle(
|
|
|
12, Color(0XFF1D7AFC), FontWeight.w600)),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .016,
|
|
|
),
|
|
|
Expanded(
|
|
|
child: GestureDetector(
|
|
|
onTap: () async {
|
|
|
|
|
|
|
|
|
var payload = {
|
|
|
"action": "reject",
|
|
|
"ref_number": '',
|
|
|
"payment_type":object.paymentType
|
|
|
};
|
|
|
|
|
|
try {
|
|
|
bool status = await AppSettings.acceptPlanRequestsWithPayment(payload, object.dbId);
|
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
|
if (status) {
|
|
|
AppSettings.longSuccessToast('Rejected');
|
|
|
Navigator.pop(context);
|
|
|
getAcceptedPlansFromSupplier();
|
|
|
|
|
|
|
|
|
// Use Navigator safely
|
|
|
/* Navigator.pushReplacement(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => OrderDetails(supplierDetails: object),
|
|
|
),
|
|
|
);*/
|
|
|
} else {
|
|
|
AppSettings.longFailedToast('Failed to accept order request');
|
|
|
}
|
|
|
} catch (e) {
|
|
|
AppSettings.longFailedToast('Error: $e');
|
|
|
}
|
|
|
},
|
|
|
child: Container(
|
|
|
decoration: BoxDecoration(
|
|
|
shape: BoxShape.rectangle,
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
border: Border.all(
|
|
|
width: 1, color: Color(0XFFE2483D)),
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
12,
|
|
|
)),
|
|
|
alignment: Alignment.center,
|
|
|
child: Visibility(
|
|
|
visible: true,
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 12),
|
|
|
child: Text('Reject',
|
|
|
style: fontTextStyle(12, Color(0XFFE2483D),
|
|
|
FontWeight.w600)),
|
|
|
),
|
|
|
),
|
|
|
)),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
);
|
|
|
});
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return SingleChildScrollView(
|
|
|
child: Stack(children: [
|
|
|
Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 0),
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
children: [
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .008,
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
Expanded(
|
|
|
child: GestureDetector(
|
|
|
onTap: () {
|
|
|
Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => BookATanker()),
|
|
|
);
|
|
|
},
|
|
|
child: Card(
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
elevation: 2,
|
|
|
child: Container(
|
|
|
padding: EdgeInsets.fromLTRB(5, 5, 0, 0),
|
|
|
height: 165,
|
|
|
//width: MediaQuery.of(context).size.height * .14,
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
children: [
|
|
|
Padding(
|
|
|
padding: EdgeInsets.fromLTRB(5, 5, 0, 0),
|
|
|
child: Column(
|
|
|
crossAxisAlignment:
|
|
|
CrossAxisAlignment.start,
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment.start,
|
|
|
children: [
|
|
|
Text(
|
|
|
'Book a tanker',
|
|
|
style: fontTextStyle(
|
|
|
14,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w700),
|
|
|
),
|
|
|
Text(
|
|
|
'Order now or schedule for later',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF757575),
|
|
|
FontWeight.w400),
|
|
|
),
|
|
|
],
|
|
|
)),
|
|
|
/* Expanded(child: Align(
|
|
|
alignment: Alignment.bottomRight,
|
|
|
child: Image.asset('images/WaterTankImage.png'),
|
|
|
))*/
|
|
|
],
|
|
|
)),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
Expanded(
|
|
|
child: GestureDetector(
|
|
|
onTap: () {
|
|
|
/* Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => SupplyCalendarScreen()),
|
|
|
);*/
|
|
|
Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => PlanRequestScreen()),
|
|
|
);
|
|
|
},
|
|
|
child: Card(
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
elevation: 2,
|
|
|
child: Container(
|
|
|
padding: EdgeInsets.fromLTRB(5, 5, 0, 0),
|
|
|
//height:MediaQuery.of(context).size.height * .20,
|
|
|
height: 165,
|
|
|
// width: MediaQuery.of(context).size.height * .14,
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
children: [
|
|
|
Padding(
|
|
|
padding: EdgeInsets.fromLTRB(5, 5, 0, 0),
|
|
|
child: Column(
|
|
|
crossAxisAlignment:
|
|
|
CrossAxisAlignment.start,
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment.start,
|
|
|
children: [
|
|
|
Text(
|
|
|
'Plans',
|
|
|
style: fontTextStyle(
|
|
|
14,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w700),
|
|
|
),
|
|
|
Text(
|
|
|
'Subscribe for long-term water delivery',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF757575),
|
|
|
FontWeight.w400),
|
|
|
),
|
|
|
],
|
|
|
)),
|
|
|
SizedBox(
|
|
|
height:
|
|
|
MediaQuery.of(context).size.height * .038,
|
|
|
),
|
|
|
/*Expanded(child: Align(
|
|
|
alignment: Alignment.bottomRight,
|
|
|
child: Image.asset('images/ConsumptionImage.png',),))*/ /*height: 80,width: 80,*/
|
|
|
],
|
|
|
)),
|
|
|
),
|
|
|
)),
|
|
|
],
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .024,
|
|
|
),
|
|
|
|
|
|
Visibility(
|
|
|
visible: supplierOrdersList.length != 0,
|
|
|
child: Column(
|
|
|
children: [
|
|
|
GestureDetector(
|
|
|
onTap: () {
|
|
|
Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => OrderRequestsPage()),
|
|
|
);
|
|
|
},
|
|
|
child: Row(
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
Text(
|
|
|
'Order Requests',
|
|
|
style: fontTextStyle(
|
|
|
14, Color(0XFF2A2A2A), FontWeight.w600),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .093,
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
Image.asset(
|
|
|
'images/arrow-right.png',
|
|
|
fit: BoxFit.cover,
|
|
|
width:
|
|
|
16, // Match the diameter of the CircleAvatar
|
|
|
height: 16,
|
|
|
),
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .012,
|
|
|
),
|
|
|
Center(
|
|
|
child: Container(
|
|
|
width: double.infinity,
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
height: 150,
|
|
|
padding: EdgeInsets.all(0),
|
|
|
child: isSupplierOrdersDataLoading
|
|
|
? Center(
|
|
|
child: CircularProgressIndicator(
|
|
|
color: primaryColor,
|
|
|
strokeWidth: 5.0,
|
|
|
),
|
|
|
)
|
|
|
: supplierOrdersList.length != 0
|
|
|
? Column(
|
|
|
children: [
|
|
|
Expanded(
|
|
|
child: PageView.builder(
|
|
|
controller: _pageController1,
|
|
|
itemCount:
|
|
|
supplierOrdersList.length,
|
|
|
itemBuilder: (context, index) {
|
|
|
final order =
|
|
|
supplierOrdersList[index];
|
|
|
|
|
|
final orderDateTime =
|
|
|
"${order.acceptedTime}"
|
|
|
.trim();
|
|
|
final statusTime =
|
|
|
getOrderTimeOnly(
|
|
|
orderDateTime);
|
|
|
|
|
|
// status badge color
|
|
|
Color statusColor =
|
|
|
Color(0xFF1D7AFC);
|
|
|
if (statusTime == "Expired") {
|
|
|
statusColor =
|
|
|
Color(0xFF757575);
|
|
|
} else if (statusTime ==
|
|
|
"New") {
|
|
|
statusColor =
|
|
|
Color(0XFF1D7AFC);
|
|
|
} else if (statusTime
|
|
|
.endsWith("m")) {
|
|
|
statusColor =
|
|
|
Color(0XFFE56910);
|
|
|
}
|
|
|
|
|
|
return Container(
|
|
|
decoration: BoxDecoration(
|
|
|
color: Color(
|
|
|
0XFFFFFFFF), // Same as Card color
|
|
|
borderRadius:
|
|
|
BorderRadius.circular(
|
|
|
12), // Rounded corners
|
|
|
border: Border.all(
|
|
|
color: Color(
|
|
|
0XFF1D7AFC), // Border color
|
|
|
width:
|
|
|
0.5, // Border width
|
|
|
),
|
|
|
),
|
|
|
//color: Color(0XFFFFFFFF),
|
|
|
child: Padding(
|
|
|
padding:
|
|
|
EdgeInsets.all(12),
|
|
|
child: Column(
|
|
|
mainAxisSize:
|
|
|
MainAxisSize.min,
|
|
|
crossAxisAlignment:
|
|
|
CrossAxisAlignment
|
|
|
.start,
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.start,
|
|
|
children: [
|
|
|
Row(
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.spaceBetween,
|
|
|
children: [
|
|
|
Visibility(
|
|
|
visible: supplierOrdersList[
|
|
|
index]
|
|
|
.supplierName !=
|
|
|
'',
|
|
|
child: Text(
|
|
|
supplierOrdersList[
|
|
|
index]
|
|
|
.supplierName,
|
|
|
style: fontTextStyle(
|
|
|
14,
|
|
|
Color(
|
|
|
0XFF343637),
|
|
|
FontWeight
|
|
|
.w600),
|
|
|
),
|
|
|
),
|
|
|
Visibility(
|
|
|
visible: statusTime
|
|
|
.isNotEmpty,
|
|
|
child: Padding(
|
|
|
padding: const EdgeInsets
|
|
|
.only(
|
|
|
top: 4.0,
|
|
|
bottom:
|
|
|
4.0),
|
|
|
child:
|
|
|
Container(
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
horizontal:
|
|
|
6,
|
|
|
vertical:
|
|
|
2),
|
|
|
decoration:
|
|
|
BoxDecoration(
|
|
|
color:
|
|
|
statusColor,
|
|
|
borderRadius:
|
|
|
BorderRadius.circular(
|
|
|
4),
|
|
|
),
|
|
|
child: Text(
|
|
|
statusTime,
|
|
|
style: fontTextStyle(
|
|
|
10,
|
|
|
Colors
|
|
|
.white,
|
|
|
FontWeight
|
|
|
.w500),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
Row(
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.spaceBetween,
|
|
|
children: [
|
|
|
Visibility(
|
|
|
visible: supplierOrdersList[
|
|
|
index]
|
|
|
.displayAddress !=
|
|
|
'',
|
|
|
child: Text(
|
|
|
supplierOrdersList[
|
|
|
index]
|
|
|
.displayAddress,
|
|
|
style: fontTextStyle(
|
|
|
10,
|
|
|
Color(
|
|
|
0XFF646566),
|
|
|
FontWeight
|
|
|
.w400),
|
|
|
),
|
|
|
),
|
|
|
Visibility(
|
|
|
visible: supplierOrdersList[
|
|
|
index]
|
|
|
.date !=
|
|
|
'',
|
|
|
child: Text(
|
|
|
supplierOrdersList[
|
|
|
index]
|
|
|
.date +
|
|
|
' ' +
|
|
|
supplierOrdersList[
|
|
|
index]
|
|
|
.time,
|
|
|
style: fontTextStyle(
|
|
|
9,
|
|
|
Color(
|
|
|
0XFF646566),
|
|
|
FontWeight
|
|
|
.w400),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(
|
|
|
context)
|
|
|
.size
|
|
|
.height *
|
|
|
.012,
|
|
|
),
|
|
|
Row(
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.spaceBetween,
|
|
|
children: [
|
|
|
Column(
|
|
|
crossAxisAlignment:
|
|
|
CrossAxisAlignment
|
|
|
.start,
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.start,
|
|
|
children: [
|
|
|
Container(
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
horizontal:
|
|
|
4,
|
|
|
vertical:
|
|
|
2),
|
|
|
decoration:
|
|
|
BoxDecoration(
|
|
|
color: supplierOrdersList[index].typeofwater.toString().toLowerCase() ==
|
|
|
'bore water'
|
|
|
? Color(
|
|
|
0xFF8877DD)
|
|
|
: Color(
|
|
|
0xFFCA86B0),
|
|
|
borderRadius:
|
|
|
BorderRadius.circular(
|
|
|
4),
|
|
|
border:
|
|
|
Border
|
|
|
.all(
|
|
|
width:
|
|
|
1,
|
|
|
color: supplierOrdersList[index].typeofwater.toString().toLowerCase() ==
|
|
|
'bore water'
|
|
|
? Color(0xFF8877DD)
|
|
|
: Color(0xFFCA86B0),
|
|
|
),
|
|
|
),
|
|
|
child:
|
|
|
AutoSizeText(
|
|
|
capitalizeFirst(
|
|
|
supplierOrdersList[index]
|
|
|
.typeofwater),
|
|
|
maxLines:
|
|
|
1,
|
|
|
overflow:
|
|
|
TextOverflow
|
|
|
.ellipsis,
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(
|
|
|
0xFFFFFFFF),
|
|
|
FontWeight
|
|
|
.w400),
|
|
|
),
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
Text(
|
|
|
'₹' +
|
|
|
AppSettings.formDouble(supplierOrdersList[index].quotedAmount) +
|
|
|
'/',
|
|
|
style: fontTextStyle(
|
|
|
20,
|
|
|
Color(0XFF515253),
|
|
|
FontWeight.w600),
|
|
|
),
|
|
|
Text(
|
|
|
supplierOrdersList[index]
|
|
|
.capacity,
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w600),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
GestureDetector(
|
|
|
onTap: statusTime ==
|
|
|
"Expired"
|
|
|
? null
|
|
|
: () {
|
|
|
showRejectOrdersDialog(supplierOrdersList[index]);
|
|
|
},
|
|
|
child:
|
|
|
ColorFiltered(
|
|
|
colorFilter: statusTime ==
|
|
|
"Expired"
|
|
|
? ColorFilter.mode(
|
|
|
Color(
|
|
|
0XFF9F9F9F),
|
|
|
BlendMode
|
|
|
.srcIn)
|
|
|
: ColorFilter.mode(
|
|
|
Colors.transparent,
|
|
|
BlendMode.multiply),
|
|
|
child: Image
|
|
|
.asset(
|
|
|
'images/wrong_button.png',
|
|
|
width:
|
|
|
44,
|
|
|
height:
|
|
|
44,
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context)
|
|
|
.size
|
|
|
.width *
|
|
|
.012,
|
|
|
),
|
|
|
GestureDetector(
|
|
|
onTap: statusTime ==
|
|
|
"Expired"
|
|
|
? null
|
|
|
: () async {
|
|
|
// showAcceptOrdersDialog(supplierOrdersList[index]);
|
|
|
final result =
|
|
|
await Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => OrderDetails(
|
|
|
supplierDetails: supplierOrdersList[index],
|
|
|
),
|
|
|
),
|
|
|
);
|
|
|
;
|
|
|
if (result ==
|
|
|
true) {
|
|
|
getConnectedSuppliersData();
|
|
|
getOrdersData();
|
|
|
getAcceptedOrdersFromSupplier();
|
|
|
getAcceptedPlansFromSupplier();
|
|
|
}
|
|
|
},
|
|
|
child:
|
|
|
ColorFiltered(
|
|
|
colorFilter: statusTime ==
|
|
|
"Expired"
|
|
|
? ColorFilter.mode(
|
|
|
Color(
|
|
|
0XFF9F9F9F),
|
|
|
BlendMode
|
|
|
.srcIn)
|
|
|
: ColorFilter.mode(
|
|
|
Colors.transparent,
|
|
|
BlendMode.multiply),
|
|
|
child: Image
|
|
|
.asset(
|
|
|
'images/right_button.png',
|
|
|
width:
|
|
|
44,
|
|
|
height:
|
|
|
44,
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
)),
|
|
|
);
|
|
|
},
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context)
|
|
|
.size
|
|
|
.height *
|
|
|
.010,
|
|
|
),
|
|
|
SmoothPageIndicator(
|
|
|
controller: _pageController1,
|
|
|
count: supplierOrdersList.length,
|
|
|
effect: ExpandingDotsEffect(
|
|
|
activeDotColor: Colors.blueAccent,
|
|
|
dotHeight: 3,
|
|
|
dotWidth: 3,
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
)
|
|
|
: Center(
|
|
|
child: Text(
|
|
|
'No Data Available',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF000000),
|
|
|
FontWeight.w500),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
)),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .024,
|
|
|
),
|
|
|
|
|
|
Visibility(
|
|
|
visible: planRequestsList.length != 0,
|
|
|
child: Column(
|
|
|
children: [
|
|
|
GestureDetector(
|
|
|
onTap: () {
|
|
|
Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => PlanRequestsScreen()),
|
|
|
);
|
|
|
},
|
|
|
child: Row(
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
Text(
|
|
|
'Plan Requests',
|
|
|
style: fontTextStyle(
|
|
|
14, Color(0XFF2A2A2A), FontWeight.w600),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width:
|
|
|
MediaQuery.of(context).size.width * .093,
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
Image.asset(
|
|
|
'images/arrow-right.png',
|
|
|
fit: BoxFit.cover,
|
|
|
width:
|
|
|
16, // Match the diameter of the CircleAvatar
|
|
|
height: 16,
|
|
|
),
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
)),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .012,
|
|
|
),
|
|
|
Center(
|
|
|
child: Container(
|
|
|
width: double.infinity,
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
height: 230,
|
|
|
padding: EdgeInsets.all(0),
|
|
|
child: isPlanRequestsDataLoading
|
|
|
? Center(
|
|
|
child: CircularProgressIndicator(
|
|
|
color: primaryColor,
|
|
|
strokeWidth: 5.0,
|
|
|
),
|
|
|
)
|
|
|
: planRequestsList.length != 0
|
|
|
? Column(
|
|
|
children: [
|
|
|
Expanded(
|
|
|
child: PageView.builder(
|
|
|
controller:
|
|
|
_pageControllerForPlans,
|
|
|
itemCount:
|
|
|
planRequestsList.length,
|
|
|
itemBuilder: (context, index) {
|
|
|
final plans =
|
|
|
planRequestsList[index];
|
|
|
|
|
|
final orderDateTime =
|
|
|
"${plans.acceptedTime}"
|
|
|
.trim();
|
|
|
final statusTime =
|
|
|
getOrderTimeOnly(
|
|
|
orderDateTime);
|
|
|
|
|
|
// status badge color
|
|
|
Color statusColor =
|
|
|
Color(0xFF1D7AFC);
|
|
|
if (statusTime == "Expired") {
|
|
|
statusColor =
|
|
|
Color(0xFF757575);
|
|
|
} else if (statusTime ==
|
|
|
"New") {
|
|
|
statusColor =
|
|
|
Color(0XFF1D7AFC);
|
|
|
} else if (statusTime
|
|
|
.endsWith("m")) {
|
|
|
statusColor =
|
|
|
Color(0XFFE56910);
|
|
|
}
|
|
|
|
|
|
final int totalOrders =
|
|
|
planRequestsList[index]
|
|
|
.dates
|
|
|
.length;
|
|
|
final double biddingPrice =
|
|
|
double.tryParse(
|
|
|
planRequestsList[
|
|
|
index]
|
|
|
.biddingPrice) ??
|
|
|
0;
|
|
|
|
|
|
final double totalAmount =
|
|
|
totalOrders * biddingPrice;
|
|
|
return Container(
|
|
|
decoration: BoxDecoration(
|
|
|
color: Color(
|
|
|
0XFFFFFFFF), // Same as Card color
|
|
|
borderRadius:
|
|
|
BorderRadius.circular(
|
|
|
12), // Rounded corners
|
|
|
border: Border.all(
|
|
|
color: Color(
|
|
|
0XFF1D7AFC), // Border color
|
|
|
width:
|
|
|
0.5, // Border width
|
|
|
),
|
|
|
),
|
|
|
//color: Color(0XFFFFFFFF),
|
|
|
child: Padding(
|
|
|
padding:
|
|
|
EdgeInsets.all(12),
|
|
|
child: Column(
|
|
|
mainAxisSize:
|
|
|
MainAxisSize.min,
|
|
|
crossAxisAlignment:
|
|
|
CrossAxisAlignment
|
|
|
.start,
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.start,
|
|
|
children: [
|
|
|
Row(
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.spaceBetween,
|
|
|
children: [
|
|
|
Visibility(
|
|
|
visible: planRequestsList[
|
|
|
index]
|
|
|
.supplierName !=
|
|
|
'',
|
|
|
child: Text(
|
|
|
planRequestsList[
|
|
|
index]
|
|
|
.supplierName,
|
|
|
style: fontTextStyle(
|
|
|
14,
|
|
|
Color(
|
|
|
0XFF343637),
|
|
|
FontWeight
|
|
|
.w600),
|
|
|
),
|
|
|
),
|
|
|
Visibility(
|
|
|
visible: statusTime
|
|
|
.isNotEmpty,
|
|
|
child: Padding(
|
|
|
padding: const EdgeInsets
|
|
|
.only(
|
|
|
top: 4.0,
|
|
|
bottom:
|
|
|
4.0),
|
|
|
child:
|
|
|
Container(
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
horizontal:
|
|
|
6,
|
|
|
vertical:
|
|
|
2),
|
|
|
decoration:
|
|
|
BoxDecoration(
|
|
|
color:
|
|
|
statusColor,
|
|
|
borderRadius:
|
|
|
BorderRadius.circular(
|
|
|
4),
|
|
|
),
|
|
|
child: Text(
|
|
|
statusTime,
|
|
|
style: fontTextStyle(
|
|
|
10,
|
|
|
Colors
|
|
|
.white,
|
|
|
FontWeight
|
|
|
.w500),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
Row(
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.spaceBetween,
|
|
|
children: [
|
|
|
Visibility(
|
|
|
visible: planRequestsList[
|
|
|
index]
|
|
|
.displayAddress !=
|
|
|
'',
|
|
|
child: Text(
|
|
|
planRequestsList[
|
|
|
index]
|
|
|
.displayAddress,
|
|
|
style: fontTextStyle(
|
|
|
10,
|
|
|
Color(
|
|
|
0XFF646566),
|
|
|
FontWeight
|
|
|
.w400),
|
|
|
),
|
|
|
),
|
|
|
Visibility(
|
|
|
visible: planRequestsList[
|
|
|
index]
|
|
|
.startDate !=
|
|
|
'',
|
|
|
child: Text(
|
|
|
planRequestsList[
|
|
|
index]
|
|
|
.startDate +
|
|
|
' to ' +
|
|
|
planRequestsList[
|
|
|
index]
|
|
|
.endDate,
|
|
|
style: fontTextStyle(
|
|
|
9,
|
|
|
Color(
|
|
|
0XFF646566),
|
|
|
FontWeight
|
|
|
.w400),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(
|
|
|
context)
|
|
|
.size
|
|
|
.height *
|
|
|
.012,
|
|
|
),
|
|
|
Row(
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.spaceBetween,
|
|
|
children: [
|
|
|
Column(
|
|
|
crossAxisAlignment:
|
|
|
CrossAxisAlignment
|
|
|
.start,
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.start,
|
|
|
children: [
|
|
|
Container(
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
horizontal:
|
|
|
4,
|
|
|
vertical:
|
|
|
2),
|
|
|
decoration:
|
|
|
BoxDecoration(
|
|
|
color: planRequestsList[index].typeofwater.toString().toLowerCase() ==
|
|
|
'bore water'
|
|
|
? Color(
|
|
|
0xFF8877DD)
|
|
|
: Color(
|
|
|
0xFFCA86B0),
|
|
|
borderRadius:
|
|
|
BorderRadius.circular(
|
|
|
4),
|
|
|
border:
|
|
|
Border
|
|
|
.all(
|
|
|
width:
|
|
|
1,
|
|
|
color: planRequestsList[index].typeofwater.toString().toLowerCase() ==
|
|
|
'bore water'
|
|
|
? Color(0xFF8877DD)
|
|
|
: Color(0xFFCA86B0),
|
|
|
),
|
|
|
),
|
|
|
child:
|
|
|
AutoSizeText(
|
|
|
capitalizeFirst(
|
|
|
planRequestsList[index]
|
|
|
.typeofwater),
|
|
|
maxLines:
|
|
|
1,
|
|
|
overflow:
|
|
|
TextOverflow
|
|
|
.ellipsis,
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(
|
|
|
0xFFFFFFFF),
|
|
|
FontWeight
|
|
|
.w400),
|
|
|
),
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
Text(
|
|
|
'Actual Price: ',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF646566),
|
|
|
FontWeight.w400),
|
|
|
),
|
|
|
Text(
|
|
|
'₹' +
|
|
|
AppSettings.formDouble(planRequestsList[index].quotedAmount) +
|
|
|
'/',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF515253),
|
|
|
FontWeight.w600),
|
|
|
),
|
|
|
Text(
|
|
|
planRequestsList[index]
|
|
|
.capacity,
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w600),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
Text(
|
|
|
'Bidding Price: ',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF646566),
|
|
|
FontWeight.w400),
|
|
|
),
|
|
|
Text(
|
|
|
'₹' +
|
|
|
AppSettings.formDouble(planRequestsList[index].biddingPrice) +
|
|
|
'/',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF515253),
|
|
|
FontWeight.w600),
|
|
|
),
|
|
|
Text(
|
|
|
planRequestsList[index]
|
|
|
.capacity,
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w600),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
Text(
|
|
|
'Frequency: ',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF646566),
|
|
|
FontWeight.w400),
|
|
|
),
|
|
|
Text(
|
|
|
planRequestsList[index].frequency +
|
|
|
'/week',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w600),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
GestureDetector(
|
|
|
onTap: statusTime ==
|
|
|
"Expired"
|
|
|
? null
|
|
|
: () {
|
|
|
showRejectPlanDialog(planRequestsList[index]);
|
|
|
},
|
|
|
child:
|
|
|
ColorFiltered(
|
|
|
colorFilter: statusTime ==
|
|
|
"Expired"
|
|
|
? ColorFilter.mode(
|
|
|
Color(
|
|
|
0XFF9F9F9F),
|
|
|
BlendMode
|
|
|
.srcIn)
|
|
|
: ColorFilter.mode(
|
|
|
Colors.transparent,
|
|
|
BlendMode.multiply),
|
|
|
child: Image
|
|
|
.asset(
|
|
|
'images/wrong_button.png',
|
|
|
width:
|
|
|
44,
|
|
|
height:
|
|
|
44,
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context)
|
|
|
.size
|
|
|
.width *
|
|
|
.012,
|
|
|
),
|
|
|
GestureDetector(
|
|
|
onTap: statusTime ==
|
|
|
"Expired"
|
|
|
? null
|
|
|
: () async{
|
|
|
// showAcceptOrdersDialog(supplierOrdersList[index]);
|
|
|
if (planRequestsList[index].paymentType ==
|
|
|
'advance') {
|
|
|
|
|
|
final result =
|
|
|
await Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => PlanDetails(
|
|
|
supplierDetails: planRequestsList[index],
|
|
|
),
|
|
|
),
|
|
|
);
|
|
|
if (result ==
|
|
|
true) {
|
|
|
getConnectedSuppliersData();
|
|
|
getOrdersData();
|
|
|
getAcceptedOrdersFromSupplier();
|
|
|
getAcceptedPlansFromSupplier();
|
|
|
}
|
|
|
} else {
|
|
|
showAcceptPlanDialog(planRequestsList[index]);
|
|
|
}
|
|
|
},
|
|
|
child:
|
|
|
ColorFiltered(
|
|
|
colorFilter: statusTime ==
|
|
|
"Expired"
|
|
|
? ColorFilter.mode(
|
|
|
Color(
|
|
|
0XFF9F9F9F),
|
|
|
BlendMode
|
|
|
.srcIn)
|
|
|
: ColorFilter.mode(
|
|
|
Colors.transparent,
|
|
|
BlendMode.multiply),
|
|
|
child: Image
|
|
|
.asset(
|
|
|
'images/right_button.png',
|
|
|
width:
|
|
|
44,
|
|
|
height:
|
|
|
44,
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(
|
|
|
context)
|
|
|
.size
|
|
|
.height *
|
|
|
.010,
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
Text(
|
|
|
'Payment Type: ',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(
|
|
|
0XFF646566),
|
|
|
FontWeight
|
|
|
.w400),
|
|
|
),
|
|
|
Text(
|
|
|
planRequestsList[
|
|
|
index]
|
|
|
.paymentType,
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(
|
|
|
0XFF515253),
|
|
|
FontWeight
|
|
|
.w600),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
Visibility(
|
|
|
visible: planRequestsList[
|
|
|
index]
|
|
|
.paymentType !=
|
|
|
'after_delivery',
|
|
|
child: Row(
|
|
|
children: [
|
|
|
Text(
|
|
|
planRequestsList[index]
|
|
|
.paymentType ==
|
|
|
'credit'
|
|
|
? 'Credit Limit: '
|
|
|
: 'Advance Amount: ',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(
|
|
|
0XFF646566),
|
|
|
FontWeight
|
|
|
.w400),
|
|
|
),
|
|
|
Text(
|
|
|
planRequestsList[
|
|
|
index]
|
|
|
.advanceAmount,
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(
|
|
|
0XFF515253),
|
|
|
FontWeight
|
|
|
.w600),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
Text.rich(
|
|
|
TextSpan(
|
|
|
children: [
|
|
|
TextSpan(
|
|
|
text:
|
|
|
"Total amount for this plan orders ",
|
|
|
style:
|
|
|
fontTextStyle(
|
|
|
12,
|
|
|
const Color(
|
|
|
0xFF939495),
|
|
|
FontWeight
|
|
|
.w400,
|
|
|
),
|
|
|
),
|
|
|
TextSpan(
|
|
|
text:
|
|
|
'$totalOrders × ${biddingPrice.toStringAsFixed(0)} = ₹${totalAmount.toStringAsFixed(0)}',
|
|
|
style:
|
|
|
fontTextStyle(
|
|
|
12,
|
|
|
const Color(
|
|
|
0xFF515253),
|
|
|
FontWeight
|
|
|
.w500,
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
softWrap: true,
|
|
|
maxLines: 2,
|
|
|
overflow:
|
|
|
TextOverflow
|
|
|
.visible,
|
|
|
textAlign: TextAlign
|
|
|
.center,
|
|
|
)
|
|
|
],
|
|
|
)),
|
|
|
);
|
|
|
},
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context)
|
|
|
.size
|
|
|
.height *
|
|
|
.010,
|
|
|
),
|
|
|
SmoothPageIndicator(
|
|
|
controller: _pageControllerForPlans,
|
|
|
count: planRequestsList.length,
|
|
|
effect: ExpandingDotsEffect(
|
|
|
activeDotColor: Colors.blueAccent,
|
|
|
dotHeight: 3,
|
|
|
dotWidth: 3,
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
)
|
|
|
: Center(
|
|
|
child: Text(
|
|
|
'No Data Available',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF000000),
|
|
|
FontWeight.w500),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
)),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .024,
|
|
|
),
|
|
|
|
|
|
Row(
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
Text(
|
|
|
'Today’s Price',
|
|
|
style:
|
|
|
fontTextStyle(14, Color(0XFF2A2A2A), FontWeight.w600),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .093,
|
|
|
),
|
|
|
GestureDetector(
|
|
|
onTap: () {
|
|
|
Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => TodaysPriceMainScreen()),
|
|
|
);
|
|
|
},
|
|
|
child: Row(
|
|
|
children: [
|
|
|
Image.asset(
|
|
|
'images/arrow-right.png',
|
|
|
fit: BoxFit.cover,
|
|
|
width: 16, // Match the diameter of the CircleAvatar
|
|
|
height: 16,
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .006,
|
|
|
),
|
|
|
Column(
|
|
|
children: [
|
|
|
GestureDetector(
|
|
|
onTap: () {
|
|
|
/* Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => SupplyCalendarScreen()),
|
|
|
);*/
|
|
|
},
|
|
|
child: Card(
|
|
|
color: Colors.white,
|
|
|
//width: MediaQuery.of(context).size.height * .14,
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 12),
|
|
|
child: Row(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
children: [
|
|
|
Text(
|
|
|
'DRINKING WATER',
|
|
|
style: fontTextStyle(12,
|
|
|
Color(0XFF646566), FontWeight.w500),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height:
|
|
|
MediaQuery.of(context).size.height *
|
|
|
.012,
|
|
|
),
|
|
|
Container(
|
|
|
decoration: BoxDecoration(
|
|
|
color: Color(0xFFED8C85),
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
border: Border.all(
|
|
|
color: Color(0xFFED8C85), width: 1),
|
|
|
),
|
|
|
padding: EdgeInsets.all(2),
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize
|
|
|
.min, // Important for wrapping content
|
|
|
children: [
|
|
|
Image.asset(
|
|
|
'images/long_arrow_down.png',
|
|
|
fit: BoxFit.cover,
|
|
|
width: 8,
|
|
|
height: 8,
|
|
|
),
|
|
|
SizedBox(
|
|
|
width:
|
|
|
4), // spacing between image and text
|
|
|
Text(
|
|
|
'0.35%',
|
|
|
style: fontTextStyle(
|
|
|
10,
|
|
|
Color(0xFFFFFFFF),
|
|
|
FontWeight.w400),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
children: [
|
|
|
Text(
|
|
|
'Avg',
|
|
|
style: fontTextStyle(10,
|
|
|
Color(0XFF757575), FontWeight.w400),
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
Text(
|
|
|
'₹ 1,432/',
|
|
|
style: fontTextStyle(
|
|
|
20,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w600),
|
|
|
),
|
|
|
Text(
|
|
|
'5,000L',
|
|
|
style: fontTextStyle(
|
|
|
14,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w600),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
)),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .024,
|
|
|
),
|
|
|
GestureDetector(
|
|
|
onTap: () {
|
|
|
/* Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => SupplyCalendarScreen()),
|
|
|
);*/
|
|
|
},
|
|
|
child: Card(
|
|
|
color: Colors.white,
|
|
|
//width: MediaQuery.of(context).size.height * .14,
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 12),
|
|
|
child: Row(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
children: [
|
|
|
Text(
|
|
|
'BORE WATER',
|
|
|
style: fontTextStyle(12,
|
|
|
Color(0XFF646566), FontWeight.w500),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height:
|
|
|
MediaQuery.of(context).size.height *
|
|
|
.012,
|
|
|
),
|
|
|
Container(
|
|
|
decoration: BoxDecoration(
|
|
|
color: Color(0XFF36AF31),
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
border: Border.all(
|
|
|
color: Color(0XFF36AF31), width: 1),
|
|
|
),
|
|
|
padding: EdgeInsets.all(2),
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize
|
|
|
.min, // Important for wrapping content
|
|
|
children: [
|
|
|
Image.asset(
|
|
|
'images/long_arrow_up.png',
|
|
|
fit: BoxFit.cover,
|
|
|
width: 8,
|
|
|
height: 8,
|
|
|
),
|
|
|
SizedBox(
|
|
|
width:
|
|
|
4), // spacing between image and text
|
|
|
Text(
|
|
|
'0.23%',
|
|
|
style: fontTextStyle(
|
|
|
10,
|
|
|
Color(0xFFFFFFFF),
|
|
|
FontWeight.w400),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
children: [
|
|
|
Text(
|
|
|
'Avg',
|
|
|
style: fontTextStyle(10,
|
|
|
Color(0XFF757575), FontWeight.w400),
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
Text(
|
|
|
'₹ 840/',
|
|
|
style: fontTextStyle(
|
|
|
20,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w600),
|
|
|
),
|
|
|
Text(
|
|
|
'5,000L',
|
|
|
style: fontTextStyle(
|
|
|
14,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w600),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
)),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .024,
|
|
|
),
|
|
|
Row(
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
Text(
|
|
|
'My Suppliers',
|
|
|
style:
|
|
|
fontTextStyle(14, Color(0XFF2A2A2A), FontWeight.w600),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .093,
|
|
|
),
|
|
|
GestureDetector(
|
|
|
onTap: () {
|
|
|
Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => MySuppliers(
|
|
|
navigationFrom: 'dashboard',
|
|
|
)),
|
|
|
);
|
|
|
},
|
|
|
child: Row(
|
|
|
children: [
|
|
|
Image.asset(
|
|
|
'images/arrow-right.png',
|
|
|
fit: BoxFit.cover,
|
|
|
width: 16, // Match the diameter of the CircleAvatar
|
|
|
height: 16,
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
Container(
|
|
|
height: 100,
|
|
|
child: isConnectedDataLoading
|
|
|
? Center(
|
|
|
child: CircularProgressIndicator(
|
|
|
color: primaryColor,
|
|
|
strokeWidth: 5.0,
|
|
|
),
|
|
|
)
|
|
|
: connectedSuppliersList.isNotEmpty
|
|
|
? ListView.separated(
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
padding: EdgeInsets.all(8),
|
|
|
itemCount: connectedSuppliersList.length,
|
|
|
separatorBuilder: (context, index) => SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .03,
|
|
|
),
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
return Padding(
|
|
|
padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
child: Column(
|
|
|
crossAxisAlignment:
|
|
|
CrossAxisAlignment.center,
|
|
|
children: [
|
|
|
CircleAvatar(
|
|
|
radius: 35,
|
|
|
backgroundColor: Color(0XFFE8F2FF),
|
|
|
child: Image.asset(
|
|
|
'images/profile_user.png',
|
|
|
fit: BoxFit.cover,
|
|
|
width: 70,
|
|
|
height: 70,
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context)
|
|
|
.size
|
|
|
.width *
|
|
|
.012),
|
|
|
Text(
|
|
|
connectedSuppliersList[index]
|
|
|
.supplier_name,
|
|
|
style: fontTextStyle(10,
|
|
|
Color(0XFF646566), FontWeight.w400),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
},
|
|
|
)
|
|
|
: Center(
|
|
|
child: Text(
|
|
|
'No Data Available',
|
|
|
style: fontTextStyle(
|
|
|
12, Color(0XFF000000), FontWeight.w500),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height * .024,
|
|
|
),
|
|
|
Row(
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
Text(
|
|
|
'Upcoming Deliveries',
|
|
|
style:
|
|
|
fontTextStyle(14, Color(0XFF2A2A2A), FontWeight.w600),
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(context).size.width * .093,
|
|
|
),
|
|
|
Row(
|
|
|
children: [
|
|
|
GestureDetector(
|
|
|
onTap: () {
|
|
|
Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
builder: (context) => MyOrders(
|
|
|
navigationFrom: 'dashboard',
|
|
|
),
|
|
|
),
|
|
|
);
|
|
|
},
|
|
|
child: Image.asset(
|
|
|
'images/arrow-right.png',
|
|
|
fit: BoxFit.cover,
|
|
|
width: 16, // Match the diameter of the CircleAvatar
|
|
|
height: 16,
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
Center(
|
|
|
child: Container(
|
|
|
width: double.infinity,
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
height: 160,
|
|
|
padding: EdgeInsets.all(0),
|
|
|
child: isOrdersDataLoading
|
|
|
? Center(
|
|
|
child: CircularProgressIndicator(
|
|
|
color: primaryColor,
|
|
|
strokeWidth: 5.0,
|
|
|
),
|
|
|
)
|
|
|
: upcomingOrders.length != 0
|
|
|
? Column(
|
|
|
children: [
|
|
|
Expanded(
|
|
|
child: PageView.builder(
|
|
|
controller: _pageController,
|
|
|
itemCount: upcomingOrders.length,
|
|
|
itemBuilder: (context, index) {
|
|
|
return Card(
|
|
|
color: Color(0XFFFFFFFF),
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.all(16),
|
|
|
child: Column(
|
|
|
crossAxisAlignment:
|
|
|
CrossAxisAlignment.start,
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment.start,
|
|
|
children: [
|
|
|
Row(
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.spaceBetween,
|
|
|
children: [
|
|
|
Visibility(
|
|
|
visible: upcomingOrders[
|
|
|
index]
|
|
|
.supplierName !=
|
|
|
'',
|
|
|
child: Text(
|
|
|
upcomingOrders[index]
|
|
|
.supplierName,
|
|
|
style: fontTextStyle(
|
|
|
16,
|
|
|
Color(0XFF2D2E30),
|
|
|
FontWeight.w600),
|
|
|
),
|
|
|
),
|
|
|
Align(
|
|
|
alignment: Alignment
|
|
|
.centerRight,
|
|
|
child: Container(
|
|
|
padding: EdgeInsets
|
|
|
.fromLTRB(
|
|
|
4, 2, 2, 4),
|
|
|
decoration:
|
|
|
BoxDecoration(
|
|
|
color: Color(
|
|
|
0XFFFFFFFF), // Same as Card color
|
|
|
borderRadius:
|
|
|
BorderRadius
|
|
|
.circular(
|
|
|
4), // Rounded corners
|
|
|
border:
|
|
|
Border.all(
|
|
|
color: Color(
|
|
|
0XFFFFFFFF), // Border color
|
|
|
width:
|
|
|
1, // Border width
|
|
|
),
|
|
|
),
|
|
|
child: Row(
|
|
|
children: [
|
|
|
Image.asset(
|
|
|
'images/credit.png',
|
|
|
width:
|
|
|
12, // Adjust as needed
|
|
|
height:
|
|
|
12, // Adjust as needed
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(
|
|
|
context)
|
|
|
.size
|
|
|
.width *
|
|
|
.008,
|
|
|
),
|
|
|
Text(
|
|
|
'Credit Account',
|
|
|
style: fontTextStyle(
|
|
|
9,
|
|
|
Color(
|
|
|
0XFF2D2E30),
|
|
|
FontWeight
|
|
|
.w500),
|
|
|
),
|
|
|
],
|
|
|
)),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
Visibility(
|
|
|
visible:
|
|
|
upcomingOrders[index]
|
|
|
.typeofwater !=
|
|
|
'',
|
|
|
child: Text(
|
|
|
upcomingOrders[index]
|
|
|
.typeofwater,
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF4692FD),
|
|
|
FontWeight.w400),
|
|
|
),
|
|
|
),
|
|
|
Visibility(
|
|
|
visible: upcomingOrders[
|
|
|
index]
|
|
|
.displayAddress !=
|
|
|
'',
|
|
|
child: Text(
|
|
|
upcomingOrders[index]
|
|
|
.displayAddress,
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(0XFF515253),
|
|
|
FontWeight.w400),
|
|
|
),
|
|
|
),
|
|
|
Row(
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.spaceBetween,
|
|
|
children: [
|
|
|
Visibility(
|
|
|
visible: true,
|
|
|
child: Text(
|
|
|
upcomingOrders[index]
|
|
|
.displayDateOfOrder,
|
|
|
style: fontTextStyle(
|
|
|
10,
|
|
|
Color(0XFF939495),
|
|
|
FontWeight.w500),
|
|
|
),
|
|
|
),
|
|
|
Align(
|
|
|
alignment: Alignment
|
|
|
.centerRight,
|
|
|
child: Visibility(
|
|
|
visible:
|
|
|
upcomingOrders[
|
|
|
index]
|
|
|
.price !=
|
|
|
'',
|
|
|
child: Text(
|
|
|
'₹ ' +
|
|
|
upcomingOrders[
|
|
|
index]
|
|
|
.price,
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(
|
|
|
0XFF515253),
|
|
|
FontWeight
|
|
|
.w400),
|
|
|
),
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
Divider(
|
|
|
color: Colors.grey.shade300,
|
|
|
),
|
|
|
Align(
|
|
|
alignment: Alignment.center,
|
|
|
child: Row(
|
|
|
mainAxisAlignment:
|
|
|
MainAxisAlignment
|
|
|
.center,
|
|
|
crossAxisAlignment:
|
|
|
CrossAxisAlignment
|
|
|
.center,
|
|
|
children: [
|
|
|
GestureDetector(
|
|
|
child: Text(
|
|
|
'TRACK ORDER',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(
|
|
|
0XFF1D7AFC),
|
|
|
FontWeight
|
|
|
.w600)),
|
|
|
onTap: () {},
|
|
|
),
|
|
|
SizedBox(
|
|
|
width: MediaQuery.of(
|
|
|
context)
|
|
|
.size
|
|
|
.width *
|
|
|
.15,
|
|
|
),
|
|
|
GestureDetector(
|
|
|
child: Text('CANCEL',
|
|
|
style: fontTextStyle(
|
|
|
12,
|
|
|
Color(
|
|
|
0XFFE2483D),
|
|
|
FontWeight
|
|
|
.w600)),
|
|
|
onTap: () {},
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
)),
|
|
|
);
|
|
|
},
|
|
|
),
|
|
|
),
|
|
|
SizedBox(
|
|
|
height: MediaQuery.of(context).size.height *
|
|
|
.010,
|
|
|
),
|
|
|
SmoothPageIndicator(
|
|
|
controller: _pageController,
|
|
|
count: upcomingOrders.length,
|
|
|
effect: ExpandingDotsEffect(
|
|
|
activeDotColor: Colors.blueAccent,
|
|
|
dotHeight: 3,
|
|
|
dotWidth: 3,
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
)
|
|
|
: Center(
|
|
|
child: Text(
|
|
|
'No Data Available',
|
|
|
style: fontTextStyle(
|
|
|
12, Color(0XFF000000), FontWeight.w500),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
)),
|
|
|
]),
|
|
|
);
|
|
|
}
|
|
|
}
|