Browse Source

修改显示

weicu
tanlongsheng 1 year ago
parent
commit
dbd518c0ed
  1. 17
      lib/modules/meeting/controllers/meeting_mine_controller.dart
  2. 28
      lib/modules/meeting/views/bottomSheet/statistics_bottom_sheet.dart
  3. 61
      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: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<ProfileController>();
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;

28
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<StatisticsBottomSheet> {
final _mineController = Get.find<MeetingMineController>();
final _profileCtrl = Get.find<ProfileController>();
@override
Widget build(BuildContext context) {
@ -49,15 +53,27 @@ class _StatisticsBottomSheetState extends State<StatisticsBottomSheet> {
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<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(
'tianming liu',
_profileCtrl.userInfo.value.name,
style: TextStyle(
color: Colors.black87,
fontSize: 20.sp,

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

@ -102,36 +102,36 @@ class MeetingMineView extends GetView<MeetingMineController> {
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<Object>?,
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<Object>?,
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<MeetingMineController> {
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,

Loading…
Cancel
Save