update devices

This commit is contained in:
mohammad
2024-06-26 11:53:32 +03:00
parent 1fb8a8d035
commit ea4dc852f8
12 changed files with 190 additions and 59 deletions

View File

@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/view/widgets/popup_menu_widget.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
class DeviceAppbar extends StatelessWidget implements PreferredSizeWidget {
final String deviceName;
final String deviceUuid;
final double appBarHeight = 56.0;
final void Function()? onPressed;
const DeviceAppbar({super.key, required this.deviceName, required this.deviceUuid,this.onPressed});
@override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: Colors.transparent,
centerTitle: true,
title: BodyLarge(
text: deviceName ?? "",
fontColor: ColorsManager.primaryColor,
fontWeight: FontsManager.bold,
),
actions: [
IconButton(onPressed: () {
showPopupMenu(context: context, items: [
PopupMenuItem(
onTap: () async {
HomeCubit.getInstance().updateDevice(deviceUuid);
},
value: 'Update',
child: const Text('Update'),
)
]);
}, icon: Icon(Icons.edit))
],
);
}
@override
Size get preferredSize => Size.fromHeight(appBarHeight);
}