import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appColors.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';

class BookSuccessPage extends GetView {
  final scaffoldKey = GlobalKey<ScaffoldState>();
  BoxConstraints? bodysize;
  Map data;
  BookSuccessPage({required this.data});
  final infoList = [
    {"label": "预约编号：", "value": "54648614654646"},
    {"label": "预约人员：", "value": "张大大"},
    {"label": "手机号码：", "value": "139****5699"},
    {"label": "体验时间：", "value": "2024-02-15 07:30"},
    {"label": "预约门店：", "value": "SWES眠花糖杭州南星桥旗舰店"},
    {"label": "门店地址：", "value": "浙江省杭州市上城区飞云江路45号一层"},
  ];

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(builder: (context, cc) {
      bodysize = cc;
      return GestureDetector(
          onTap: () => FocusScope.of(context).unfocus(),
          child: Container(
            decoration: const BoxDecoration(
              image: DecorationImage(
                image: AssetImage('assets/images/new_background.png'), // 本地图片
                fit: BoxFit.fill, // 填满整个 Container
              ),
            ),
            child: Scaffold(
              // key: scaffoldKey,
              backgroundColor: Colors.transparent,
              appBar: AppBar(
                backgroundColor: Colors.transparent,
                automaticallyImplyLeading: false,
                iconTheme: IconThemeData(color: Colors.white),
                titleSpacing: 0,
                // leading: returnIconButtomAddCallback(() {
                //   controller.saveDataApi();
                //   updateParm(isShowToast: false);
                // }),
                // leading: returnIconButtomNew,
                title: Container(
                  width: double.infinity,
                  height: 180.rpx,
                  child: Stack(
                    alignment: Alignment.center,
                    children: [
                      // 中间居中的标题
                      Text(
                        '我要预约',
                        textAlign: TextAlign.center,
                        style: TextStyle(
                          color: Colors.white,
                          fontSize: 30.rpx,
                        ),
                      ),
                      // 左侧图标
                      Positioned(
                        left: 0.rpx,
                        child: returnIconButtomNew,
                      ),
                    ],
                  ),
                ),

                actions: [],
                centerTitle: false,
              ),

              body: Container(
                width: bodysize!.maxWidth,
                height: bodysize!.maxHeight * 1,
                child: Column(
                  mainAxisSize: MainAxisSize.max,
                  children: [
                    Container(
                      width: bodysize!.maxWidth,
                      margin: EdgeInsets.only(top: 90.rpx),
                      child: Column(
                        mainAxisSize: MainAxisSize.max,
                        children: [
                          Container(
                            width: 148.rpx,
                            height: 148.rpx,
                            clipBehavior: Clip.antiAlias,
                            decoration: const BoxDecoration(
                              shape: BoxShape.circle,
                            ),
                            child: Image.asset(
                              'assets/images/success.png',
                              fit: BoxFit.contain,
                              color: Color(0xFF84F5FF),
                            ),
                          ),
                          Align(
                            alignment: const AlignmentDirectional(0, 0),
                            child: Text(
                              '预约成功！',
                              style: TextStyle(
                                fontFamily: 'Readex Pro',
                                fontSize: 30.rpx,
                                color: Colors.white,
                                letterSpacing: 0,
                                fontWeight: FontWeight.w600,
                              ),
                            ),
                          ),
                        ].divide(SizedBox(height: 30.rpx)),
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(
                          left: 30.rpx, right: 30.rpx, top: 55.rpx),
                      width: bodysize!.maxWidth,
                      decoration: BoxDecoration(
                        color: Color(0xFF003058),
                        borderRadius: BorderRadius.circular(16.rpx),
                      ),
                      child: SingleChildScrollView(
                          child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          SizedBox(height: 20), // 上间距
                          for (var item in infoList)
                            Container(
                                height: 60.rpx,
                                padding:
                                    EdgeInsets.symmetric(horizontal: 35.rpx),
                                alignment: Alignment.centerLeft,
                                child: Row(
                                  children: [
                                    Text(
                                      item['label']!,
                                      style: TextStyle(
                                        color: Color(0XFF929699),
                                        fontSize: 26.rpx,
                                      ),
                                    ),
                                    SizedBox(width: 30.rpx),
                                    Text(
                                      item['value']!,
                                      style: TextStyle(
                                        color: Colors.white,
                                        fontSize: 26.rpx,
                                      ),
                                    ),
                                  ],
                                )),

                          SizedBox(height: 60.rpx), // 空间隔断
                          Padding(
                            padding: EdgeInsets.symmetric(horizontal: 35),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: [
                                SizedBox(
                                    width: 200.rpx,
                                    height: 60.rpx,
                                    child: ElevatedButton(
                                      style: ElevatedButton.styleFrom(
                                        backgroundColor: Color(0xFF84F5FF),
                                        padding: EdgeInsets.zero, // 去除文字内边距
                                        tapTargetSize: MaterialTapTargetSize
                                            .shrinkWrap, // 去除额外点击区域
                                        // shape:
                                        //     RoundedRectangleBorder(), // 可选：去除默认圆角
                                      ),
                                      onPressed: () {},
                                      child: Center(
                                        // 保证文字居中
                                        child: Text(
                                          "关闭",
                                          style: TextStyle(
                                            color: Color(0XFF011D33),
                                            fontSize: 26.rpx,
                                          ),
                                        ),
                                      ),
                                    )),
                                SizedBox(width: 60.rpx),
                                SizedBox(
                                    width: 200.rpx,
                                    height: 60.rpx,
                                    child: ElevatedButton(
                                      style: ElevatedButton.styleFrom(
                                        backgroundColor: Color(0xFF84F5FF),
                                        padding: EdgeInsets.zero, // 去除文字内边距
                                        tapTargetSize: MaterialTapTargetSize
                                            .shrinkWrap, // 去除额外点击区域
                                        // shape:
                                        //     RoundedRectangleBorder(), // 可选：去除默认圆角
                                      ),
                                      onPressed: () {},
                                      child: Center(
                                        // 保证文字居中
                                        child: Text(
                                          "我的预约",
                                          style: TextStyle(
                                            color: Color(0XFF011D33),
                                            fontSize: 26.rpx,
                                          ),
                                        ),
                                      ),
                                    ))
                              ],
                            ),
                          ),

                          SizedBox(height: 80.rpx), // 下间距
                        ],
                      )),
                    ),
                  ],
                ),
              ),
            ),
          ));
    });
  }
}
