@davoodmehraban89 / LifeMate / commits / bf7869d
Fork 0

LifeMate — Personal, Family & Learning Companion

feat: apply profile-aware pink and blue themes

davoodmehraban89 committed Oct 5, 2026 at 07:51 UTC bf7869dadd98f726bc4002bd373f7f16c695924a
1 file changed +32 -1
apps/lifemate/lib/main.dart
+32 -1
@@ -370,10 +370,40 @@ class HomeShell extends StatefulWidget {
370
371 class _HomeShellState extends State<HomeShell> {
372 int index = 0;
373 + String themePreference = 'adult_blue';
374 static const destinations = ['امروز', 'برنامه هفتگی', 'تقویم', 'تکالیف و کارها', 'امتحان‌ها و نمرات', 'تمرکز', 'همراه هوشمند'];
375
376 @override
376 - Widget build(BuildContext context) => Scaffold(
377 + void initState() {
378 + super.initState();
379 + loadTheme();
380 + }
381 +
382 + Future<void> loadTheme() async {
383 + try {
384 + final profile = await widget.api.getProfile();
385 + if (mounted) {
386 + setState(() {
387 + themePreference = profile['theme_preference']?.toString() ?? 'adult_blue';
388 + });
389 + }
390 + } catch (_) {}
391 + }
392 +
393 + Color get accent => themePreference == 'girl_pink'
394 + ? const Color(0xFFE58FB0)
395 + : const Color(0xFF4D86E8);
396 +
397 + @override
398 + Widget build(BuildContext context) => Theme(
399 + data: Theme.of(context).copyWith(
400 + colorScheme: ColorScheme.fromSeed(
401 + seedColor: accent,
402 + surface: Colors.white,
403 + ),
404 + scaffoldBackgroundColor: Colors.white,
405 + ),
406 + child: Scaffold(
407 appBar: AppBar(
408 title: Text(destinations[index]),
409 actions: [
@@ -411,6 +441,7 @@ class _HomeShellState extends State<HomeShell> {
441 ),
442 ),
443 ),
444 + ),
445 );
446 }
447