BUG_FIX
This commit is contained in:
parent
058875d571
commit
cf23f4f936
@ -811,7 +811,8 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
|||||||
),
|
),
|
||||||
columns: [
|
columns: [
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Expanded(
|
||||||
|
child: Text(
|
||||||
'S.NO',
|
'S.NO',
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
@ -819,6 +820,7 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
@ -928,8 +930,11 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
|||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
fontFamily: "Inter",
|
fontFamily: "Inter",
|
||||||
),
|
),
|
||||||
softWrap: true,
|
softWrap: true, // Allows wrapping
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow:
|
||||||
|
TextOverflow
|
||||||
|
.visible, // Ensures full display
|
||||||
|
maxLines: null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
DataCell(
|
||||||
@ -1251,6 +1256,12 @@ class _ListAllPlansState extends State<ListAllPlans> {
|
|||||||
fontWeight:
|
fontWeight:
|
||||||
FontWeight.w500,
|
FontWeight.w500,
|
||||||
),
|
),
|
||||||
|
softWrap:
|
||||||
|
true, // Allows wrapping
|
||||||
|
overflow:
|
||||||
|
TextOverflow
|
||||||
|
.visible, // Ensures full display
|
||||||
|
maxLines: null,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -26,13 +26,15 @@ class MiscellaneousListWidget extends StatelessWidget {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(top: 16.0),
|
// color: Color(0xFFE8F0FC),
|
||||||
|
margin: const EdgeInsets.only(top: 28.0),
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
// Header with title and button
|
// Header with title and button
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
cursor:
|
cursor:
|
||||||
@ -56,10 +58,23 @@ class MiscellaneousListWidget extends StatelessWidget {
|
|||||||
// style: TextStyle(fontSize: 13),
|
// style: TextStyle(fontSize: 13),
|
||||||
// ),
|
// ),
|
||||||
// SizedBox(width: 8), // spacing between icon and text
|
// SizedBox(width: 8), // spacing between icon and text
|
||||||
Icon(
|
Container(
|
||||||
Icons.add_circle_sharp,
|
decoration: BoxDecoration(
|
||||||
size: 30,
|
shape: BoxShape.circle,
|
||||||
color: Color(0xFF114D8B),
|
border: Border.all(
|
||||||
|
color: Color(0xFF114D8B), // Outline color
|
||||||
|
width: 2, // Outline thickness
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 30,
|
||||||
|
width: 30,
|
||||||
|
child: Center(
|
||||||
|
child: Icon(
|
||||||
|
Icons.add,
|
||||||
|
size: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -159,7 +174,8 @@ class MiscellaneousListWidget extends StatelessWidget {
|
|||||||
getRequestValue(item["special_request"]?.toString()),
|
getRequestValue(item["special_request"]?.toString()),
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w800,
|
color: Color(0xFF114D8B),
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
@ -189,54 +205,67 @@ class MiscellaneousListWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Divider(color: Colors.blueGrey.shade50),
|
// Divider(color: Colors.blueGrey.shade50),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 10),
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
// Expanded(
|
||||||
flex: 2,
|
// flex: 2,
|
||||||
child: Text(
|
// child: Text(
|
||||||
"Special Request",
|
// "Special Request",
|
||||||
style: GoogleFonts.poppins(fontSize: 11),
|
// style: GoogleFonts.poppins(fontSize: 11),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 3,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Comments",
|
"Comments",
|
||||||
style: GoogleFonts.poppins(fontSize: 11),
|
style: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: SizedBox.shrink(),
|
: SizedBox.shrink(),
|
||||||
|
SizedBox(height: 4),
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Container(
|
||||||
|
// color: Color(0xFFE8F0FC),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Expanded(
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
// Expanded(
|
||||||
flex: 2,
|
// flex: 2,
|
||||||
child: Text(
|
// child: Text(
|
||||||
getRequestValue(
|
// getRequestValue(
|
||||||
item["special_request"]?.toString(),
|
// item["special_request"]?.toString(),
|
||||||
),
|
// ),
|
||||||
style: GoogleFonts.poppins(
|
// style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
// fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
// fontWeight: FontWeight.w600,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Expanded(
|
Container(
|
||||||
flex: 3,
|
// width: MediaQuery.of(context).size.width * 0.6,
|
||||||
|
// padding: EdgeInsets.all(16),
|
||||||
|
// color: Color(0xFFE8F0FC),
|
||||||
|
child: Expanded(
|
||||||
|
// flex: 1,
|
||||||
child: Text(
|
child: Text(
|
||||||
item["comments"],
|
item["comments"],
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(fontSize: 11),
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: Column(
|
: Column(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@ -32,12 +32,10 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
|
|||||||
Color(0xFF027E87), // Blue Shade
|
Color(0xFF027E87), // Blue Shade
|
||||||
Color(0xFF12B24B), // Green
|
Color(0xFF12B24B), // Green
|
||||||
Color(0xFFe30f01), // Emerald Green
|
Color(0xFFe30f01), // Emerald Green
|
||||||
// Color(0xFFef3030), // Emerald Green
|
|
||||||
Color(0xFFf26157), // Emerald Green
|
Color(0xFFf26157), // Emerald Green
|
||||||
// Color(0xFF2ECC71), // Emerald Green
|
|
||||||
Color(0xFFFF9800), // Orange
|
Color(0xFFFF9800), // Orange
|
||||||
Color(0xFFE67E22), // Orange 2
|
Color(0xFF3F51B5), // Orange 2
|
||||||
Color(0xFFBF4C0D), // Orange dark orange 3
|
Color(0xFF00695C), // Orange dark orange 3
|
||||||
Color(0xFFD9067A), // rose
|
Color(0xFFD9067A), // rose
|
||||||
Color(0xFFc94b92), // rose light
|
Color(0xFFc94b92), // rose light
|
||||||
Color(0xFF9C27B0), // Purple
|
Color(0xFF9C27B0), // Purple
|
||||||
@ -45,31 +43,32 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
|
|||||||
];
|
];
|
||||||
|
|
||||||
final List<Color> layoutSecondaryColors = [
|
final List<Color> layoutSecondaryColors = [
|
||||||
Color(0xFF00B0FF), // Lighter Blue
|
Color(0xFF82B1FF), // Lighter BlueAccent
|
||||||
Color(0xFF00ACC1), // Teal Blue
|
Color(0xFF4DD0E1), // Lighter Teal
|
||||||
Color(0xFF43A047), // Dark Green
|
Color(0xFF43A047), // Light Green
|
||||||
Color(0xFF27AE60), // Medium Emerald
|
Color(0xFFEF5350), // Lighter Red
|
||||||
Color(0xFFFFC107), // Amber (complementary to orange)
|
Color(0xFFFF8A65), // Coral Peach
|
||||||
Color(0xFFFFA726), // Light orange
|
Color(0xFFFFB74D), // Amber Orange
|
||||||
Color(0xFFE64A19), // Deep Orange
|
Color(0xFF7986CB), // Indigo Soft
|
||||||
Color(0xFFFF4081), // Bright Pink (complementary to rose)
|
Color(0xFF4DB6AC), // Soft Teal
|
||||||
|
Color(0xFFF06292), // Light Rose
|
||||||
Color(0xFFF48FB1), // Light Pink
|
Color(0xFFF48FB1), // Light Pink
|
||||||
Color(0xFFBA68C8), // Light Purple
|
Color(0xFFBA68C8), // Soft Purple
|
||||||
Color(0xFFAB47BC), // Orchid Purple
|
Color(0xFFDDA0DD), // Plum
|
||||||
];
|
];
|
||||||
|
|
||||||
final List<Color> layoutTertiaryColors = [
|
final List<Color> layoutTertiaryColors = [
|
||||||
Color(0xFF82B1FF), // Very Light Blue
|
Color(0xFFE3F2FD), // Very Light Blue
|
||||||
Color(0xFF4DD0E1), // Lighter Teal
|
Color(0xFFE0F7FA), // Very Light Teal
|
||||||
Color(0xFF81C784), // Light Green
|
Color(0xFFC8E6C9), // Mint Green
|
||||||
Color(0xFFAAF0D1), // Pastel Mint
|
Color(0xFFFFCDD2), // Light Coral/Red
|
||||||
Color(0xFFFFE0B2), // Pale Orange
|
Color(0xFFFFE0B2), // Peach
|
||||||
Color(0xFFFFCCBC), // Light Orange Peach
|
Color(0xFFFFF3E0), // Lightest Orange
|
||||||
Color(0xFFFFAB91), // Light Coral
|
Color(0xFFFFEBEE), // Very Light Rose
|
||||||
Color(0xFFF8BBD0), // Pastel Rose
|
Color(0xFFFCE4EC), // Pastel Pink
|
||||||
Color(0xFFF8BBD0), // Pastel Pink
|
Color(0xFFF3E5F5), // Light Lavender
|
||||||
Color(0xFFE1BEE7), // Lavender
|
Color(0xFFEDE7F6), // Soft Purple Grey
|
||||||
Color(0xFFD1C4E9), // Light Purple Grey
|
Color(0xFFF8F9FA), // Near-white Neutral
|
||||||
];
|
];
|
||||||
|
|
||||||
// Body colors
|
// Body colors
|
||||||
|
|||||||
@ -659,6 +659,8 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
|||||||
} else if (userId.isNotEmpty && userId != "0") {
|
} else if (userId.isNotEmpty && userId != "0") {
|
||||||
print("TestplanUsrId : $userId");
|
print("TestplanUsrId : $userId");
|
||||||
print("TestplanUsrIdSelf : $selfId");
|
print("TestplanUsrIdSelf : $selfId");
|
||||||
|
planUsrId = userId;
|
||||||
|
print("TestplanUsrId2 : $planUsrId");
|
||||||
_selectedOption = (selfId != userId) ? "Option 2" : "Option 1";
|
_selectedOption = (selfId != userId) ? "Option 2" : "Option 1";
|
||||||
otherUserName = userName;
|
otherUserName = userName;
|
||||||
}
|
}
|
||||||
@ -3766,7 +3768,9 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
|||||||
reverse: false, // show right-end on overflow
|
reverse: false, // show right-end on overflow
|
||||||
physics: BouncingScrollPhysics(),
|
physics: BouncingScrollPhysics(),
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(minWidth: isDesktop ? MediaQuery.of(context).size.width * 0.5 : 180),
|
constraints: BoxConstraints(
|
||||||
|
minWidth: isDesktop ? MediaQuery.of(context).size.width * 0.5 : 180,
|
||||||
|
),
|
||||||
child: IntrinsicWidth(
|
child: IntrinsicWidth(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _tripTitleController,
|
controller: _tripTitleController,
|
||||||
@ -3786,9 +3790,15 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
|||||||
),
|
),
|
||||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 1, vertical: 16),
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 1,
|
||||||
|
vertical: 16,
|
||||||
|
),
|
||||||
errorText: validationErrors["trip_title"],
|
errorText: validationErrors["trip_title"],
|
||||||
errorStyle: GoogleFonts.poppins(fontSize: 12, color: Colors.red),
|
errorStyle: GoogleFonts.poppins(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.red,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
scrollPhysics: BouncingScrollPhysics(),
|
scrollPhysics: BouncingScrollPhysics(),
|
||||||
@ -3799,7 +3809,6 @@ class CreateNewPlansState extends State<CreateNewPlan> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget _buildApprovalItem(String title, String name) {
|
Widget _buildApprovalItem(String title, String name) {
|
||||||
return Row(
|
return Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:dotted_border/dotted_border.dart';
|
||||||
import 'package:easy_stepper/easy_stepper.dart';
|
import 'package:easy_stepper/easy_stepper.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:frontend/Screens/itnerary_list/accomodation_list.dart';
|
import 'package:frontend/Screens/itnerary_list/accomodation_list.dart';
|
||||||
@ -7,6 +8,7 @@ import 'package:frontend/Screens/itnerary_list/bus_list.dart';
|
|||||||
import 'package:frontend/Screens/itnerary_list/flight_list.dart';
|
import 'package:frontend/Screens/itnerary_list/flight_list.dart';
|
||||||
import 'package:frontend/Screens/itnerary_list/taxi_list.dart';
|
import 'package:frontend/Screens/itnerary_list/taxi_list.dart';
|
||||||
import 'package:frontend/Screens/itnerary_list/train_list.dart';
|
import 'package:frontend/Screens/itnerary_list/train_list.dart';
|
||||||
|
import 'package:frontend/utils/auth_utils.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:responsive_builder/responsive_builder.dart';
|
import 'package:responsive_builder/responsive_builder.dart';
|
||||||
|
|
||||||
@ -64,6 +66,14 @@ class DynamicItinerary extends StatefulWidget {
|
|||||||
class DynamicItineraryState extends State<DynamicItinerary> {
|
class DynamicItineraryState extends State<DynamicItinerary> {
|
||||||
final ApiService apiService = ApiService();
|
final ApiService apiService = ApiService();
|
||||||
|
|
||||||
|
late ScrollController _scrollController;
|
||||||
|
bool _canScrollLeft = false;
|
||||||
|
bool _canScrollRight = true;
|
||||||
|
|
||||||
|
Color? layoutColor;
|
||||||
|
Color? secondColor;
|
||||||
|
Color? thridColor;
|
||||||
|
|
||||||
String? _tripType;
|
String? _tripType;
|
||||||
String selectedOption = "";
|
String selectedOption = "";
|
||||||
String selectedListOption = "";
|
String selectedListOption = "";
|
||||||
@ -98,6 +108,13 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
handleSelectedPlan();
|
handleSelectedPlan();
|
||||||
updateSelectedServices();
|
updateSelectedServices();
|
||||||
_tripType = widget.tripType;
|
_tripType = widget.tripType;
|
||||||
|
loadInitialData();
|
||||||
|
_scrollController = ScrollController();
|
||||||
|
_scrollController.addListener(_updateScrollButtonState);
|
||||||
|
// Delay check after layout is built
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_updateScrollButtonState(); // Initial scroll check
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -116,6 +133,54 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_scrollController.removeListener(_updateScrollButtonState);
|
||||||
|
_scrollController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _updateScrollButtonState() {
|
||||||
|
if (!_scrollController.hasClients) return;
|
||||||
|
|
||||||
|
final max = _scrollController.position.maxScrollExtent;
|
||||||
|
final offset = _scrollController.offset;
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_canScrollLeft = offset > 0;
|
||||||
|
_canScrollRight = offset < max;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadInitialData() async {
|
||||||
|
String? layoutString = await getLayoutColor();
|
||||||
|
String? secondString = await getSecondaryColor();
|
||||||
|
String? thridString = await getTernaryColor();
|
||||||
|
|
||||||
|
// String? bodyStringColor = await getBodyColor();
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
layoutColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(layoutString))
|
||||||
|
: Colors.redAccent;
|
||||||
|
|
||||||
|
secondColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(secondString!))
|
||||||
|
: Colors.orange;
|
||||||
|
|
||||||
|
thridColor =
|
||||||
|
layoutString != null
|
||||||
|
? Color(int.parse(thridString!))
|
||||||
|
: Colors.orangeAccent;
|
||||||
|
// bodyColor =
|
||||||
|
// bodyStringColor != null
|
||||||
|
// ? Color(int.parse(bodyStringColor))
|
||||||
|
// : Colors.white;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void updateTripType(String? newTripType) {
|
void updateTripType(String? newTripType) {
|
||||||
if (_tripType != newTripType) {
|
if (_tripType != newTripType) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -823,10 +888,11 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
left: MediaQuery.of(context).size.width * 0.05,
|
left: MediaQuery.of(context).size.width * 0.05,
|
||||||
right: MediaQuery.of(context).size.width * 0.05,
|
right: MediaQuery.of(context).size.width * 0.05,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 12),
|
padding: EdgeInsets.symmetric(vertical: 2, horizontal: 2),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white, // Card background
|
color: Colors.white, // Card background
|
||||||
borderRadius: BorderRadius.circular(8),
|
// color: thridColor, // Card background
|
||||||
|
borderRadius: BorderRadius.circular(40),
|
||||||
|
|
||||||
// color: Color(0xFFE6E7F5)
|
// color: Color(0xFFE6E7F5)
|
||||||
// border: Border.all(color: Colors.black12, width: 1.3),
|
// border: Border.all(color: Colors.black12, width: 1.3),
|
||||||
@ -840,17 +906,55 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
isMobile
|
||||||
|
? IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.arrow_back_ios,
|
||||||
|
color: Colors.black54,
|
||||||
|
// color: _canScrollLeft ? Colors.black : Colors.grey,
|
||||||
|
),
|
||||||
|
onPressed:
|
||||||
|
_canScrollLeft
|
||||||
|
? () {
|
||||||
|
_scrollBy(-100);
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
)
|
||||||
|
: SizedBox.shrink(),
|
||||||
|
Expanded(
|
||||||
child:
|
child:
|
||||||
isMobile
|
isMobile
|
||||||
? SingleChildScrollView(
|
? SingleChildScrollView(
|
||||||
|
controller: _scrollController,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: Row(children: _buildOptions()),
|
child: Row(children: _buildOptions()),
|
||||||
)
|
)
|
||||||
: Row(
|
: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceEvenly,
|
||||||
children: _buildOptions(),
|
children: _buildOptions(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
isMobile
|
||||||
|
? IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
color: Colors.black54,
|
||||||
|
// color: _canScrollRight ? Colors.black : Colors.grey,
|
||||||
|
),
|
||||||
|
onPressed:
|
||||||
|
_canScrollRight
|
||||||
|
? () {
|
||||||
|
_scrollBy(100);
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
)
|
||||||
|
: SizedBox.shrink(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -858,6 +962,21 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _scrollBy(double offset) {
|
||||||
|
if (!_scrollController.hasClients) return;
|
||||||
|
|
||||||
|
final targetOffset = (_scrollController.offset + offset).clamp(
|
||||||
|
_scrollController.position.minScrollExtent,
|
||||||
|
_scrollController.position.maxScrollExtent,
|
||||||
|
);
|
||||||
|
|
||||||
|
_scrollController.animateTo(
|
||||||
|
targetOffset,
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
bool hasValidItineraryEntries() {
|
bool hasValidItineraryEntries() {
|
||||||
if (ServicesChoosed == null || ServicesChoosed!.isEmpty) return false;
|
if (ServicesChoosed == null || ServicesChoosed!.isEmpty) return false;
|
||||||
|
|
||||||
@ -986,39 +1105,66 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
// border: Border(
|
||||||
bottom: BorderSide(
|
// bottom: BorderSide(
|
||||||
color: isOptionSelected ? Color(0xFF114D8B) : Colors.transparent,
|
// color: isOptionSelected ? Color(0xFF114D8B) : Colors.transparent,
|
||||||
width: 2,
|
// width: 2,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
),
|
),
|
||||||
),
|
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 3),
|
||||||
),
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 10),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
DottedBorder(
|
||||||
|
options: RoundedRectDottedBorderOptions(
|
||||||
|
dashPattern: [1, 3],
|
||||||
|
strokeWidth: 1.5,
|
||||||
|
radius: Radius.circular(46),
|
||||||
|
color: isOptionSelected ? secondColor! : Colors.transparent,
|
||||||
|
padding: EdgeInsets.all(3.5),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isOptionSelected ? secondColor : Colors.white,
|
||||||
|
|
||||||
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
|
),
|
||||||
|
|
||||||
|
padding: const EdgeInsets.all(3.0),
|
||||||
|
child:
|
||||||
iconUrl.isNotEmpty
|
iconUrl.isNotEmpty
|
||||||
? Image.network(
|
? Image.network(
|
||||||
iconUrl,
|
iconUrl,
|
||||||
width: 18,
|
width: 15,
|
||||||
height: 18,
|
height: 15,
|
||||||
errorBuilder: (context, error, stackTrace) {
|
errorBuilder: (context, error, stackTrace) {
|
||||||
return Icon(
|
return Icon(
|
||||||
fallbackIcon,
|
fallbackIcon,
|
||||||
size: 25,
|
size: 20,
|
||||||
color:
|
color:
|
||||||
isOptionSelected
|
isOptionSelected
|
||||||
? Color(0xFF114D8B)
|
? Colors.white
|
||||||
: Color(0xFF475569),
|
: Colors.black87,
|
||||||
|
// color:
|
||||||
|
// isOptionSelected
|
||||||
|
// ? Color(0xFF114D8B)
|
||||||
|
// : Color(0xFF475569),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: Icon(
|
: Icon(
|
||||||
fallbackIcon,
|
fallbackIcon,
|
||||||
size: 25,
|
size: 20,
|
||||||
color:
|
color:
|
||||||
isOptionSelected ? Color(0xFF114D8B) : Color(0xFF475569),
|
isOptionSelected ? Colors.white : Colors.black87,
|
||||||
|
// color:
|
||||||
|
// isOptionSelected
|
||||||
|
// ? Color(0xFF114D8B)
|
||||||
|
// : Color(0xFF475569),
|
||||||
),
|
),
|
||||||
SizedBox(height: 2),
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 1),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
@ -1027,15 +1173,16 @@ class DynamicItineraryState extends State<DynamicItinerary> {
|
|||||||
// style: GoogleFonts.poppins( fontSize: 12,
|
// style: GoogleFonts.poppins( fontSize: 12,
|
||||||
// fontWeight: FontWeight.w600,
|
// fontWeight: FontWeight.w600,
|
||||||
// color: Color(0xFF575A74))
|
// color: Color(0xFF575A74))
|
||||||
style: TextStyle(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 14,
|
fontSize: 12,
|
||||||
color:
|
color: Colors.black,
|
||||||
isOptionSelected
|
// color:
|
||||||
? Color(0xFF114D8B)
|
// isOptionSelected
|
||||||
: Color(0xFF475569),
|
// ? Color(0xFF114D8B)
|
||||||
fontFamily: "Inter",
|
// : Color(0xFF475569),
|
||||||
|
// fontFamily: "Inter",
|
||||||
fontWeight:
|
fontWeight:
|
||||||
isOptionSelected ? FontWeight.bold : FontWeight.w500,
|
isOptionSelected ? FontWeight.w700 : FontWeight.w400,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 4),
|
SizedBox(width: 4),
|
||||||
|
|||||||
@ -101,7 +101,6 @@ class _PolicyState extends State<Policy> {
|
|||||||
});
|
});
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
|
|
||||||
Map<String, dynamic> data = {
|
Map<String, dynamic> data = {
|
||||||
"name": _policyController.text,
|
"name": _policyController.text,
|
||||||
"domestic": SelectedDomestic,
|
"domestic": SelectedDomestic,
|
||||||
@ -153,6 +152,7 @@ class _PolicyState extends State<Policy> {
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
void _addFocusListener(FocusNode node, Function(bool) updateState) {
|
void _addFocusListener(FocusNode node, Function(bool) updateState) {
|
||||||
node.addListener(() {
|
node.addListener(() {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -160,6 +160,7 @@ class _PolicyState extends State<Policy> {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _checkAuthAndLoadData() async {
|
void _checkAuthAndLoadData() async {
|
||||||
final String? token = await getToken(); // Your async function to get token
|
final String? token = await getToken(); // Your async function to get token
|
||||||
|
|
||||||
@ -461,7 +462,6 @@ class _PolicyState extends State<Policy> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool isValidData(Map<String, dynamic> data) {
|
bool isValidData(Map<String, dynamic> data) {
|
||||||
errorMessages.clear(); // Reset previous errors
|
errorMessages.clear(); // Reset previous errors
|
||||||
|
|
||||||
@ -1150,7 +1150,9 @@ class _PolicyState extends State<Policy> {
|
|||||||
ServicesChoosed!.map((service) => service['name'].toString()).toList();
|
ServicesChoosed!.map((service) => service['name'].toString()).toList();
|
||||||
|
|
||||||
List<String> serviceDBvalue =
|
List<String> serviceDBvalue =
|
||||||
ServicesChoosed!.map((service) => service['service_id'].toString()).toList();
|
ServicesChoosed!
|
||||||
|
.map((service) => service['service_id'].toString())
|
||||||
|
.toList();
|
||||||
|
|
||||||
print("1093");
|
print("1093");
|
||||||
print(services);
|
print(services);
|
||||||
@ -1201,7 +1203,8 @@ class _PolicyState extends State<Policy> {
|
|||||||
// ?.addOrUpdatePolicy(selectedServiceIndex.value);
|
// ?.addOrUpdatePolicy(selectedServiceIndex.value);
|
||||||
print("policyselectedService - $selectedService");
|
print("policyselectedService - $selectedService");
|
||||||
if (selectedService == "Flight" ||
|
if (selectedService == "Flight" ||
|
||||||
selectedService == "Train" || selectedService == "Accomodation") {
|
selectedService == "Train" ||
|
||||||
|
selectedService == "Accomodation") {
|
||||||
showClass = true;
|
showClass = true;
|
||||||
showCost = false;
|
showCost = false;
|
||||||
int serviceCode = selectedService == "Flight" ? 1 : 2;
|
int serviceCode = selectedService == "Flight" ? 1 : 2;
|
||||||
|
|||||||
@ -321,12 +321,14 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
[a1, a2, a3].where((a) => a != null).length > 0 &&
|
[a1, a2, a3].where((a) => a != null).length > 0 &&
|
||||||
[a1, a2, a3].where((a) => a == null).length > 0;
|
[a1, a2, a3].where((a) => a == null).length > 0;
|
||||||
|
|
||||||
bool allExceptionalActionsNull = ae1 == null && ae2 == null && ae3 == null && ae4 == null;
|
bool allExceptionalActionsNull =
|
||||||
|
ae1 == null && ae2 == null && ae3 == null && ae4 == null;
|
||||||
bool someExceptionalActionsMissing =
|
bool someExceptionalActionsMissing =
|
||||||
[ae1, ae2, ae3, ae4].where((a) => a != null).length > 0 &&
|
[ae1, ae2, ae3, ae4].where((a) => a != null).length > 0 &&
|
||||||
[ae1, ae2, ae3, ae4].where((a) => a == null).length > 0;
|
[ae1, ae2, ae3, ae4].where((a) => a == null).length > 0;
|
||||||
|
|
||||||
bool allAmendActionsNull = aa1 == null && aa2 == null && aa3 == null && aa4 == null;
|
bool allAmendActionsNull =
|
||||||
|
aa1 == null && aa2 == null && aa3 == null && aa4 == null;
|
||||||
bool someAmendActionsMissing =
|
bool someAmendActionsMissing =
|
||||||
[aa1, aa2, aa3, aa4].where((a) => a != null).length > 0 &&
|
[aa1, aa2, aa3, aa4].where((a) => a != null).length > 0 &&
|
||||||
[aa1, aa2, aa3, aa4].where((a) => a == null).length > 0;
|
[aa1, aa2, aa3, aa4].where((a) => a == null).length > 0;
|
||||||
@ -458,6 +460,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
void fieldForPolicy() {
|
void fieldForPolicy() {
|
||||||
print("fieldForPolicy - ${widget.selectedTabNotifier.value}");
|
print("fieldForPolicy - ${widget.selectedTabNotifier.value}");
|
||||||
|
|
||||||
|
print("POlicyCheck - $policyData");
|
||||||
// Save current input to policyData before switching
|
// Save current input to policyData before switching
|
||||||
if (ServiceId != null) {
|
if (ServiceId != null) {
|
||||||
print("Calling addOrUpdatePolicy");
|
print("Calling addOrUpdatePolicy");
|
||||||
@ -470,7 +473,7 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
ServiceId = widget.selectedServiceDBValue;
|
ServiceId = widget.selectedServiceDBValue;
|
||||||
print("ServiceId");
|
print("ServiceId");
|
||||||
print(ServiceId);
|
print(ServiceId);
|
||||||
// Initialize controllers and variables if not present
|
// Initialize controllers and variables if not present (Controller Creation)
|
||||||
costController.putIfAbsent(ServiceId!, () => TextEditingController());
|
costController.putIfAbsent(ServiceId!, () => TextEditingController());
|
||||||
classAction.putIfAbsent((widget.selectedServiceDBValue), () => "1");
|
classAction.putIfAbsent((widget.selectedServiceDBValue), () => "1");
|
||||||
// classController.putIfAbsent(ServiceId!, () => TextEditingController());
|
// classController.putIfAbsent(ServiceId!, () => TextEditingController());
|
||||||
@ -1235,7 +1238,10 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
// padding: const EdgeInsets.all(10),
|
// padding: const EdgeInsets.all(10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 4.0,
|
||||||
|
vertical: 4.0,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@ -1381,7 +1387,10 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
// padding: const EdgeInsets.all(10),
|
// padding: const EdgeInsets.all(10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 4.0,
|
||||||
|
vertical: 4.0,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@ -1531,7 +1540,10 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
// padding: const EdgeInsets.all(10),
|
// padding: const EdgeInsets.all(10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 4.0,
|
||||||
|
vertical: 4.0,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@ -1682,7 +1694,10 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
// padding: const EdgeInsets.all(10),
|
// padding: const EdgeInsets.all(10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 4.0,
|
||||||
|
vertical: 4.0,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@ -1927,7 +1942,10 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
// padding: const EdgeInsets.all(10),
|
// padding: const EdgeInsets.all(10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 4.0,
|
||||||
|
vertical: 4.0,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@ -2073,7 +2091,10 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
// padding: const EdgeInsets.all(10),
|
// padding: const EdgeInsets.all(10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 4.0,
|
||||||
|
vertical: 4.0,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@ -2223,7 +2244,10 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
// padding: const EdgeInsets.all(10),
|
// padding: const EdgeInsets.all(10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 4.0,
|
||||||
|
vertical: 4.0,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@ -2374,7 +2398,10 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
// padding: const EdgeInsets.all(10),
|
// padding: const EdgeInsets.all(10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 4.0,
|
||||||
|
vertical: 4.0,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@ -2599,7 +2626,6 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
|
|
||||||
if (dropdownItems.isEmpty) {
|
if (dropdownItems.isEmpty) {
|
||||||
dropdownItems.add(
|
dropdownItems.add(
|
||||||
DropdownMenuItem<String>(
|
DropdownMenuItem<String>(
|
||||||
@ -2631,7 +2657,8 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
// Important to wrap inside setState if async
|
// Important to wrap inside setState if async
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
classAction[(widget.selectedServiceDBValue)] = dropdownItems.first.value!;
|
classAction[(widget.selectedServiceDBValue)] =
|
||||||
|
dropdownItems.first.value!;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -2691,13 +2718,18 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
height: 40,
|
height: 40,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child:
|
child:
|
||||||
(widget.selectedServiceDBValue) != null && (isLoading || dropdownItems.isEmpty)
|
(widget.selectedServiceDBValue) != null &&
|
||||||
|
(isLoading || dropdownItems.isEmpty)
|
||||||
? const Center(child: CircularProgressIndicator())
|
? const Center(child: CircularProgressIndicator())
|
||||||
: DropdownSearch<Map<String, dynamic>>(
|
: DropdownSearch<Map<String, dynamic>>(
|
||||||
key:
|
key:
|
||||||
classAction[(widget.selectedServiceDBValue)] == null
|
classAction[(widget.selectedServiceDBValue)] ==
|
||||||
|
null
|
||||||
? UniqueKey()
|
? UniqueKey()
|
||||||
: ValueKey(classAction[(widget.selectedServiceDBValue)]),
|
: ValueKey(
|
||||||
|
classAction[(widget
|
||||||
|
.selectedServiceDBValue)],
|
||||||
|
),
|
||||||
items: purposeList.cast<Map<String, dynamic>>(),
|
items: purposeList.cast<Map<String, dynamic>>(),
|
||||||
|
|
||||||
// selectedItem: purposeList.firstWhere(
|
// selectedItem: purposeList.firstWhere(
|
||||||
@ -2705,11 +2737,13 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
// orElse: () => {},
|
// orElse: () => {},
|
||||||
// ),
|
// ),
|
||||||
selectedItem:
|
selectedItem:
|
||||||
classAction[(widget.selectedServiceDBValue)] != null
|
classAction[(widget.selectedServiceDBValue)] !=
|
||||||
|
null
|
||||||
? purposeList.firstWhere(
|
? purposeList.firstWhere(
|
||||||
(item) =>
|
(item) =>
|
||||||
item['dropdown_key'] ==
|
item['dropdown_key'] ==
|
||||||
classAction[(widget.selectedServiceDBValue)],
|
classAction[(widget
|
||||||
|
.selectedServiceDBValue)],
|
||||||
orElse: () => {},
|
orElse: () => {},
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
@ -2772,7 +2806,8 @@ class PolicyCriteriaState extends State<PolicyCriteria> {
|
|||||||
purposeList.isNotEmpty
|
purposeList.isNotEmpty
|
||||||
? (Map<String, dynamic>? newValue) async {
|
? (Map<String, dynamic>? newValue) async {
|
||||||
setState(() {
|
setState(() {
|
||||||
classAction[(widget.selectedServiceDBValue)] =
|
classAction[(widget
|
||||||
|
.selectedServiceDBValue)] =
|
||||||
newValue?['dropdown_key'];
|
newValue?['dropdown_key'];
|
||||||
print(
|
print(
|
||||||
"Selected Purpose: ${classAction[(widget.selectedServiceDBValue)]}",
|
"Selected Purpose: ${classAction[(widget.selectedServiceDBValue)]}",
|
||||||
|
|||||||
257
lib/app.dart
257
lib/app.dart
@ -31,14 +31,34 @@ class _MyAppState extends State<MyApp> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
SemanticsBinding.instance.ensureSemantics(); // ✅ Safe here - for testing uncomment this
|
SemanticsBinding.instance
|
||||||
|
.ensureSemantics(); // Safe here -only for testing uncomment, Otherwise Email Template wont allow to type
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
final uri = Uri.parse(html.window.location.href);
|
final uri = Uri.parse(html.window.location.href);
|
||||||
print("URI - $uri");
|
print("URI - $uri");
|
||||||
|
final fragment = uri.fragment; // e.g., 'authredirection?code=xyz123'
|
||||||
|
|
||||||
if (uri.path == '/tstat/authredirection' &&
|
print("Full URI: $uri");
|
||||||
uri.queryParameters['code'] != null) {
|
print("Fragment: $fragment");
|
||||||
_authCode = uri.queryParameters['code'];
|
|
||||||
|
// Parse just the fragment safely
|
||||||
|
final fragmentParts = fragment.split('?');
|
||||||
|
print("fragmentParts: $fragmentParts");
|
||||||
|
final fragmentPath = fragmentParts.first;
|
||||||
|
print("fragmentPath: $fragmentPath");
|
||||||
|
final query = fragmentParts.length > 1 ? fragmentParts[1] : '';
|
||||||
|
|
||||||
|
print("query: $query");
|
||||||
|
|
||||||
|
final queryParams = Uri.splitQueryString(query);
|
||||||
|
print("query: $query");
|
||||||
|
|
||||||
|
final authCode = queryParams['code'];
|
||||||
|
|
||||||
|
if (fragmentPath == '/authredirection' && authCode != null) {
|
||||||
|
// _authCode = uri.queryParameters['code'];
|
||||||
|
|
||||||
|
_authCode = queryParams['code'];
|
||||||
// _isAuthRedirect = true;
|
// _isAuthRedirect = true;
|
||||||
html.window.console.log("Auth code detected: $_authCode");
|
html.window.console.log("Auth code detected: $_authCode");
|
||||||
// print(">>> _isAuthRedirect: $_isAuthRedirect");
|
// print(">>> _isAuthRedirect: $_isAuthRedirect");
|
||||||
@ -54,9 +74,14 @@ class _MyAppState extends State<MyApp> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> handleTokenUsingMS(String? authCode) async {
|
Future<void> handleTokenUsingMS(String? authCode) async {
|
||||||
|
print("handleTokenUsingMS- $authCode");
|
||||||
if (authCode == null) return;
|
if (authCode == null) return;
|
||||||
|
|
||||||
|
// final url =
|
||||||
|
// 'http://localhost:40617/tstat/auth/verifyMSAuthUser?code=$authCode';
|
||||||
final url = '$apiUrl/auth/verifyMSAuthUser?code=$authCode';
|
final url = '$apiUrl/auth/verifyMSAuthUser?code=$authCode';
|
||||||
|
|
||||||
|
print("url- $url");
|
||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
@ -103,57 +128,6 @@ class _MyAppState extends State<MyApp> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<void> handleTokenUsingMS(authCode) async {
|
|
||||||
// if (authCode == null) return;
|
|
||||||
//
|
|
||||||
// final url = '$apiUrl/auth/verifyMSAuthUser?code=$authCode';
|
|
||||||
// try {
|
|
||||||
// final response = await http.get(
|
|
||||||
// Uri.parse(url),
|
|
||||||
// headers: {'Content-Type': 'application/json'},
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (response.statusCode == 200) {
|
|
||||||
// final MS_Token = json.decode(response.body)['token'];
|
|
||||||
// print("MS_Token - $MS_Token");
|
|
||||||
//
|
|
||||||
// if (MS_Token != '') {
|
|
||||||
// print('Microsoft - Token Available');
|
|
||||||
// await storeUserDetails(MS_Token);
|
|
||||||
//
|
|
||||||
// print("userRole - $userRole");
|
|
||||||
//
|
|
||||||
// if (userRole == "Travel Agent") {
|
|
||||||
// router.go('/listTravelAgentPlan');
|
|
||||||
// } else if (userRole == "Org Admin" || userRole == "Travel Admin") {
|
|
||||||
// router.go('/listAllPlan');
|
|
||||||
// } else {
|
|
||||||
// router.go('/listPlan');
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// print('Microsoft - Token Not Available');
|
|
||||||
// throw Exception('Token not Founded');
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // final errorMessage = json.decode(response.body)['message'];
|
|
||||||
// // print(errorMessage);
|
|
||||||
// // throw Exception(errorMessage);
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// final errorMessage = json.decode(response.body)['message'];
|
|
||||||
// print(errorMessage);
|
|
||||||
// throw Exception(errorMessage);
|
|
||||||
// } catch (_) {
|
|
||||||
// print("Non-JSON error from server: ${response.body}");
|
|
||||||
// throw Exception("Authentication failed: ${response.body}");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// router.go('/');
|
|
||||||
// print("Error: $e");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Future<void> storeUserDetails(String token) async {
|
Future<void> storeUserDetails(String token) async {
|
||||||
try {
|
try {
|
||||||
final parts = token.split('.');
|
final parts = token.split('.');
|
||||||
@ -209,176 +183,3 @@ class _MyAppState extends State<MyApp> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// import 'package:flutter/foundation.dart';
|
|
||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:flutter/rendering.dart';
|
|
||||||
// import 'package:flutter_quill/flutter_quill.dart';
|
|
||||||
// import 'package:flutter_localizations/flutter_localizations.dart';
|
|
||||||
//
|
|
||||||
// import 'package:frontend/routes/custom_router.dart';
|
|
||||||
// import 'dart:html' as html;
|
|
||||||
// import 'package:frontend/config/apiUrl.dart'; // 1 newly added
|
|
||||||
// import 'package:go_router/go_router.dart';
|
|
||||||
// import 'package:http/http.dart' as http; // 2 newly added
|
|
||||||
// import 'dart:convert'; // 3 newly added
|
|
||||||
//
|
|
||||||
// import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
//
|
|
||||||
// import 'Screens/myTemplates/templateTest.dart';
|
|
||||||
//
|
|
||||||
// class MyApp extends StatefulWidget {
|
|
||||||
// const MyApp({super.key});
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// State<MyApp> createState() => _MyAppState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _MyAppState extends State<MyApp> {
|
|
||||||
// String? _authCode;
|
|
||||||
// String? userRole;
|
|
||||||
// bool _isAuthRedirect = false;
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
// super.initState();
|
|
||||||
// SemanticsBinding.instance.ensureSemantics(); // ✅ Safe here
|
|
||||||
// if (kIsWeb) {
|
|
||||||
// final uri = Uri.parse(html.window.location.href);
|
|
||||||
// if (uri.path == '/authredirection' &&
|
|
||||||
// uri.queryParameters['code'] != null) {
|
|
||||||
// _authCode = uri.queryParameters['code'];
|
|
||||||
// // _isAuthRedirect = true;
|
|
||||||
// html.window.console.log("Auth code detected: $_authCode");
|
|
||||||
// // print(">>> _isAuthRedirect: $_isAuthRedirect");
|
|
||||||
// print(">>> Auth code found at startup: $_authCode");
|
|
||||||
//
|
|
||||||
// WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
// handleTokenUsingMS(_authCode);
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// html.window.console.log("No auth code found or wrong path.");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Future<void> handleTokenUsingMS(authCode) async {
|
|
||||||
// if (authCode == null) return;
|
|
||||||
//
|
|
||||||
// final url = '$apiUrl/auth/verifyMSAuthUser?code=$authCode';
|
|
||||||
// try {
|
|
||||||
// final response = await http.get(
|
|
||||||
// Uri.parse(url),
|
|
||||||
// headers: {'Content-Type': 'application/json'},
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (response.statusCode == 200) {
|
|
||||||
// final MS_Token = json.decode(response.body)['token'];
|
|
||||||
// print("MS_Token - $MS_Token");
|
|
||||||
//
|
|
||||||
// if (MS_Token != '') {
|
|
||||||
// print('Microsoft - Token Available');
|
|
||||||
// await storeUserDetails(MS_Token);
|
|
||||||
//
|
|
||||||
// print("userRole - $userRole");
|
|
||||||
//
|
|
||||||
// if (userRole == "Travel Agent") {
|
|
||||||
// router.go('/listTravelAgentPlan');
|
|
||||||
// } else if (userRole == "Org Admin" || userRole == "Travel Admin") {
|
|
||||||
// router.go('/listAllPlan');
|
|
||||||
// } else {
|
|
||||||
// router.go('/listPlan');
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// print('Microsoft - Token Not Available');
|
|
||||||
// throw Exception('Token not Founded');
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// final errorMessage = json.decode(response.body)['message'];
|
|
||||||
// print(errorMessage);
|
|
||||||
// throw Exception(errorMessage);
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// print("Error: $e");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Future<void> storeUserDetails(String token) async {
|
|
||||||
// try {
|
|
||||||
// final parts = token.split('.');
|
|
||||||
// if (parts.length != 3) throw Exception('Invalid token format');
|
|
||||||
//
|
|
||||||
// final payload = json.decode(
|
|
||||||
// utf8.decode(base64Url.decode(base64Url.normalize(parts[1]))),
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// final userData = payload['data'];
|
|
||||||
//
|
|
||||||
// final prefs = await SharedPreferences.getInstance();
|
|
||||||
// await prefs.setString('auth_token', token);
|
|
||||||
// await prefs.setString(
|
|
||||||
// 'user_data',
|
|
||||||
// jsonEncode(userData),
|
|
||||||
// ); // Store full user data
|
|
||||||
//
|
|
||||||
// if (userData != null) {
|
|
||||||
// final pref = await SharedPreferences.getInstance();
|
|
||||||
// await pref.setString('auth_token', token);
|
|
||||||
// await pref.setString('user_data', jsonEncode(userData));
|
|
||||||
//
|
|
||||||
// userRole = userData['role'];
|
|
||||||
//
|
|
||||||
// print("userData - $userData");
|
|
||||||
// print("userData11 - ${userData['role']}");
|
|
||||||
// print("userData12 - $userRole");
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// print('Error decoding token: $e');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// // if (_isAuthRedirect) {
|
|
||||||
// // print("Rendering MicrosoftPage with code: $_authCode");
|
|
||||||
// // return MaterialApp(
|
|
||||||
// // home: MicrosoftPage(code: _authCode),
|
|
||||||
// // debugShowCheckedModeBanner: false,
|
|
||||||
// // );
|
|
||||||
// // }
|
|
||||||
// // return MaterialApp(
|
|
||||||
// // title: 'Quill Web Test',
|
|
||||||
// // localizationsDelegates: const [
|
|
||||||
// // GlobalMaterialLocalizations.delegate,
|
|
||||||
// // GlobalCupertinoLocalizations.delegate,
|
|
||||||
// // GlobalWidgetsLocalizations.delegate,
|
|
||||||
// // FlutterQuillLocalizations.delegate,
|
|
||||||
// // ],
|
|
||||||
// // supportedLocales: const [Locale('en')],
|
|
||||||
// // home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
|
||||||
// // );
|
|
||||||
// return MaterialApp.router(
|
|
||||||
// title: 'TRIP MANAGEMENT',
|
|
||||||
// routerConfig: router,
|
|
||||||
// debugShowCheckedModeBanner: false,
|
|
||||||
// localizationsDelegates: const [
|
|
||||||
// GlobalMaterialLocalizations.delegate,
|
|
||||||
// GlobalCupertinoLocalizations.delegate,
|
|
||||||
// GlobalWidgetsLocalizations.delegate,
|
|
||||||
// FlutterQuillLocalizations.delegate,
|
|
||||||
// ],
|
|
||||||
// supportedLocales: const [
|
|
||||||
// Locale('en'),
|
|
||||||
// Locale('es'), // Add more as needed
|
|
||||||
// ],
|
|
||||||
// localeResolutionCallback: (locale, supportedLocales) {
|
|
||||||
// for (var supportedLocale in supportedLocales) {
|
|
||||||
// if (supportedLocale.languageCode == locale?.languageCode) {
|
|
||||||
// return supportedLocale;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return supportedLocales.first;
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
//api url
|
//api url
|
||||||
// const String apiUrl = 'http://localhost/tstat_be';
|
// const String apiUrl = 'http://localhost/tstat_be';
|
||||||
// const String apiUrl = 'https://uat.tripapprovaltool.com/tstat_be';
|
// const String apiUrl = 'https://uat.tripapprovaltool.com/tstat_be';
|
||||||
const String apiUrl = 'http://apitest.tripapprovaltool.com/tstat_be'; // look at this
|
const String apiUrl =
|
||||||
|
'http://apitest.tripapprovaltool.com/tstat_be'; // look at this
|
||||||
|
|||||||
@ -145,6 +145,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.1"
|
version: "0.4.1"
|
||||||
|
dotted_border:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dotted_border
|
||||||
|
sha256: "99b091ec6891ba0c5331fdc2b502993c7c108f898995739a73c6845d71dad70c"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.0"
|
||||||
dropdown_search:
|
dropdown_search:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -63,6 +63,7 @@ dependencies:
|
|||||||
html2md: ^1.3.2
|
html2md: ^1.3.2
|
||||||
flutter_quill_delta_from_html: ^1.5.2
|
flutter_quill_delta_from_html: ^1.5.2
|
||||||
flutter_launcher_icons: ^0.14.4
|
flutter_launcher_icons: ^0.14.4
|
||||||
|
dotted_border: ^3.1.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
<!-- Favicon -->
|
<!-- Favicon -->
|
||||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||||
|
|
||||||
<title>frontend</title>
|
<title>Trip Approval Tool</title>
|
||||||
<link rel="manifest" href="manifest.json">
|
<link rel="manifest" href="manifest.json">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user