import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/dialog/global_dialog/policy_dialog/policy_dialog_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class PolicyConfirmDialog extends StatelessWidget {
  final PolicyDialogModel model;

  const PolicyConfirmDialog(this.model, {Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.transparent,
      body: Center(
        child: UnconstrainedBox(
          child: Container(
            padding: EdgeInsets.all(15),
            width: 290,
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(13), color: Colors.white),
            child: Column(
              children: <Widget>[
                Text(
                  model?.title ?? '',
                  style: TextStyle(
                      fontSize: 16,
                      fontWeight: FontWeight.bold,
                      color: HexColor.fromHex(model?.titleColor ?? '#333333')),
                ),
                Padding(
                  padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
                  child: Text(
                    model?.content ?? '',
                    style: TextStyle(
                      fontSize: 12,
                      color: HexColor.fromHex(model?.contentColor ?? '#555555'),
                    ),
                  ),
                ),
                Row(
                  children: <Widget>[
                    Expanded(
                      child: GestureDetector(
                        onTap: () {
                          Navigator.pop(context, false);
                        },
                        child: Container(
                          height: 36,
                          child: Center(
                            child: Text(
                              model?.leftBfnText ?? '',
                              style: TextStyle(
                                  color: HexColor.fromHex(
                                      model?.leftBfnTextColor ?? '')),
                            ),
                          ),
                          decoration: BoxDecoration(
                              color: HexColor.fromHex(
                                  model?.leftBfnBgColor ?? '#ffffff'),
                              borderRadius: BorderRadius.circular(18),
                              border: Border.all(
                                  color: Color(0xffd8d8d8), width: 1)),
                        ),
                      ),
                    ),
                    Container(
                      width: 30,
                    ),
                    Expanded(
                      child: GestureDetector(
                        onTap: () {
                          Navigator.pop(context, true);
                        },
                        child: Container(
                          height: 36,
                          child: Center(
                            child: Text(
                              model?.rightBfnText ?? '',
                              style: TextStyle(
                                  color: HexColor.fromHex(
                                      model?.rightBfnTextColor ?? '')),
                            ),
                          ),
                          decoration: BoxDecoration(
                            color:
                                HexColor.fromHex(model?.rightBfnBgColor ?? ''),
                            borderRadius: BorderRadius.circular(18),
                          ),
                        ),
                      ),
                    ),
                  ],
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}
