优化
This commit is contained in:
70
lib/components/control_buttons.dart
Normal file
70
lib/components/control_buttons.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
|
||||
/// Control Buttons Component
|
||||
class ControlButtons extends StatelessWidget {
|
||||
final bool isPaused;
|
||||
final VoidCallback onTogglePause;
|
||||
final VoidCallback onStopEarly;
|
||||
final String pauseText;
|
||||
final String resumeText;
|
||||
final String stopText;
|
||||
|
||||
const ControlButtons({
|
||||
super.key,
|
||||
required this.isPaused,
|
||||
required this.onTogglePause,
|
||||
required this.onStopEarly,
|
||||
required this.pauseText,
|
||||
required this.resumeText,
|
||||
required this.stopText,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
// Pause/Resume Button
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: OutlinedButton(
|
||||
onPressed: onTogglePause,
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: AppColors.primary,
|
||||
side: const BorderSide(color: AppColors.primary, width: 1),
|
||||
minimumSize: const Size(double.infinity, 48),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(isPaused ? Icons.play_arrow : Icons.pause),
|
||||
const SizedBox(width: 8),
|
||||
Text(isPaused ? resumeText : pauseText),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Stop Button
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 24.0),
|
||||
child: TextButton(
|
||||
onPressed: onStopEarly,
|
||||
child: Text(
|
||||
stopText,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textSecondary,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
51
lib/components/distraction_button.dart
Normal file
51
lib/components/distraction_button.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
|
||||
/// Distraction Button Component
|
||||
class DistractionButton extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
final String buttonText;
|
||||
|
||||
const DistractionButton({
|
||||
super.key,
|
||||
required this.onPressed,
|
||||
required this.buttonText,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: onPressed,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.distractionButton,
|
||||
foregroundColor: AppColors.textPrimary,
|
||||
minimumSize: const Size(double.infinity, 48),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
buttonText,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
'🤚',
|
||||
style: TextStyle(fontSize: 20),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
27
lib/components/timer_display.dart
Normal file
27
lib/components/timer_display.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../theme/app_text_styles.dart';
|
||||
|
||||
/// Timer Display Component
|
||||
class TimerDisplay extends StatelessWidget {
|
||||
final int remainingSeconds;
|
||||
|
||||
const TimerDisplay({
|
||||
super.key,
|
||||
required this.remainingSeconds,
|
||||
});
|
||||
|
||||
/// Format seconds to MM:SS format
|
||||
String _formatTime(int seconds) {
|
||||
final minutes = seconds ~/ 60;
|
||||
final secs = seconds % 60;
|
||||
return '${minutes.toString().padLeft(2, '0')}:${secs.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text(
|
||||
_formatTime(remainingSeconds),
|
||||
style: AppTextStyles.timerDisplay,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user