This commit is contained in:
袁天才
2025-11-23 21:00:47 +08:00
parent 133941ed6a
commit 8c61688a26
25 changed files with 2068 additions and 4546 deletions

View File

@@ -146,79 +146,87 @@ class _FocusScreenState extends State<FocusScreen> {
showModalBottomSheet(
context: context,
backgroundColor: AppColors.white,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
),
builder: (context) {
return SafeArea(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Drag handle
Center(
child: Container(
width: 32,
height: 4,
decoration: BoxDecoration(
color: AppColors.distractionButton,
borderRadius: BorderRadius.circular(2),
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(
left: 24.0,
right: 24.0,
top: 24.0,
bottom: 24.0 + MediaQuery.of(context).viewInsets.bottom,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Drag handle
Center(
child: Container(
width: 32,
height: 4,
decoration: BoxDecoration(
color: AppColors.distractionButton,
borderRadius: BorderRadius.circular(2),
),
),
),
),
const SizedBox(height: 24),
const SizedBox(height: 24),
// Title
const Text(
'What pulled you away?',
style: TextStyle(
fontFamily: 'Nunito',
fontSize: 18,
fontWeight: FontWeight.w600,
color: AppColors.textPrimary,
// Title
const Text(
'What pulled you away?',
style: TextStyle(
fontFamily: 'Nunito',
fontSize: 18,
fontWeight: FontWeight.w600,
color: AppColors.textPrimary,
),
),
),
const SizedBox(height: 24),
const SizedBox(height: 24),
// Distraction options
...DistractionType.all.map((type) {
return Column(
children: [
ListTile(
leading: Text(
DistractionType.getEmoji(type),
style: const TextStyle(fontSize: 24),
// Distraction options
...DistractionType.all.map((type) {
return Column(
children: [
ListTile(
leading: Text(
DistractionType.getEmoji(type),
style: const TextStyle(fontSize: 24),
),
title: Text(
DistractionType.getDisplayName(type),
style: AppTextStyles.bodyText,
),
onTap: () {
Navigator.pop(context);
_recordDistraction(type);
},
),
title: Text(
DistractionType.getDisplayName(type),
style: AppTextStyles.bodyText,
),
onTap: () {
Navigator.pop(context);
_recordDistraction(type);
},
),
if (type != DistractionType.all.last)
const Divider(color: AppColors.divider),
],
);
}),
if (type != DistractionType.all.last)
const Divider(color: AppColors.divider),
],
);
}),
const SizedBox(height: 16),
const SizedBox(height: 16),
// Skip button
Center(
child: TextButton(
onPressed: () {
Navigator.pop(context);
_recordDistraction(null);
},
child: const Text('Skip this time'),
// Skip button
Center(
child: TextButton(
onPressed: () {
Navigator.pop(context);
_recordDistraction(null);
},
child: const Text('Skip this time'),
),
),
),
],
],
),
),
),
);
@@ -260,86 +268,98 @@ class _FocusScreenState extends State<FocusScreen> {
return Scaffold(
backgroundColor: AppColors.background,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Spacer(),
// Timer Display
Text(
_formatTime(_remainingSeconds),
style: AppTextStyles.timerDisplay,
),
const SizedBox(height: 80),
// "I got distracted" Button
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: _showDistractionSheet,
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.distractionButton,
foregroundColor: AppColors.textPrimary,
minimumSize: const Size(double.infinity, 48),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
padding: const EdgeInsets.all(24.0),
child: Column(
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.2,
),
elevation: 0,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'I got distracted',
style: TextStyle(
fontFamily: 'Nunito',
fontSize: 18,
fontWeight: FontWeight.w600,
// Timer Display
Text(
_formatTime(_remainingSeconds),
style: AppTextStyles.timerDisplay,
),
const SizedBox(height: 80),
// "I got distracted" Button
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: _showDistractionSheet,
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: [
const Text(
'I got distracted',
style: TextStyle(
fontFamily: 'Nunito',
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
const SizedBox(width: 8),
Text(
'🤚',
style: const TextStyle(fontSize: 20),
),
],
),
),
const SizedBox(width: 8),
Text(
'🤚',
style: const TextStyle(fontSize: 20),
),
],
),
),
),
const SizedBox(height: 16),
// Pause Button
SizedBox(
width: double.infinity,
child: OutlinedButton(
onPressed: _togglePause,
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 ? 'Resume' : 'Pause'),
],
),
const SizedBox(height: 16),
// Pause Button
SizedBox(
width: double.infinity,
child: OutlinedButton(
onPressed: _togglePause,
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 ? 'Resume' : 'Pause'),
],
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.2,
),
],
),
),
),
const Spacer(),
// Stop Button (text button at bottom)
TextButton(
// Stop Button (text button at bottom)
Padding(
padding: const EdgeInsets.only(bottom: 24.0),
child: TextButton(
onPressed: _stopEarly,
child: const Text(
'Stop session',
@@ -349,8 +369,8 @@ class _FocusScreenState extends State<FocusScreen> {
),
),
),
],
),
),
],
),
),
);