import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:marking_app/routes/RouterManager.dart';
import 'package:marking_app/utils/const_text.dart';
import 'package:marking_app/utils/fluro/index.dart';
import 'package:marking_app/utils/index.dart';
import 'package:marking_app/utils/my_text.dart';
import 'package:package_info/package_info.dart';
// 其他页面

class OhterPage extends StatefulWidget {
  const OhterPage({super.key});

  @override
  State<OhterPage> createState() => _OhterPageState();
}

class _OhterPageState extends State<OhterPage> {
  String localVersion = '';

  @override
  void initState() {
    super.initState();
    getPageInfo();
  }

  // 获取当前版本号
  getPageInfo() async {
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    toUpState(setState, () => localVersion = packageInfo.version, mounted);
  }

  @override
  Widget build(BuildContext context) {
    final personalInfoTitleStly = TextStyle(
      color: const Color.fromRGBO(80, 87, 103, 1),
      fontSize: 16.sp,
    );
    final personalInfoValStly = TextStyle(
      color: const Color.fromRGBO(148, 163, 182, 1),
      fontSize: 16.sp,
    );

    return Scaffold(
        backgroundColor: const Color.fromRGBO(248, 248, 248, 1),
        appBar: AppBar(
          backgroundColor: Theme.of(context).primaryColor,
          title: quickText('其他', color: Colors.white),
        ),
        body: Stack(
          alignment: const FractionalOffset(0.5, 0.98),
          children: [
            ListView(
              children: [
                Container(
                  margin: EdgeInsets.symmetric(vertical: 22.h, horizontal: 16.w),
                  padding: EdgeInsets.symmetric(vertical: 22.h, horizontal: 16.w),
                  height: 130.h,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(6.w)),
                    color: Colors.white,
                    boxShadow: const [
                      BoxShadow(
                        color: Color.fromRGBO(46, 91, 255, 0.1),
                        offset: Offset.zero, //阴影y轴偏移量
                        blurRadius: 20, //阴影模糊程度
                        spreadRadius: 10, //阴影扩散程度
                      )
                    ],
                  ),
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      InkWell(
                        onTap: () {
                          RouterManager.router.navigateTo(
                            context,
                            transition: TransitionType.fadeIn,
                            '${RouterManager.agreementPath}?type=${AGREEMENT_KEY.PRIVACY_GREEMENT.name}',
                          );
                        },
                        child: Container(
                          padding: EdgeInsets.only(bottom: 4.h),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text('用户隐私协议', style: personalInfoTitleStly),
                              Icon(
                                Icons.arrow_forward_ios,
                                color: const Color.fromRGBO(80, 87, 103, 1),
                                size: 16.sp,
                              )
                            ],
                          ),
                        ),
                      ),
                      Container(
                        height: 1.w,
                        color: const Color.fromRGBO(240, 243, 255, 1),
                      ),
                      SizedBox(height: 8.h),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [Text('APP版本', style: personalInfoTitleStly), quickText(localVersion)],
                      )
                    ],
                  ),
                ),
                // InkWell(
                //   onTap: () {
                //     RouterManager.router.navigateTo(
                //       context,
                //       transition: TransitionType.fadeIn,
                //       '${RouterManager.agreementPath}?type=${AGREEMENT_KEY.PRIVACY_GREEMENT.name}',
                //     );
                //   },
                //   child: Container(
                //     decoration: BoxDecoration(
                //       border: Border(
                //         bottom: BorderSide(
                //           color: Color.fromARGB(255, 171, 172, 175),
                //           width: 1.w,
                //         ),
                //       ),
                //     ),
                //     padding: EdgeInsets.symmetric(vertical: 12.h),
                //     child: Row(
                //       mainAxisAlignment: MainAxisAlignment.spaceBetween,
                //       children: [
                //         Text('用户隐私协议', style: personalInfoTitleStly),
                //         Icon(
                //           Icons.arrow_forward_ios,
                //           color: const Color.fromRGBO(80, 87, 103, 1),
                //           size: 16.sp,
                //         )
                //       ],
                //     ),
                //   ),
                // ),
                // Container(
                //   decoration: BoxDecoration(
                //     border: Border(
                //       bottom: BorderSide(
                //         color: Color.fromARGB(255, 171, 172, 175),
                //         width: 1.w,
                //       ),
                //     ),
                //   ),
                //   margin: EdgeInsets.only(top: 20.h),
                //   padding: EdgeInsets.symmetric(vertical: 14.h),
                //   child: Row(
                //     mainAxisAlignment: MainAxisAlignment.spaceBetween,
                //     children: [
                //       Text('APP版本', style: personalInfoTitleStly),
                //       quickText(localVersion)
                //     ],
                //   ),
                // ),
              ],
            ),
            Row(
              mainAxisSize: MainAxisSize.min,
              mainAxisAlignment: MainAxisAlignment.center,
              children: [Text('APP备案号: ', style: personalInfoTitleStly), quickText('渝ICP备17007225号-3A', size: 14.sp)],
            ),
          ],
        ));
  }
}
