From e24c5fee655f7ee8b73e8e0e368a9dcddca869fe Mon Sep 17 00:00:00 2001 From: tanlongsheng <252620078@qq.com> Date: Wed, 16 Jul 2025 17:55:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/meeting_mine_controller.dart | 17 ++++++ .../bottomSheet/statistics_bottom_sheet.dart | 28 +++++++-- .../meeting/views/meeting_mine_view.dart | 61 ++++++++++--------- 3 files changed, 70 insertions(+), 36 deletions(-) diff --git a/lib/modules/meeting/controllers/meeting_mine_controller.dart b/lib/modules/meeting/controllers/meeting_mine_controller.dart index b219cc602..9e0fe905d 100644 --- a/lib/modules/meeting/controllers/meeting_mine_controller.dart +++ b/lib/modules/meeting/controllers/meeting_mine_controller.dart @@ -1,4 +1,5 @@ import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../../data/services/db/sqflite_api.dart'; @@ -7,6 +8,8 @@ import '../../profile/controllers/profile_controller.dart'; class MeetingMineController extends GetxController { final profileCtrl = Get.find(); + final ScrollController scrollController = ScrollController(); + Map statistics = {}; RxInt days = 0.obs; @@ -21,9 +24,23 @@ class MeetingMineController extends GetxController { @override void onInit() { super.onInit(); + WidgetsBinding.instance.addPostFrameCallback((_) { + if (scrollController.hasClients) { + final now = DateTime.now(); + if (now.month > 6) { + scrollController.jumpTo(scrollController.position.maxScrollExtent); + } + } + }); _getStatistics(); } + @override + void onClose() { + scrollController.dispose(); + super.onClose(); + } + void _getStatistics() async { List dataList = await SqfliteApi.getMeetingList(); numberFiles.value = dataList.length; diff --git a/lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart b/lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart index 2eb8d1f38..e9cd37d2a 100644 --- a/lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart +++ b/lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart @@ -1,7 +1,10 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import '../../../profile/controllers/profile_controller.dart'; import '../../controllers/meeting_mine_controller.dart'; class StatisticsBottomSheet extends StatefulWidget { @@ -13,6 +16,7 @@ class StatisticsBottomSheet extends StatefulWidget { class _StatisticsBottomSheetState extends State { final _mineController = Get.find(); + final _profileCtrl = Get.find(); @override Widget build(BuildContext context) { @@ -49,15 +53,27 @@ class _StatisticsBottomSheetState extends State { margin: EdgeInsets.only(bottom: 10.w), decoration: BoxDecoration( borderRadius: BorderRadius.circular(50.w), - image: const DecorationImage( - image: NetworkImage( - 'https://pic8.iqiyipic.com/image/20250403/ed/a7/a_100013977_m_601_m75_318_424.avif'), - fit: BoxFit.cover, - ), + ), + child: CircleAvatar( + radius: 25.w, + backgroundImage: _profileCtrl.localAvatar.value.isNotEmpty + ? FileImage(File(_profileCtrl.localAvatar.value)) + : (_profileCtrl.userInfo.value.avatar.isNotEmpty + ? NetworkImage(_profileCtrl.userInfo.value.avatar) + : null) as ImageProvider?, + backgroundColor: Colors.grey[200], + child: (_profileCtrl.localAvatar.value.isEmpty && + _profileCtrl.userInfo.value.avatar.isEmpty) + ? Icon( + Icons.person, + size: 25.r, + color: Colors.grey[600], + ) + : null, ), ), Text( - 'tianming liu', + _profileCtrl.userInfo.value.name, style: TextStyle( color: Colors.black87, fontSize: 20.sp, diff --git a/lib/modules/meeting/views/meeting_mine_view.dart b/lib/modules/meeting/views/meeting_mine_view.dart index a2cef03c5..153822bb1 100644 --- a/lib/modules/meeting/views/meeting_mine_view.dart +++ b/lib/modules/meeting/views/meeting_mine_view.dart @@ -102,36 +102,36 @@ class MeetingMineView extends GetView { child: Row( children: [ // 统一头像显示逻辑:本地头像 > 网络头像 > 默认图标 - Obx(() => Container( - width: 50.w, - height: 50.w, - margin: EdgeInsets.only(right: 10.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50.w), - ), - child: CircleAvatar( - radius: 25.w, - backgroundImage: controller - .profileCtrl.localAvatar.value.isNotEmpty - ? FileImage( - File(controller.profileCtrl.localAvatar.value)) - : (controller - .profileCtrl.userInfo.value.avatar.isNotEmpty - ? NetworkImage( - controller.profileCtrl.userInfo.value.avatar) - : null) as ImageProvider?, - backgroundColor: Colors.grey[200], - child: (controller.profileCtrl.localAvatar.value.isEmpty && - controller - .profileCtrl.userInfo.value.avatar.isEmpty) - ? Icon( - Icons.person, - size: 25.r, - color: Colors.grey[600], - ) - : null, - ), - )), + Obx( + () => Container( + width: 50.w, + height: 50.w, + margin: EdgeInsets.only(right: 10.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(50.w), + ), + child: CircleAvatar( + radius: 25.w, + backgroundImage: controller + .profileCtrl.localAvatar.value.isNotEmpty + ? FileImage( + File(controller.profileCtrl.localAvatar.value)) + : (controller.profileCtrl.userInfo.value.avatar.isNotEmpty + ? NetworkImage( + controller.profileCtrl.userInfo.value.avatar) + : null) as ImageProvider?, + backgroundColor: Colors.grey[200], + child: (controller.profileCtrl.localAvatar.value.isEmpty && + controller.profileCtrl.userInfo.value.avatar.isEmpty) + ? Icon( + Icons.person, + size: 25.r, + color: Colors.grey[600], + ) + : null, + ), + ), + ), Expanded( child: Obx( () => Text( @@ -197,6 +197,7 @@ class MeetingMineView extends GetView { padding: EdgeInsets.symmetric(horizontal: 2.w), margin: EdgeInsets.only(top: 8.w, bottom: 2.w), child: GridView.builder( + controller: controller.scrollController, scrollDirection: Axis.horizontal, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 7,