import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface.dart'; import 'package:syncrow_app/features/shared_widgets/custom_switch.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'; import 'package:syncrow_app/utils/helpers/custom_page_route.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart'; class RoomPageSwitch extends StatelessWidget { const RoomPageSwitch({ super.key, required this.device, }); final DeviceModel device; @override Widget build(BuildContext context) { return InkWell( onTap: () { //Navigate to the chosen category view without animation // Navigator.push( // context, // CustomPageRoute( // builder: (context) { // return DevicesCubit.get(context) // .chosenCategoryView!; // }, // ), // ); if (device.productType == DeviceType.AC) { Navigator.push( context, CustomPageRoute( builder: (context) => AcInterface(deviceModel: device), ), ); } }, child: DefaultContainer( child: Padding( padding: const EdgeInsets.only(top: 10, right: 10, left: 10), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SvgPicture.asset( device.icon!, fit: BoxFit.contain, ), CustomSwitch( device: device, ), ], ), Expanded( child: FittedBox( fit: BoxFit.scaleDown, child: BodyLarge( text: device.name ?? "", style: context.bodyLarge.copyWith( fontWeight: FontWeight.bold, height: 0, fontSize: 24, color: Colors.grey, ), ), ), ), ], ), ), ), ); } }