edit backgroun and inmclude
This commit is contained in:
+182
-204
@@ -8,6 +8,9 @@ import 'home_page.dart';
|
||||
import 'lessons_page.dart';
|
||||
import 'select_school_page.dart';
|
||||
import 'login_page.dart';
|
||||
import '../widgets/app_drawer.dart';
|
||||
import '../widgets/app_bottom_nav.dart';
|
||||
import '../widgets/yogibook_background.dart';
|
||||
|
||||
class MeditationPage extends StatefulWidget {
|
||||
final String token;
|
||||
@@ -288,41 +291,14 @@ class _MeditationPageState extends State<MeditationPage>
|
||||
).animate(CurvedAnimation(parent: _pulseCtrl, curve: Curves.easeInOut));
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: kBg,
|
||||
drawer: Drawer(
|
||||
child: SafeArea(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
const DrawerHeader(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
'Menu',
|
||||
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w900),
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.swap_horiz),
|
||||
title: const Text('Cambia scuola'),
|
||||
onTap: () async {
|
||||
Navigator.of(context).pop(); // chiude drawer
|
||||
await _goTo(SelectSchoolPage(token: widget.token));
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.logout),
|
||||
title: const Text('Logout'),
|
||||
onTap: _logout,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
drawer: AppDrawer(
|
||||
token: widget.token,
|
||||
school: widget.school,
|
||||
userFirstName: widget.userFirstName,
|
||||
),
|
||||
|
||||
appBar: AppBar(
|
||||
backgroundColor: kBg,
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
title: const Text(
|
||||
@@ -381,203 +357,205 @@ class _MeditationPageState extends State<MeditationPage>
|
||||
),
|
||||
],
|
||||
),
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 10, 16, 16),
|
||||
child: Column(
|
||||
children: [
|
||||
// Top card with progress
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.fromLTRB(14, 12, 14, 14),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
blurRadius: 18,
|
||||
color: Color(0x12000000),
|
||||
offset: Offset(0, 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Respiro consapevole',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w900,
|
||||
body: YogibookBackground(
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 10, 16, 16),
|
||||
child: Column(
|
||||
children: [
|
||||
// Top card with progress
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.fromLTRB(14, 12, 14, 14),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
blurRadius: 18,
|
||||
color: Color(0x12000000),
|
||||
offset: Offset(0, 10),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
child: LinearProgressIndicator(
|
||||
minHeight: 8,
|
||||
value: _progress,
|
||||
backgroundColor: const Color(0xFFE9E9EF),
|
||||
valueColor: const AlwaysStoppedAnimation(
|
||||
Color(0xFFF59E0B),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Respiro consapevole',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
child: LinearProgressIndicator(
|
||||
minHeight: 8,
|
||||
value: _progress,
|
||||
backgroundColor: const Color(0xFFE9E9EF),
|
||||
valueColor: const AlwaysStoppedAnimation(
|
||||
Color(0xFFF59E0B),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Square + countdown
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 8),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
AnimatedBuilder(
|
||||
animation: Listenable.merge([
|
||||
_squareCtrl,
|
||||
bubbleScale,
|
||||
]),
|
||||
builder: (_, __) {
|
||||
final scale = bubbleScale.value;
|
||||
// Square + countdown
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 8),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
AnimatedBuilder(
|
||||
animation: Listenable.merge([
|
||||
_squareCtrl,
|
||||
bubbleScale,
|
||||
]),
|
||||
builder: (_, __) {
|
||||
final scale = bubbleScale.value;
|
||||
|
||||
return Transform.scale(
|
||||
scale: scale,
|
||||
child: CustomPaint(
|
||||
painter: _SquareBreathPainter(
|
||||
t: _squareCtrl.value,
|
||||
color: kGreen,
|
||||
),
|
||||
child: SizedBox(
|
||||
width: 240,
|
||||
height: 240,
|
||||
child: Center(
|
||||
child: Text(
|
||||
_breathLabel,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 18,
|
||||
return Transform.scale(
|
||||
scale: scale,
|
||||
child: CustomPaint(
|
||||
painter: _SquareBreathPainter(
|
||||
t: _squareCtrl.value,
|
||||
color: kGreen,
|
||||
),
|
||||
child: SizedBox(
|
||||
width: 240,
|
||||
height: 240,
|
||||
child: Center(
|
||||
child: Text(
|
||||
_breathLabel,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
Text(
|
||||
_mmss(remainingSeconds),
|
||||
style: const TextStyle(
|
||||
fontSize: 44,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: Color(0xFF1F1F1F),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const Text(
|
||||
'Tempo rimanente',
|
||||
style: TextStyle(
|
||||
color: Colors.black45,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
Text(
|
||||
_mmss(remainingSeconds),
|
||||
style: const TextStyle(
|
||||
fontSize: 44,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: Color(0xFF1F1F1F),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 18),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 44,
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: running ? _pause : _start,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: kGreen,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
),
|
||||
icon: Icon(
|
||||
running ? Icons.pause : Icons.play_arrow,
|
||||
),
|
||||
label: Text(running ? 'Pausa' : 'Avvia'),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const Text(
|
||||
'Tempo rimanente',
|
||||
style: TextStyle(
|
||||
color: Colors.black45,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
SizedBox(
|
||||
height: 44,
|
||||
child: OutlinedButton(
|
||||
onPressed: _reset,
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: const BorderSide(
|
||||
color: kGreen,
|
||||
width: 2,
|
||||
),
|
||||
|
||||
const SizedBox(height: 18),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 44,
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: running ? _pause : _start,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: kGreen,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
icon: Icon(
|
||||
running ? Icons.pause : Icons.play_arrow,
|
||||
),
|
||||
label: Text(running ? 'Pausa' : 'Avvia'),
|
||||
),
|
||||
child: const Text(
|
||||
'Reset',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
SizedBox(
|
||||
height: 44,
|
||||
child: OutlinedButton(
|
||||
onPressed: _reset,
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: const BorderSide(
|
||||
color: kGreen,
|
||||
width: 2,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'Reset',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 52,
|
||||
child: ElevatedButton(
|
||||
onPressed: () async {
|
||||
_pause();
|
||||
await _stopMusic();
|
||||
if (!mounted) return;
|
||||
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => HomePage(
|
||||
token: widget.token,
|
||||
school: widget.school,
|
||||
userFirstName: widget.userFirstName,
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: kGreen,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'TERMINA SESSIONE',
|
||||
style: TextStyle(fontWeight: FontWeight.w900),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 52,
|
||||
child: ElevatedButton(
|
||||
onPressed: () async {
|
||||
_pause();
|
||||
await _stopMusic();
|
||||
if (!mounted) return;
|
||||
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => HomePage(
|
||||
token: widget.token,
|
||||
school: widget.school,
|
||||
userFirstName: widget.userFirstName,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: kGreen,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'TERMINA SESSIONE',
|
||||
style: TextStyle(fontWeight: FontWeight.w900),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user