// lib/app/widgets/hi_help_entrance.dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:kaer_with_panels/app/widgets/kr_local_image.dart';
import 'package:get/get.dart';
import 'package:kaer_with_panels/app/routes/app_pages.dart';

/// 全局统一的帮助入口 Widget (HI 前缀)
///
/// 通常放置在 Stack 的顶层，通过 Positioned 控制位置。
class HIHelpEntrance extends StatelessWidget {
  const HIHelpEntrance({
    super.key,
    this.bottom = 40.0,
    this.isLight = true,
  });

  final double bottom;
  final bool isLight; // 用于控制主题颜色

  @override
  Widget build(BuildContext context) {
    final Color displayColor = isLight ? Colors.white : Colors.black;

    return Positioned(
      bottom: bottom,
      left: 0,
      right: 0,
      child: GestureDetector(
        onTap: () {
          Get.toNamed(Routes.HI_HELP);
        },
        child: AbsorbPointer(
          child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              KrLocalImage(
                imageName: 'hi-home-logo',
                imageType: ImageType.svg,
                color: displayColor,
                width: 32.w,
                height: 32.w,
              ),
              SizedBox(width: 4.w),
              Stack(
                clipBehavior: Clip.none,
                children: [
                  Padding(
                    padding: const EdgeInsets.only(bottom: 2.0),
                    child: Text(
                      '遇到问题？',
                      style: TextStyle(
                        color: displayColor,
                        fontSize: 16.sp,
                        fontWeight: FontWeight.w600,
                        decoration: TextDecoration.none,
                      ),
                    ),
                  ),
                  Positioned(
                    left: 0,
                    right: 0,
                    bottom: 0,
                    child: Container(
                      height: 1.2,
                      color: displayColor,
                    ),
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}