import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:hugeicons/hugeicons.dart';

import '../../../../common/extension/extension.dart';
import '../../../../common/theme/theme.dart';
import '../../../components/spacer/spacer.dart';
import '../../../router/app_router.gr.dart';

/// Pintu masuk ke halaman bagi hasil dari beranda.
class HomeProfitSharingBanner extends StatelessWidget {
  const HomeProfitSharingBanner({super.key});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.fromLTRB(16, 16, 16, 0),
      child: InkWell(
        borderRadius: BorderRadius.circular(AppValue.radius),
        onTap: () => context.router.push(const ProfitSharingRoute()),
        child: Container(
          padding: const EdgeInsets.all(16),
          decoration: BoxDecoration(
            gradient: const LinearGradient(
              colors: AppColor.primaryGradient,
              begin: Alignment.centerLeft,
              end: Alignment.centerRight,
            ),
            borderRadius: BorderRadius.circular(AppValue.radius),
            boxShadow: [
              BoxShadow(
                color: AppColor.primary.withOpacity(0.25),
                blurRadius: 12,
                offset: const Offset(0, 4),
              ),
            ],
          ),
          child: Row(
            children: [
              Container(
                width: 44,
                height: 44,
                decoration: BoxDecoration(
                  color: AppColor.textWhite.withOpacity(0.18),
                  borderRadius: BorderRadius.circular(12),
                ),
                child: const HugeIcon(
                  icon: HugeIcons.strokeRoundedPieChart,
                  color: AppColor.textWhite,
                  size: 24,
                ),
              ),
              const SpaceWidth(14),
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      context.lang.profit_sharing,
                      style: AppStyle.md.copyWith(
                        color: AppColor.textWhite,
                        fontWeight: FontWeight.w700,
                      ),
                    ),
                    const SizedBox(height: 2),
                    Text(
                      context.lang.profit_sharing_desc,
                      style: AppStyle.xs.copyWith(
                        color: AppColor.textWhite.withOpacity(0.8),
                      ),
                      maxLines: 2,
                      overflow: TextOverflow.ellipsis,
                    ),
                  ],
                ),
              ),
              const SpaceWidth(8),
              const Icon(
                Icons.chevron_right_rounded,
                color: AppColor.textWhite,
                size: 24,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
