import 'package:flutter/material.dart';
import 'package:qhd_prevention/tools/tools.dart';

import 'mine_about_page.dart';
import 'mine_set_page.dart';

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

  @override
  State<MinePage> createState() => _MinePageState();
}

class _MinePageState extends State<MinePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ListView(children: [
        Container(
          height: 120,
          color: Colors.white,
          padding: EdgeInsets.all(0),
          child: Padding(
            padding: EdgeInsets.only(left: 30),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              spacing: 10,
              children: [

                ClipRRect(
                  borderRadius: BorderRadius.circular(30),
                  child: Image.asset(
                    "assets/images/avatar.png",
                    height: 60,
                    width: 60,
                  ),
                ),
                SizedBox(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    spacing: 10,
                    children: [
                      Text(SessionService.instance.username!, style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold),),
                      Text("手机号:${SessionService.instance.phone!}", style: TextStyle(color: Colors.black54),)],
                  ),
                ),
              ],
            ),
          ),
        ),
        SizedBox(height: 10,),
        GestureDetector(
          onTap: () {
            pushPage(MineSetPage(), context);
          },
          child:   _setItemWidget("设置"),
        ),

        Divider(height: 1,color: Colors.black12,),
      GestureDetector(
        onTap: () {
          pushPage(MineAboutPage(), context);
        },
          child:   _setItemWidget("关于")
      ),
      ],),
    );
  }
  Widget _setItemWidget(final String text) {
    return Container(
      height: 55,
      color: Colors.white,
      child: Padding(
        padding: EdgeInsets.all(15),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text(text, style: TextStyle(fontSize: 16),),
            Icon(Icons.chevron_right)
          ],
        ),
      ),
    );
  }

}

