user setting screen is finishe
This commit is contained in:
@@ -2,191 +2,260 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import '../widgets/app_background.dart';
|
||||
import '../widgets/settings_bar.dart';
|
||||
import '../screens/about_screen.dart';
|
||||
import '../screens/auth_screen.dart';
|
||||
import '../widgets/change_password_modal.dart';
|
||||
|
||||
class UserSettingsScreen extends StatelessWidget {
|
||||
|
||||
class UserSettingsScreen extends StatefulWidget {
|
||||
const UserSettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
State<UserSettingsScreen> createState() => _UserSettingsScreenState();
|
||||
}
|
||||
|
||||
class _UserSettingsScreenState extends State<UserSettingsScreen> {
|
||||
bool _notificationsOn = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Directionality(
|
||||
textDirection: TextDirection.rtl,
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
body: AppBackground(
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
/// -------------------- SETTINGS BAR --------------------
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr, // KEEP LOGO LEFT, BACK RIGHT
|
||||
child: SettingsBar(
|
||||
selectedIndex: 0,
|
||||
onTap: (_) {},
|
||||
showBackButton: true,
|
||||
onBackTap: () => Navigator.pop(context),
|
||||
iconPaths: const [],
|
||||
),
|
||||
SettingsBar(
|
||||
selectedIndex: 0,
|
||||
onTap: (_) {},
|
||||
showBackButton: true,
|
||||
onBackTap: () => Navigator.pop(context),
|
||||
iconPaths: const [],
|
||||
),
|
||||
|
||||
const SizedBox(height: 10),
|
||||
|
||||
/// -------------------- PAGE TITLE --------------------
|
||||
const Text(
|
||||
"الإعدادات",
|
||||
style: TextStyle(
|
||||
fontSize: 26,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 40),
|
||||
child: Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: const Text(
|
||||
"الإعدادات",
|
||||
style: TextStyle(
|
||||
fontSize: 26,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
/// -------------------- FORM CONTAINER --------------------
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
/// Outer border container
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.85,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFEEFFFA), // LIGHT GREEN FIXED
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
border: Border.all(
|
||||
color: const Color(0xDD00C28E),
|
||||
width: 1,
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 40),
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.85,
|
||||
height: MediaQuery.of(context).size.height * 0.62,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xF3EEFFFA),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.black26,
|
||||
blurRadius: 30,
|
||||
offset: Offset(0, 20),
|
||||
),
|
||||
],
|
||||
),
|
||||
boxShadow: const [
|
||||
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),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 22,
|
||||
vertical: 55,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
|
||||
/// -------------------- USER NAME --------------------
|
||||
const Center(
|
||||
child: Text(
|
||||
/// -------------------- USER NAME --------------------
|
||||
const Text(
|
||||
"اسم الموظف",
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontSize: 25,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 4),
|
||||
const SizedBox(height: 6),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
child: Center(
|
||||
/// ✅ CLICKABLE + UNDERLINED
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder:
|
||||
(_) => const ChangePasswordModal(),
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
"تغيير كلمة المرور",
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontSize: 15,
|
||||
color: Colors.black54,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationThickness: 1.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const SizedBox(width: 6),
|
||||
SvgPicture.asset(
|
||||
"assets/images/edit.svg",
|
||||
width: 16,
|
||||
height: 16,
|
||||
width: 22,
|
||||
height: 22,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 18),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
/// -------------------- 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,
|
||||
/// -------------------- NOTIFICATION SWITCH --------------------
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_notificationsOn = !_notificationsOn;
|
||||
});
|
||||
},
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(
|
||||
milliseconds: 250,
|
||||
),
|
||||
width: 95,
|
||||
height: 42,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
_notificationsOn
|
||||
? const Color(0xFF0A6B4A)
|
||||
: const Color(0xFFB5B5B5),
|
||||
borderRadius: BorderRadius.circular(
|
||||
40,
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment:
|
||||
_notificationsOn
|
||||
? Alignment.centerRight
|
||||
: Alignment.centerLeft,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(
|
||||
milliseconds: 250,
|
||||
),
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
_notificationsOn
|
||||
? const Color(0xFF12BE85)
|
||||
: const Color(0xFF0F0F0F),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x2D000000),
|
||||
blurRadius: 6,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
SvgPicture.asset(
|
||||
"assets/images/notification.svg",
|
||||
width: 22,
|
||||
),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
"الإشعارات",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
SvgPicture.asset(
|
||||
"assets/images/ball2.svg",
|
||||
width: 22,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
_divider(),
|
||||
|
||||
_settingsRow(
|
||||
label: "عن الشركة",
|
||||
icon: "assets/images/info.svg",
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const AboutScreen(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
_buildDivider(),
|
||||
_divider(),
|
||||
|
||||
_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: () {},
|
||||
),
|
||||
],
|
||||
_settingsRow(
|
||||
label: "تسجيل خروج",
|
||||
icon: "assets/images/logout2.svg",
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => const AuthScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
/// -------------------- USER AVATAR --------------------
|
||||
/// -------------------- AVATAR --------------------
|
||||
Positioned(
|
||||
top: -45,
|
||||
top: -55,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 105,
|
||||
height: 105,
|
||||
width: 120,
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: const Color(0xFFE1E1E1),
|
||||
border: Border.all(
|
||||
color: const Color(0xFF177046),
|
||||
width: 6,
|
||||
color: const Color(0xFF2D5E50),
|
||||
width: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -204,39 +273,44 @@ class UserSettingsScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// Divider line
|
||||
Widget _buildDivider() {
|
||||
Widget _divider() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 1,
|
||||
color: const Color(0xFF008864),
|
||||
margin: const EdgeInsets.symmetric(vertical: 12),
|
||||
height: 1.2,
|
||||
color: const Color(0xFFB5DECC),
|
||||
);
|
||||
}
|
||||
|
||||
// RTL Settings row (text right, icon left)
|
||||
Widget _buildSettingsRow({
|
||||
Widget _settingsRow({
|
||||
required String label,
|
||||
required String icon,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
/// ICON on LEFT — RTL
|
||||
SvgPicture.asset(icon, width: 22),
|
||||
|
||||
/// TEXT on RIGHT — RTL
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black87,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const SizedBox(width: 24),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
SvgPicture.asset(icon, width: 23),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user