diff --git a/lib/screens/holiday_screen.dart b/lib/screens/holiday_screen.dart index 9d1f92c..2ffb0f5 100644 --- a/lib/screens/holiday_screen.dart +++ b/lib/screens/holiday_screen.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import '../screens/request_leave_screen.dart'; +import '../screens/request_advance_scrren.dart'; class HolidayScreen extends StatefulWidget { const HolidayScreen({super.key}); @@ -94,7 +95,16 @@ class _HolidayScreenState extends State { svgPath: "assets/images/money2.svg", iconWidth: 38, iconHeight: 30, - onTap: () {}, + onTap: () { + + // Navigate to RequestAdvanceScreen + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const RequestAdvanceScreen(), + ), + ); + }, ), const SizedBox(height: 18), diff --git a/lib/screens/request_advance_scrren.dart b/lib/screens/request_advance_scrren.dart new file mode 100644 index 0000000..8bad87b --- /dev/null +++ b/lib/screens/request_advance_scrren.dart @@ -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 createState() => _RequestAdvanceScreenState(); +} + +class _RequestAdvanceScreenState extends State { + + // 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), + ], + ), + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/request_leave_screen.dart b/lib/screens/request_leave_screen.dart index 074a5c0..61cff36 100644 --- a/lib/screens/request_leave_screen.dart +++ b/lib/screens/request_leave_screen.dart @@ -81,9 +81,7 @@ class _RequestLeaveScreenState extends State { child: SafeArea( child: Column( children: [ - // ============================= - // TOP NAV BAR - // ============================= + // In your RequestLeaveScreen's build method, replace the SettingsBar with this: SettingsBar( selectedIndex: -1, onTap: (_) {}, @@ -104,9 +102,10 @@ class _RequestLeaveScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Align( - alignment: Alignment.topRight, - child: const Text( + // Fixed alignment for "طلب أجازة" + const Align( + alignment: Alignment.topRight, // Changed to centerRight + child: Text( "طلب أجازة ", style: TextStyle( color: Colors.white, @@ -134,72 +133,86 @@ class _RequestLeaveScreenState extends State { const SizedBox(height: 6), + // Modified dropdown with disabled state Directionality( - textDirection: - TextDirection.rtl, // <<< CHANGE DIRECTION HERE - 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), + textDirection: TextDirection.rtl, + child: Opacity( + opacity: isTimedLeave ? 0.45 : 1.0, + child: IgnorePointer( + ignoring: isTimedLeave, + child: Container( + width: double.infinity, + padding: const EdgeInsets.symmetric( + horizontal: 20, ), - ], - ), - child: DropdownButtonHideUnderline( - child: DropdownButton( - value: leaveType, - icon: const Icon( - Icons.keyboard_arrow_down_rounded, - color: Colors.black, - size: 28, + height: 58, + decoration: BoxDecoration( + color: + isTimedLeave + ? Colors.grey[300] + : Colors.white, + borderRadius: BorderRadius.circular(14), + boxShadow: const [ + BoxShadow( + color: Color(0x22000000), + blurRadius: 8, + offset: Offset(0, 3), + ), + ], ), - style: const TextStyle( - color: Colors.black, - fontSize: 17, + child: DropdownButtonHideUnderline( + child: DropdownButton( + 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 { color: const Color(0xFFEAEAEA), borderRadius: BorderRadius.circular(12), ), - child: TextField( - controller: reasonController, - maxLines: 5, - decoration: const InputDecoration( - border: InputBorder.none, - hintText: "", + // 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: 40), + const SizedBox(height: 70), // CONFIRM BUTTON Center( - child: OnboardingButton( + child: // In your RequestLeaveScreen's build method + OnboardingButton( text: "تأكيد الطلب", backgroundColor: const Color(0xFFD1FEF0), + textColor: Colors.black, // Changed to black onPressed: () {}, ), ), @@ -535,10 +559,8 @@ class _RequestLeaveScreenState extends State { case 4: return "الخميس"; case 5: - return "الجمعة"; - case 6: return "السبت"; - case 7: + case 6: return "الأحد"; default: return ""; diff --git a/lib/widgets/onboarding_button.dart b/lib/widgets/onboarding_button.dart index d91c657..8951ff4 100644 --- a/lib/widgets/onboarding_button.dart +++ b/lib/widgets/onboarding_button.dart @@ -4,12 +4,14 @@ class OnboardingButton extends StatelessWidget { final String text; final VoidCallback? onPressed; final Color backgroundColor; + final Color textColor; const OnboardingButton({ super.key, required this.text, this.onPressed, this.backgroundColor = const Color(0xFF2D2D2D), + this.textColor = Colors.white, }); @override @@ -29,21 +31,21 @@ class OnboardingButton extends StatelessWidget { onPressed: onPressed, style: ElevatedButton.styleFrom( backgroundColor: backgroundColor, - foregroundColor: Colors.white, - disabledForegroundColor: Colors.white, + foregroundColor: textColor, + disabledForegroundColor: textColor, disabledBackgroundColor: backgroundColor, padding: const EdgeInsets.symmetric(horizontal: 80, vertical: 10), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), - elevation: 8, // Increased elevation for more prominent shadow + elevation: 8, shadowColor: const Color(0x47000000), // More defined shadow color ), child: Text( text, - style: const TextStyle( - color: Colors.white, - fontSize: 20, + style: TextStyle( + color: textColor, // Use the textColor parameter here + fontSize: 22, fontWeight: FontWeight.w600, ), ), diff --git a/lib/widgets/settings_bar.dart b/lib/widgets/settings_bar.dart index 26dc700..9214c5c 100644 --- a/lib/widgets/settings_bar.dart +++ b/lib/widgets/settings_bar.dart @@ -12,7 +12,7 @@ class SettingsBar extends StatelessWidget { super.key, required this.selectedIndex, 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, required this.iconPaths, }); @@ -32,7 +32,6 @@ class SettingsBar extends StatelessWidget { ), Row( children: [ - if (showBackButton) GestureDetector( onTap: onBackTap, @@ -51,10 +50,11 @@ class SettingsBar extends StatelessWidget { ], ), child: Center( - child: SvgPicture.asset( - "assets/images/back.svg", - width: 26, - height: 26, + // Always use Flutter's built-in back icon pointing to the right + child: const Icon( + Icons.arrow_forward, // Changed to arrow_forward for RTL + size: 26, + color: Colors.black, // Adjust color as needed ), ), ), @@ -102,4 +102,4 @@ class SettingsBar extends StatelessWidget { ), ); } -} +} \ No newline at end of file