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 Tips extends StatefulWidget {
  final Function tips;
  final String text;
  Tips(this.tips, {this.text});

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

class _Tips extends State<Tips> {
  @override
  Widget build(BuildContext context) {
    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          width: MediaQuery.of(context).size.width - 80.w,
          height: 146.h,
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(8),
          ),
          child: Column(
            children: [
              Container(
                width: double.infinity,
                height: 90.h,
                alignment: Alignment.center,
                padding: EdgeInsets.all(10),
                child: Text(
                  widget.text ?? S.of(context).querenyaoshanchudangqianpinglunma,
                  style: TextStyle(
                    fontSize: 17.sp,
                    fontWeight: MyFontWeight.medium,
                    color: Color(0xFF353535),
                  ),
                ),
              ),
              Container(
                color: Color(0x1A000000),
                height: 1.h,
              ),
              Container(
                height: 55.h,
                child: Row(
                  mainAxisSize: MainAxisSize.max,
                  children: [
                    Expanded(
                      child: InkWell(
                        onTap:  () {
                          SmartDialog.dismiss();
                        },
                        child: Container(
                          width: double.infinity,
                          height: 90.h,
                          alignment: Alignment.center,
                          child: Text(
                            S.of(context).quxiao,
                            style: TextStyle(
                              fontSize: 17.sp,
                              fontWeight: MyFontWeight.medium,
                              color: Color(0xFF353535),
                            ),
                          ),
                        ),
                      ),
                      flex: 1,
                    ),
                    Container(
                      color: Color(0x1A000000),
                      width: 1.h,
                    ),
                    Expanded(
                      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: 17.sp,
                              fontWeight: MyFontWeight.medium,
                              color: Color(0xFF32A060),
                            ),
                          ),
                        ),
                      ),
                      flex: 1,
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}