mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
86 lines
2.7 KiB
Dart
86 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/sub_space_model.dart';
|
|
import 'package:syncrow_web/pages/device_managment/device_setting/sub_space_dialog.dart';
|
|
import 'package:syncrow_web/utils/color_manager.dart';
|
|
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
|
|
|
class SubSpaceDialogButtons extends StatelessWidget {
|
|
const SubSpaceDialogButtons({
|
|
super.key,
|
|
required String? selectedId,
|
|
required this.widget,
|
|
}) : _selectedId = selectedId;
|
|
|
|
final String? _selectedId;
|
|
final SubSpaceDialog widget;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
height: 50,
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Container(
|
|
decoration: const BoxDecoration(
|
|
border: Border(
|
|
right: BorderSide(
|
|
color: ColorsManager.dividerColor,
|
|
width: 0.5,
|
|
),
|
|
),
|
|
),
|
|
child: TextButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
child: Text(
|
|
'Cancel',
|
|
style: context.textTheme.bodyMedium?.copyWith(
|
|
color: ColorsManager.textGray,
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
decoration: const BoxDecoration(
|
|
border: Border(
|
|
left: BorderSide(
|
|
color: ColorsManager.dividerColor,
|
|
width: 0.5,
|
|
),
|
|
),
|
|
),
|
|
child: TextButton(
|
|
onPressed: _selectedId == null
|
|
? null
|
|
: () {
|
|
final selectedModel = widget.subSpaces.firstWhere(
|
|
(space) => space.id == _selectedId,
|
|
orElse: () =>
|
|
SubSpaceModel(id: null, name: '', devices: []),
|
|
);
|
|
Navigator.of(context)
|
|
.pop(selectedModel);
|
|
},
|
|
child: Text(
|
|
'Confirm',
|
|
style: context.textTheme.bodyMedium?.copyWith(
|
|
color: ColorsManager.secondaryColor,
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|