mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-17 02:25:16 +00:00
72 lines
2.4 KiB
Dart
72 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
|
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
|
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
|
|
|
class AlertDialogFunctionsOperationsBody extends StatefulWidget {
|
|
const AlertDialogFunctionsOperationsBody({
|
|
super.key,
|
|
required this.functions,
|
|
required this.index,
|
|
});
|
|
|
|
final List<SceneStaticFunction> functions;
|
|
final int index;
|
|
|
|
@override
|
|
State<AlertDialogFunctionsOperationsBody> createState() =>
|
|
_AlertDialogFunctionsOperationsBodyState();
|
|
}
|
|
|
|
class _AlertDialogFunctionsOperationsBodyState
|
|
extends State<AlertDialogFunctionsOperationsBody> {
|
|
String? groupValue = "";
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
...widget.functions[widget.index].operationalValues.map(
|
|
(operation) => BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
|
builder: (context, state) {
|
|
return SceneListTile(
|
|
iconsSize: 25,
|
|
minLeadingWidth: 15,
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
assetPath: operation.icon,
|
|
titleString: operation.value,
|
|
textAlign: TextAlign.start,
|
|
trailingWidget: Radio(
|
|
value: operation.value,
|
|
groupValue: (state is SelectedTaskValueState)
|
|
? state.value
|
|
: groupValue,
|
|
onChanged: (value) {
|
|
setState(() {
|
|
groupValue = value;
|
|
});
|
|
context
|
|
.read<CreateSceneBloc>()
|
|
.add(SelectedValueEvent(value: value!));
|
|
},
|
|
),
|
|
onPressed: () {
|
|
setState(() {
|
|
groupValue = operation.value;
|
|
});
|
|
context
|
|
.read<CreateSceneBloc>()
|
|
.add(SelectedValueEvent(value: groupValue!));
|
|
},
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|