more chnages has been done for the usr setting screen

This commit is contained in:
Daniah Ayad Al-sultani
2025-12-09 17:26:37 +03:00
parent 5931732b41
commit 993f396537
2 changed files with 217 additions and 154 deletions

View File

@@ -1,3 +1,4 @@
import 'package:coda_project/screens/user_settings_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import '../widgets/app_background.dart'; import '../widgets/app_background.dart';
@@ -42,16 +43,25 @@ class _MainPageState extends State<MainPage> {
child: SafeArea( child: SafeArea(
child: Column( child: Column(
children: [ children: [
SettingsBar( SettingsBar(
selectedIndex: _settingsIndex, selectedIndex: _settingsIndex,
onTap: (index) { onTap: (index) {
setState(() { setState(() {
_settingsIndex = index; _settingsIndex = index;
}); });
},
showBackButton: false, // 🟢 If user clicked the first icon (user.svg), open settings screen
iconPaths: _settingsIconPaths, if (index == 0) {
), Navigator.push(
context,
MaterialPageRoute(builder: (_) => const UserSettingsScreen()),
);
}
},
showBackButton: false,
iconPaths: _settingsIconPaths,
),
// Main content area // Main content area
Expanded( Expanded(

View File

@@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import '../widgets/app_background.dart';
import '../widgets/settings_bar.dart';
class UserSettingsScreen extends StatelessWidget { class UserSettingsScreen extends StatelessWidget {
const UserSettingsScreen({super.key}); const UserSettingsScreen({super.key});
@@ -8,181 +10,232 @@ class UserSettingsScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Directionality( return Directionality(
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
child: Stack( child: Scaffold(
children: [ body: AppBackground(
// ⭐ You already have your app background + settings bar outside this widget child: SafeArea(
child: Column(
// -------------------- WHITE CARD -------------------- children: [
Positioned( /// -------------------- SETTINGS BAR --------------------
top: 140, Directionality(
left: 20, textDirection: TextDirection.ltr, // KEEP LOGO LEFT, BACK RIGHT
right: 20, child: SettingsBar(
child: Container( selectedIndex: 0,
padding: const EdgeInsets.only(top: 70, bottom: 25), onTap: (_) {},
decoration: BoxDecoration( showBackButton: true,
color: Colors.white, onBackTap: () => Navigator.pop(context),
borderRadius: BorderRadius.circular(16), iconPaths: const [],
boxShadow: const [
BoxShadow(
color: Color(0x33000000),
blurRadius: 12,
offset: Offset(0, 5),
), ),
], ),
),
child: Column( const SizedBox(height: 10),
children: [
// -------------------- EMPLOYEE NAME -------------------- /// -------------------- PAGE TITLE --------------------
Text( const Text(
"اسم الموظف", "الإعدادات",
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 26,
fontWeight: FontWeight.w700, color: Colors.white,
color: Colors.black, fontWeight: FontWeight.bold,
fontFamily: "AbdEriady",
),
), ),
),
const SizedBox(height: 6), const SizedBox(height: 20),
Row( /// -------------------- FORM CONTAINER --------------------
mainAxisAlignment: MainAxisAlignment.center, Expanded(
children: [ child: Center(
Text( child: Stack(
"تغيير كلمة المرور", clipBehavior: Clip.none,
style: TextStyle(
fontSize: 12,
color: Colors.grey[700],
),
),
const SizedBox(width: 4),
SvgPicture.asset(
"assets/images/edit.svg",
width: 16,
height: 16,
)
],
),
const SizedBox(height: 25),
// -------------------- NOTIFICATION TOGGLE --------------------
Padding(
padding: const EdgeInsets.symmetric(horizontal: 18),
child: Row(
children: [ children: [
Switch( /// Outer border container
value: true, Container(
activeColor: const Color(0xFF177046), width: MediaQuery.of(context).size.width * 0.85,
inactiveTrackColor: Colors.grey[400], decoration: BoxDecoration(
onChanged: (value) {}, color: const Color(0xFFEEFFFA), // LIGHT GREEN FIXED
), borderRadius: BorderRadius.circular(28),
const Spacer(), border: Border.all(
Text( color: const Color(0xDD00C28E),
"الإشعارات", width: 1,
style: TextStyle( ),
fontSize: 16, boxShadow: const [
fontWeight: FontWeight.w500, BoxShadow(
color: Colors.black26,
blurRadius: 8,
offset: Offset(0, 4),
),
],
),
padding: const EdgeInsets.symmetric(
horizontal: 18,
vertical: 40,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 55),
/// -------------------- USER NAME --------------------
const Center(
child: Text(
"اسم الموظف",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
),
const SizedBox(height: 4),
GestureDetector(
onTap: () {},
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
"تغيير كلمة المرور",
style: TextStyle(
fontSize: 13,
color: Colors.black54,
),
),
const SizedBox(width: 4),
SvgPicture.asset(
"assets/images/edit.svg",
width: 16,
height: 16,
),
],
),
),
),
const SizedBox(height: 18),
/// -------------------- NOTIFICATION SWITCH --------------------
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Switch(
value: true,
activeColor: const Color(0xFF177046),
inactiveThumbColor: Colors.black,
onChanged: (v) {},
),
/// RTL text on right, icon on left
Row(
children: [
const Text(
"الإشعارات",
style: TextStyle(
fontSize: 16,
color: Colors.black87,
),
),
const SizedBox(width: 8),
SvgPicture.asset(
"assets/images/notification.svg",
width: 22,
),
],
),
],
),
_buildDivider(),
_buildSettingsRow(
label: "عن الشركة",
icon: "assets/images/info.svg",
onTap: () {},
),
_buildDivider(),
_buildSettingsRow(
label: "تسجيل خروج",
icon: "assets/images/logout.svg",
onTap: () {},
),
_buildDivider(),
_buildSettingsRow(
label: "إجازات الموظفين",
icon: "assets/images/holiday.svg",
onTap: () {},
),
],
), ),
), ),
const SizedBox(width: 8),
SvgPicture.asset( /// -------------------- USER AVATAR --------------------
"assets/images/bell.svg", Positioned(
width: 20, top: -45,
height: 20, left: 0,
right: 0,
child: Center(
child: Container(
width: 105,
height: 105,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: const Color(0xFFE1E1E1),
border: Border.all(
color: const Color(0xFF177046),
width: 6,
),
),
),
),
), ),
], ],
), ),
), ),
),
_divider(), ],
// -------------------- ABOUT COMPANY --------------------
_settingsTile(
label: "عن الشركة",
iconPath: "assets/images/info.svg",
),
_divider(),
// -------------------- LOGOUT --------------------
_settingsTile(
label: "تسجيل خروج",
iconPath: "assets/images/logout.svg",
),
_divider(),
// -------------------- EMPLOYEE LEAVES --------------------
_settingsTile(
label: "إجازات الموظفين",
iconPath: "assets/images/leaves.svg",
),
],
),
), ),
), ),
),
// -------------------- PROFILE IMAGE --------------------
Positioned(
top: 90,
left: 0,
right: 0,
child: Center(
child: Container(
width: 120,
height: 120,
padding: const EdgeInsets.all(6),
decoration: BoxDecoration(
color: const Color(0xFF177046),
shape: BoxShape.circle,
),
child: Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFD9D9D9), // placeholder profile
),
),
),
),
),
],
), ),
); );
} }
// Divider line styled like design // Divider line
Widget _divider() { Widget _buildDivider() {
return Container( return Container(
margin: const EdgeInsets.symmetric(vertical: 12),
height: 1,
width: double.infinity, width: double.infinity,
color: const Color(0xFFD1D1D1), margin: const EdgeInsets.symmetric(vertical: 12),
height: 1.2,
color: const Color(0xFFB5DECC),
); );
} }
// Settings row tile // RTL Settings row (text right, icon left)
Widget _settingsTile({ Widget _buildSettingsRow({
required String label, required String label,
required String iconPath, required String icon,
required VoidCallback onTap,
}) { }) {
return Padding( return GestureDetector(
padding: const EdgeInsets.symmetric(horizontal: 18), onTap: onTap,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
/// ICON on LEFT — RTL
SvgPicture.asset(icon, width: 22),
/// TEXT on RIGHT — RTL
Text( Text(
label, label,
style: const TextStyle( style: const TextStyle(
fontSize: 15, fontSize: 16,
fontWeight: FontWeight.w600, color: Colors.black87,
), ),
), ),
const Spacer(),
SvgPicture.asset(
iconPath,
width: 20,
height: 20,
),
], ],
), ),
); );