|
...
|
...
|
@@ -101,7 +101,7 @@ class TodayTabBody extends StatelessWidget { |
|
|
|
context, controller.selectedDate.value),
|
|
|
|
showBackToToday: !isSameDay(
|
|
|
|
controller.selectedDate.value,
|
|
|
|
controller.lastSelectableDay,
|
|
|
|
controller.lastSelectableDay.value,
|
|
|
|
),
|
|
|
|
onBackToToday: _backToToday,
|
|
|
|
onTapPremiumCard: () {
|
|
...
|
...
|
@@ -231,7 +231,8 @@ class TodayTabBody extends StatelessWidget { |
|
|
|
const SizedBox(height: 12),
|
|
|
|
_LatestHrvCard(controller: controller),
|
|
|
|
if (!controller.isFriend) measureHRVButton(context),
|
|
|
|
Padding(
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
|
|
|
child: Text(
|
|
|
|
(controller.isFriend
|
|
...
|
...
|
@@ -243,6 +244,7 @@ class TodayTabBody extends StatelessWidget { |
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TodaySleepCard(controller: controller),
|
|
...
|
...
|
@@ -309,15 +311,16 @@ class TodayTabBody extends StatelessWidget { |
|
|
|
child: SizedBox(
|
|
|
|
height: _weekRowsHeight,
|
|
|
|
child: TableCalendar(
|
|
|
|
key: ValueKey(controller.firstSelectableDay.value),
|
|
|
|
key: ValueKey(
|
|
|
|
'${controller.firstSelectableDay.value}-${controller.lastSelectableDay.value}'),
|
|
|
|
calendarFormat: CalendarFormat.week,
|
|
|
|
headerVisible: false,
|
|
|
|
daysOfWeekHeight: _weekRowsHeight / 2,
|
|
|
|
rowHeight: _weekRowsHeight / 2,
|
|
|
|
focusedDay: controller.focusedDay.value,
|
|
|
|
firstDay: controller.firstSelectableDay.value,
|
|
|
|
lastDay: controller.lastSelectableDay,
|
|
|
|
currentDay: controller.lastSelectableDay,
|
|
|
|
lastDay: controller.lastSelectableDay.value,
|
|
|
|
currentDay: controller.lastSelectableDay.value,
|
|
|
|
locale: Localizations.localeOf(context).toString(),
|
|
|
|
startingDayOfWeek: _startingDayOfWeek(context),
|
|
|
|
availableCalendarFormats: const {
|
|
...
|
...
|
@@ -371,7 +374,7 @@ class TodayTabBody extends StatelessWidget { |
|
|
|
period: ReportPeriod.day,
|
|
|
|
selectedDate: controller.selectedDate.value,
|
|
|
|
weekStart: controller.selectedDate.value,
|
|
|
|
maxDate: controller.lastSelectableDay,
|
|
|
|
maxDate: controller.lastSelectableDay.value,
|
|
|
|
minDate: controller.firstSelectableDay.value,
|
|
|
|
);
|
|
|
|
if (picked != null) {
|
|
...
|
...
|
@@ -415,7 +418,7 @@ class TodayTabBody extends StatelessWidget { |
|
|
|
)
|
|
|
|
: null,
|
|
|
|
child: Text(
|
|
|
|
isSameDay(day, controller.lastSelectableDay)
|
|
|
|
isSameDay(day, controller.lastSelectableDay.value)
|
|
|
|
? l10n.todayOnWeeklyCalendar
|
|
|
|
: _weekdayText(context, day),
|
|
|
|
style: TextStyle(
|
|
...
|
...
|
@@ -470,11 +473,11 @@ class TodayTabBody extends StatelessWidget { |
|
|
|
}
|
|
|
|
|
|
|
|
void _backToToday() {
|
|
|
|
controller.changeDate(controller.lastSelectableDay);
|
|
|
|
controller.changeDate(controller.lastSelectableDay.value);
|
|
|
|
}
|
|
|
|
|
|
|
|
String _dateTitle(BuildContext context, DateTime selectedDay) {
|
|
|
|
final today = controller.lastSelectableDay;
|
|
|
|
final today = controller.lastSelectableDay.value;
|
|
|
|
if (isSameDay(selectedDay, today)) return context.l10n.today;
|
|
|
|
if (isSameDay(selectedDay, today.subtract(const Duration(days: 1)))) {
|
|
|
|
return context.l10n.yesterday;
|
|
...
|
...
|
@@ -492,7 +495,7 @@ class TodayTabBody extends StatelessWidget { |
|
|
|
|
|
|
|
bool _isAfterToday(DateTime day) {
|
|
|
|
final normalizedDay = DateUtils.dateOnly(day);
|
|
|
|
return normalizedDay.isAfter(controller.lastSelectableDay);
|
|
|
|
return normalizedDay.isAfter(controller.lastSelectableDay.value);
|
|
|
|
}
|
|
|
|
|
|
|
|
Color _calendarTextColor(
|
|
...
|
...
|
@@ -562,7 +565,7 @@ class _LatestHrvCard extends StatelessWidget { |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'${l10n.mostRecent}($latestDataTimeText)',
|
|
|
|
'${l10n.mostRecent}($latestDataTimeText)',
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textSecondary,
|
|
|
|
fontSize: 12,
|
|
...
|
...
|
@@ -582,7 +585,7 @@ class _LatestHrvCard extends StatelessWidget { |
|
|
|
),
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
Text(
|
|
|
|
'${latestHrv}ms · $stateStr',
|
|
|
|
'${latestHrv}ms·$stateStr',
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textPrimary,
|
|
|
|
fontSize: 18,
|
...
|
...
|
|