Refine: Enforce timer display constraints (seconds require minutes)
This commit is contained in:
@@ -475,10 +475,13 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
|||||||
final minutes = d.inMinutes % 60;
|
final minutes = d.inMinutes % 60;
|
||||||
final seconds = d.inSeconds % 60;
|
final seconds = d.inSeconds % 60;
|
||||||
|
|
||||||
|
final bool showMins = user.showPadTimerMinutes;
|
||||||
|
final bool showSecs = user.showPadTimerSeconds && showMins; // Enforce minutes must be shown to show seconds
|
||||||
|
|
||||||
List<String> parts = [];
|
List<String> parts = [];
|
||||||
if (hours > 0) parts.add('${hours}h');
|
if (hours > 0) parts.add('${hours}h');
|
||||||
if (user.showPadTimerMinutes) parts.add('${minutes}m');
|
if (showMins) parts.add('${minutes}m');
|
||||||
if (user.showPadTimerSeconds) parts.add('${seconds}s');
|
if (showSecs) parts.add('${seconds}s');
|
||||||
|
|
||||||
if (parts.isEmpty) {
|
if (parts.isEmpty) {
|
||||||
if (hours == 0 && minutes == 0 && seconds == 0) return 'Just now';
|
if (hours == 0 && minutes == 0 && seconds == 0) return 'Just now';
|
||||||
@@ -495,12 +498,15 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
|||||||
final minutes = absRemaining.inMinutes % 60;
|
final minutes = absRemaining.inMinutes % 60;
|
||||||
final seconds = absRemaining.inSeconds % 60;
|
final seconds = absRemaining.inSeconds % 60;
|
||||||
|
|
||||||
|
final bool showMins = user.showPadTimerMinutes;
|
||||||
|
final bool showSecs = user.showPadTimerSeconds && showMins; // Enforce minutes must be shown to show seconds
|
||||||
|
|
||||||
List<String> parts = [];
|
List<String> parts = [];
|
||||||
if (hours > 0) parts.add('${hours}h');
|
if (hours > 0) parts.add('${hours}h');
|
||||||
if (user.showPadTimerMinutes) {
|
if (showMins) {
|
||||||
parts.add('${minutes}m');
|
parts.add('${minutes}m');
|
||||||
}
|
}
|
||||||
if (user.showPadTimerSeconds) {
|
if (showSecs) {
|
||||||
parts.add('${seconds}s');
|
parts.add('${seconds}s');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,14 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
|||||||
style: GoogleFonts.outfit(fontWeight: FontWeight.w500, color: AppColors.charcoal),
|
style: GoogleFonts.outfit(fontWeight: FontWeight.w500, color: AppColors.charcoal),
|
||||||
),
|
),
|
||||||
value: _showPadTimerMinutes,
|
value: _showPadTimerMinutes,
|
||||||
onChanged: (val) => setState(() => _showPadTimerMinutes = val),
|
onChanged: (val) {
|
||||||
|
setState(() {
|
||||||
|
_showPadTimerMinutes = val;
|
||||||
|
if (!val) {
|
||||||
|
_showPadTimerSeconds = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
activeColor: AppColors.menstrualPhase,
|
activeColor: AppColors.menstrualPhase,
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -207,10 +214,13 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
|||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
title: Text(
|
title: Text(
|
||||||
'Show Seconds',
|
'Show Seconds',
|
||||||
style: GoogleFonts.outfit(fontWeight: FontWeight.w500, color: AppColors.charcoal),
|
style: GoogleFonts.outfit(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: _showPadTimerMinutes ? AppColors.charcoal : AppColors.warmGray
|
||||||
|
),
|
||||||
),
|
),
|
||||||
value: _showPadTimerSeconds,
|
value: _showPadTimerSeconds,
|
||||||
onChanged: (val) => setState(() => _showPadTimerSeconds = val),
|
onChanged: _showPadTimerMinutes ? (val) => setState(() => _showPadTimerSeconds = val) : null,
|
||||||
activeColor: AppColors.menstrualPhase,
|
activeColor: AppColors.menstrualPhase,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user