mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
132 lines
5.0 KiB
Dart
132 lines
5.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_view.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/one_gang/one_gang_wizard.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/one_touch/one_touch_wizard.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_wizard.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/three_touch/three_touch_wizard.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/two_gang/two_gang_wizard.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/two_touch/two_touch_wizard.dart';
|
|
import 'package:syncrow_app/features/devices/view/widgets/water_heater/wh_wizard.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
|
import 'package:syncrow_app/utils/context_extension.dart';
|
|
|
|
class WizardPage extends StatelessWidget {
|
|
final List<DevicesCategoryModel> groupsList;
|
|
const WizardPage({super.key, required this.groupsList});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GridView.builder(
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 2,
|
|
crossAxisSpacing: 10,
|
|
mainAxisSpacing: 10,
|
|
childAspectRatio: 1.5,
|
|
),
|
|
padding: const EdgeInsets.only(top: 10),
|
|
shrinkWrap: true,
|
|
itemCount: groupsList.length,
|
|
itemBuilder: (_, index) {
|
|
return GestureDetector(
|
|
onTap: () {
|
|
if (groupsList[index].name == 'AC') {
|
|
Navigator.push(
|
|
context,
|
|
PageRouteBuilder(
|
|
pageBuilder: (context, animation1, animation2) =>
|
|
const ACsView()));
|
|
}
|
|
if (groupsList[index].name == '3G') {
|
|
Navigator.push(
|
|
context,
|
|
PageRouteBuilder(
|
|
pageBuilder: (context, animation1, animation2) =>
|
|
const ThreeGangWizard()));
|
|
}
|
|
if (groupsList[index].name == '2G') {
|
|
Navigator.push(
|
|
context,
|
|
PageRouteBuilder(
|
|
pageBuilder: (context, animation1, animation2) =>
|
|
const TwoGangWizard()));
|
|
}
|
|
if (groupsList[index].name == '1G') {
|
|
Navigator.push(
|
|
context,
|
|
PageRouteBuilder(
|
|
pageBuilder: (context, animation1, animation2) =>
|
|
const OneGangWizard()));
|
|
}
|
|
if (groupsList[index].name == 'WH') {
|
|
Navigator.push(
|
|
context,
|
|
PageRouteBuilder(
|
|
pageBuilder: (context, animation1, animation2) =>
|
|
const WHWizard()));
|
|
}
|
|
|
|
if (groupsList[index].name == '1GT') {
|
|
Navigator.push(
|
|
context,
|
|
PageRouteBuilder(
|
|
pageBuilder: (context, animation1, animation2) =>
|
|
const OneTouchWizard()));
|
|
}
|
|
|
|
if (groupsList[index].name == '2GT') {
|
|
Navigator.push(
|
|
context,
|
|
PageRouteBuilder(
|
|
pageBuilder: (context, animation1, animation2) =>
|
|
const TwoTouchWizard()));
|
|
}
|
|
|
|
if (groupsList[index].name == '3GT') {
|
|
Navigator.push(
|
|
context,
|
|
PageRouteBuilder(
|
|
pageBuilder: (context, animation1, animation2) =>
|
|
const ThreeTouchWizard()));
|
|
}
|
|
},
|
|
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(
|
|
groupsList[index].icon!,
|
|
fit: BoxFit.contain,
|
|
),
|
|
// CustomSwitch(
|
|
],
|
|
),
|
|
FittedBox(
|
|
fit: BoxFit.scaleDown,
|
|
child: BodyLarge(
|
|
text: groupsList[index].name!,
|
|
style: context.bodyLarge.copyWith(
|
|
fontWeight: FontWeight.bold,
|
|
height: 0,
|
|
fontSize: 20,
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|