Stracture of the request leave and advance was made
This commit is contained in:
@@ -1,6 +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 '../screens/request_leave_screen.dart';
|
import '../screens/request_leave_screen.dart';
|
||||||
|
import '../screens/request_advance_scrren.dart';
|
||||||
|
|
||||||
class HolidayScreen extends StatefulWidget {
|
class HolidayScreen extends StatefulWidget {
|
||||||
const HolidayScreen({super.key});
|
const HolidayScreen({super.key});
|
||||||
@@ -94,7 +95,16 @@ class _HolidayScreenState extends State<HolidayScreen> {
|
|||||||
svgPath: "assets/images/money2.svg",
|
svgPath: "assets/images/money2.svg",
|
||||||
iconWidth: 38,
|
iconWidth: 38,
|
||||||
iconHeight: 30,
|
iconHeight: 30,
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
|
|
||||||
|
// Navigate to RequestAdvanceScreen
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const RequestAdvanceScreen(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 18),
|
const SizedBox(height: 18),
|
||||||
|
|
||||||
|
|||||||
193
lib/screens/request_advance_scrren.dart
Normal file
193
lib/screens/request_advance_scrren.dart
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import '../widgets/app_background.dart';
|
||||||
|
import '../widgets/settings_bar.dart';
|
||||||
|
import '../widgets/onboarding_button.dart';
|
||||||
|
|
||||||
|
class RequestAdvanceScreen extends StatefulWidget {
|
||||||
|
const RequestAdvanceScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<RequestAdvanceScreen> createState() => _RequestAdvanceScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RequestAdvanceScreenState extends State<RequestAdvanceScreen> {
|
||||||
|
|
||||||
|
// Text controller for amount
|
||||||
|
final TextEditingController amountController = TextEditingController();
|
||||||
|
// Text controller for reason
|
||||||
|
final TextEditingController reasonController = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: AppBackground(
|
||||||
|
child: SafeArea(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// Settings bar
|
||||||
|
SettingsBar(
|
||||||
|
selectedIndex: -1,
|
||||||
|
onTap: (_) {},
|
||||||
|
showBackButton: true,
|
||||||
|
onBackTap: () => Navigator.pop(context),
|
||||||
|
iconPaths: const [
|
||||||
|
"assets/images/user.svg",
|
||||||
|
"assets/images/bell.svg",
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 25),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Title for advance request
|
||||||
|
const Align(
|
||||||
|
alignment: Alignment.topRight,
|
||||||
|
child: Text(
|
||||||
|
"طلب سلفة",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 28,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 40),
|
||||||
|
//=============================
|
||||||
|
// AMOUNT INPUT
|
||||||
|
//=============================
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: const Text(
|
||||||
|
"المبلغ المطلوب",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
|
||||||
|
Directionality(
|
||||||
|
textDirection: TextDirection.rtl,
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
height: 58,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(14),
|
||||||
|
boxShadow: const [
|
||||||
|
BoxShadow(
|
||||||
|
color: Color(0x22000000),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
|
controller: amountController,
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
hintText: "دع .000 ",
|
||||||
|
hintStyle: TextStyle(color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
|
||||||
|
// =============================
|
||||||
|
// REASON TEXTFIELD
|
||||||
|
// =============================
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: Directionality(
|
||||||
|
textDirection: TextDirection.rtl,
|
||||||
|
child: const Text(
|
||||||
|
"السبب",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// OUTER BORDER CONTAINER
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(
|
||||||
|
15,
|
||||||
|
), // border thickness space
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: Color(0xFF00FFAA), // green border
|
||||||
|
width: 0.5,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(14),
|
||||||
|
),
|
||||||
|
|
||||||
|
// INNER TEXTFIELD CONTAINER
|
||||||
|
child: Container(
|
||||||
|
height: 100,
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 14,
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFEAEAEA),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
// Added Directionality to fix text direction
|
||||||
|
child: Directionality(
|
||||||
|
textDirection: TextDirection.rtl,
|
||||||
|
child: TextField(
|
||||||
|
controller: reasonController,
|
||||||
|
maxLines: 5,
|
||||||
|
textAlign:
|
||||||
|
TextAlign.right, // Added this to align text to the right
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
hintText:
|
||||||
|
"اكتب السبب", // Added placeholder text
|
||||||
|
hintStyle: TextStyle(color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 70),
|
||||||
|
|
||||||
|
// CONFIRM BUTTON
|
||||||
|
Center(
|
||||||
|
child: OnboardingButton(
|
||||||
|
text: "تأكيد الطلب",
|
||||||
|
backgroundColor: const Color(0xFFD1FEF0),
|
||||||
|
textColor: Colors.black,
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 40),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -81,9 +81,7 @@ class _RequestLeaveScreenState extends State<RequestLeaveScreen> {
|
|||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// =============================
|
// In your RequestLeaveScreen's build method, replace the SettingsBar with this:
|
||||||
// TOP NAV BAR
|
|
||||||
// =============================
|
|
||||||
SettingsBar(
|
SettingsBar(
|
||||||
selectedIndex: -1,
|
selectedIndex: -1,
|
||||||
onTap: (_) {},
|
onTap: (_) {},
|
||||||
@@ -104,9 +102,10 @@ class _RequestLeaveScreenState extends State<RequestLeaveScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Align(
|
// Fixed alignment for "طلب أجازة"
|
||||||
alignment: Alignment.topRight,
|
const Align(
|
||||||
child: const Text(
|
alignment: Alignment.topRight, // Changed to centerRight
|
||||||
|
child: Text(
|
||||||
"طلب أجازة ",
|
"طلب أجازة ",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
@@ -134,72 +133,86 @@ class _RequestLeaveScreenState extends State<RequestLeaveScreen> {
|
|||||||
|
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
|
|
||||||
|
// Modified dropdown with disabled state
|
||||||
Directionality(
|
Directionality(
|
||||||
textDirection:
|
textDirection: TextDirection.rtl,
|
||||||
TextDirection.rtl, // <<< CHANGE DIRECTION HERE
|
child: Opacity(
|
||||||
child: Container(
|
opacity: isTimedLeave ? 0.45 : 1.0,
|
||||||
width: double.infinity,
|
child: IgnorePointer(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
ignoring: isTimedLeave,
|
||||||
height: 58,
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
width: double.infinity,
|
||||||
color: Colors.white,
|
padding: const EdgeInsets.symmetric(
|
||||||
borderRadius: BorderRadius.circular(14),
|
horizontal: 20,
|
||||||
boxShadow: const [
|
|
||||||
BoxShadow(
|
|
||||||
color: Color(0x22000000),
|
|
||||||
blurRadius: 8,
|
|
||||||
offset: Offset(0, 3),
|
|
||||||
),
|
),
|
||||||
],
|
height: 58,
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
child: DropdownButtonHideUnderline(
|
color:
|
||||||
child: DropdownButton<String>(
|
isTimedLeave
|
||||||
value: leaveType,
|
? Colors.grey[300]
|
||||||
icon: const Icon(
|
: Colors.white,
|
||||||
Icons.keyboard_arrow_down_rounded,
|
borderRadius: BorderRadius.circular(14),
|
||||||
color: Colors.black,
|
boxShadow: const [
|
||||||
size: 28,
|
BoxShadow(
|
||||||
|
color: Color(0x22000000),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
style: const TextStyle(
|
child: DropdownButtonHideUnderline(
|
||||||
color: Colors.black,
|
child: DropdownButton<String>(
|
||||||
fontSize: 17,
|
value: leaveType,
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.keyboard_arrow_down_rounded,
|
||||||
|
color: Colors.black,
|
||||||
|
size: 28,
|
||||||
|
),
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 17,
|
||||||
|
),
|
||||||
|
isExpanded: true,
|
||||||
|
onChanged:
|
||||||
|
isTimedLeave
|
||||||
|
? null
|
||||||
|
: (value) {
|
||||||
|
setState(() => leaveType = value!);
|
||||||
|
},
|
||||||
|
items: [
|
||||||
|
DropdownMenuItem(
|
||||||
|
value: "إجازة مرضية ",
|
||||||
|
child: Directionality(
|
||||||
|
textDirection: TextDirection.rtl,
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: Text("إجازة مرضية "),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DropdownMenuItem(
|
||||||
|
value: "إجازة مدفوعة",
|
||||||
|
child: Directionality(
|
||||||
|
textDirection: TextDirection.rtl,
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: Text("إجازة مدفوعة"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DropdownMenuItem(
|
||||||
|
value: "إجازة غير مدفوعة",
|
||||||
|
child: Directionality(
|
||||||
|
textDirection: TextDirection.rtl,
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: Text("إجازة غير مدفوعة"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
isExpanded: true,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() => leaveType = value!);
|
|
||||||
},
|
|
||||||
items: [
|
|
||||||
DropdownMenuItem(
|
|
||||||
value: "إجازة مرضية ",
|
|
||||||
child: Directionality(
|
|
||||||
textDirection: TextDirection.rtl,
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Text("إجازة مرضية "),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
DropdownMenuItem(
|
|
||||||
value: "إجازة مدفوعة",
|
|
||||||
child: Directionality(
|
|
||||||
textDirection: TextDirection.rtl,
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Text("إجازة مدفوعة"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
DropdownMenuItem(
|
|
||||||
value: "إجازة غير مدفوعة",
|
|
||||||
child: Directionality(
|
|
||||||
textDirection: TextDirection.rtl,
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: Text("إجازة غير مدفوعة"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -417,24 +430,35 @@ class _RequestLeaveScreenState extends State<RequestLeaveScreen> {
|
|||||||
color: const Color(0xFFEAEAEA),
|
color: const Color(0xFFEAEAEA),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
child: TextField(
|
// Added Directionality to fix text direction
|
||||||
controller: reasonController,
|
child: Directionality(
|
||||||
maxLines: 5,
|
textDirection: TextDirection.rtl,
|
||||||
decoration: const InputDecoration(
|
child: TextField(
|
||||||
border: InputBorder.none,
|
controller: reasonController,
|
||||||
hintText: "",
|
maxLines: 5,
|
||||||
|
textAlign:
|
||||||
|
TextAlign
|
||||||
|
.right, // Added this to align text to the right
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
hintText:
|
||||||
|
"اكتب السبب", // Added placeholder text
|
||||||
|
hintStyle: TextStyle(color: Colors.grey),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(height: 40),
|
const SizedBox(height: 70),
|
||||||
|
|
||||||
// CONFIRM BUTTON
|
// CONFIRM BUTTON
|
||||||
Center(
|
Center(
|
||||||
child: OnboardingButton(
|
child: // In your RequestLeaveScreen's build method
|
||||||
|
OnboardingButton(
|
||||||
text: "تأكيد الطلب",
|
text: "تأكيد الطلب",
|
||||||
backgroundColor: const Color(0xFFD1FEF0),
|
backgroundColor: const Color(0xFFD1FEF0),
|
||||||
|
textColor: Colors.black, // Changed to black
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -535,10 +559,8 @@ class _RequestLeaveScreenState extends State<RequestLeaveScreen> {
|
|||||||
case 4:
|
case 4:
|
||||||
return "الخميس";
|
return "الخميس";
|
||||||
case 5:
|
case 5:
|
||||||
return "الجمعة";
|
|
||||||
case 6:
|
|
||||||
return "السبت";
|
return "السبت";
|
||||||
case 7:
|
case 6:
|
||||||
return "الأحد";
|
return "الأحد";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ class OnboardingButton extends StatelessWidget {
|
|||||||
final String text;
|
final String text;
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
final Color backgroundColor;
|
final Color backgroundColor;
|
||||||
|
final Color textColor;
|
||||||
|
|
||||||
const OnboardingButton({
|
const OnboardingButton({
|
||||||
super.key,
|
super.key,
|
||||||
required this.text,
|
required this.text,
|
||||||
this.onPressed,
|
this.onPressed,
|
||||||
this.backgroundColor = const Color(0xFF2D2D2D),
|
this.backgroundColor = const Color(0xFF2D2D2D),
|
||||||
|
this.textColor = Colors.white,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -29,21 +31,21 @@ class OnboardingButton extends StatelessWidget {
|
|||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: textColor,
|
||||||
disabledForegroundColor: Colors.white,
|
disabledForegroundColor: textColor,
|
||||||
disabledBackgroundColor: backgroundColor,
|
disabledBackgroundColor: backgroundColor,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 80, vertical: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 80, vertical: 10),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
),
|
),
|
||||||
elevation: 8, // Increased elevation for more prominent shadow
|
elevation: 8,
|
||||||
shadowColor: const Color(0x47000000), // More defined shadow color
|
shadowColor: const Color(0x47000000), // More defined shadow color
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
text,
|
text,
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: textColor, // Use the textColor parameter here
|
||||||
fontSize: 20,
|
fontSize: 22,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class SettingsBar extends StatelessWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.selectedIndex,
|
required this.selectedIndex,
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
this.showBackButton = false, //to swicth between back button and settings icons
|
this.showBackButton = false, // to switch between back button and settings icons
|
||||||
this.onBackTap,
|
this.onBackTap,
|
||||||
required this.iconPaths,
|
required this.iconPaths,
|
||||||
});
|
});
|
||||||
@@ -32,7 +32,6 @@ class SettingsBar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
|
||||||
if (showBackButton)
|
if (showBackButton)
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: onBackTap,
|
onTap: onBackTap,
|
||||||
@@ -51,10 +50,11 @@ class SettingsBar extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: SvgPicture.asset(
|
// Always use Flutter's built-in back icon pointing to the right
|
||||||
"assets/images/back.svg",
|
child: const Icon(
|
||||||
width: 26,
|
Icons.arrow_forward, // Changed to arrow_forward for RTL
|
||||||
height: 26,
|
size: 26,
|
||||||
|
color: Colors.black, // Adjust color as needed
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user