together_mobile/lib/screens/more/more_screen.dart

106 lines
3.5 KiB
Dart
Raw Normal View History

import 'package:cached_network_image/cached_network_image.dart';
2023-06-21 17:44:28 +08:00
import 'package:flutter/material.dart';
2023-06-21 17:44:28 +08:00
import 'package:go_router/go_router.dart';
2023-06-21 17:44:28 +08:00
import 'package:together_mobile/common/constants.dart';
import 'package:together_mobile/models/init_get_it.dart';
import 'package:together_mobile/models/user_model.dart';
import 'package:together_mobile/request/server.dart';
2023-06-21 17:44:28 +08:00
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(
2023-09-09 16:48:47 +08:00
onTap: () {
context.pushNamed('MainProfile');
},
2023-06-21 17:44:28 +08:00
child: Padding(
padding: const EdgeInsets.all(
10,
),
child: Row(
children: [
SizedBox(
width: 90,
height: 90,
2023-07-27 18:17:52 +08:00
child: getIt.get<UserProfile>().avatar.isEmpty
? const CircleAvatar(
backgroundImage:
AssetImage('assets/images/user_2.png'),
)
: CircleAvatar(
backgroundImage: CachedNetworkImageProvider(
2023-09-09 16:48:47 +08:00
'$userAvatarsUrl/${getIt.get<UserProfile>().avatar}',
2023-07-27 18:17:52 +08:00
),
),
2023-06-21 17:44:28 +08:00
),
const SizedBox(
width: 15,
),
Expanded(
2023-06-21 17:44:28 +08:00
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
getIt.get<UserProfile>().nickname,
2023-06-21 17:44:28 +08:00
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 20),
2023-06-21 17:44:28 +08:00
),
Text(
'用户名: ${getIt.get<UserAccount>().username}',
2023-06-21 17:44:28 +08:00
overflow: TextOverflow.ellipsis,
style: const TextStyle(
2023-06-21 17:44:28 +08:00
color: kUnActivatedColor,
fontSize: 14,
),
),
],
),
),
const SizedBox(
width: 15,
),
const Icon(Icons.keyboard_arrow_right),
],
),
),
),
const SizedBox(
height: 10,
),
ListTile(
2023-09-09 16:48:47 +08:00
onTap: () {
2023-09-10 11:30:20 +08:00
context.goNamed('Setting');
2023-09-09 16:48:47 +08:00
},
2023-06-21 17:44:28 +08:00
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),
),
],
),
),
);
}
}