login
This commit is contained in:
parent
454c07b04a
commit
8c828b1dac
@ -95,7 +95,7 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
print("userData12 - $userRole");
|
||||
}
|
||||
|
||||
apiService.getOrganizationData();
|
||||
await apiService.getOrganizationData();
|
||||
} catch (e) {
|
||||
print('Error decoding token: $e');
|
||||
}
|
||||
@ -313,14 +313,6 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
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<LoginWidget> {
|
||||
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<LoginWidget> {
|
||||
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",
|
||||
|
||||
@ -334,8 +334,8 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
||||
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<OrgSetUp> {
|
||||
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<OrgSetUp> {
|
||||
|
||||
// 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<OrgSetUp> {
|
||||
}
|
||||
|
||||
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<void> _pickImage() async {
|
||||
final picker = ImagePicker();
|
||||
final XFile? pickedFile = await picker.pickImage(
|
||||
@ -500,6 +524,7 @@ class _OrgSetUpState extends State<OrgSetUp> {
|
||||
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<OrgSetUp> {
|
||||
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,
|
||||
|
||||
@ -57,35 +57,38 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
|
||||
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<ColorThemePickerWidget> {
|
||||
}) {
|
||||
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(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -55,6 +55,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
initializeData();
|
||||
getOrganizationData();
|
||||
});
|
||||
|
||||
if (userData?["role"] == "Org Admin" ||
|
||||
userData?["role"] == "Travel Admin") {
|
||||
selectedTab = TabSelection.dashboard;
|
||||
@ -147,7 +148,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
|
||||
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<CustomAppBar> {
|
||||
child:
|
||||
selectedOrg?['logo'] != null
|
||||
? SizedBox(
|
||||
height: 60,
|
||||
height: 50,
|
||||
child: ClipRect(
|
||||
child: Image.network(
|
||||
selectedOrg!['logo'],
|
||||
|
||||
@ -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<OrganizationSetting> {
|
||||
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<OrganizationSetting> {
|
||||
Icon(
|
||||
item['icon'],
|
||||
size: 40,
|
||||
color: Color(0xFF114D8B),
|
||||
color: layoutColor,
|
||||
// color: Color(0xFF114D8B),
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
Expanded(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user