Compare commits

...

3 Commits

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

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

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

Loading…
Cancel
Save