页面精简

This commit is contained in:
2022-10-31 10:42:17 +08:00
parent bc98924548
commit 52d775dd78
5 changed files with 75 additions and 84 deletions

View File

@@ -5,68 +5,61 @@ import 'package:chat/views/user/index/widgets/user_top_bar.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class UserPage extends StatefulWidget {
class UserPage extends StatelessWidget {
const UserPage({Key? key}) : super(key: key);
@override
_UserPageState createState() => _UserPageState();
}
class _UserPageState extends State<UserPage> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Column(
children: [
const UserTopBar(),
const Divider(
height: 0,
color: AppColors.border,
),
const SizedBox(height: 8),
const Divider(
height: 0,
color: AppColors.border,
),
ActionItem(
'服务',
onTap: () {
Get.toNamed(UserRoutes.serve);
},
),
const Divider(
height: 0,
color: AppColors.border,
),
const SizedBox(height: 8),
const Divider(
height: 0,
color: AppColors.border,
),
ActionItem(
'分享邀请',
onTap: () {
Get.toNamed(UserRoutes.share);
},
),
const Divider(
height: 0,
color: AppColors.border,
indent: 16,
),
ActionItem(
'设置',
onTap: () {
Get.toNamed(UserRoutes.setting);
},
),
const Divider(
height: 0,
color: AppColors.border,
),
],
),
return Scaffold(
body: Column(
children: [
const UserTopBar(),
const Divider(
height: 0,
color: AppColors.border,
),
const SizedBox(height: 8),
const Divider(
height: 0,
color: AppColors.border,
),
ActionItem(
'服务',
onTap: () {
Get.toNamed(UserRoutes.serve);
},
),
const Divider(
height: 0,
color: AppColors.border,
),
const SizedBox(height: 8),
const Divider(
height: 0,
color: AppColors.border,
),
ActionItem(
'分享邀请',
onTap: () {
Get.toNamed(UserRoutes.share);
},
),
const Divider(
height: 0,
color: AppColors.border,
indent: 16,
),
ActionItem(
'设置',
onTap: () {
Get.toNamed(UserRoutes.setting);
},
),
const Divider(
height: 0,
color: AppColors.border,
),
],
),
);
}

View File

@@ -11,17 +11,20 @@ import 'package:get/get.dart';
class UserTopBar extends StatelessWidget {
const UserTopBar({Key? key}) : super(key: key);
final double paddingTop = 96;
final double avatarHeight = 64;
@override
Widget build(BuildContext context) {
return Container(
color: AppColors.white,
padding: const EdgeInsets.only(
padding: EdgeInsets.only(
left: 24,
top: 48,
top: paddingTop,
right: 24,
bottom: 24,
),
height: 64 + 48 + 24,
// height: avatarHeight + paddingTop + 24,
child: GetX<AuthService>(builder: (_) {
return Row(
crossAxisAlignment: CrossAxisAlignment.end,
@@ -32,7 +35,7 @@ class UserTopBar extends StatelessWidget {
},
child: CustomAvatar(
_.userInfo.value.avatar,
size: 64,
size: avatarHeight,
),
),
const SizedBox(width: 16),