import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:tm_app/core/utils/size_config.dart';

import '../../core/constants/assets.dart';
import '../../core/theme/colors.dart';

class TabletDesktopAppbar extends StatelessWidget {
  const TabletDesktopAppbar({
    required this.title,
    this.haveFilter,
    this.onFilterPressed,
    super.key,
  });

  final String title;
  final bool? haveFilter;
  final VoidCallback? onFilterPressed;

  @override
  Widget build(BuildContext context) {
    final isRtl = Directionality.of(context) == TextDirection.rtl;
    return Row(
      children: [
        InkWell(
          borderRadius: BorderRadius.circular(8),
          onTap: () => context.pop(),
          child: SvgPicture.asset(
            isRtl ? AssetsManager.arrowRight : AssetsManager.arrowLeft,
          ),
        ),
        SizedBox(width: 8.0.w()),
        Text(
          title,
          style: TextStyle(
            fontSize: 20,
            fontWeight: FontWeight.w600,
            color: AppColors.grey70,
          ),
        ),
        const Spacer(),
        if (haveFilter == true)
          IconButton(
            icon: SvgPicture.asset(
              AssetsManager.filter,
              height: 24.0.w(),
              width: 24.0.w(),
            ),
            onPressed: onFilterPressed,
          ),
      ],
    );
  }
}
