import 'dart:io';

import 'package:flutter/material.dart';

import 'package:go_router/go_router.dart';

import 'package:together_mobile/common/constants.dart';
import 'package:together_mobile/models/init_get_it.dart';
import 'package:together_mobile/models/user_model.dart';

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

  @override
  State<MoreScreen> createState() => _MoreScreenState();
}

class _MoreScreenState extends State<MoreScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: const Icon(Icons.psychology),
      ),
      body: SafeArea(
        child: Column(
          children: [
            InkWell(
              onTap: () => context.push('/more/profile'),
              child: Padding(
                padding: const EdgeInsets.all(
                  10,
                ),
                child: Row(
                  children: [
                    SizedBox(
                      width: 90,
                      height: 90,
                      child: CircleAvatar(
                        backgroundImage: FileImage(
                          File(getIt.get<UserProfile>().avatar),
                        ),
                      ),
                    ),
                    const SizedBox(
                      width: 15,
                    ),
                    Expanded(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            getIt.get<UserProfile>().nickname,
                            overflow: TextOverflow.ellipsis,
                            style: const TextStyle(fontSize: 20),
                          ),
                          Text(
                            '用户名: ${getIt.get<UserAccount>().username}',
                            overflow: TextOverflow.ellipsis,
                            style: const TextStyle(
                              color: kUnActivatedColor,
                              fontSize: 14,
                            ),
                          ),
                        ],
                      ),
                    ),
                    const SizedBox(
                      width: 15,
                    ),
                    const Icon(Icons.keyboard_arrow_right),
                  ],
                ),
              ),
            ),
            const SizedBox(
              height: 10,
            ),
            ListTile(
              onTap: () => context.push('/more/setting'),
              contentPadding: const EdgeInsets.all(10),
              visualDensity: VisualDensity.compact,
              leading: const Icon(Icons.settings),
              title: const Text(
                '设置',
                style: TextStyle(fontSize: 18),
              ),
              trailing: const Icon(Icons.keyboard_arrow_right),
            ),
          ],
        ),
      ),
    );
  }
}