@davoodmehraban89 / LifeMate / commits / f3e5afc
Fork 0

LifeMate — Personal, Family & Learning Companion

feat: add RTL identity and family shell

davoodmehraban89 committed Oct 5, 2026 at 07:31 UTC f3e5afcebf0fae785779e81dab3231cd260ccdd2
1 file changed +155
apps/lifemate/lib/main.dart new
+155
@@ -0,0 +1,155 @@
1 +import 'package:flutter/material.dart';
2 +import 'package:flutter_localizations/flutter_localizations.dart';
3 +
4 +void main() => runApp(const LifeMateApp());
5 +
6 +enum MemberRole { teen, parent, adult }
7 +enum ProfileTheme { girlPink, boyBlue, adultBlue }
8 +
9 +class LifeMateApp extends StatelessWidget {
10 + const LifeMateApp({super.key});
11 +
12 + @override
13 + Widget build(BuildContext context) {
14 + const accent = Color(0xFF4D86E8);
15 + return MaterialApp(
16 + debugShowCheckedModeBanner: false,
17 + locale: const Locale('fa'),
18 + supportedLocales: const [Locale('fa'), Locale('en')],
19 + localizationsDelegates: const [
20 + GlobalMaterialLocalizations.delegate,
21 + GlobalWidgetsLocalizations.delegate,
22 + GlobalCupertinoLocalizations.delegate,
23 + ],
24 + theme: ThemeData(
25 + colorScheme: ColorScheme.fromSeed(seedColor: accent, surface: Colors.white),
26 + scaffoldBackgroundColor: const Color(0xFFF8FAFD),
27 + useMaterial3: true,
28 + ),
29 + home: const Directionality(textDirection: TextDirection.rtl, child: SignInPage()),
30 + );
31 + }
32 +}
33 +
34 +class SignInPage extends StatefulWidget {
35 + const SignInPage({super.key});
36 + @override
37 + State<SignInPage> createState() => _SignInPageState();
38 +}
39 +
40 +class _SignInPageState extends State<SignInPage> {
41 + final email = TextEditingController();
42 + final password = TextEditingController();
43 +
44 + @override
45 + Widget build(BuildContext context) => Scaffold(
46 + body: SafeArea(
47 + child: Center(
48 + child: ConstrainedBox(
49 + constraints: const BoxConstraints(maxWidth: 440),
50 + child: ListView(
51 + padding: const EdgeInsets.all(28),
52 + shrinkWrap: true,
53 + children: [
54 + const Icon(Icons.route_rounded, size: 64),
55 + const SizedBox(height: 16),
56 + const Text('LifeMate', textAlign: TextAlign.center, style: TextStyle(fontSize: 32, fontWeight: FontWeight.w700)),
57 + const Text('همراه شخصی، تحصیلی و خانوادگی', textAlign: TextAlign.center),
58 + const SizedBox(height: 32),
59 + TextField(controller: email, keyboardType: TextInputType.emailAddress, decoration: const InputDecoration(labelText: 'ایمیل', border: OutlineInputBorder())),
60 + const SizedBox(height: 12),
61 + TextField(controller: password, obscureText: true, decoration: const InputDecoration(labelText: 'رمز عبور', border: OutlineInputBorder())),
62 + const SizedBox(height: 16),
63 + FilledButton(onPressed: () => Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (_) => const HomeShell())), child: const Text('ورود')),
64 + TextButton(onPressed: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const RecoveryPage())), child: const Text('رمز عبور را فراموش کرده‌ام')),
65 + TextButton(onPressed: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const RegistrationPage())), child: const Text('ساخت حساب جدید')),
66 + ],
67 + ),
68 + ),
69 + ),
70 + ),
71 + );
72 +}
73 +
74 +class RegistrationPage extends StatelessWidget {
75 + const RegistrationPage({super.key});
76 + @override
77 + Widget build(BuildContext context) => const _FormScaffold(title: 'ساخت حساب', fields: ['نام', 'ایمیل', 'رمز عبور', 'تکرار رمز عبور'], action: 'ثبت‌نام و ارسال ایمیل تأیید');
78 +}
79 +
80 +class RecoveryPage extends StatelessWidget {
81 + const RecoveryPage({super.key});
82 + @override
83 + Widget build(BuildContext context) => const _FormScaffold(title: 'بازیابی رمز عبور', fields: ['ایمیل تأییدشده'], action: 'ارسال لینک بازیابی');
84 +}
85 +
86 +class ChangePasswordPage extends StatelessWidget {
87 + const ChangePasswordPage({super.key});
88 + @override
89 + Widget build(BuildContext context) => const _FormScaffold(title: 'تغییر رمز عبور', fields: ['رمز فعلی', 'رمز جدید', 'تکرار رمز جدید'], action: 'ذخیره رمز جدید');
90 +}
91 +
92 +class _FormScaffold extends StatelessWidget {
93 + const _FormScaffold({required this.title, required this.fields, required this.action});
94 + final String title;
95 + final List<String> fields;
96 + final String action;
97 + @override
98 + Widget build(BuildContext context) => Scaffold(
99 + appBar: AppBar(title: Text(title)),
100 + body: Center(child: ConstrainedBox(constraints: const BoxConstraints(maxWidth: 520), child: ListView(padding: const EdgeInsets.all(24), children: [
101 + ...fields.map((f) => Padding(padding: const EdgeInsets.only(bottom: 12), child: TextField(obscureText: f.contains('رمز'), decoration: InputDecoration(labelText: f, border: const OutlineInputBorder())))),
102 + FilledButton(onPressed: () {}, child: Text(action)),
103 + ]))),
104 + );
105 +}
106 +
107 +class HomeShell extends StatefulWidget {
108 + const HomeShell({super.key});
109 + @override
110 + State<HomeShell> createState() => _HomeShellState();
111 +}
112 +
113 +class _HomeShellState extends State<HomeShell> {
114 + int index = 0;
115 + static const destinations = ['امروز', 'برنامه', 'تقویم', 'کارها', 'امتحان‌ها', 'تمرکز', 'همراه هوشمند'];
116 + @override
117 + Widget build(BuildContext context) => Scaffold(
118 + appBar: AppBar(title: Text(destinations[index]), actions: [IconButton(onPressed: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ProfileFamilyPage())), icon: const Icon(Icons.person_outline))]),
119 + body: Center(child: Text(destinations[index], style: Theme.of(context).textTheme.headlineMedium)),
120 + bottomNavigationBar: NavigationBar(
121 + selectedIndex: index > 4 ? 0 : index,
122 + onDestinationSelected: (i) => setState(() => index = i),
123 + destinations: const [
124 + NavigationDestination(icon: Icon(Icons.home_outlined), label: 'امروز'),
125 + NavigationDestination(icon: Icon(Icons.schedule_outlined), label: 'برنامه'),
126 + NavigationDestination(icon: Icon(Icons.calendar_month_outlined), label: 'تقویم'),
127 + NavigationDestination(icon: Icon(Icons.task_alt_outlined), label: 'کارها'),
128 + NavigationDestination(icon: Icon(Icons.school_outlined), label: 'امتحان‌ها'),
129 + ],
130 + ),
131 + drawer: Drawer(child: SafeArea(child: ListView(children: [
132 + const ListTile(title: Text('LifeMate'), subtitle: Text('منو')),
133 + ...destinations.asMap().entries.map((e) => ListTile(title: Text(e.value), onTap: () { setState(() => index = e.key); Navigator.pop(context); })),
134 + const Divider(),
135 + ListTile(leading: const Icon(Icons.family_restroom), title: const Text('خانواده'), onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ProfileFamilyPage()))),
136 + ]))),
137 + );
138 +}
139 +
140 +class ProfileFamilyPage extends StatelessWidget {
141 + const ProfileFamilyPage({super.key});
142 + @override
143 + Widget build(BuildContext context) => Scaffold(
144 + appBar: AppBar(title: const Text('پروفایل و خانواده')),
145 + body: ListView(padding: const EdgeInsets.all(20), children: [
146 + const Card(child: ListTile(leading: CircleAvatar(child: Icon(Icons.person)), title: Text('پروفایل من'), subtitle: Text('نقش، اطلاعات شخصی و تم'))),
147 + Card(child: Column(children: [
148 + const ListTile(leading: Icon(Icons.family_restroom), title: Text('Family Workspace'), subtitle: Text('اعضا، نقش‌ها و دسترسی‌ها')),
149 + ListTile(leading: const Icon(Icons.person_add_alt), title: const Text('دعوت عضو'), onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const _FormScaffold(title: 'دعوت به خانواده', fields: ['ایمیل', 'نقش'], action: 'ارسال دعوت')))),
150 + ])),
151 + ListTile(leading: const Icon(Icons.password), title: const Text('تغییر رمز عبور'), onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const ChangePasswordPage()))),
152 + const ListTile(leading: Icon(Icons.privacy_tip_outlined), title: Text('حریم خصوصی و دسترسی‌ها'), subtitle: Text('خصوصی، اعضای منتخب، والد/سرپرست، خانواده، ایمنی')),
153 + ]),
154 + );
155 +}