import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:marking_app/routes/RouterManager.dart';
import 'package:marking_app/utils/anti_shake_throttling.dart';

// 返回首页
class ReturnToHomepage extends StatelessWidget {
  final Color? bgColor;
  const ReturnToHomepage({super.key,this.bgColor = const Color.fromRGBO(135, 135, 135, 1)});

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () => easyThrottle('RETURN_TO_HOMEPAGE', () {
        Navigator.of(context).popUntil(ModalRoute.withName(RouterManager.root));
      }),
      child: Container(
        padding: EdgeInsets.only(right: 4.5.w),
        alignment: Alignment.center,
        child: Icon(Icons.home_rounded, size: 22.sp, color: bgColor),
      ),
    );
  }
}
