import 'package:driverapp/core/viewModels/project_view_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class ArrowBack extends StatelessWidget {
  final Function onTap;
  final Color arrowColor;

  ArrowBack({Key key, this.onTap, this.arrowColor}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    ProjectViewModel projectViewModel = Provider.of(context);
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: Feedback.wrapForTap(() {
        onTap != null ? onTap() : Navigator.pop(context);
      }, context),
      child: Icon(
        projectViewModel.isArabic ? Icons.arrow_forward : Icons.arrow_back,
        color: arrowColor ?? Theme.of(context).primaryColor,
        size: 22,
      ),
    );
  }
}
