@ -7,13 +7,14 @@ import 'package:test_sa/extensions/text_extensions.dart';
import ' package:test_sa/extensions/widget_extensions.dart ' ;
import ' package:test_sa/models/lookup.dart ' ;
import ' package:test_sa/models/new_models/site.dart ' ;
import ' package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart ' ;
import ' package:test_sa/new_views/app_style/app_color.dart ' ;
import ' package:test_sa/new_views/common_widgets/app_filled_button.dart ' ;
import ' package:test_sa/new_views/common_widgets/multiple_item_drop_down_menu.dart ' ;
import ' package:test_sa/providers/department_provider.dart ' ;
import ' package:test_sa/providers/gas_request_providers/site_provider.dart ' ;
import ' package:test_sa/views/widgets/date_and_time/date_picker.dart ' ;
import ' package:test_sa/views/widgets/equipment/ commissioning _status_buttons.dart' ;
import ' package:test_sa/views/widgets/equipment/ asset _status_buttons.dart' ;
import ' ../../../models/device/asset_search.dart ' ;
import ' ../../../new_views/common_widgets/app_lazy_loading.dart ' ;
@ -69,115 +70,110 @@ class _DeviceFilterScreenState extends State<DeviceFilterScreen> {
@ override
Widget build ( BuildContext context ) {
return SafeArea (
top: false ,
child: Scaffold (
appBar: DefaultAppBar (
title: context . translation . filter ,
actions: [
if ( loading = = false & & _showResetButton ( ) )
TextButton (
onPressed: ( ) {
setState ( ( ) {
startDate = null ;
endDate = null ;
_selectedDepartments = [ ] ;
_selectedSites = [ ] ;
_commissioningStatus = null ;
} ) ;
return Scaffold (
appBar: DefaultAppBar (
title: context . translation . filter ,
actions: [
if ( loading = = false & & _showResetButton ( ) )
TextButton (
onPressed: ( ) {
setState ( ( ) {
startDate = null ;
endDate = null ;
_selectedDepartments = [ ] ;
_selectedSites = [ ] ;
_commissioningStatus = null ;
} ) ;
} ,
style: TextButton . styleFrom ( padding: EdgeInsets . zero , tapTargetSize: MaterialTapTargetSize . shrinkWrap ) ,
child: Text (
' Clear Filters ' ,
style: AppTextStyles . bodyText2 . copyWith ( color: AppColor . primary10 ) ,
) ,
) . paddingOnly ( start: 16 , end: 16 )
] ,
) ,
body: Column (
children: [
ListView (
padding: const EdgeInsets . all ( 16 ) ,
children: [
AssetStatusButtons (
initialValue: _commissioningStatus ,
onSelect: ( value ) {
if ( value ! = null ) {
_commissioningStatus = value ;
}
} ,
) ,
16. height ,
MultipleItemDropDownMenu < Lookup , DepartmentProvider > (
context: context ,
title: context . translation . byDepartment ,
showAsBottomSheet: true ,
backgroundColor: context . isDark ? AppColor . neutral60 : Colors . white ,
/ / backgroundColor: AppColor . fieldBgColor ( context ) ,
showShadow: true ,
height: 56. toScreenHeight ,
showCancel: true ,
onSelect: ( value ) {
if ( value ! = null ) {
setState ( ( ) {
_selectedDepartments = value ;
} ) ;
}
} ,
style: TextButton . styleFrom ( padding: EdgeInsets . zero , tapTargetSize: MaterialTapTargetSize . shrinkWrap ) ,
child: Text (
' Clear Filters ' ,
style: AppTextStyles . bodyText2 . copyWith ( color: AppColor . primary10 ) ,
) ,
) . paddingOnly ( start: 16 , end: 16 )
] ,
) ,
body: Column (
children: [
SingleChildScrollView (
child: Column (
crossAxisAlignment: CrossAxisAlignment . stretch ,
) ,
12. height ,
MultipleItemDropDownMenu < Site , SiteProvider > (
context: context ,
title: context . translation . bySite ,
showAsBottomSheet: true ,
/ / backgroundColor: AppColor . fieldBgColor ( context ) ,
backgroundColor: context . isDark ? AppColor . neutral60 : Colors . white ,
showShadow: true ,
height: 56. toScreenHeight ,
showCancel: true ,
onSelect: ( value ) {
if ( value ! = null ) {
setState ( ( ) {
_selectedSites = value ;
} ) ;
}
} ,
) ,
16. height ,
context . translation . pmDateRange . heading5 ( context ) . custom ( color: AppColor . textStyleColor ( context ) ) ,
8. height ,
Row (
children: [
CommissioningStatusButtons (
initialValue: _commissioningStatus ,
onSelect: ( value ) {
if ( value ! = null ) {
_commissioningStatus = value ;
}
} ,
) ,
16. height ,
MultipleItemDropDownMenu < Lookup , DepartmentProvider > (
context: context ,
title: context . translation . byDepartment ,
showAsBottomSheet: true ,
backgroundColor: context . isDark ? AppColor . neutral60 : Colors . white ,
/ / backgroundColor: AppColor . fieldBgColor ( context ) ,
showShadow: true ,
height: 56. toScreenHeight ,
showCancel: true ,
onSelect: ( value ) {
if ( value ! = null ) {
setState ( ( ) {
_selectedDepartments = value ;
} ) ;
}
ADatePicker (
label: context . translation . to ,
from: DateTime ( 2000 ) ,
date: DateTime . tryParse ( startDate ? ? " " ) ,
onDatePicker: ( date ) {
setState ( ( ) {
startDate = date . toIso8601String ( ) ;
} ) ;
} ,
) . paddingOnly ( start: 16 , end: 16 ) ,
8. height ,
MultipleItemDropDownMenu < Site , SiteProvider > (
context: context ,
title: context . translation . bySite ,
showAsBottomSheet: true ,
/ / backgroundColor: AppColor . fieldBgColor ( context ) ,
backgroundColor: context . isDark ? AppColor . neutral60 : Colors . white ,
showShadow: true ,
height: 56. toScreenHeight ,
showCancel: true ,
onSelect: ( value ) {
if ( value ! = null ) {
setState ( ( ) {
_selectedSites = value ;
} ) ;
}
) . expanded ,
8. width ,
ADatePicker (
label: context . translation . to ,
from: DateTime ( 2000 ) ,
date: DateTime . tryParse ( endDate ? ? " " ) ,
onDatePicker: ( date ) {
setState ( ( ) {
endDate = date . toIso8601String ( ) ;
} ) ;
} ,
) . paddingOnly ( start: 16 , end: 16 ) ,
16. height ,
context . translation . pmDateRange . heading5 ( context ) . paddingOnly ( start: 16 , end: 16 ) ,
8. height ,
Row (
children: [
ADatePicker (
label: context . translation . to ,
from: DateTime ( 2000 ) ,
date: DateTime . tryParse ( startDate ? ? " " ) ,
onDatePicker: ( date ) {
setState ( ( ) {
startDate = date . toIso8601String ( ) ;
} ) ;
} ,
) . expanded ,
8. width ,
ADatePicker (
label: context . translation . to ,
from: DateTime ( 2000 ) ,
date: DateTime . tryParse ( endDate ? ? " " ) ,
onDatePicker: ( date ) {
setState ( ( ) {
endDate = date . toIso8601String ( ) ;
} ) ;
} ,
) . expanded ,
] ,
) . paddingOnly ( start: 16 , end: 16 ) ,
) . expanded ,
] ,
) ,
). expanded ,
AppFilledButton ( onPressed: _search , label: context . translation . applyFilter ) . paddingOnly ( start: 16 , end: 16 ) ,
] ,
). paddingOnly ( top: 16 , bottom: 16 ) ,
] ,
) . expanded ,
FooterActionButton . footerContainer ( context: context , child: AppFilledButton ( onPressed: _search , label: context . translation . applyFilter ) ) ,
] ,
) ,
) ;
}