Browse Source

修改显示

newdev_shunjiawei
tanlongsheng 1 year ago
parent
commit
e24c5fee65
  1. 17
      lib/modules/meeting/controllers/meeting_mine_controller.dart
  2. 26
      lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart
  3. 13
      lib/modules/meeting/views/meeting_mine_view.dart

17
lib/modules/meeting/controllers/meeting_mine_controller.dart

@ -1,4 +1,5 @@
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../data/services/db/sqflite_api.dart'; import '../../../data/services/db/sqflite_api.dart';
@ -7,6 +8,8 @@ import '../../profile/controllers/profile_controller.dart';
class MeetingMineController extends GetxController { class MeetingMineController extends GetxController {
final profileCtrl = Get.find<ProfileController>(); final profileCtrl = Get.find<ProfileController>();
final ScrollController scrollController = ScrollController();
Map statistics = {}; Map statistics = {};
RxInt days = 0.obs; RxInt days = 0.obs;
@ -21,9 +24,23 @@ class MeetingMineController extends GetxController {
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
WidgetsBinding.instance.addPostFrameCallback((_) {
if (scrollController.hasClients) {
final now = DateTime.now();
if (now.month > 6) {
scrollController.jumpTo(scrollController.position.maxScrollExtent);
}
}
});
_getStatistics(); _getStatistics();
} }
@override
void onClose() {
scrollController.dispose();
super.onClose();
}
void _getStatistics() async { void _getStatistics() async {
List dataList = await SqfliteApi.getMeetingList(); List dataList = await SqfliteApi.getMeetingList();
numberFiles.value = dataList.length; numberFiles.value = dataList.length;

26
lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart

@ -1,7 +1,10 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.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 '../../../profile/controllers/profile_controller.dart';
import '../../controllers/meeting_mine_controller.dart'; import '../../controllers/meeting_mine_controller.dart';
class StatisticsBottomSheet extends StatefulWidget { class StatisticsBottomSheet extends StatefulWidget {
@ -13,6 +16,7 @@ class StatisticsBottomSheet extends StatefulWidget {
class _StatisticsBottomSheetState extends State<StatisticsBottomSheet> { class _StatisticsBottomSheetState extends State<StatisticsBottomSheet> {
final _mineController = Get.find<MeetingMineController>(); final _mineController = Get.find<MeetingMineController>();
final _profileCtrl = Get.find<ProfileController>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -49,15 +53,27 @@ class _StatisticsBottomSheetState extends State<StatisticsBottomSheet> {
margin: EdgeInsets.only(bottom: 10.w), margin: EdgeInsets.only(bottom: 10.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.w), 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<Object>?,
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( Text(
'tianming liu', _profileCtrl.userInfo.value.name,
style: TextStyle( style: TextStyle(
color: Colors.black87, color: Colors.black87,
fontSize: 20.sp, fontSize: 20.sp,

13
lib/modules/meeting/views/meeting_mine_view.dart

@ -102,7 +102,8 @@ class MeetingMineView extends GetView<MeetingMineController> {
child: Row( child: Row(
children: [ children: [
// 统一头像显示逻辑:本地头像 > 网络头像 > 默认图标 // 统一头像显示逻辑:本地头像 > 网络头像 > 默认图标
Obx(() => Container( Obx(
() => Container(
width: 50.w, width: 50.w,
height: 50.w, height: 50.w,
margin: EdgeInsets.only(right: 10.w), margin: EdgeInsets.only(right: 10.w),
@ -115,15 +116,13 @@ class MeetingMineView extends GetView<MeetingMineController> {
.profileCtrl.localAvatar.value.isNotEmpty .profileCtrl.localAvatar.value.isNotEmpty
? FileImage( ? FileImage(
File(controller.profileCtrl.localAvatar.value)) File(controller.profileCtrl.localAvatar.value))
: (controller : (controller.profileCtrl.userInfo.value.avatar.isNotEmpty
.profileCtrl.userInfo.value.avatar.isNotEmpty
? NetworkImage( ? NetworkImage(
controller.profileCtrl.userInfo.value.avatar) controller.profileCtrl.userInfo.value.avatar)
: null) as ImageProvider<Object>?, : null) as ImageProvider<Object>?,
backgroundColor: Colors.grey[200], backgroundColor: Colors.grey[200],
child: (controller.profileCtrl.localAvatar.value.isEmpty && child: (controller.profileCtrl.localAvatar.value.isEmpty &&
controller controller.profileCtrl.userInfo.value.avatar.isEmpty)
.profileCtrl.userInfo.value.avatar.isEmpty)
? Icon( ? Icon(
Icons.person, Icons.person,
size: 25.r, size: 25.r,
@ -131,7 +130,8 @@ class MeetingMineView extends GetView<MeetingMineController> {
) )
: null, : null,
), ),
)), ),
),
Expanded( Expanded(
child: Obx( child: Obx(
() => Text( () => Text(
@ -197,6 +197,7 @@ class MeetingMineView extends GetView<MeetingMineController> {
padding: EdgeInsets.symmetric(horizontal: 2.w), padding: EdgeInsets.symmetric(horizontal: 2.w),
margin: EdgeInsets.only(top: 8.w, bottom: 2.w), margin: EdgeInsets.only(top: 8.w, bottom: 2.w),
child: GridView.builder( child: GridView.builder(
controller: controller.scrollController,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7, crossAxisCount: 7,

Loading…
Cancel
Save