mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
tap filter
This commit is contained in:
@ -38,14 +38,13 @@ class AccessManagementPage extends StatelessWidget {
|
||||
],
|
||||
scaffoldBody: BlocProvider(create: (BuildContext context) => AccessBloc()..add(FetchTableData()),
|
||||
child: BlocConsumer<AccessBloc, AccessState>(listener: (context, state) {
|
||||
if (state is FailedState) {
|
||||
// CustomSnackBar.displaySnackBar(
|
||||
// state.errorMessage
|
||||
// );
|
||||
}
|
||||
|
||||
}, builder: (context, state) {
|
||||
final accessBloc = BlocProvider.of<AccessBloc>(context);
|
||||
return Container(
|
||||
final filteredData = accessBloc.filteredData;
|
||||
return state is AccessLoaded?
|
||||
const Center(child: CircularProgressIndicator()):
|
||||
Container(
|
||||
padding: EdgeInsets.all(30),
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
@ -61,35 +60,34 @@ class AccessManagementPage extends StatelessWidget {
|
||||
itemCount: BlocProvider.of<AccessBloc>(context).tabs.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
final isSelected = index ==
|
||||
BlocProvider.of<AccessBloc>(context).selectedIndex;
|
||||
final isSelected = index == BlocProvider.of<AccessBloc>(context).selectedIndex;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
BlocProvider.of<AccessBloc>(context).add(TabChangedEvent(index));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorsManager.boxColor,
|
||||
border: Border.all(
|
||||
color: isSelected ? Colors.blue : Colors.transparent,
|
||||
width: 2.0,),
|
||||
borderRadius: index == 0
|
||||
? const BorderRadius.only(
|
||||
topLeft: Radius.circular(10),
|
||||
bottomLeft: Radius.circular(10))
|
||||
: index == 3
|
||||
? const BorderRadius.only(
|
||||
topRight: Radius.circular(10),
|
||||
bottomRight: Radius.circular(10))
|
||||
: null),
|
||||
padding: const EdgeInsets.only(left: 10,right: 10),
|
||||
color: ColorsManager.boxColor,
|
||||
border: Border.all(
|
||||
color: isSelected ? Colors.blue : Colors.transparent,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: index == 0
|
||||
? const BorderRadius.only(
|
||||
topLeft: Radius.circular(10),
|
||||
bottomLeft: Radius.circular(10))
|
||||
: index == 3
|
||||
? const BorderRadius.only(
|
||||
topRight: Radius.circular(10),
|
||||
bottomRight: Radius.circular(10))
|
||||
: null,
|
||||
),
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: Center(
|
||||
child: Text(
|
||||
BlocProvider.of<AccessBloc>(context).tabs[index],
|
||||
style: TextStyle(
|
||||
color: isSelected
|
||||
? Colors.blue
|
||||
: Colors.black,
|
||||
color: isSelected ? Colors.blue : Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -105,12 +103,15 @@ class AccessManagementPage extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text('Name'),
|
||||
Text('Name',
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: Colors.black,fontSize: 13),),
|
||||
const SizedBox(height: 5,),
|
||||
Container(
|
||||
height:size.height * 0.053,
|
||||
width: size.width * 0.15,
|
||||
decoration: containerDecoration,
|
||||
child: TextFormField(
|
||||
@ -118,7 +119,8 @@ class AccessManagementPage extends StatelessWidget {
|
||||
style: const TextStyle(color: Colors.black),
|
||||
decoration: textBoxDecoration()!
|
||||
.copyWith(hintText: 'Please enter'),
|
||||
)),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
@ -152,6 +154,7 @@ class AccessManagementPage extends StatelessWidget {
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
accessBloc.add(FilterDataEvent(
|
||||
selectedTabIndex: BlocProvider.of<AccessBloc>(context).selectedIndex, // Pass the selected tab index
|
||||
passwordName: accessBloc.passwordName.text.toLowerCase(),
|
||||
startTime: accessBloc.effectiveTimeTimeStamp,
|
||||
endTime: accessBloc.expirationTimeTimeStamp
|
||||
@ -234,8 +237,8 @@ class AccessManagementPage extends StatelessWidget {
|
||||
height: 20,
|
||||
),
|
||||
Expanded(
|
||||
child: state is TableLoaded
|
||||
? DynamicTable(
|
||||
child: DynamicTable(
|
||||
isEmpty: filteredData.isEmpty ,
|
||||
withCheckBox: false,
|
||||
size: size,
|
||||
cellDecoration: containerDecoration,
|
||||
@ -243,102 +246,30 @@ class AccessManagementPage extends StatelessWidget {
|
||||
'Name',
|
||||
'Access Type',
|
||||
'Access Period',
|
||||
'Device Id',
|
||||
'Accessible Device',
|
||||
'Authorizer',
|
||||
'Authorization Date & Time',
|
||||
'Access Status'
|
||||
],
|
||||
data: state.data.map((item) {
|
||||
data: filteredData.map((item) {
|
||||
return [
|
||||
item.passwodName.toString(),
|
||||
item.passwordName.toString(),
|
||||
item.passwordType.value,
|
||||
('${accessBloc.timestampToDate(item.effectiveTime)} - ${accessBloc.timestampToDate(item.invalidTime)}'),
|
||||
item.deviceUuid.toString(),
|
||||
'',
|
||||
'',
|
||||
''
|
||||
item.passwordStatus.value
|
||||
];
|
||||
}).toList(),
|
||||
)
|
||||
: const Center(child: CircularProgressIndicator()),
|
||||
// : const Center(child: CircularProgressIndicator()),
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
})));
|
||||
}
|
||||
|
||||
|
||||
// Container TableWidget(Size size, TableLoaded state,AccessBloc accessBloc) {
|
||||
// return Container(
|
||||
// decoration: containerDecoration,
|
||||
// width: size.width,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(10.0),
|
||||
// child: ListView(
|
||||
// scrollDirection: Axis.horizontal,
|
||||
// children: [
|
||||
// Container(
|
||||
// width: size.width,
|
||||
// height: size.height,
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Container(
|
||||
// color: ColorsManager.boxColor,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// _buildTableHeaderCell('Password name'),
|
||||
// _buildTableHeaderCell(' Password Type'),
|
||||
// _buildTableHeaderCell('Start Time'),
|
||||
// _buildTableHeaderCell('End Time'),
|
||||
// _buildTableHeaderCell('Device Id'),
|
||||
// // _buildTableHeaderCell('Authorization Source'),
|
||||
// // _buildTableHeaderCell('Authorizer'),
|
||||
// _buildTableHeaderCell('Password Created'),
|
||||
// // _buildTableHeaderCell('Access Status'),
|
||||
// _buildTableHeaderCell('Password Status'),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// width: size.width,
|
||||
// color: ColorsManager.whiteColors,
|
||||
// child: ListView(
|
||||
// shrinkWrap: true,
|
||||
// children: [
|
||||
// Column(
|
||||
// children: state.data.map((item) {
|
||||
// return Row(
|
||||
// children: [
|
||||
// _buildTableCell(item.passwodName),
|
||||
// _buildTableCell(item.passwordType),
|
||||
//
|
||||
// _buildTableCell(accessBloc.timestampToDateTime(item.effectiveTime).toString()),
|
||||
// _buildTableCell(accessBloc.timestampToDateTime(item.invalidTime).toString()),
|
||||
// _buildTableCell(item.deviceUuid.toString()),
|
||||
// // _buildTableCell(item.authorizationSource),
|
||||
// // _buildTableCell(item.authorizer),
|
||||
// _buildTableCell(item.passwordCreated!=null?accessBloc.timestampToDateTime(item.passwordCreated).toString():'no data'),
|
||||
// // _buildTableCell(item.accessStatus),
|
||||
// _buildTableCell(item.passwordStatus.toString()),
|
||||
// ],
|
||||
// );
|
||||
// }).toList(),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user