|
|
|
import 'package:doublefeel_flutter/r.dart';
|
|
|
|
import 'package:fl_chart/fl_chart.dart';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
|
|
|
|
|
|
|
|
import '../../report_common/widgets/health_report_subject_scope.dart';
|
|
|
|
import '../../report_common/utils/report_localization.dart';
|
|
|
|
import '../models/sleep_report_models.dart';
|
|
|
|
import 'sleep_report_text_styles.dart';
|
|
|
|
|
|
|
|
class SleepWeekReportView extends StatelessWidget {
|
|
|
|
const SleepWeekReportView({
|
|
...
|
...
|
@@ -22,43 +22,14 @@ class SleepWeekReportView extends StatelessWidget { |
|
|
|
static const qualityAverageLine = Color(0xFFC9D6FF);
|
|
|
|
static const green = Color(0xFF3BD49D);
|
|
|
|
static const red = Color(0xFFFF5279);
|
|
|
|
static const h1 = Color(0xFF0F0F11);
|
|
|
|
static const h1 = SleepReportTextStyles.titleColor;
|
|
|
|
static const h2 = Color(0xFF78787D);
|
|
|
|
static const h3 = Color(0xFFB0B0B6);
|
|
|
|
static const grid = Color(0xFFF3F3F3);
|
|
|
|
|
|
|
|
static bool get _usesAppleTextRenderer =>
|
|
|
|
defaultTargetPlatform == TargetPlatform.iOS ||
|
|
|
|
defaultTargetPlatform == TargetPlatform.macOS;
|
|
|
|
static TextStyle get titleTextStyle => SleepReportTextStyles.titleTextStyle;
|
|
|
|
|
|
|
|
static TextStyle get titleTextStyle {
|
|
|
|
const baseStyle = TextStyle(
|
|
|
|
color: h1,
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
height: 1.2,
|
|
|
|
);
|
|
|
|
if (!_usesAppleTextRenderer) return baseStyle;
|
|
|
|
return baseStyle.copyWith(
|
|
|
|
fontFamily: 'PingFang SC',
|
|
|
|
fontFamilyFallback: const ['Heiti SC', 'Arial Unicode MS'],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static StrutStyle get titleStrutStyle {
|
|
|
|
if (!_usesAppleTextRenderer) {
|
|
|
|
return const StrutStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
height: 1.2,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return const StrutStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontFamily: 'PingFang SC',
|
|
|
|
fontFamilyFallback: ['Heiti SC', 'Arial Unicode MS'],
|
|
|
|
height: 1.2,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
static StrutStyle get titleStrutStyle => SleepReportTextStyles.titleStrutStyle;
|
|
|
|
|
|
|
|
static int minutesFromEvening(DateTime time) {
|
|
|
|
final minutes = time.hour * 60 + time.minute;
|
...
|
...
|
|