Compare commits

...

3 Commits

@ -51,7 +51,7 @@ class _ResourcesDriverScreenState extends State<ResourcesDriverScreen> {
String search = '';
bool isLoading = false;
List<DriversModel> driversList = [];
String selectedStatus = "all";
// ---------- form (bottom sheet) ----------
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
@ -1319,6 +1319,27 @@ class _ResourcesDriverScreenState extends State<ResourcesDriverScreen> {
bool matchesFilter = true;
// Top metric click filter
if(selectedStatus != "all"){
if(selectedStatus == "delivery"){
matchesFilter =
it.status.toLowerCase().trim() == "on delivery";
}
if(selectedStatus == "available"){
matchesFilter =
it.status.toLowerCase().trim() == "available";
}
if(selectedStatus == "offline"){
matchesFilter =
it.status.toLowerCase().trim() == "offline";
}
}
// Menu filter
if(selectedFilter!=null){
matchesFilter =
@ -1408,29 +1429,58 @@ class _ResourcesDriverScreenState extends State<ResourcesDriverScreen> {
child: IntrinsicHeight(
child: Row(
children: [
Expanded(
child: SmallMetricBox(
title: 'On delivery',
value: onDeliveryCount.toString(),
child: GestureDetector(
onTap: (){
setState(() {
selectedStatus = "delivery";
selectedFilter = null;
});
},
child: SmallMetricBox(
title: 'On delivery',
value: onDeliveryCount.toString(),
),
),
),
const SizedBox(width: 8),
Expanded(
child: SmallMetricBox(
title: 'Available',
value: availableCount.toString(),
child: GestureDetector(
onTap: (){
setState(() {
selectedStatus = "available";
selectedFilter = null;
});
},
child: SmallMetricBox(
title: 'Available',
value: availableCount.toString(),
),
),
),
const SizedBox(width: 8),
Expanded(
child: SmallMetricBox(
title: 'Offline',
value: offlineCount.toString(),
child: GestureDetector(
onTap: (){
setState(() {
selectedStatus = "offline";
selectedFilter = null;
});
},
child: SmallMetricBox(
title: 'Offline',
value: offlineCount.toString(),
),
),
),
],
),
),
),

@ -1553,6 +1553,7 @@ class _ResourcesFleetScreenState extends State<ResourcesFleetScreen> {
onTap: (){
setState(() {
selectedFilter = "Maintenance";
});
},
child: SmallMetricBox(

@ -88,6 +88,7 @@ class _ResourcesSourceScreenState extends State<ResourcesSourceScreen> {
int selectedTab = 2;
String search = '';
bool isLoading = false;
String selectedWaterFilter = "all";
List<SourceLocationsModel> sourceLocationsList = [];
// ---------- Form state (bottom sheet) ----------
@ -716,6 +717,16 @@ class _ResourcesSourceScreenState extends State<ResourcesSourceScreen> {
bool matchesFilter = true;
// Top metric filter
if(selectedWaterFilter != "all"){
matchesFilter =
it.water_type.toLowerCase().trim() ==
selectedWaterFilter;
}
// Menu filter
if(selectedFilter!=null){
matchesFilter =
@ -813,29 +824,58 @@ class _ResourcesSourceScreenState extends State<ResourcesSourceScreen> {
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: SmallMetricBox(
title: 'Drinking water',
value: drinkingCount.toString(),
child: GestureDetector(
onTap: (){
setState(() {
selectedWaterFilter = "drinking water";
selectedFilter = null;
});
},
child: SmallMetricBox(
title: 'Drinking water',
value: drinkingCount.toString(),
),
),
),
const SizedBox(width: 8),
Expanded(
child: SmallMetricBox(
title: 'Bore water',
value: boreCount.toString(),
child: GestureDetector(
onTap: (){
setState(() {
selectedWaterFilter = "bore water";
selectedFilter = null;
});
},
child: SmallMetricBox(
title: 'Bore water',
value: boreCount.toString(),
),
),
),
const SizedBox(width: 8),
Expanded(
child: SmallMetricBox(
title: 'Both',
value: bothCount.toString(),
child: GestureDetector(
onTap: (){
setState(() {
selectedWaterFilter = "both";
selectedFilter = null;
});
},
child: SmallMetricBox(
title: 'Both',
value: bothCount.toString(),
),
),
),
],
),
),
],
),

Loading…
Cancel
Save