feat: 完成主页、消息页、我的页三个模块开发
This commit is contained in:
parent
f8db0ce0ff
commit
64f1a28997
@ -27,7 +27,7 @@ class AppPages {
|
|||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: AppRoutes.home,
|
name: AppRoutes.home,
|
||||||
page: () => const HomeView(),
|
page: () => HomeView(),
|
||||||
binding: HomeBinding(),
|
binding: HomeBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:flutter/widgets.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:starwork_flutter/base/app_permission.dart';
|
import 'package:starwork_flutter/base/app_permission.dart';
|
||||||
|
import 'package:super_tooltip/super_tooltip.dart';
|
||||||
import 'package:starwork_flutter/views/home/widget/home_attendance_chart_area_widget.dart';
|
import 'package:starwork_flutter/views/home/widget/home_attendance_chart_area_widget.dart';
|
||||||
import 'package:starwork_flutter/views/home/widget/home_carousel_area_widget.dart';
|
import 'package:starwork_flutter/views/home/widget/home_carousel_area_widget.dart';
|
||||||
import 'package:starwork_flutter/views/home/widget/home_function_list_area_widget.dart';
|
import 'package:starwork_flutter/views/home/widget/home_function_list_area_widget.dart';
|
||||||
@ -15,7 +16,10 @@ import 'package:starwork_flutter/views/home/widget/home_team_notice_row_widget.d
|
|||||||
import 'home_controller.dart';
|
import 'home_controller.dart';
|
||||||
|
|
||||||
class HomeView extends GetView<HomeController> {
|
class HomeView extends GetView<HomeController> {
|
||||||
const HomeView({super.key});
|
HomeView({super.key});
|
||||||
|
|
||||||
|
// 气泡提示框控制器
|
||||||
|
final SuperTooltipController _tooltipController = SuperTooltipController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -89,9 +93,32 @@ class HomeView extends GetView<HomeController> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Icon(
|
SuperTooltip(
|
||||||
Icons.add_circle_outline,
|
controller: _tooltipController,
|
||||||
size: 22.sp,
|
popupDirection: TooltipDirection.down,
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
borderColor: Colors.transparent,
|
||||||
|
borderWidth: 0,
|
||||||
|
borderRadius: 8.0,
|
||||||
|
arrowLength: 8.0,
|
||||||
|
arrowBaseWidth: 12.0,
|
||||||
|
arrowTipDistance: 14.0.h,
|
||||||
|
hasShadow: false,
|
||||||
|
shadowColor: Colors.black26,
|
||||||
|
shadowBlurRadius: 8.0,
|
||||||
|
shadowSpreadRadius: 2.0,
|
||||||
|
touchThroughAreaShape: ClipAreaShape.rectangle,
|
||||||
|
barrierColor: Colors.transparent,
|
||||||
|
content: _buildTooltipContent(),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
_tooltipController.showTooltip();
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
Icons.add_circle_outline,
|
||||||
|
size: 22.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -229,4 +256,104 @@ class HomeView extends GetView<HomeController> {
|
|||||||
// 调用controller的刷新方法
|
// 调用controller的刷新方法
|
||||||
await controller.refreshHome();
|
await controller.refreshHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 构建气泡提示框内容
|
||||||
|
Widget _buildTooltipContent() {
|
||||||
|
final List<Map<String, dynamic>> menuItems = [
|
||||||
|
{
|
||||||
|
'title': '搜索设备',
|
||||||
|
'icon': Icons.sensors_rounded,
|
||||||
|
'onTap': () => _handleMenuTap('添加设备'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'title': '加入团队',
|
||||||
|
'icon': Icons.group_add,
|
||||||
|
'onTap': () => _handleMenuTap('创建群组'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
width: 100.w,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: menuItems.asMap().entries.map((entry) {
|
||||||
|
final index = entry.key;
|
||||||
|
final item = entry.value;
|
||||||
|
return _buildMenuItem(
|
||||||
|
title: item['title'],
|
||||||
|
icon: item['icon'],
|
||||||
|
onTap: item['onTap'],
|
||||||
|
isLast: index == menuItems.length - 1,
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 构建单个菜单项
|
||||||
|
Widget _buildMenuItem({
|
||||||
|
required String title,
|
||||||
|
required IconData icon,
|
||||||
|
required VoidCallback onTap,
|
||||||
|
required bool isLast,
|
||||||
|
}) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
_tooltipController.hideTooltip();
|
||||||
|
onTap();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8.w),
|
||||||
|
width: double.infinity,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: !isLast
|
||||||
|
? const Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: Colors.grey,
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
icon,
|
||||||
|
size: 18.sp,
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
|
SizedBox(width: 8.w,),
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.sp,
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 处理菜单点击事件
|
||||||
|
void _handleMenuTap(String menuTitle) {
|
||||||
|
Get.snackbar(
|
||||||
|
'提示',
|
||||||
|
'点击了:$menuTitle',
|
||||||
|
snackPosition: SnackPosition.TOP,
|
||||||
|
duration: const Duration(seconds: 2),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
pubspec.lock
16
pubspec.lock
@ -477,14 +477,6 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.1"
|
version: "2.4.1"
|
||||||
skeletonizer:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: skeletonizer
|
|
||||||
sha256: "0dcacc51c144af4edaf37672072156f49e47036becbc394d7c51850c5c1e884b"
|
|
||||||
url: "https://pub.flutter-io.cn"
|
|
||||||
source: hosted
|
|
||||||
version: "1.4.3"
|
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -530,6 +522,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.0"
|
||||||
|
super_tooltip:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: super_tooltip
|
||||||
|
sha256: "06f734caa2ddb2313813dac2c939f096222beece9c146ec7d71e07e6e869bef2"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.0"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -32,10 +32,10 @@ dependencies:
|
|||||||
# loading 动画库 需要指定flutter_spinkit为固定版本
|
# loading 动画库 需要指定flutter_spinkit为固定版本
|
||||||
flutter_easyloading: ^3.0.0
|
flutter_easyloading: ^3.0.0
|
||||||
flutter_spinkit: 5.2.1
|
flutter_spinkit: 5.2.1
|
||||||
# 骨架屏
|
|
||||||
skeletonizer: ^1.4.3
|
|
||||||
# 轮播图
|
# 轮播图
|
||||||
carousel_slider: ^5.1.1
|
carousel_slider: ^5.1.1
|
||||||
|
# 气泡提示框
|
||||||
|
super_tooltip: ^2.0.8
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user