File size: 9,048 Bytes
87a2e39 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
import 'dart:ui';
import 'package:flutter/material.dart';
void main() {
runApp(const Profil());
}
// Couleurs simulées (à remplacer par tes vraies constantes)
const Color primaryColor = Colors.deepPurple;
const Color accentColor = Colors.deepOrange;
const Color backgroundColor = Colors.white;
class Profil extends StatelessWidget {
const Profil({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: const DashboardScreen(),
);
}
}
class DashboardScreen extends StatefulWidget {
const DashboardScreen({super.key});
@override
State<DashboardScreen> createState() => _DashboardScreenState();
}
class _DashboardScreenState extends State<DashboardScreen>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _animation;
bool isLoading = false;
List<String> children =
[]; // Simulé - à remplacer par ton vrai modèle de données
@override
void initState() {
super.initState();
_controller = AnimationController(
duration: const Duration(milliseconds: 800),
vsync: this,
);
_animation = CurvedAnimation(parent: _controller, curve: Curves.easeInOut);
_controller.forward();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
Widget buildDrawer(BuildContext context) {
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: const [
DrawerHeader(
decoration: BoxDecoration(color: Color.fromARGB(255, 54, 199, 32)),
child: Text(
'Menu',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
ListTile(leading: Icon(Icons.home), title: Text('Accueil')),
],
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: backgroundColor,
extendBodyBehindAppBar: true,
appBar: AppBar(
title: const Text(
'Tableau de bord',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 22,
),
),
backgroundColor: primaryColor.withOpacity(0.9),
elevation: 0,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(bottom: Radius.circular(20)),
),
iconTheme: const IconThemeData(color: Colors.white),
flexibleSpace: ClipRRect(
borderRadius: const BorderRadius.vertical(
bottom: Radius.circular(20),
),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
const Color.fromARGB(255, 7, 139, 47).withOpacity(0.9),
const Color.fromARGB(255, 34, 255, 144).withOpacity(0.8),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
),
),
),
actions: [
Stack(
alignment: Alignment.center,
children: [
IconButton(
icon: const Icon(Icons.notifications_rounded, size: 28),
onPressed: () {},
),
Positioned(
right: 12,
top: 14,
child: Container(
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(6),
),
constraints: const BoxConstraints(
minWidth: 16,
minHeight: 16,
),
child: const Text(
'3',
style: TextStyle(
color: Colors.white,
fontSize: 10,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
),
],
),
],
),
drawer: buildDrawer(context),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [backgroundColor, Colors.white],
),
),
child: FadeTransition(
opacity: _animation,
child:
isLoading
? const Center(child: CircularProgressIndicator())
: children.isEmpty
? buildNoChildrenView()
: buildChildrenDashboard(),
),
),
floatingActionButton:
children.isEmpty
? null
: FloatingActionButton(
onPressed: () {
// Action rapide
},
backgroundColor: accentColor,
elevation: 4,
child: const Icon(
Icons.add_rounded,
color: Colors.white,
size: 28,
),
),
);
}
Widget buildNoChildrenView() {
return SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 150),
Container(
width: 150,
height: 150,
decoration: BoxDecoration(
color: const Color.fromARGB(255, 16, 205, 47).withOpacity(0.1),
shape: BoxShape.circle,
),
child: Icon(
Icons.person,
size: 80,
color: const Color.fromARGB(255, 152, 210, 59),
),
),
const SizedBox(height: 30),
Text(
'Profil User',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: const Color.fromARGB(255, 140, 197, 80),
),
),
const SizedBox(height: 15),
Text(
'Vous n\'avez pas encore inscrit d\'enfant. Commencez par inscrire votre enfant pour accéder à son suivi scolaire.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16, color: Colors.grey.shade700),
),
const SizedBox(height: 30),
ElevatedButton.icon(
onPressed: () {},
icon: const Icon(Icons.person_add_rounded),
label: const Text(
'Changer votre Profil',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
style: ElevatedButton.styleFrom(
backgroundColor: const Color.fromARGB(255, 34, 255, 119),
foregroundColor: const Color.fromARGB(255, 17, 17, 17),
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
elevation: 3,
),
),
],
),
);
}
Widget buildChildrenDashboard() {
return Column(
children: [
const SizedBox(height: 110),
buildChildSelector(),
const SizedBox(height: 20),
Expanded(
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.fromLTRB(20, 0, 20, 30),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
buildChildSummary(),
const SizedBox(height: 20),
buildActionCards(),
const SizedBox(height: 25),
buildRecentActivities(),
const SizedBox(height: 25),
buildUpcomingEvents(),
],
),
),
),
],
);
}
Widget buildChildSelector() => const Text("Sélecteur d'enfant (à compléter)");
Widget buildChildSummary() => const Text("Résumé enfant (à compléter)");
Widget buildActionCards() => const Text("Actions (à compléter)");
Widget buildRecentActivities() =>
const Text("Activités récentes (à compléter)");
Widget buildUpcomingEvents() =>
const Text("Événements à venir (à compléter)");
}
|