import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';

class SettlementTips extends StatefulWidget {
  final Function tips;
  final String text;
  final Color color;
  SettlementTips(this.tips, {this.text,this.color});

  @override
  State<StatefulWidget> createState() {
    return _SettlementTips();
  }
}

class _SettlementTips extends State<SettlementTips> {

  @override
  Widget build(BuildContext context) {
    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          width: MediaQuery.of(context).size.width - 80.w,
          height: 165.h,
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(8),
          ),
          child: Column(
            children: [
              Container(
                width: double.infinity,
                height:109.h,
                alignment: Alignment.center,
                padding: EdgeInsets.all(10),
                child: Text(
                  widget.text ?? S.of(context).querenyaoshanchudangqianpinglunma,
                  style: TextStyle(
                    fontSize: 15.sp,
                    height: 1.5.h,
                    fontWeight: MyFontWeight.medium,
                    color: Color(0xFF353535),
                  ),
                ),
              ),
              Container(
                color: Color(0x1A000000),
                height: 1.h,
              ),
              Container(
                height: 55.h,
                child: InkWell(
                  onTap: () {
                    SmartDialog.dismiss();
                    widget.tips();
                  },
                  child: Container(
                    width: double.infinity,
                    height: 90.h,
                    alignment: Alignment.center,
                    child: Text(
                      S.of(context).queren,
                      style: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: MyFontWeight.medium,
                        color: widget?.color ?? Color(0xFF32A060),
                      ),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}