import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:making_school_asignment_app/routes/app_pages.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: () {
        // Navigator.of(context).popUntil(ModalRoute.withName(Routes.startPage));
        Get.until((route) => route.settings.name == Routes.startPage);
      },
      child: Container(
        padding: EdgeInsets.only(right: 4.5.w),
        alignment: Alignment.center,
        child: Icon(Icons.home_rounded, size: 30.r, color: bgColor),
      ),
    );
  }
}
