add custom scroll view to access managment screen and devices screen

This commit is contained in:
ashrafzarkanisala
2024-08-27 03:29:35 +03:00
parent 7d700f47dd
commit 56edcaf788
8 changed files with 403 additions and 425 deletions
@@ -48,52 +48,61 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
'Low Battery ($lowBatteryCount)',
];
return Container(
padding: isLargeScreenSize(context)
? const EdgeInsets.all(30)
: const EdgeInsets.all(15),
height: context.screenHeight,
width: context.screenWidth,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
FilterWidget(
size: MediaQuery.of(context).size,
tabs: tabs,
selectedIndex: selectedIndex,
onTabChanged: (index) {
context
.read<DeviceManagementBloc>()
.add(SelectedFilterChanged(index));
},
),
const SizedBox(height: 20),
const DeviceSearchFilters(),
const SizedBox(height: 12),
Container(
height: 43,
width: isSmallScreenSize(context) ? double.infinity : 100,
decoration: containerDecoration,
child: Center(
child: DefaultButton(
onPressed: () {
final selectedDevice =
context.read<DeviceManagementBloc>().selectedDevice;
if (selectedDevice != null) {
showDialog(
context: context,
builder: (context) =>
DeviceControlDialog(device: selectedDevice),
);
}
},
borderRadius: 9,
child: const Text('Control'),
),
return CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Container(
padding: isLargeScreenSize(context)
? const EdgeInsets.all(30)
: const EdgeInsets.all(15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
FilterWidget(
size: MediaQuery.of(context).size,
tabs: tabs,
selectedIndex: selectedIndex,
onTabChanged: (index) {
context
.read<DeviceManagementBloc>()
.add(SelectedFilterChanged(index));
},
),
const SizedBox(height: 20),
const DeviceSearchFilters(),
const SizedBox(height: 12),
Container(
height: 43,
width: isSmallScreenSize(context) ? double.infinity : 100,
decoration: containerDecoration,
child: Center(
child: DefaultButton(
onPressed: () {
final selectedDevice = context
.read<DeviceManagementBloc>()
.selectedDevice;
if (selectedDevice != null) {
showDialog(
context: context,
builder: (context) =>
DeviceControlDialog(device: selectedDevice),
);
}
},
borderRadius: 9,
child: const Text('Control'),
),
),
),
],
),
),
const SizedBox(height: 12),
Expanded(
),
SliverFillRemaining(
child: Padding(
padding: isLargeScreenSize(context)
? const EdgeInsets.all(30)
: const EdgeInsets.all(15),
child: DynamicTable(
cellDecoration: containerDecoration,
onRowSelected: (index, isSelected, row) {
@@ -136,8 +145,8 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
isEmpty: devicesToShow.isEmpty,
),
),
],
),
),
],
);
},
);