diff --git a/lib/Screens/authentication/login/login_widget.dart b/lib/Screens/authentication/login/login_widget.dart index 9758778..a16201b 100644 --- a/lib/Screens/authentication/login/login_widget.dart +++ b/lib/Screens/authentication/login/login_widget.dart @@ -95,7 +95,7 @@ class _LoginWidgetState extends State { print("userData12 - $userRole"); } - apiService.getOrganizationData(); + await apiService.getOrganizationData(); } catch (e) { print('Error decoding token: $e'); } @@ -313,14 +313,6 @@ class _LoginWidgetState extends State { flex: 2, child: Container( decoration: BoxDecoration( - // image: DecorationImage( - // image: AssetImage( - // 'assets/images/login/login_travel.png', - // ), - // // fit: BoxFit.fill - // fit: BoxFit.contain - // // fit: BoxFit.cover, // or BoxFit.contain, BoxFit.fill, etc. - // ), color: Color(0xFFE6F0FA), // color: Color(0xFFF0F7FF), // color: Colors.white, @@ -401,18 +393,12 @@ class _LoginWidgetState extends State { return Column( children: [ // width: width, - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Image.asset( - 'assets/images/login/logoNew.jpg', - width: 180, // Optional: control size - height: 70, - fit: BoxFit.contain, - ), - ], - ), - + // Row( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // + // ], + // ), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -428,6 +414,12 @@ class _LoginWidgetState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ + Image.asset( + 'assets/images/login/logoNew.jpg', + width: 180, // Optional: control size + height: 70, + fit: BoxFit.contain, + ), const SizedBox(height: 2), Text( "Sign In", diff --git a/lib/Screens/organization/orgSetup.dart b/lib/Screens/organization/orgSetup.dart index 131cb48..8cb85dd 100644 --- a/lib/Screens/organization/orgSetup.dart +++ b/lib/Screens/organization/orgSetup.dart @@ -334,8 +334,8 @@ class _OrgSetUpState extends State { await updateOrgDataWithNewValues(orgList); print("📨 Response Organizt Update:"); // return orgList; - - context.go('/listPlan'); + context.go('/OrganizationSettings'); + // context.go('/listPlan'); } else { print("❌ Submission failed. Status: ${response.statusCode}"); print("📨 Body: ${response.body}"); @@ -353,6 +353,16 @@ class _OrgSetUpState extends State { if (orgDataString != null) { try { orgData = jsonDecode(orgDataString); + + layoutColor = + orgData['layout_color'] != null + ? Color( + int.parse( + orgData['layout_color'].toString().replaceFirst('0x', ''), + radix: 16, + ), + ) + : Colors.white; } catch (e) { print('❌ Failed to decode org_data: $e'); } @@ -363,6 +373,8 @@ class _OrgSetUpState extends State { // Save back await prefs.setString('org_data', jsonEncode(orgData)); + await prefs.setString('layout_color', orgData['layout_color']); + print("✅ Updated org_data saved."); } @@ -471,6 +483,18 @@ class _OrgSetUpState extends State { } Widget buildOrgLayout(bool isDesktop) { + final screenWidth = MediaQuery.of(context).size.width; + final screenHeight = MediaQuery.of(context).size.height; + + final double responsiveLogoWidth = + screenWidth * 0.15; // 15% of screen width + final double responsiveLogoHeight = + screenHeight * 0.07; // 7% of screen height + + final double largeResponsiveLogoWidth = + screenWidth * 0.6; // 60% of screen width + final double largeResponsiveLogoHeight = screenHeight * 0.15; + Future _pickImage() async { final picker = ImagePicker(); final XFile? pickedFile = await picker.pickImage( @@ -500,6 +524,7 @@ class _OrgSetUpState extends State { isDesktop ? MediaQuery.of(context).size.height * 0.98 : MediaQuery.of(context).size.height, + // decoration: BoxDecoration( // border: isDesktop // ? Border.all( @@ -594,23 +619,29 @@ class _OrgSetUpState extends State { Spacer(), GestureDetector( onTap: _pickImage, + child: _imageBytes != null ? ClipOval( child: Image.memory( _imageBytes!, - width: 50, - height: 50, - fit: BoxFit.cover, + // width: 50, + // height: 50, + width: + responsiveLogoWidth, // Use responsive width + height: responsiveLogoHeight, + fit: BoxFit.contain, ), ) : selectedOrg?['logo'] != null ? ClipRect( child: Image.network( selectedOrg!['logo'], - width: 250, // increased - height: 75, // increased - + width: + responsiveLogoWidth, // Use responsive width + height: responsiveLogoHeight, + // width: 250, + // height: 55, fit: BoxFit.contain, errorBuilder: ( context, diff --git a/lib/Screens/organization/themeColor.dart b/lib/Screens/organization/themeColor.dart index 7c14f12..2ad9f5f 100644 --- a/lib/Screens/organization/themeColor.dart +++ b/lib/Screens/organization/themeColor.dart @@ -57,35 +57,38 @@ class _ColorThemePickerWidgetState extends State { children: [ // Layout Color Picker GestureDetector( - onTap: () => _showColorPickerDialog( - title: "Choose Layout Color", - colors: layoutThemeColors, - onColorSelected: (color) { - setState(() { - selectedLayoutColor = color; - }); - widget.onLayoutColorSelected(color); - }, - ), + onTap: + () => _showColorPickerDialog( + title: "Choose Layout Color", + colors: layoutThemeColors, + onColorSelected: (color) { + setState(() { + selectedLayoutColor = color; + }); + widget.onLayoutColorSelected(color); + }, + ), child: _buildColorBox( - selectedLayoutColor ?? Colors.grey.shade300, Icons.palette), - ), - SizedBox(width: 15), - // Body Color Picker - GestureDetector( - onTap: () => _showColorPickerDialog( - title: "Choose Body Color", - colors: bodyThemeColors, - onColorSelected: (color) { - setState(() { - selectedBodyColor = color; // low opacity - }); - widget.onBodyColorSelected(selectedBodyColor!); - }, + selectedLayoutColor ?? Colors.grey.shade300, + Icons.palette, ), - child: _buildColorBox( - selectedBodyColor ?? Colors.grey.shade300, Icons.opacity), ), + // SizedBox(width: 15), + // // Body Color Picker + // GestureDetector( + // onTap: () => _showColorPickerDialog( + // title: "Choose Body Color", + // colors: bodyThemeColors, + // onColorSelected: (color) { + // setState(() { + // selectedBodyColor = color; // low opacity + // }); + // widget.onBodyColorSelected(selectedBodyColor!); + // }, + // ), + // child: _buildColorBox( + // selectedBodyColor ?? Colors.grey.shade300, Icons.opacity), + // ), ], ); } @@ -110,30 +113,32 @@ class _ColorThemePickerWidgetState extends State { }) { showDialog( context: context, - builder: (context) => AlertDialog( - title: Text(title), - content: Wrap( - spacing: 10, - runSpacing: 10, - children: colors.map((color) { - return GestureDetector( - onTap: () { - onColorSelected(color); - Navigator.of(context).pop(); - }, - child: Container( - width: 30, - height: 30, - decoration: BoxDecoration( - color: color, - shape: BoxShape.circle, - border: Border.all(color: Colors.black26), - ), - ), - ); - }).toList(), - ), - ), + builder: + (context) => AlertDialog( + title: Text(title), + content: Wrap( + spacing: 10, + runSpacing: 10, + children: + colors.map((color) { + return GestureDetector( + onTap: () { + onColorSelected(color); + Navigator.of(context).pop(); + }, + child: Container( + width: 30, + height: 30, + decoration: BoxDecoration( + color: color, + shape: BoxShape.circle, + border: Border.all(color: Colors.black26), + ), + ), + ); + }).toList(), + ), + ), ); } } diff --git a/lib/config/apiUrl.dart b/lib/config/apiUrl.dart index bc1e6df..b6b5695 100644 --- a/lib/config/apiUrl.dart +++ b/lib/config/apiUrl.dart @@ -1,3 +1,3 @@ //api url -// const String apiUrl = 'http://apitest.tripapprovaltool.com'; -const String apiUrl = 'https://uat.tripapprovaltool.com'; +const String apiUrl = 'http://apitest.tripapprovaltool.com'; +// const String apiUrl = 'https://uat.tripapprovaltool.com'; diff --git a/lib/routes/custom_appBar.dart b/lib/routes/custom_appBar.dart index 31bf083..c8d85bf 100644 --- a/lib/routes/custom_appBar.dart +++ b/lib/routes/custom_appBar.dart @@ -55,6 +55,7 @@ class _CustomAppBarState extends State { initializeData(); getOrganizationData(); }); + if (userData?["role"] == "Org Admin" || userData?["role"] == "Travel Admin") { selectedTab = TabSelection.dashboard; @@ -147,7 +148,7 @@ class _CustomAppBarState extends State { layoutColor = selectedOrg?['layout_color'] != null ? Color(int.parse(selectedOrg!['layout_color'])) - : Colors.white; + : Colors.black; bodyColor = selectedOrg?['color'] != null @@ -309,7 +310,7 @@ class _CustomAppBarState extends State { child: selectedOrg?['logo'] != null ? SizedBox( - height: 60, + height: 50, child: ClipRect( child: Image.network( selectedOrg!['logo'], diff --git a/lib/routes/organizationSetting.dart b/lib/routes/organizationSetting.dart index 8ede904..bf5cde3 100644 --- a/lib/routes/organizationSetting.dart +++ b/lib/routes/organizationSetting.dart @@ -5,6 +5,7 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:responsive_builder/responsive_builder.dart'; import '../services/apiService.dart'; +import '../utils/auth_utils.dart'; import 'custom_appBar.dart'; import 'custom_drawer.dart'; @@ -17,6 +18,29 @@ class OrganizationSetting extends StatefulWidget { class OrganizationSettingState extends State { final ApiService apiService = ApiService(); + Color? layoutColor; + + void initState() { + super.initState(); + loadInitialData(); + } + + void loadInitialData() async { + String? layoutString = await getLayoutColor(); + // String? bodyStringColor = await getBodyColor(); + + setState(() { + layoutColor = + layoutString != null + ? Color(int.parse(layoutString)) + : Colors.redAccent; + + // bodyColor = + // bodyStringColor != null + // ? Color(int.parse(bodyStringColor)) + // : Colors.white; + }); + } @override Widget build(BuildContext context) { @@ -270,7 +294,8 @@ class OrganizationSettingState extends State { Icon( item['icon'], size: 40, - color: Color(0xFF114D8B), + color: layoutColor, + // color: Color(0xFF114D8B), ), SizedBox(width: 16), Expanded(