mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 17:44:56 +00:00
push ac functions and gang switches functions
This commit is contained in:
@ -3,16 +3,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/routiens/bloc/routine_bloc.dart';
|
||||
import 'package:syncrow_web/pages/routiens/helper/dialog_helper/device_dialog_helper.dart';
|
||||
import 'package:syncrow_web/pages/routiens/widgets/dragable_card.dart';
|
||||
|
||||
class ThenContainer extends StatelessWidget {
|
||||
const ThenContainer({Key? key}) : super(key: key);
|
||||
const ThenContainer({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<RoutineBloc, RoutineState>(
|
||||
builder: (context, state) {
|
||||
return DragTarget<Map<String, String>>(
|
||||
return DragTarget<Map<String, dynamic>>(
|
||||
builder: (context, candidateData, rejectedData) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@ -20,7 +21,9 @@ class ThenContainer extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('THEN', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const Text('THEN',
|
||||
style:
|
||||
TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 16),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
@ -37,8 +40,16 @@ class ThenContainer extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
},
|
||||
onAccept: (data) {
|
||||
context.read<RoutineBloc>().add(AddToThenContainer(data));
|
||||
onWillAccept: (data) => data != null,
|
||||
onAccept: (data) async {
|
||||
final result =
|
||||
await DeviceDialogHelper.showDeviceDialog(context, data);
|
||||
if (result != null) {
|
||||
context.read<RoutineBloc>().add(AddToThenContainer(result));
|
||||
} else if (!['AC', '1G', '2G', '3G']
|
||||
.contains(data['productType'])) {
|
||||
context.read<RoutineBloc>().add(AddToThenContainer(data));
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user