import 'package:flutter/material.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/display_medium.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/constants.dart';

class CategoryViewAppBar extends StatelessWidget implements PreferredSizeWidget {
  final String title;
  const CategoryViewAppBar({
    required this.title,
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return AppBar(
      backgroundColor: Colors.transparent,
      elevation: 0,
      toolbarHeight: Constants.appBarHeight,
      centerTitle: true,
      title: DisplayMedium(
        // text: DevicesCubit.getInstance().chosenCategory!.name!,
        text: title,
        style: context.displayMedium
            .copyWith(color: ColorsManager.primaryColor, fontWeight: FontWeight.bold, fontSize: 14),
      ),
      leading: IconButton(
        icon: const Icon(
          Icons.arrow_back_ios,
          color: ColorsManager.textPrimaryColor,
        ),
        onPressed: () {
          Navigator.of(context).pop();
          // DevicesCubit.getInstance().clearCategoriesSelection(context);
        },
      ),
    );
  }

  @override
  Size get preferredSize => Size.fromHeight(Constants.appBarHeight);
}
