// ignore_for_file: sized_box_for_whitespace

import 'package:flutter/material.dart';
import 'package:tour_travel_agr/resource/font.dart';
import 'package:tour_travel_agr/resource/size.dart';
import 'package:tour_travel_agr/resource/style.dart';

class CustomAppBar extends StatelessWidget {
  const CustomAppBar({
    Key? key,
    required this.text,
    this.canGoback = true,
    this.showElipses = false,
  }) : super(key: key);

  final String text;
  final bool canGoback;
  final bool showElipses;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 44,
      width: double.infinity,
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          (canGoback)
              ? GestureDetector(
                  onTap: () {
                    bool canPop = Navigator.canPop(context);
                    if (canPop) {
                      Navigator.pop(context);
                    }
                  },
                  child: Container(
                    margin: EdgeInsets.only(
                      right: AppMargin.m16,
                    ),
                    width: 24,
                    height: 24,
                    child: const Center(
                      child: Icon(
                        Icons.arrow_back,
                        size: 26,
                      ),
                    ),
                  ),
                )
              : const SizedBox(),
          Text(
            text,
            style: getBoldStyle(
              color: Colors.black,
              fontFamily: FontConstants.mulish,
              fontSize: FontSize.s17,
            ),
          )
        ],
      ),
    );
  }
}
