import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_scaffold/common/index.dart';
import 'package:ln_jq_app/common/login_util.dart';

class MallExchangeSuccessPage extends StatelessWidget {
  const MallExchangeSuccessPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        backgroundColor: Colors.white,
        elevation: 0,
        leading: IconButton(
          icon: const Icon(Icons.arrow_back_ios, size: 20, color: Colors.black),
          onPressed: () => Get.back(), // 返回首页
        ),
        title: const Text('商品兑换', style: TextStyle(color: Colors.black, fontSize: 18)),
      ),
      body: Center(
        child: Column(
          children: [
            SizedBox(height: 114.h),
            _buildSuccessIcon(),
            const SizedBox(height: 24),
            Text(
              '兑换成功',
              style: TextStyle(
                fontSize: 24.sp,
                fontWeight: FontWeight.w600,
                color: Color(0xFF333333),
              ),
            ),
            const SizedBox(height: 8),
            Text(
              '预计 3 日内发货\n请留意查收',
              textAlign: TextAlign.center,
              style: TextStyle(fontSize: 14.sp, color: Color(0xFF999999)),
            ),
            const SizedBox(height: 60),
            ElevatedButton(
              onPressed: () => Get.back(),
              style: ElevatedButton.styleFrom(
                backgroundColor: const Color(0xFF007A45),
                minimumSize: const Size(140, 50),
                shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
              ),
              child: Text(
                '返回首页',
                style: TextStyle(
                  color: Colors.white,
                  fontWeight: FontWeight.w400,
                  fontSize: 16.sp,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }

  Widget _buildSuccessIcon() {
    return Container(child: LoginUtil.getAssImg("mall_pay_success@2x"));
  }
}
