import 'package:chat/configs/app_colors.dart';
import 'package:chat/routes/user_routes.dart';
import 'package:chat/services/auth_service.dart';
import 'package:chat/views/home/widgets/action_button.dart';
import 'package:chat/views/home/widgets/action_item.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class UserSettingPage extends StatefulWidget {
  const UserSettingPage({Key? key}) : super(key: key);

  @override
  _UserSettingPageState createState() => _UserSettingPageState();
}

class _UserSettingPageState extends State<UserSettingPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('设置中心'),
      ),
      body: Column(
        children: [
          ActionItem(
            '账号与安全',
            onTap: () {
              Get.toNamed(UserRoutes.safe);
            },
          ),
          const Divider(
            height: 0,
            color: AppColors.border,
          ),
          const SizedBox(height: 8),
          const Divider(
            height: 0,
            color: AppColors.border,
          ),
          ActionItem(
            '新消息通知',
            onTap: () {
              Get.toNamed(UserRoutes.safe);
            },
          ),
          const Divider(
            height: 0,
            color: AppColors.border,
            indent: 16,
          ),
          ActionItem(
            '隐私权限',
            onTap: () {
              Get.toNamed(UserRoutes.safe);
            },
          ),
          const Divider(
            height: 0,
            color: AppColors.border,
          ),
          const SizedBox(height: 8),
          ActionItem(
            '关于ZH-CHAT',
            onTap: () {
              Get.toNamed(UserRoutes.safe);
            },
          ),
          const Divider(
            height: 0,
            color: AppColors.border,
            indent: 16,
          ),
          ActionItem(
            '帮助与反馈',
            onTap: () {
              Get.toNamed(UserRoutes.safe);
            },
          ),
          const SizedBox(height: 8),
          const Divider(
            height: 0,
            color: AppColors.border,
          ),
          ActionItem(
            '版本更新',
            onTap: () {
              Get.toNamed(UserRoutes.safe);
            },
          ),
          const Divider(
            height: 0,
            color: AppColors.border,
          ),
          const SizedBox(height: 8),
          const Divider(
            height: 0,
            color: AppColors.border,
          ),
          ActionButton(
            '退出',
            color: AppColors.primary,
            onTap: () async {
              AuthService.to.logout();
            },
          ),
          const Divider(
            height: 0,
            color: AppColors.border,
          ),
        ],
      ),
    );
  }
}
