mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-03-11 02:01:45 +00:00
power_clamp_issue&search_issue
This commit is contained in:
@ -22,7 +22,8 @@ class PowerClampBloc extends Bloc<PowerClampEvent, PowerClampState> {
|
||||
on<FilterRecordsByDateEvent>(_filterRecordsByDate);
|
||||
}
|
||||
DateTime? dateTime = DateTime.now();
|
||||
String formattedDate = DateFormat('yyyy/MM/dd').format(DateTime.now());
|
||||
|
||||
String formattedDate = DateFormat('dd/MM/yyyy').format(DateTime.now());
|
||||
bool lowBattery = false;
|
||||
bool closingReminder = false;
|
||||
bool doorAlarm = false;
|
||||
@ -305,8 +306,8 @@ class PowerClampBloc extends Bloc<PowerClampEvent, PowerClampState> {
|
||||
(newDate) {
|
||||
if (newDate != null) {
|
||||
dateTime = newDate;
|
||||
formattedDate = DateFormat('yyyy/MM/dd').format(dateTime!);
|
||||
|
||||
// formattedDate = DateFormat('yyyy/MM/dd').format(dateTime!);
|
||||
formattedDate = DateFormat('dd/MM/yyyy').format(dateTime!);
|
||||
add(FilterRecordsByDateEvent(
|
||||
selectedDate: dateTime!,
|
||||
viewType: views[currentIndex],
|
||||
@ -319,8 +320,7 @@ class PowerClampBloc extends Bloc<PowerClampEvent, PowerClampState> {
|
||||
(newDate) {
|
||||
if (newDate != null) {
|
||||
dateTime = newDate;
|
||||
formattedDate = DateFormat('yyyy-MM').format(dateTime!);
|
||||
|
||||
formattedDate = DateFormat('yyyy/MM').format(dateTime!);
|
||||
add(FilterRecordsByDateEvent(
|
||||
selectedDate: dateTime!,
|
||||
viewType: views[currentIndex],
|
||||
@ -530,13 +530,13 @@ class PowerClampBloc extends Bloc<PowerClampEvent, PowerClampState> {
|
||||
Future<DateTime?> dayMonthYearPicker({
|
||||
required BuildContext context,
|
||||
}) async {
|
||||
DateTime selectedDate = DateTime.now(); // Default selected date
|
||||
DateTime selectedDate = DateTime.now();
|
||||
|
||||
return await showModalBottomSheet<DateTime>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 350, // Increased height to accommodate the buttons
|
||||
height: 350,
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -546,8 +546,7 @@ class PowerClampBloc extends Bloc<PowerClampEvent, PowerClampState> {
|
||||
minimumYear: 1900,
|
||||
maximumYear: DateTime.now().year,
|
||||
onDateTimeChanged: (DateTime newDateTime) {
|
||||
selectedDate =
|
||||
newDateTime; // Update the selected date when changed
|
||||
selectedDate = newDateTime;
|
||||
},
|
||||
),
|
||||
),
|
||||
@ -561,15 +560,13 @@ class PowerClampBloc extends Bloc<PowerClampEvent, PowerClampState> {
|
||||
TextButton(
|
||||
child: const Text('Cancel'),
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
.pop(); // Dismiss the modal without returning a value
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('OK'),
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
.pop(selectedDate); // Return the selected date
|
||||
Navigator.of(context).pop(selectedDate);
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -591,6 +588,8 @@ class PowerClampBloc extends Bloc<PowerClampEvent, PowerClampState> {
|
||||
.where((record) => record.eventTime!.year == event.selectedDate.year)
|
||||
.toList();
|
||||
} else if (event.viewType == 'Month') {
|
||||
formattedDate =
|
||||
"${getMonthShortName(event.selectedDate.month)} ${event.selectedDate.year.toString()}";
|
||||
filteredRecords = record
|
||||
.where((record) =>
|
||||
record.eventTime!.year == event.selectedDate.year &&
|
||||
@ -604,10 +603,6 @@ class PowerClampBloc extends Bloc<PowerClampEvent, PowerClampState> {
|
||||
record.eventTime!.day == event.selectedDate.day)
|
||||
.toList();
|
||||
}
|
||||
String getMonthShortName(int month) {
|
||||
final date = DateTime(0, month);
|
||||
return DateFormat.MMM().format(date);
|
||||
}
|
||||
|
||||
energyDataList = filteredRecords.map((eventDevice) {
|
||||
return EnergyData(
|
||||
@ -615,18 +610,32 @@ class PowerClampBloc extends Bloc<PowerClampEvent, PowerClampState> {
|
||||
? getMonthShortName(
|
||||
int.tryParse(DateFormat('MM').format(eventDevice.eventTime!))!)
|
||||
: event.viewType == 'Month'
|
||||
? DateFormat('yyyy/MM/dd').format(eventDevice.eventTime!)
|
||||
? DateFormat('dd/MM').format(eventDevice.eventTime!)
|
||||
: DateFormat('HH:mm:ss').format(eventDevice.eventTime!),
|
||||
double.parse(eventDevice.value!),
|
||||
);
|
||||
}).toList();
|
||||
|
||||
selectDateRange();
|
||||
Future.delayed(const Duration(milliseconds: 500));
|
||||
emit(FilterRecordsState(filteredRecords: energyDataList));
|
||||
}
|
||||
|
||||
String getMonthShortName(int month) {
|
||||
final date = DateTime(0, month);
|
||||
return DateFormat.MMM().format(date);
|
||||
}
|
||||
|
||||
String endChartDate = '';
|
||||
|
||||
void selectDateRange() async {
|
||||
DateTime startDate = dateTime!;
|
||||
DateTime endDate = DateTime(startDate.year, startDate.month + 1, 1)
|
||||
.subtract(Duration(days: 1));
|
||||
String formattedEndDate = DateFormat('dd/MM/yyyy').format(endDate);
|
||||
endChartDate = ' - $formattedEndDate';
|
||||
}
|
||||
}
|
||||
|
||||
// Event for filtering records by date
|
||||
|
||||
|
||||
// _listenToChanges() {
|
||||
|
||||
@ -22,6 +22,8 @@ class PowerClampCard extends StatelessWidget {
|
||||
final String? totalFactor;
|
||||
final Widget? dateSwitcher;
|
||||
final String? formattedDate;
|
||||
final String? phaseType;
|
||||
|
||||
final String? energyConsumption;
|
||||
final Function()? selectDateEvent;
|
||||
final List<EnergyData>? chartData;
|
||||
@ -37,6 +39,7 @@ class PowerClampCard extends StatelessWidget {
|
||||
this.totalCurrentGeneral,
|
||||
this.totalFrequencyGeneral,
|
||||
this.totalVoltage,
|
||||
this.phaseType,
|
||||
this.totalActive,
|
||||
this.totalFrequency,
|
||||
this.totalFactor,
|
||||
@ -53,8 +56,7 @@ class PowerClampCard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultContainer(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
|
||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 10, bottom: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -116,7 +118,7 @@ class PowerClampCard extends StatelessWidget {
|
||||
PowerClampInfoCard(
|
||||
iconPath: Assets.voltageIcon,
|
||||
title: 'Voltage',
|
||||
value: totalVoltage!,
|
||||
value: '${double.parse(totalVoltage!) / 10}',
|
||||
unit: ' V',
|
||||
),
|
||||
PowerClampInfoCard(
|
||||
@ -152,13 +154,15 @@ class PowerClampCard extends StatelessWidget {
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const BodyMedium(
|
||||
text: 'Total consumption',
|
||||
BodyMedium(
|
||||
text: isGeneral == true
|
||||
? 'Total consumption'
|
||||
: phaseType!,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
Text(
|
||||
dateTimeSelected !,
|
||||
dateTimeSelected!,
|
||||
style: const TextStyle(
|
||||
fontSize: 8, fontWeight: FontWeight.w400),
|
||||
),
|
||||
|
||||
@ -55,7 +55,6 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
||||
child: BlocProvider(
|
||||
create: (context) => PowerClampBloc(PCId: widget.device?.uuid ?? '')
|
||||
..add(const PowerClampInitial()),
|
||||
// ..add(const ReportLogsInitial(code: 'VoltageA')),
|
||||
child: BlocBuilder<PowerClampBloc, PowerClampState>(
|
||||
builder: (context, state) {
|
||||
final blocProvider = context.read<PowerClampBloc>();
|
||||
@ -88,6 +87,7 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
||||
},
|
||||
child: PageView(controller: _pageController, children: [
|
||||
_buildPowerClampCard(
|
||||
phaseType: '',
|
||||
title: 'Total Energy \nConsumption',
|
||||
phase: model.status.general,
|
||||
isGeneral: true,
|
||||
@ -96,18 +96,21 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
||||
),
|
||||
_buildPowerClampCard(
|
||||
title: 'Phase A Energy \nConsumption',
|
||||
phaseType: 'Phase A consumption',
|
||||
phase: model.status.phaseA,
|
||||
chartData: chartData,
|
||||
blocProvider: blocProvider,
|
||||
),
|
||||
_buildPowerClampCard(
|
||||
title: 'Phase B Energy \nConsumption',
|
||||
phaseType: 'Phase B consumption',
|
||||
phase: model.status.phaseB,
|
||||
chartData: chartData,
|
||||
blocProvider: blocProvider,
|
||||
),
|
||||
_buildPowerClampCard(
|
||||
title: 'Phase C Energy \nConsumption',
|
||||
phaseType: 'Phase C consumption',
|
||||
phase: model.status.phaseC,
|
||||
chartData: chartData,
|
||||
blocProvider: blocProvider,
|
||||
@ -154,6 +157,7 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
||||
List<EnergyData> chartData, PowerClampBloc blocProvider) {
|
||||
return [
|
||||
_buildPowerClampCard(
|
||||
phaseType: '',
|
||||
title: 'Total Energy \nConsumption',
|
||||
phase: model.status.general,
|
||||
isGeneral: true,
|
||||
@ -161,18 +165,21 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
||||
blocProvider: blocProvider,
|
||||
),
|
||||
_buildPowerClampCard(
|
||||
phaseType: 'Phase A consumption',
|
||||
title: 'Phase A Energy \nConsumption',
|
||||
phase: model.status.phaseA,
|
||||
chartData: chartData,
|
||||
blocProvider: blocProvider,
|
||||
),
|
||||
_buildPowerClampCard(
|
||||
phaseType: 'Phase B consumption',
|
||||
title: 'Phase B Energy \nConsumption',
|
||||
phase: model.status.phaseB,
|
||||
chartData: chartData,
|
||||
blocProvider: blocProvider,
|
||||
),
|
||||
_buildPowerClampCard(
|
||||
phaseType: 'Phase C consumption',
|
||||
title: 'Phase C Energy \nConsumption',
|
||||
phase: model.status.phaseC,
|
||||
chartData: chartData,
|
||||
@ -183,15 +190,18 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
||||
|
||||
Widget _buildPowerClampCard({
|
||||
required String title,
|
||||
required String phaseType,
|
||||
required Phase phase,
|
||||
bool isGeneral = false,
|
||||
required List<EnergyData> chartData,
|
||||
required PowerClampBloc blocProvider,
|
||||
}) {
|
||||
return PowerClampCard(
|
||||
dateTimeSelected:blocProvider.formattedDate,
|
||||
dateTimeSelected:
|
||||
'${blocProvider.dateTime!.day}/${blocProvider.dateTime!.month}/${blocProvider.dateTime!.year} ${blocProvider.endChartDate}',
|
||||
energyConsumption: _getValueOrNA(phase.dataPoints, isGeneral ? 0 : 5),
|
||||
title: title,
|
||||
phaseType: phaseType,
|
||||
isGeneral: isGeneral,
|
||||
dateSwitcher: blocProvider.dateSwitcher(),
|
||||
formattedDate: blocProvider.formattedDate,
|
||||
|
||||
@ -21,53 +21,50 @@ class PowerClampInfoCard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: DefaultContainer(
|
||||
height: 55,
|
||||
color: ColorsManager.grayBox,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: SvgPicture.asset(
|
||||
iconPath,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
child: DefaultContainer(
|
||||
height: 55,
|
||||
color: ColorsManager.grayBox,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: SvgPicture.asset(
|
||||
iconPath,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
BodyMedium(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 8,
|
||||
text: title,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
BodyMedium(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 15,
|
||||
text: value,
|
||||
),
|
||||
BodyMedium(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 8,
|
||||
text: unit,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
BodyMedium(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 8,
|
||||
text: title,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
BodyMedium(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 15,
|
||||
text: value,
|
||||
),
|
||||
BodyMedium(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 8,
|
||||
text: unit,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -67,21 +67,38 @@ class _RoomPageState extends State<RoomPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 1.5,
|
||||
),
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
itemCount: _filteredDevices.length,
|
||||
itemBuilder: (context, index) {
|
||||
return RoomPageSwitch(device: _filteredDevices[index]);
|
||||
},
|
||||
),
|
||||
),
|
||||
_filteredDevices.isNotEmpty
|
||||
? Expanded(
|
||||
child: GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 1.5,
|
||||
),
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
itemCount: _filteredDevices.length,
|
||||
itemBuilder: (context, index) {
|
||||
return RoomPageSwitch(device: _filteredDevices[index]);
|
||||
},
|
||||
),
|
||||
)
|
||||
: const Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
'No Results Found',
|
||||
style: TextStyle(
|
||||
color: ColorsManager.grayColor,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -22,7 +22,6 @@ class RoomsSlider extends StatelessWidget {
|
||||
onPageChanged: (index) {
|
||||
HomeCubit.getInstance().roomSliderPageChanged(index);
|
||||
},
|
||||
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
@ -45,15 +44,20 @@ class RoomsSlider extends StatelessWidget {
|
||||
(room) => InkWell(
|
||||
onTap: () {
|
||||
HomeCubit.getInstance().roomSliderPageChanged(
|
||||
HomeCubit.getInstance().selectedSpace!.rooms!.indexOf(room));
|
||||
HomeCubit.getInstance()
|
||||
.selectedSpace!
|
||||
.rooms!
|
||||
.indexOf(room));
|
||||
},
|
||||
child: TitleMedium(
|
||||
text: room.name!,
|
||||
style: context.titleMedium.copyWith(
|
||||
fontSize: 25,
|
||||
color: HomeCubit.getInstance().selectedRoom == room
|
||||
? ColorsManager.textPrimaryColor
|
||||
: ColorsManager.textPrimaryColor.withOpacity(.2),
|
||||
color:
|
||||
HomeCubit.getInstance().selectedRoom == room
|
||||
? ColorsManager.textPrimaryColor
|
||||
: ColorsManager.textPrimaryColor
|
||||
.withOpacity(.2),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -35,7 +35,7 @@ class WizardPage extends StatelessWidget {
|
||||
|
||||
return StatefulBuilder(
|
||||
builder: (context, setState) {
|
||||
return ListView(
|
||||
return Column(
|
||||
children: [
|
||||
if (groupsList.isNotEmpty)
|
||||
TextFormField(
|
||||
@ -64,129 +64,170 @@ class WizardPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 1.5,
|
||||
),
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: _filteredGroups.length,
|
||||
itemBuilder: (_, index) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (_filteredGroups[index].name == 'AC') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
const ACsView()));
|
||||
}
|
||||
if (_filteredGroups[index].name == '3G') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
const ThreeGangWizard()));
|
||||
}
|
||||
if (_filteredGroups[index].name == '2G') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
const TwoGangWizard()));
|
||||
}
|
||||
if (_filteredGroups[index].name == '1G') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
const OneGangWizard()));
|
||||
}
|
||||
if (_filteredGroups[index].name == 'WH') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
const WHWizard()));
|
||||
}
|
||||
|
||||
if (_filteredGroups[index].name == '1GT') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
const OneTouchWizard()));
|
||||
}
|
||||
|
||||
if (_filteredGroups[index].name == '2GT') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
const TwoTouchWizard()));
|
||||
}
|
||||
|
||||
if (_filteredGroups[index].name == '3GT') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
const ThreeTouchWizard()));
|
||||
}
|
||||
|
||||
if (_filteredGroups[index].name == 'GD') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
const GarageWizard()));
|
||||
}
|
||||
if (_filteredGroups[index].name == 'CUR') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
const CurtainsWizard()));
|
||||
}
|
||||
},
|
||||
child: DefaultContainer(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
_filteredGroups.isNotEmpty
|
||||
? Expanded(
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
_filteredGroups[index].icon!,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
],
|
||||
),
|
||||
FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: BodyLarge(
|
||||
text: _filteredGroups[index].name!,
|
||||
style: context.bodyLarge.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 0,
|
||||
fontSize: 20,
|
||||
color: Colors.grey,
|
||||
),
|
||||
GridView.builder(
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 1.5,
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: _filteredGroups.length,
|
||||
itemBuilder: (_, index) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (_filteredGroups[index].name == 'AC') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1,
|
||||
animation2) =>
|
||||
const ACsView()));
|
||||
}
|
||||
if (_filteredGroups[index].name == '3G') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1,
|
||||
animation2) =>
|
||||
const ThreeGangWizard()));
|
||||
}
|
||||
if (_filteredGroups[index].name == '2G') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1,
|
||||
animation2) =>
|
||||
const TwoGangWizard()));
|
||||
}
|
||||
if (_filteredGroups[index].name == '1G') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1,
|
||||
animation2) =>
|
||||
const OneGangWizard()));
|
||||
}
|
||||
if (_filteredGroups[index].name == 'WH') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1,
|
||||
animation2) =>
|
||||
const WHWizard()));
|
||||
}
|
||||
|
||||
if (_filteredGroups[index].name == '1GT') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1,
|
||||
animation2) =>
|
||||
const OneTouchWizard()));
|
||||
}
|
||||
|
||||
if (_filteredGroups[index].name == '2GT') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1,
|
||||
animation2) =>
|
||||
const TwoTouchWizard()));
|
||||
}
|
||||
|
||||
if (_filteredGroups[index].name == '3GT') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1,
|
||||
animation2) =>
|
||||
const ThreeTouchWizard()));
|
||||
}
|
||||
|
||||
if (_filteredGroups[index].name == 'GD') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1,
|
||||
animation2) =>
|
||||
const GarageWizard()));
|
||||
}
|
||||
if (_filteredGroups[index].name == 'CUR') {
|
||||
Navigator.push(
|
||||
context,
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1,
|
||||
animation2) =>
|
||||
const CurtainsWizard()));
|
||||
}
|
||||
},
|
||||
child: DefaultContainer(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
_filteredGroups[index].icon!,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
],
|
||||
),
|
||||
FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: BodyLarge(
|
||||
text: _filteredGroups[index].name!,
|
||||
style: context.bodyLarge.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
height: 0,
|
||||
fontSize: 20,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
: const Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
'No Results Found',
|
||||
style: TextStyle(
|
||||
color: ColorsManager.grayColor,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user