mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 12:57:55 +00:00
66 lines
2.2 KiB
Dart
66 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/svg.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 '../../bloc/devices_cubit.dart';
|
|
|
|
class Switches extends StatelessWidget {
|
|
const Switches({
|
|
super.key,
|
|
});
|
|
|
|
@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),
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
shrinkWrap: true,
|
|
itemCount: DevicesCubit.get(context).categories.length,
|
|
itemBuilder: (context, index) {
|
|
return DefaultContainer(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
SvgPicture.asset(
|
|
DevicesCubit.get(context).categories[index].icon,
|
|
fit: BoxFit.contain,
|
|
),
|
|
SizedBox(
|
|
width: 30,
|
|
height: 20,
|
|
child: CustomSwitch(
|
|
value: DevicesCubit.get(context)
|
|
.categories[index]
|
|
.switchValue,
|
|
onChanged: (value) => DevicesCubit.get(context)
|
|
.changeSwitchValue(
|
|
DevicesCubit.get(context).categories[index].type),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
BodyLarge(
|
|
text: DevicesCubit.get(context).categories[index].name,
|
|
fontWeight: FontWeight.bold,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|