import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/coupon.dart';
import 'package:huixiang/retrofit/data/store.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/store/scan.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/round_button.dart';

class CouponDetailsWidget extends StatefulWidget {
  final Coupon coupon;
  CouponDetailsWidget(this.coupon);
  @override
  State<StatefulWidget> createState() {
    return _CouponDetailsWidget();
  }
}

class _CouponDetailsWidget extends State<CouponDetailsWidget> {
  int selectIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height:355.h,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(8),
          topRight: Radius.circular(8),
        ),
      ),
      child: SingleChildScrollView(
    physics: BouncingScrollPhysics(),
    child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Expanded(
                  child: Container(
                    alignment: Alignment.center,
                    margin: EdgeInsets.symmetric(vertical: 12),
                    child: Text(
                      S.of(context).shiyongxiangqing,
                      style: TextStyle(
                        fontWeight: MyFontWeight.bold,
                        fontSize: 15.sp,
                        color: Color(0xFF353535),
                      ),
                    ),
                  )),
              GestureDetector(
                onTap: () {
                  setState(() {
                    Navigator.of(context).pop();
                  });
                },
                child: Icon(
                  Icons.clear,
                  color: Colors.black,
                  size: 18,
                ),
              ),
              SizedBox(width: 14),
            ],
          ),
          Container(
            width: double.infinity,
            height: 1.h,
            color: Color(0xFFF2F2F2),
            margin: EdgeInsets.only(bottom: 11.h),
          ),
          Container(
            color: Colors.white,
            margin: EdgeInsets.symmetric(horizontal: 12),
            child: Html(
              data: widget.coupon.remark ?? "",
              customImageRenders: {
                networkSourceMatcher(): networkImageRender(
                  loadingWidget: () {
                    return Container();
                  },
                ),
              },
            ),
          ),
  ])));
  }
}