mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
128 lines
4.2 KiB
Dart
128 lines
4.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
|
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/device_info_model.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';
|
|
import 'package:syncrow_web/web_layout/default_container.dart';
|
|
|
|
class DeviceManagementContent extends StatelessWidget {
|
|
const DeviceManagementContent({
|
|
super.key,
|
|
required this.device,
|
|
required this.subSpaces,
|
|
required this.deviceInfo,
|
|
});
|
|
|
|
final AllDevicesModel device;
|
|
final List<SubSpaceModel> subSpaces;
|
|
final DeviceInfoModel deviceInfo;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget infoRow(
|
|
{required String label,
|
|
required String value,
|
|
Widget? trailing,
|
|
required Color? valueColor}) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 6.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
label,
|
|
style: context.theme.textTheme.bodyMedium!.copyWith(
|
|
fontSize: 14,
|
|
color: ColorsManager.grayColor,
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Text(
|
|
value,
|
|
textAlign: TextAlign.end,
|
|
style: context.theme.textTheme.bodyMedium!
|
|
.copyWith(fontSize: 14, color: valueColor),
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
trailing ?? const SizedBox.shrink(),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
return DefaultContainer(
|
|
padding: EdgeInsets.zero,
|
|
child: Column(
|
|
children: [
|
|
const SizedBox(height: 5),
|
|
Padding(
|
|
padding: const EdgeInsets.all(10.0),
|
|
child: InkWell(
|
|
onTap: () {
|
|
showSubSpaceDialog(
|
|
context,
|
|
communityUuid: device.community!.uuid!,
|
|
spaceUuid: device.spaces!.first.uuid!,
|
|
subSpaces: subSpaces,
|
|
selected: device.subspace!.uuid,
|
|
);
|
|
},
|
|
child: infoRow(
|
|
label: 'Sub-Space:',
|
|
value: deviceInfo.subspace.subspaceName,
|
|
valueColor: ColorsManager.textGray,
|
|
trailing: const Icon(
|
|
Icons.arrow_forward_ios,
|
|
size: 16,
|
|
color: ColorsManager.greyColor,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const Divider(color: ColorsManager.dividerColor),
|
|
Padding(
|
|
padding: const EdgeInsets.all(10.0),
|
|
child: infoRow(
|
|
label: 'Virtual Address:',
|
|
value: deviceInfo.productUuid,
|
|
valueColor: ColorsManager.blackColor,
|
|
trailing: InkWell(
|
|
onTap: () {
|
|
Clipboard.setData(
|
|
ClipboardData(text: device.productUuid ?? ''),
|
|
);
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
const SnackBar(
|
|
content: Text('Virtual Address copied to clipboard'),
|
|
),
|
|
);
|
|
},
|
|
child: const Icon(
|
|
Icons.copy,
|
|
size: 16,
|
|
color: ColorsManager.greyColor,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const Divider(color: ColorsManager.dividerColor),
|
|
Padding(
|
|
padding: const EdgeInsets.all(10.0),
|
|
child: infoRow(
|
|
label: 'MAC Address:',
|
|
valueColor: ColorsManager.blackColor,
|
|
value: deviceInfo.macAddress,
|
|
),
|
|
),
|
|
const SizedBox(height: 5),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|