mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 22:04:54 +00:00
working on functions view
This commit is contained in:
82
lib/features/scene/view/device_functions_view.dart
Normal file
82
lib/features/scene/view/device_functions_view.dart
Normal file
@ -0,0 +1,82 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/scene_helper.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/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/strings_manager.dart';
|
||||
|
||||
class DeviceFunctionsView extends StatelessWidget with SceneHelper {
|
||||
const DeviceFunctionsView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final device = ModalRoute.of(context)?.settings.arguments as DeviceModel;
|
||||
// var functions = [];
|
||||
// if (device.functions.isNotEmpty) {
|
||||
// functions = getFunctionsWithIcons(
|
||||
// type: device.productType, functions: device.functions);
|
||||
// }
|
||||
|
||||
return DefaultScaffold(
|
||||
title: '${device.name} ${StringsManager.functions}',
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: BodyMedium(
|
||||
text: 'Save',
|
||||
fontWeight: FontWeight.normal,
|
||||
fontColor: ColorsManager.secondaryColor.withOpacity(0.6),
|
||||
),
|
||||
),
|
||||
],
|
||||
leading: TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: BodyMedium(
|
||||
text: 'Cancel',
|
||||
fontWeight: FontWeight.normal,
|
||||
fontColor: ColorsManager.textPrimaryColor.withOpacity(0.6),
|
||||
),
|
||||
),
|
||||
leadingWidth: 80,
|
||||
padding: EdgeInsets.zero,
|
||||
child: DefaultContainer(
|
||||
margin: const EdgeInsets.only(top: 24),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: device.functions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final function = device.functions[index];
|
||||
return SceneListTile(
|
||||
assetPath: null,
|
||||
minLeadingWidth: 40,
|
||||
leadingWidget: Image.asset(
|
||||
Assets.assetsIconsLogo,
|
||||
width: 20,
|
||||
),
|
||||
titleWidget: BodyMedium(
|
||||
text: function.code ?? '',
|
||||
style: context.titleSmall.copyWith(
|
||||
color: ColorsManager.secondaryTextColor,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
trailingWidget: const Icon(
|
||||
Icons.arrow_forward_ios_rounded,
|
||||
color: ColorsManager.greyColor,
|
||||
size: 16,
|
||||
),
|
||||
onPressed: () {},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user