import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';

class SleepHabitPage extends StatefulWidget {
  @override
  _SleepHabitPageState createState() => _SleepHabitPageState();
}

BoxConstraints? bodysize;

class _SleepHabitPageState extends State<SleepHabitPage> {
  @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(
              backgroundColor: Colors.transparent,
              appBar: AppBar(
                backgroundColor: Colors.transparent,
                iconTheme: const IconThemeData(color: Colors.white),
                automaticallyImplyLeading: false,
                titleSpacing: 0,
                title: SizedBox(
                  width: double.infinity,
                  height: 180.rpx,
                  child: Stack(
                    alignment: Alignment.center,
                    children: [
                      // 中间居中的标题
                      Text(
                        '睡眠习惯'.tr,
                        textAlign: TextAlign.center,
                        style: TextStyle(
                          color: Colors.white,
                          fontSize: 30.rpx,
                        ),
                      ),
                      // 左侧图标
                      Positioned(
                        left: 0.rpx,
                        child: returnIconButtomNew,
                      ),
                    ],
                  ),
                ),
                centerTitle: false,
              ),
              body: SafeArea(
                  top: true,
                  child: Padding(
                      padding: EdgeInsets.only(
                          left: 30.rpx, right: 30.rpx, top: 30.rpx),
                      child: Column(
                        children: [
                          ClickableContainer(
                              backgroundColor: Color(0XFF003058),
                              highlightColor: Color(0XFF055466),
                              borderRadius: 16.rpx,
                              padding: EdgeInsets.only(top: 0),
                              onTap: () {
                                Get.toNamed('/rxhxMht');
                              },
                              child: Container(
                                  alignment: Alignment.center,
                                  width: bodysize!.maxWidth * 1,
                                  height: bodysize!.maxHeight * 0.056,
                                  child: Text(
                                    '柔性唤醒'.tr,
                                    style: TextStyle(
                                        fontSize: 26.rpx, color: Colors.white),
                                  ))),
                          SizedBox(height: 20.rpx),
                          ClickableContainer(
                              backgroundColor: Color(0XFF003058),
                              highlightColor: Color(0XFF055466),
                              borderRadius: 16.rpx,
                              padding: EdgeInsets.only(top: 0),
                              onTap: () {
                                Get.toNamed('/syms');
                              },
                              child: Container(
                                  alignment: Alignment.center,
                                  width: bodysize!.maxWidth * 1,
                                  height: bodysize!.maxHeight * 0.056,
                                  child: Text(
                                    '睡眠隐私'.tr,
                                    style: TextStyle(
                                        fontSize: 26.rpx, color: Colors.white),
                                  )))
                        ],
                      ))),
            )),
      );
    });
  }
}
