mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-25 18:39:39 +00:00
187 lines
7.3 KiB
Dart
187 lines
7.3 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/enum/create_scene_enum.dart';
|
|
import 'package:syncrow_app/features/scene/view/scene_tasks_view.dart';
|
|
import 'package:syncrow_app/features/scene/view/settings/validity_page.dart';
|
|
import 'package:syncrow_app/features/scene/widgets/effective_period_setting/effective_period_bottom_sheet.dart';
|
|
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
|
import 'package:syncrow_app/utils/context_extension.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
class SceneAutoSettings extends StatelessWidget {
|
|
const SceneAutoSettings({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final sceneSettings =
|
|
ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>? ??
|
|
{};
|
|
final sceneId = sceneSettings['sceneId'] as String? ?? '';
|
|
final isAutomation = context.read<CreateSceneBloc>().sceneType ==
|
|
CreateSceneEnum.deviceStatusChanges;
|
|
final sceneName = sceneSettings['sceneName'] as String? ?? '';
|
|
|
|
return DefaultScaffold(
|
|
title: 'Settings',
|
|
padding: EdgeInsets.zero,
|
|
leading: IconButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
icon: const Icon(
|
|
Icons.arrow_back_ios,
|
|
)),
|
|
child: SizedBox(
|
|
height: MediaQuery.sizeOf(context).height,
|
|
child: Column(
|
|
children: [
|
|
DefaultContainer(
|
|
child: Column(
|
|
children: [
|
|
InkWell(
|
|
onTap: () {
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
builder: (context) =>const ValidityPage(),
|
|
));
|
|
},
|
|
child: Container(
|
|
padding: EdgeInsets.only(top: 12, bottom: 12),
|
|
child: const Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
BodyMedium(
|
|
text: 'Validity',
|
|
fontWeight: FontWeight.normal,
|
|
),
|
|
Icon(
|
|
Icons.arrow_forward_ios,
|
|
size: 15,
|
|
color: ColorsManager.textGray,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const Divider(
|
|
color: ColorsManager.backgroundColor,
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
context.customBottomSheet(
|
|
child: const EffectPeriodBottomSheetContent(),
|
|
);
|
|
},
|
|
child: Container(
|
|
padding: EdgeInsets.only(top: 12, bottom: 12),
|
|
child: const Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
BodyMedium(
|
|
text: 'Effective Period',
|
|
fontWeight: FontWeight.normal,
|
|
),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
Icon(
|
|
Icons.arrow_forward_ios,
|
|
size: 15,
|
|
color: ColorsManager.textGray,
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const Divider(
|
|
color: ColorsManager.backgroundColor,
|
|
),
|
|
InkWell(
|
|
onTap: () {},
|
|
child: Container(
|
|
padding: EdgeInsets.only(top: 12, bottom: 12),
|
|
child: const Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
BodyMedium(
|
|
text: 'Executed by',
|
|
fontWeight: FontWeight.normal,
|
|
),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
BodyMedium(
|
|
fontColor: ColorsManager.textGray,
|
|
text: 'Cloud',
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: 13,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
|
child: DefaultContainer(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
const SizedBox(
|
|
height: 8,
|
|
),
|
|
Visibility(
|
|
visible: isAutomation,
|
|
child: SceneListTile(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 16, vertical: 8),
|
|
titleString: "Effective Period",
|
|
trailingWidget:
|
|
const Icon(Icons.arrow_forward_ios_rounded),
|
|
onPressed: () {
|
|
|
|
},
|
|
),
|
|
),
|
|
Visibility(
|
|
visible: sceneName.isNotEmpty && isAutomation,
|
|
child: SizedBox(
|
|
width: context.width * 0.9,
|
|
child: const Divider(
|
|
color: ColorsManager.greyColor,
|
|
),
|
|
),
|
|
),
|
|
Visibility(
|
|
visible: sceneName.isNotEmpty,
|
|
child: DeleteBottomSheetContent(
|
|
isAutomation: isAutomation,
|
|
sceneId: sceneId,
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 16,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|