更新
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/home_page/SleepDataModuleWidget.dart';
|
||||
import 'package:EasyDartModule/EasyDartModule.dart' as es;
|
||||
import 'package:vbvs_app/language/AppLanguage.dart';
|
||||
|
||||
class SleepCard extends StatefulWidget {
|
||||
final dynamic sleepReport;
|
||||
@@ -30,9 +31,10 @@ class _SleepCardState extends State<SleepCard> with TickerProviderStateMixin {
|
||||
_shouldAnimate = true;
|
||||
_initAnimation();
|
||||
}
|
||||
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (widget.highlightItem != null && _highlightKey.currentContext != null) {
|
||||
if (widget.highlightItem != null &&
|
||||
_highlightKey.currentContext != null) {
|
||||
Scrollable.ensureVisible(
|
||||
_highlightKey.currentContext!,
|
||||
duration: Duration(milliseconds: 500),
|
||||
@@ -67,7 +69,7 @@ class _SleepCardState extends State<SleepCard> with TickerProviderStateMixin {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
_animationController!.forward();
|
||||
}
|
||||
|
||||
@@ -85,7 +87,8 @@ class _SleepCardState extends State<SleepCard> with TickerProviderStateMixin {
|
||||
widget.sleepReport.isEmpty) {
|
||||
return Container();
|
||||
}
|
||||
|
||||
String lcode = mhLanguageController.selectLanguage.value!.language_code!;
|
||||
int num = AppLanguage().isChinese() ? 3 : 2;
|
||||
List data = widget.sleepReport['bs'] ?? [];
|
||||
|
||||
return Container(
|
||||
@@ -104,11 +107,10 @@ class _SleepCardState extends State<SleepCard> with TickerProviderStateMixin {
|
||||
children: List.generate(data.length, (index) {
|
||||
final item = data[index];
|
||||
item['showTip'] = true;
|
||||
final bool isHighlighted = _shouldAnimate &&
|
||||
item['id'] == _highlightedId;
|
||||
|
||||
final bool isHighlighted =
|
||||
_shouldAnimate && item['id'] == _highlightedId;
|
||||
return SizedBox(
|
||||
width: (MediaQuery.of(context).size.width - 160.rpx) / 3,
|
||||
width: (MediaQuery.of(context).size.width - 160.rpx) / num,
|
||||
child: AnimatedBuilder(
|
||||
animation: _animationController ?? AlwaysStoppedAnimation(0),
|
||||
builder: (context, child) {
|
||||
@@ -118,13 +120,17 @@ class _SleepCardState extends State<SleepCard> with TickerProviderStateMixin {
|
||||
? BoxDecoration(
|
||||
border: Border.all(
|
||||
color: themeController.currentColor.sc2
|
||||
.withOpacity(_animationController?.value ?? 0),
|
||||
.withOpacity(
|
||||
_animationController?.value ?? 0),
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
)
|
||||
: null,
|
||||
child: SleepDataModuleWidget(data: item,sleepReportData: widget.sleepReport,),
|
||||
child: SleepDataModuleWidget(
|
||||
data: item,
|
||||
sleepReportData: widget.sleepReport,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -138,4 +144,4 @@ class _SleepCardState extends State<SleepCard> with TickerProviderStateMixin {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,12 +148,24 @@ class _SleepScoreWidgetState extends State<SleepScoreWidget> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"睡眠评分".tr,
|
||||
style: TextStyle(
|
||||
color: stringToColor("#FFFFFF"),
|
||||
// Text(
|
||||
// "睡眠评分".tr,
|
||||
// style: TextStyle(
|
||||
// color: stringToColor("#FFFFFF"),
|
||||
// fontSize:
|
||||
// AppConstants().normal_text_fontSize),
|
||||
// ),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 12.rpx), // 👈 向下偏移的关键
|
||||
child: Text(
|
||||
"睡眠评分".tr,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize),
|
||||
AppConstants().normal_text_fontSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${widget.sleepReport['score']?['score']}',
|
||||
@@ -172,10 +184,7 @@ class _SleepScoreWidgetState extends State<SleepScoreWidget> {
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
),
|
||||
)),
|
||||
SizedBox(height: 50.rpx),
|
||||
Wrap(
|
||||
spacing: 32.rpx,
|
||||
|
||||
Reference in New Issue
Block a user