3 changed files with 482 additions and 42 deletions
@ -1,3 +1,26 @@ |
|||||
import 'package:get/get.dart'; |
import 'package:get/get.dart'; |
||||
|
|
||||
class MeetingMineController extends GetxController {} |
import 'meeting_home_controller.dart'; |
||||
|
|
||||
|
class MeetingMineController extends GetxController { |
||||
|
final _controller = Get.find<MeetingHomeController>(); |
||||
|
|
||||
|
RxInt days = 0.obs; |
||||
|
RxInt numberFiles = 0.obs; |
||||
|
RxDouble hourage = 0.0.obs; |
||||
|
RxInt continuousDays = 0.obs; |
||||
|
RxInt maxNumberFiles = 0.obs; |
||||
|
RxDouble maxHourage = 0.0.obs; |
||||
|
|
||||
|
@override |
||||
|
void onInit() { |
||||
|
super.onInit(); |
||||
|
_getStatistics(); |
||||
|
} |
||||
|
|
||||
|
void _getStatistics() { |
||||
|
numberFiles.value = _controller.originalDataList.length; |
||||
|
|
||||
|
for (var element in _controller.originalDataList) {} |
||||
|
} |
||||
|
} |
||||
|
|||||
@ -0,0 +1,293 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
|
||||
|
import '../../controllers/meeting_mine_controller.dart'; |
||||
|
|
||||
|
class StatisticsBottomSheet extends StatefulWidget { |
||||
|
const StatisticsBottomSheet({super.key}); |
||||
|
|
||||
|
@override |
||||
|
State<StatisticsBottomSheet> createState() => _StatisticsBottomSheetState(); |
||||
|
} |
||||
|
|
||||
|
class _StatisticsBottomSheetState extends State<StatisticsBottomSheet> { |
||||
|
final _mineController = Get.find<MeetingMineController>(); |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Stack( |
||||
|
children: [ |
||||
|
GestureDetector( |
||||
|
onTap: () => Get.back(), |
||||
|
behavior: HitTestBehavior.translucent, |
||||
|
child: SizedBox( |
||||
|
width: 1.sw, |
||||
|
height: 1.sh, |
||||
|
), |
||||
|
), |
||||
|
Column( |
||||
|
mainAxisAlignment: MainAxisAlignment.center, |
||||
|
children: [ |
||||
|
Container( |
||||
|
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 20.w), |
||||
|
margin: EdgeInsets.symmetric(horizontal: 10.w), |
||||
|
decoration: BoxDecoration( |
||||
|
color: Colors.white, |
||||
|
borderRadius: BorderRadius.circular(16.w), |
||||
|
image: const DecorationImage( |
||||
|
alignment: Alignment.topCenter, |
||||
|
image: AssetImage('assets/images/mine-background.png'), |
||||
|
fit: BoxFit.fitWidth, |
||||
|
), |
||||
|
), |
||||
|
child: Column( |
||||
|
children: [ |
||||
|
Container( |
||||
|
width: 50.w, |
||||
|
height: 50.w, |
||||
|
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, |
||||
|
), |
||||
|
), |
||||
|
), |
||||
|
Text( |
||||
|
'tianming liu', |
||||
|
style: TextStyle( |
||||
|
color: Colors.black87, |
||||
|
fontSize: 20.sp, |
||||
|
fontWeight: FontWeight.bold, |
||||
|
), |
||||
|
), |
||||
|
Padding( |
||||
|
padding: EdgeInsets.symmetric(vertical: 20.w), |
||||
|
child: Wrap( |
||||
|
spacing: 5.w, |
||||
|
runSpacing: 5.w, |
||||
|
children: [ |
||||
|
_item( |
||||
|
'天', |
||||
|
'${_mineController.days.value}', |
||||
|
Colors.amber, |
||||
|
), |
||||
|
_item( |
||||
|
'文件', |
||||
|
'${_mineController.numberFiles.value}', |
||||
|
Colors.blueGrey, |
||||
|
), |
||||
|
_item( |
||||
|
'小时', |
||||
|
'${_mineController.hourage.value}', |
||||
|
Colors.cyan, |
||||
|
), |
||||
|
_item( |
||||
|
'连续录音天数', |
||||
|
'${_mineController.continuousDays.value}', |
||||
|
Colors.deepOrangeAccent, |
||||
|
), |
||||
|
_item( |
||||
|
'单日最多录音', |
||||
|
'${_mineController.maxNumberFiles.value}', |
||||
|
Colors.teal, |
||||
|
), |
||||
|
_item( |
||||
|
'单日最长录音', |
||||
|
'${_mineController.maxHourage.value}', |
||||
|
Colors.pink, |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
Row( |
||||
|
children: [ |
||||
|
Text( |
||||
|
'过去12个月的热力图', |
||||
|
style: TextStyle( |
||||
|
color: Colors.grey, |
||||
|
fontSize: 12.sp, |
||||
|
), |
||||
|
), |
||||
|
const Spacer(), |
||||
|
Text( |
||||
|
'较冷', |
||||
|
style: TextStyle( |
||||
|
color: Colors.grey, |
||||
|
fontSize: 12.sp, |
||||
|
), |
||||
|
), |
||||
|
5.horizontalSpace, |
||||
|
Container( |
||||
|
width: 10.w, |
||||
|
height: 10.w, |
||||
|
margin: EdgeInsets.symmetric(horizontal: 1.w), |
||||
|
decoration: BoxDecoration( |
||||
|
color: Colors.grey[200], |
||||
|
borderRadius: BorderRadius.circular(2.w), |
||||
|
), |
||||
|
), |
||||
|
Container( |
||||
|
width: 10.w, |
||||
|
height: 10.w, |
||||
|
margin: EdgeInsets.symmetric(horizontal: 1.w), |
||||
|
decoration: BoxDecoration( |
||||
|
color: Colors.red[100], |
||||
|
borderRadius: BorderRadius.circular(2.w), |
||||
|
), |
||||
|
), |
||||
|
Container( |
||||
|
width: 10.w, |
||||
|
height: 10.w, |
||||
|
margin: EdgeInsets.symmetric(horizontal: 1.w), |
||||
|
decoration: BoxDecoration( |
||||
|
color: Colors.red, |
||||
|
borderRadius: BorderRadius.circular(2.w), |
||||
|
), |
||||
|
), |
||||
|
5.horizontalSpace, |
||||
|
Text( |
||||
|
'较热', |
||||
|
style: TextStyle( |
||||
|
color: Colors.grey, |
||||
|
fontSize: 12.sp, |
||||
|
), |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
Container( |
||||
|
height: 50.w, |
||||
|
alignment: Alignment.center, |
||||
|
child: GridView.builder( |
||||
|
shrinkWrap: true, |
||||
|
physics: const NeverScrollableScrollPhysics(), |
||||
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
||||
|
crossAxisCount: 52, |
||||
|
mainAxisSpacing: 1.w, |
||||
|
crossAxisSpacing: 1.w, |
||||
|
), |
||||
|
itemCount: 364, |
||||
|
itemBuilder: (BuildContext context, int index) { |
||||
|
return Container( |
||||
|
color: Colors.grey[200], |
||||
|
); |
||||
|
}, |
||||
|
), |
||||
|
), |
||||
|
DefaultTextStyle( |
||||
|
style: TextStyle( |
||||
|
color: Colors.grey, |
||||
|
fontSize: 10.sp, |
||||
|
), |
||||
|
child: const Row( |
||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
||||
|
children: [ |
||||
|
Text('Jan'), |
||||
|
Text('Feb'), |
||||
|
Text('Mar'), |
||||
|
Text('Apr'), |
||||
|
Text('May'), |
||||
|
Text('Jun'), |
||||
|
Text('Jul'), |
||||
|
Text('Aug'), |
||||
|
Text('Sep'), |
||||
|
Text('Oct'), |
||||
|
Text('Nov'), |
||||
|
Text('Dec'), |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
SizedBox(height: 10.w), |
||||
|
Padding( |
||||
|
padding: EdgeInsets.symmetric(horizontal: 10.w), |
||||
|
child: Row( |
||||
|
children: [ |
||||
|
_button(Icons.share, '分享图片', Colors.deepOrange, () {}), |
||||
|
10.horizontalSpace, |
||||
|
_button(Icons.download, '保存图片', Colors.cyan, () {}), |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
], |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
Widget _item(String unit, String amount, Color color) { |
||||
|
return Container( |
||||
|
width: 105.w, |
||||
|
height: 70.w, |
||||
|
padding: EdgeInsets.all(10.w), |
||||
|
decoration: BoxDecoration( |
||||
|
color: color.withOpacity(0.2), |
||||
|
borderRadius: BorderRadius.circular(8.w), |
||||
|
), |
||||
|
child: Column( |
||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
|
crossAxisAlignment: CrossAxisAlignment.start, |
||||
|
children: [ |
||||
|
Text( |
||||
|
unit, |
||||
|
style: TextStyle( |
||||
|
color: Colors.grey, |
||||
|
fontSize: 12.sp, |
||||
|
), |
||||
|
), |
||||
|
Text( |
||||
|
amount, |
||||
|
style: TextStyle( |
||||
|
color: Colors.black87, |
||||
|
fontSize: 18.sp, |
||||
|
fontWeight: FontWeight.bold, |
||||
|
), |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
Widget _button(IconData icon, String title, Color color, Function() onTap) { |
||||
|
return Expanded( |
||||
|
child: GestureDetector( |
||||
|
onTap: onTap, |
||||
|
child: Container( |
||||
|
decoration: BoxDecoration( |
||||
|
color: Colors.white, |
||||
|
borderRadius: BorderRadius.circular(16.w), |
||||
|
), |
||||
|
child: Container( |
||||
|
height: 60.w, |
||||
|
decoration: BoxDecoration( |
||||
|
color: color.withOpacity(0.1), |
||||
|
borderRadius: BorderRadius.circular(16.w), |
||||
|
), |
||||
|
child: Row( |
||||
|
mainAxisAlignment: MainAxisAlignment.center, |
||||
|
children: [ |
||||
|
Icon( |
||||
|
icon, |
||||
|
size: 25.w, |
||||
|
), |
||||
|
5.horizontalSpace, |
||||
|
Text( |
||||
|
title, |
||||
|
style: TextStyle( |
||||
|
color: Colors.black87, |
||||
|
fontSize: 16.sp, |
||||
|
), |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
), |
||||
|
), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue