mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
107 lines
3.5 KiB
Dart
107 lines
3.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_bloc.dart';
|
|
import 'package:syncrow_web/pages/routiens/widgets/dragable_card.dart';
|
|
import 'package:syncrow_web/pages/routiens/widgets/routines_title_widget.dart';
|
|
import 'package:syncrow_web/pages/routiens/widgets/search_bar_condition_title.dart';
|
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
|
|
|
class ConditionsRoutinesDevicesView extends StatelessWidget {
|
|
const ConditionsRoutinesDevicesView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 8.0),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const ConditionTitleAndSearchBar(),
|
|
const SizedBox(
|
|
height: 10,
|
|
),
|
|
const Wrap(
|
|
spacing: 10,
|
|
runSpacing: 10,
|
|
children: [
|
|
DraggableCard(
|
|
imagePath: Assets.tabToRun,
|
|
title: 'Tab to run',
|
|
),
|
|
DraggableCard(
|
|
imagePath: Assets.map,
|
|
title: 'Location',
|
|
),
|
|
DraggableCard(
|
|
imagePath: Assets.weather,
|
|
title: 'Weather',
|
|
),
|
|
DraggableCard(
|
|
imagePath: Assets.schedule,
|
|
title: 'Schedule',
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(
|
|
height: 10,
|
|
),
|
|
const TitleRoutine(
|
|
title: 'Conditions',
|
|
subtitle: '(THEN)',
|
|
),
|
|
const Wrap(
|
|
spacing: 10,
|
|
runSpacing: 10,
|
|
children: [
|
|
DraggableCard(
|
|
imagePath: Assets.notification,
|
|
title: 'Send Notification',
|
|
),
|
|
DraggableCard(
|
|
imagePath: Assets.delay,
|
|
title: 'Delay the action',
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(
|
|
height: 10,
|
|
),
|
|
const TitleRoutine(
|
|
title: 'Routines',
|
|
subtitle: '(THEN)',
|
|
),
|
|
const TitleRoutine(
|
|
title: 'Devices',
|
|
subtitle: '',
|
|
),
|
|
BlocProvider(
|
|
create: (context) => DeviceManagementBloc()
|
|
..add(
|
|
FetchDevices(),
|
|
),
|
|
child: BlocBuilder<DeviceManagementBloc, DeviceManagementState>(
|
|
builder: (context, state) {
|
|
if (state is DeviceManagementLoaded) {
|
|
return Wrap(
|
|
spacing: 10,
|
|
runSpacing: 10,
|
|
children: state.devices
|
|
.map((device) => DraggableCard(
|
|
imagePath: device.getDefaultIcon(device.productType),
|
|
title: device.name ?? '',
|
|
))
|
|
.toList(),
|
|
);
|
|
}
|
|
return const Center(child: CircularProgressIndicator());
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|