mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 23:34:55 +00:00
48 lines
1.6 KiB
Dart
48 lines
1.6 KiB
Dart
// lib/pages/routiens/widgets/then_container.dart
|
|
|
|
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/widgets/dragable_card.dart';
|
|
|
|
class ThenContainer extends StatelessWidget {
|
|
const ThenContainer({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<RoutineBloc, RoutineState>(
|
|
builder: (context, state) {
|
|
return DragTarget<Map<String, String>>(
|
|
builder: (context, candidateData, rejectedData) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(16),
|
|
width: double.infinity,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const Text('THEN', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
|
const SizedBox(height: 16),
|
|
Wrap(
|
|
spacing: 8,
|
|
runSpacing: 8,
|
|
children: state.thenItems
|
|
.map((item) => DraggableCard(
|
|
key: Key(item['key']!),
|
|
imagePath: item['imagePath']!,
|
|
title: item['title']!,
|
|
))
|
|
.toList(),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
onAccept: (data) {
|
|
context.read<RoutineBloc>().add(AddToThenContainer(data));
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|