feat: 完成主页、消息页、我的页三个模块开发

This commit is contained in:
liyi 2025-09-03 14:44:15 +08:00
parent 63773b1e24
commit cff16f671f
6 changed files with 330 additions and 21 deletions

BIN
assets/icon/icon_menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
assets/icon/icon_vip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -52,6 +52,8 @@ class AppImages{
static const String iconTeamQrcode = 'assets/icon/team_qrcode.png';
static const String iconDeviceManagement = 'assets/icon/device_management.png';
static const String iconTableMenu = 'assets/icon/icon_table_menu.png';
static const String iconVip = 'assets/icon/icon_vip.png';
static const String defaultAvatar = 'assets/images/default_avatar.png';
//
static const String iconHome = 'assets/icon/bar/home.png';

View File

@ -40,8 +40,13 @@ class HomeView extends GetView<HomeController> {
children: [
//
_buildPageHead(context),
SizedBox(
height: 10.h,
Obx(
() => Visibility(
visible: controller.isOpenNotificationPermission.value,
child: SizedBox(
height: 10.h,
),
),
),
_buildSystemNotificationPermissionRow(),
@ -160,23 +165,29 @@ class HomeView extends GetView<HomeController> {
return RefreshIndicator(
onRefresh: _onRefresh,
//
color: const Color(0xFF4A90E2), //
backgroundColor: Colors.white, //
color: const Color(0xFF4A90E2),
//
backgroundColor: Colors.white,
//
//
displacement: 60.0, //
edgeOffset: 0.0, //
displacement: 60.0,
//
edgeOffset: 0.0,
//
//
triggerMode: RefreshIndicatorTriggerMode.onEdge, //
triggerMode: RefreshIndicatorTriggerMode.onEdge,
//
//
strokeWidth: 2.5, //
strokeWidth: 2.5,
//
//
semanticsLabel: '下拉刷新首页内容',
semanticsValue: '刷新中...',
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(
//

View File

@ -1,5 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:starwork_flutter/common/constant/app_images.dart';
import 'mine_controller.dart';
@ -9,16 +12,309 @@ class MineView extends GetView<MineController> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('MineView'),
centerTitle: true,
),
body: const Center(
child: Text(
'MineView is working',
style: TextStyle(fontSize: 20),
backgroundColor: const Color(0xFFF6F7FB),
body: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 4.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildHeader(),
SizedBox(height: 10.h),
_buildUserProfile(),
SizedBox(height: 10.h),
_buildMenuItems(),
SizedBox(height: 10.h),
_buildBottomButtons(),
],
),
),
),
),
);
}
//
Widget _buildHeader() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'我的',
style: TextStyle(
fontSize: 18.sp,
fontWeight: FontWeight.w500,
color: Colors.black87,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
Row(
children: [
Stack(
children: [
Icon(
Icons.settings,
size: 22.sp,
),
Positioned(
right: 0,
top: 0,
child: Container(
width: 8.w,
height: 8.h,
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
),
],
),
],
),
],
);
}
//
Widget _buildUserProfile() {
return Row(
children: [
CircleAvatar(
radius: 30.r,
backgroundColor: Colors.grey[200],
child: ClipOval(
child: Image(
image: const AssetImage(AppImages.defaultAvatar),
width: 56.w,
height: 56.w,
fit: BoxFit.cover,
gaplessPlayback: true,
//
filterQuality: FilterQuality.medium,
//
errorBuilder: (context, error, stackTrace) {
return Icon(
Icons.person,
size: 30.sp,
color: Colors.grey[400],
);
},
),
),
),
SizedBox(width: 16.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'HikMall_30013234',
style: TextStyle(
fontSize: 18.sp,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(height: 4.h),
Row(
children: [
Image(
image: AssetImage(AppImages.iconVip),
width: 20.w,
height: 20.w,
fit: BoxFit.contain,
gaplessPlayback: true,
//
filterQuality: FilterQuality.medium,
//
errorBuilder: (context, error, stackTrace) {
return Icon(
Icons.image_not_supported,
size: 26.sp,
color: Colors.grey,
);
},
),
SizedBox(width: 4.w),
Text(
'用户',
style: TextStyle(
fontSize: 14.sp,
color: Colors.grey,
),
),
],
),
],
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 6.w, vertical: 4.h),
decoration: BoxDecoration(
color: const Color(0xFFEBEFFF),
borderRadius: BorderRadius.circular(6.r),
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(
Icons.group,
size: 14.sp,
color: Colors.blue,
),
SizedBox(width: 4.w),
Text(
'我的团队',
style: TextStyle(
fontSize: 12.sp,
color: Colors.black,
fontWeight: FontWeight.w500),
),
],
),
),
],
);
}
//
Widget _buildMenuItems() {
return Container(
padding: EdgeInsets.symmetric(horizontal: 10.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.r),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
spreadRadius: 1,
blurRadius: 4,
offset: const Offset(0, 2),
),
],
),
child: Column(
children: [
_buildMenuItem(
title: '帮助中心',
onTap: () {},
),
Divider(height: 1.h, color: Colors.grey[200]),
_buildMenuItem(
title: '线下体验',
onTap: () {},
),
Divider(height: 1.h, color: Colors.grey[200]),
_buildMenuItem(
title: '分享海康互联',
onTap: () {},
),
],
),
);
}
//
Widget _buildBottomButtons() {
return Container(
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.r),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
spreadRadius: 1,
blurRadius: 4,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buildBottomButton(
icon: Icons.receipt_long,
title: '我的订单',
onTap: () {},
),
Container(
width: 1.w,
height: 40.h,
color: Colors.grey[200],
),
_buildBottomButton(
icon: Icons.receipt,
title: '发票管理',
onTap: () {},
),
],
),
);
}
//
Widget _buildMenuItem({
required String title,
required VoidCallback onTap,
}) {
return InkWell(
onTap: onTap,
child: Container(
padding: EdgeInsets.symmetric( vertical: 10.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: TextStyle(
fontSize: 16.sp,
color: Colors.black87,
),
),
Icon(
Icons.arrow_forward_ios,
size: 16.sp,
color: Colors.grey[400],
),
],
),
),
);
}
//
Widget _buildBottomButton({
required IconData icon,
required String title,
required VoidCallback onTap,
}) {
return GestureDetector(
onTap: onTap,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
icon,
size: 20.sp,
color: Colors.grey[600],
),
SizedBox(width: 8.w),
Text(
title,
style: TextStyle(
fontSize: 14.sp,
color: Colors.grey[600],
),
),
],
),
);
}
}