forex
This commit is contained in:
parent
7f448d3e2f
commit
c61183c472
@ -93,13 +93,15 @@ class _groupState extends State<Group> {
|
|||||||
String? bodyStringColor = await getBodyColor();
|
String? bodyStringColor = await getBodyColor();
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
layoutColor = layoutString != null
|
layoutColor =
|
||||||
? Color(int.parse(layoutString))
|
layoutString != null
|
||||||
: Colors.redAccent;
|
? Color(int.parse(layoutString))
|
||||||
|
: Colors.redAccent;
|
||||||
|
|
||||||
bodyColor = bodyStringColor != null
|
bodyColor =
|
||||||
? Color(int.parse(bodyStringColor))
|
bodyStringColor != null
|
||||||
: Colors.white;
|
? Color(int.parse(bodyStringColor))
|
||||||
|
: Colors.white;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,10 +156,7 @@ class _groupState extends State<Group> {
|
|||||||
errorMessages.clear(); // Reset errors
|
errorMessages.clear(); // Reset errors
|
||||||
|
|
||||||
// Required fields that must not be empty
|
// Required fields that must not be empty
|
||||||
List<String> requiredFields = [
|
List<String> requiredFields = ["name", "description"];
|
||||||
"name",
|
|
||||||
"description",
|
|
||||||
];
|
|
||||||
|
|
||||||
// Check validation for each field
|
// Check validation for each field
|
||||||
for (String field in requiredFields) {
|
for (String field in requiredFields) {
|
||||||
@ -165,6 +164,14 @@ class _groupState extends State<Group> {
|
|||||||
errorMessages[field] = "Required";
|
errorMessages[field] = "Required";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ✅ At least one of the two policies must be selected
|
||||||
|
if ((selectedDomestic == null || selectedDomestic!.isEmpty) &&
|
||||||
|
(selectedInternational == null || selectedInternational!.isEmpty)) {
|
||||||
|
errorMessages["domestic_policy_id"] = "Select at least one policy";
|
||||||
|
errorMessages["international_policy_id"] = "Select at least one policy";
|
||||||
|
}
|
||||||
|
|
||||||
|
return errorMessages.isEmpty;
|
||||||
|
|
||||||
return errorMessages.isEmpty; // Valid if there are no errors
|
return errorMessages.isEmpty; // Valid if there are no errors
|
||||||
}
|
}
|
||||||
@ -223,23 +230,24 @@ class _groupState extends State<Group> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final response = await (isEdit
|
final response =
|
||||||
? http.put(
|
await (isEdit
|
||||||
Uri.parse(apiUrlData),
|
? http.put(
|
||||||
headers: {
|
Uri.parse(apiUrlData),
|
||||||
'Authorization': 'Bearer $token',
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Authorization': 'Bearer $token',
|
||||||
},
|
'Content-Type': 'application/json',
|
||||||
body: jsonEncode(groupData),
|
},
|
||||||
)
|
body: jsonEncode(groupData),
|
||||||
: http.post(
|
)
|
||||||
Uri.parse(apiUrlData),
|
: http.post(
|
||||||
headers: {
|
Uri.parse(apiUrlData),
|
||||||
'Authorization': 'Bearer $token',
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Authorization': 'Bearer $token',
|
||||||
},
|
'Content-Type': 'application/json',
|
||||||
body: jsonEncode(groupData),
|
},
|
||||||
));
|
body: jsonEncode(groupData),
|
||||||
|
));
|
||||||
|
|
||||||
if (response.statusCode == 200 || response.statusCode == 201) {
|
if (response.statusCode == 200 || response.statusCode == 201) {
|
||||||
print("Group submitted successfully!");
|
print("Group submitted successfully!");
|
||||||
@ -320,32 +328,38 @@ class _groupState extends State<Group> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ResponsiveBuilder(builder: (context, sizingInfo) {
|
return ResponsiveBuilder(
|
||||||
bool isDesktop = sizingInfo.deviceScreenType == DeviceScreenType.desktop;
|
builder: (context, sizingInfo) {
|
||||||
|
bool isDesktop =
|
||||||
|
sizingInfo.deviceScreenType == DeviceScreenType.desktop;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
// backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
backgroundColor: Color(0xFFf5f5f5),
|
backgroundColor: Color(0xFFf5f5f5),
|
||||||
appBar: CustomAppBar(isDesktop: isDesktop),
|
appBar: CustomAppBar(isDesktop: isDesktop),
|
||||||
drawer: CustomDrawer(isDesktop: false),
|
drawer: CustomDrawer(isDesktop: false),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: isDesktop
|
padding:
|
||||||
? EdgeInsets.symmetric(
|
isDesktop
|
||||||
horizontal: MediaQuery.of(context).size.width *
|
? EdgeInsets.symmetric(
|
||||||
0.1, // 30% of screen width as horizontal padding
|
horizontal:
|
||||||
vertical: MediaQuery.of(context).size.height *
|
MediaQuery.of(context).size.width *
|
||||||
0, // 5% of screen height as vertical padding
|
0.1, // 30% of screen width as horizontal padding
|
||||||
)
|
vertical:
|
||||||
: EdgeInsets.all(8),
|
MediaQuery.of(context).size.height *
|
||||||
child: Row(
|
0, // 5% of screen height as vertical padding
|
||||||
children: [
|
)
|
||||||
// if (isDesktop) CustomDrawer(isDesktop: true),
|
: EdgeInsets.all(8),
|
||||||
Expanded(child: buildData(isDesktop, context))
|
child: Row(
|
||||||
],
|
children: [
|
||||||
|
// if (isDesktop) CustomDrawer(isDesktop: true),
|
||||||
|
Expanded(child: buildData(isDesktop, context)),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildData(bool isDesktop, context) {
|
Widget buildData(bool isDesktop, context) {
|
||||||
@ -367,15 +381,16 @@ class _groupState extends State<Group> {
|
|||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: isDesktop
|
child:
|
||||||
? Row(
|
isDesktop
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
? Row(
|
||||||
children: _buildSubmit(isDesktop),
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
)
|
children: _buildSubmit(isDesktop),
|
||||||
: Row(
|
)
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
: Row(
|
||||||
children: _buildSubmit(isDesktop),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
),
|
children: _buildSubmit(isDesktop),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -387,9 +402,10 @@ class _groupState extends State<Group> {
|
|||||||
// margin: isDesktop
|
// margin: isDesktop
|
||||||
// ? EdgeInsets.all(10.0)
|
// ? EdgeInsets.all(10.0)
|
||||||
// : EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
// : EdgeInsets.only(left: 20.0, bottom: 20.0, top: 10.0, right: 20.0),
|
||||||
height: isDesktop
|
height:
|
||||||
? MediaQuery.of(context).size.height * 0.98
|
isDesktop
|
||||||
: MediaQuery.of(context).size.height,
|
? MediaQuery.of(context).size.height * 0.98
|
||||||
|
: MediaQuery.of(context).size.height,
|
||||||
// decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
// border: isDesktop
|
// border: isDesktop
|
||||||
// ? Border.all(
|
// ? Border.all(
|
||||||
@ -414,10 +430,7 @@ class _groupState extends State<Group> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text("Create Group", style: GoogleFonts.poppins(fontSize: 18)),
|
||||||
"Create Group",
|
|
||||||
style: GoogleFonts.poppins(fontSize: 18),
|
|
||||||
),
|
|
||||||
// Container(
|
// Container(
|
||||||
// color: Color(0xFFE9EBF6),
|
// color: Color(0xFFE9EBF6),
|
||||||
// child: IconButton(
|
// child: IconButton(
|
||||||
@ -436,53 +449,52 @@ class _groupState extends State<Group> {
|
|||||||
// height: 5,
|
// height: 5,
|
||||||
// ),
|
// ),
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.all(10),
|
margin: const EdgeInsets.all(10),
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
height: MediaQuery.of(context).size.height * 0.6,
|
height: MediaQuery.of(context).size.height * 0.6,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Row(
|
// Row(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
// children: [
|
// children: [
|
||||||
// Text(
|
// Text(
|
||||||
// "Mail Settings",
|
// "Mail Settings",
|
||||||
// style: TextStyle(color: Colors.blueAccent),
|
// style: TextStyle(color: Colors.blueAccent),
|
||||||
// ),
|
// ),
|
||||||
// Icon(
|
// Icon(
|
||||||
// Icons.keyboard_arrow_down_outlined,
|
// Icons.keyboard_arrow_down_outlined,
|
||||||
// color: Colors.blueAccent,
|
// color: Colors.blueAccent,
|
||||||
// size: 30,
|
// size: 30,
|
||||||
// ),
|
// ),
|
||||||
// ],
|
// ],
|
||||||
// ),
|
// ),
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: _buildFirstRow(isDesktop),
|
children: _buildFirstRow(isDesktop),
|
||||||
)
|
)
|
||||||
: Column(
|
: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: _buildFirstRow(isDesktop),
|
children: _buildFirstRow(isDesktop),
|
||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(
|
SizedBox(height: 10),
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
|
|
||||||
isDesktop
|
isDesktop
|
||||||
? Row(
|
? Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: _buildSecondRow(isDesktop),
|
children: _buildSecondRow(isDesktop),
|
||||||
)
|
)
|
||||||
: Column(
|
: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: _buildSecondRow(isDesktop),
|
children: _buildSecondRow(isDesktop),
|
||||||
),
|
),
|
||||||
|
|
||||||
// SizedBox(height: 15),
|
// SizedBox(height: 15),
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -496,17 +508,19 @@ class _groupState extends State<Group> {
|
|||||||
Text(
|
Text(
|
||||||
"Group Name",
|
"Group Name",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Color(0xFF575A74)),
|
color: Color(0xFF575A74),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
CustomTextFieldWrapper(
|
CustomTextFieldWrapper(
|
||||||
isFocused: false,
|
isFocused: false,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop
|
width:
|
||||||
? MediaQuery.of(context).size.width * 0.34
|
isDesktop
|
||||||
: MediaQuery.of(context).size.width * 0.85,
|
? MediaQuery.of(context).size.width * 0.34
|
||||||
|
: MediaQuery.of(context).size.width * 0.85,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -540,17 +554,19 @@ class _groupState extends State<Group> {
|
|||||||
Text(
|
Text(
|
||||||
"Description",
|
"Description",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Color(0xFF575A74)),
|
color: Color(0xFF575A74),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
CustomTextFieldWrapper(
|
CustomTextFieldWrapper(
|
||||||
isFocused: false,
|
isFocused: false,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop
|
width:
|
||||||
? MediaQuery.of(context).size.width * 0.34
|
isDesktop
|
||||||
: MediaQuery.of(context).size.width * 0.85,
|
? MediaQuery.of(context).size.width * 0.34
|
||||||
|
: MediaQuery.of(context).size.width * 0.85,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
@ -589,72 +605,82 @@ class _groupState extends State<Group> {
|
|||||||
Text(
|
Text(
|
||||||
"Select Policy For Domestic",
|
"Select Policy For Domestic",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Color(0xFF575A74)),
|
color: Color(0xFF575A74),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
CustomTextFieldWrapper(
|
CustomTextFieldWrapper(
|
||||||
isFocused: false,
|
isFocused: false,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop
|
width:
|
||||||
? MediaQuery.of(context).size.width * 0.34
|
isDesktop
|
||||||
: MediaQuery.of(context).size.width * 0.85,
|
? MediaQuery.of(context).size.width * 0.34
|
||||||
|
: MediaQuery.of(context).size.width * 0.85,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
child: apiForDomestic == null
|
child:
|
||||||
? Center(
|
apiForDomestic == null
|
||||||
child: Transform.scale(
|
? Center(
|
||||||
scale: 0.5,
|
child: Transform.scale(
|
||||||
child: CircularProgressIndicator(),
|
scale: 0.5,
|
||||||
),
|
child: CircularProgressIndicator(),
|
||||||
)
|
),
|
||||||
: DropdownSearch<String>(
|
)
|
||||||
selectedItem: selectedDomestic == null
|
: DropdownSearch<String>(
|
||||||
? null
|
selectedItem:
|
||||||
: apiForDomestic!
|
selectedDomestic == null
|
||||||
.firstWhere((policy) =>
|
? null
|
||||||
policy['policy_id'] ==
|
: apiForDomestic!
|
||||||
selectedDomestic)['name']
|
.firstWhere(
|
||||||
.toString(),
|
(policy) =>
|
||||||
popupProps: PopupProps.menu(
|
policy['policy_id'] ==
|
||||||
showSearchBox: true,
|
selectedDomestic,
|
||||||
fit: FlexFit.loose,
|
)['name']
|
||||||
constraints: BoxConstraints(maxHeight: 250),
|
.toString(),
|
||||||
searchFieldProps: TextFieldProps(
|
popupProps: PopupProps.menu(
|
||||||
decoration: InputDecoration(
|
showSearchBox: true,
|
||||||
hintText: "Search Policy...",
|
fit: FlexFit.loose,
|
||||||
contentPadding:
|
constraints: BoxConstraints(maxHeight: 250),
|
||||||
EdgeInsets.symmetric(horizontal: 10),
|
searchFieldProps: TextFieldProps(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: "Search Policy...",
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 10,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
items:
|
||||||
items: apiForDomestic!
|
apiForDomestic!
|
||||||
.map((policy) => policy['name'].toString())
|
.map((policy) => policy['name'].toString())
|
||||||
.toList(),
|
.toList(),
|
||||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||||
dropdownSearchDecoration: InputDecoration(
|
dropdownSearchDecoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
dropdownBuilder:
|
||||||
|
(context, selectedItem) => Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
selectedItem ?? "Select",
|
||||||
|
style: TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onChanged: (String? newValue) {
|
||||||
|
setState(() {
|
||||||
|
selectedDomestic =
|
||||||
|
apiForDomestic!.firstWhere(
|
||||||
|
(policy) => policy['name'] == newValue,
|
||||||
|
)['policy_id'];
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
dropdownBuilder: (context, selectedItem) => Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Text(
|
|
||||||
selectedItem ?? "Select",
|
|
||||||
style: TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onChanged: (String? newValue) {
|
|
||||||
setState(() {
|
|
||||||
selectedDomestic = apiForDomestic!.firstWhere(
|
|
||||||
(policy) =>
|
|
||||||
policy['name'] == newValue)['policy_id'];
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
@ -663,72 +689,82 @@ class _groupState extends State<Group> {
|
|||||||
Text(
|
Text(
|
||||||
"Select Policy For International",
|
"Select Policy For International",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Color(0xFF575A74)),
|
color: Color(0xFF575A74),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 5),
|
||||||
CustomTextFieldWrapper(
|
CustomTextFieldWrapper(
|
||||||
isFocused: false,
|
isFocused: false,
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
width: isDesktop
|
width:
|
||||||
? MediaQuery.of(context).size.width * 0.34
|
isDesktop
|
||||||
: MediaQuery.of(context).size.width * 0.85,
|
? MediaQuery.of(context).size.width * 0.34
|
||||||
|
: MediaQuery.of(context).size.width * 0.85,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
child: apiForInternational == null
|
child:
|
||||||
? Center(
|
apiForInternational == null
|
||||||
child: Transform.scale(
|
? Center(
|
||||||
scale: 0.5,
|
child: Transform.scale(
|
||||||
child: CircularProgressIndicator(),
|
scale: 0.5,
|
||||||
),
|
child: CircularProgressIndicator(),
|
||||||
)
|
),
|
||||||
: DropdownSearch<String>(
|
)
|
||||||
selectedItem: selectedInternational == null
|
: DropdownSearch<String>(
|
||||||
? null
|
selectedItem:
|
||||||
: apiForInternational!
|
selectedInternational == null
|
||||||
.firstWhere((policy) =>
|
? null
|
||||||
policy['policy_id'] ==
|
: apiForInternational!
|
||||||
selectedInternational)['name']
|
.firstWhere(
|
||||||
.toString(),
|
(policy) =>
|
||||||
popupProps: PopupProps.menu(
|
policy['policy_id'] ==
|
||||||
showSearchBox: true,
|
selectedInternational,
|
||||||
fit: FlexFit.loose,
|
)['name']
|
||||||
constraints: BoxConstraints(maxHeight: 250),
|
.toString(),
|
||||||
searchFieldProps: TextFieldProps(
|
popupProps: PopupProps.menu(
|
||||||
decoration: InputDecoration(
|
showSearchBox: true,
|
||||||
hintText: "Search Policy...",
|
fit: FlexFit.loose,
|
||||||
contentPadding:
|
constraints: BoxConstraints(maxHeight: 250),
|
||||||
EdgeInsets.symmetric(horizontal: 10),
|
searchFieldProps: TextFieldProps(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: "Search Policy...",
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 10,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
items:
|
||||||
items: apiForInternational!
|
apiForInternational!
|
||||||
.map((policy) => policy['name'].toString())
|
.map((policy) => policy['name'].toString())
|
||||||
.toList(),
|
.toList(),
|
||||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||||
dropdownSearchDecoration: InputDecoration(
|
dropdownSearchDecoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
dropdownBuilder:
|
||||||
|
(context, selectedItem) => Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
selectedItem ?? "Select",
|
||||||
|
style: TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onChanged: (String? newValue) {
|
||||||
|
setState(() {
|
||||||
|
selectedInternational =
|
||||||
|
apiForInternational!.firstWhere(
|
||||||
|
(policy) => policy['name'] == newValue,
|
||||||
|
)['policy_id'];
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
dropdownBuilder: (context, selectedItem) => Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Text(
|
|
||||||
selectedItem ?? "Select",
|
|
||||||
style: TextStyle(fontSize: 12),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onChanged: (String? newValue) {
|
|
||||||
setState(() {
|
|
||||||
selectedInternational = apiForInternational!
|
|
||||||
.firstWhere((policy) =>
|
|
||||||
policy['name'] == newValue)['policy_id'];
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
@ -737,22 +773,21 @@ class _groupState extends State<Group> {
|
|||||||
List<Widget> _buildSubmit(isDesktop) {
|
List<Widget> _buildSubmit(isDesktop) {
|
||||||
return [
|
return [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
foregroundColor: layoutColor,
|
foregroundColor: layoutColor,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
side: BorderSide(color: layoutColor ?? Colors.green, width: 2),
|
side: BorderSide(color: layoutColor ?? Colors.green, width: 2),
|
||||||
),
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
|
||||||
),
|
),
|
||||||
onPressed: () {
|
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||||
context.go('/group');
|
),
|
||||||
},
|
onPressed: () {
|
||||||
child: Text("Cancel")),
|
context.go('/group');
|
||||||
SizedBox(
|
},
|
||||||
width: 20,
|
child: Text("Cancel"),
|
||||||
),
|
),
|
||||||
|
SizedBox(width: 20),
|
||||||
MouseRegion(
|
MouseRegion(
|
||||||
// cursor: widget.isViewMode
|
// cursor: widget.isViewMode
|
||||||
// ? SystemMouseCursors.forbidden
|
// ? SystemMouseCursors.forbidden
|
||||||
@ -773,7 +808,7 @@ class _groupState extends State<Group> {
|
|||||||
onPressed: handleSubmit, // Disable when in view mode
|
onPressed: handleSubmit, // Disable when in view mode
|
||||||
child: Text("Submit"),
|
child: Text("Submit"),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
|
|
||||||
int fifteenPercent = 0;
|
int fifteenPercent = 0;
|
||||||
int remainingAmount = 0;
|
int remainingAmount = 0;
|
||||||
|
bool isWidget = false;
|
||||||
|
|
||||||
Map<String, FocusNode> focusNodes = {};
|
Map<String, FocusNode> focusNodes = {};
|
||||||
Map<String, bool> focusStates = {};
|
Map<String, bool> focusStates = {};
|
||||||
@ -419,12 +420,16 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
selectedCashPercent = int.tryParse(
|
selectedCashPercent = int.tryParse(
|
||||||
widget.selectedItem!["cash_percentage"]?.toString() ?? "",
|
widget.selectedItem!["cash_percentage"]?.toString() ?? "",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
print("selectedCashPercentUPdae - $selectedCashPercent");
|
||||||
selectedPerdiemAmount = widget.selectedItem!["perdiem_amount"] as String?;
|
selectedPerdiemAmount = widget.selectedItem!["perdiem_amount"] as String?;
|
||||||
isChecked =
|
isChecked =
|
||||||
widget.selectedItem!["have_card"] == "1"; // Convert string to bool
|
widget.selectedItem!["have_card"] == "1"; // Convert string to bool
|
||||||
textControllers["_cardNumber"]?.text =
|
textControllers["_cardNumber"]?.text =
|
||||||
widget.selectedItem!["card_number"]?.toString() ?? "";
|
widget.selectedItem!["card_number"]?.toString() ?? "";
|
||||||
|
|
||||||
|
isWidget = true;
|
||||||
|
|
||||||
// if (textControllers["_cardNumber"] != null) {
|
// if (textControllers["_cardNumber"] != null) {
|
||||||
// print("userCardNumber11 - $userCardNumber");
|
// print("userCardNumber11 - $userCardNumber");
|
||||||
// textControllers["_cardNumber"]!.text = userCardNumber ?? '';
|
// textControllers["_cardNumber"]!.text = userCardNumber ?? '';
|
||||||
@ -548,6 +553,13 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
|
|
||||||
selectedQuotedAmount =
|
selectedQuotedAmount =
|
||||||
((perdiemAmount + calclateVal).toString() ?? 0) as String?;
|
((perdiemAmount + calclateVal).toString() ?? 0) as String?;
|
||||||
|
|
||||||
|
if (isWidget) {
|
||||||
|
print("IsWidget Update");
|
||||||
|
|
||||||
|
int? quotedAmount = int.tryParse(selectedQuotedAmount!);
|
||||||
|
fifteenPercent = (quotedAmount! * selectedCashPercent!) ~/ 100;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (userEdited) {
|
if (userEdited) {
|
||||||
@ -612,7 +624,8 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (enteredAmount == null || calculateAmnt > qouteAmount!) {
|
if (enteredAmount == null || calculateAmnt > qouteAmount!) {
|
||||||
errorMessages["deposit_on_card"] = "Amount cannot exceed $qouteAmount";
|
errorMessages["deposit_on_card"] =
|
||||||
|
"Sum of cash card cannot exceed $qouteAmount";
|
||||||
} else if (checkValidAmount < qouteAmount) {
|
} else if (checkValidAmount < qouteAmount) {
|
||||||
errorMessages["deposit_on_card"] =
|
errorMessages["deposit_on_card"] =
|
||||||
"Enter Valid Amount"; // Clear error if valid
|
"Enter Valid Amount"; // Clear error if valid
|
||||||
@ -627,6 +640,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
void _validateCashAmount(String value) {
|
void _validateCashAmount(String value) {
|
||||||
// errorMessages["deposit_on_card"] = " ";
|
// errorMessages["deposit_on_card"] = " ";
|
||||||
errorMessages.remove("deposit_on_cash");
|
errorMessages.remove("deposit_on_cash");
|
||||||
|
|
||||||
print("_validateCashAmount - $value - $fifteenPercent");
|
print("_validateCashAmount - $value - $fifteenPercent");
|
||||||
|
|
||||||
int? enteredAmount = int.tryParse(value);
|
int? enteredAmount = int.tryParse(value);
|
||||||
@ -652,6 +666,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
errorMessages["deposit_on_card"] =
|
errorMessages["deposit_on_card"] =
|
||||||
"Enter Valid Amount"; // Clear error if valid
|
"Enter Valid Amount"; // Clear error if valid
|
||||||
}
|
}
|
||||||
|
print("CASHfifteenPercent - $fifteenPercent");
|
||||||
errorMessages["deposit_on_cash"] = "Amount cannot exceed $fifteenPercent";
|
errorMessages["deposit_on_cash"] = "Amount cannot exceed $fifteenPercent";
|
||||||
} else if (checkValidAmount == quotedAmount) {
|
} else if (checkValidAmount == quotedAmount) {
|
||||||
errorMessages.remove("deposit_on_cash");
|
errorMessages.remove("deposit_on_cash");
|
||||||
@ -1204,16 +1219,16 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
menuProps: const MenuProps(backgroundColor: Colors.white),
|
menuProps: const MenuProps(backgroundColor: Colors.white),
|
||||||
itemBuilder:
|
itemBuilder:
|
||||||
(context, item, isSelected) => Container(
|
(context, item, isSelected) => Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 6,
|
vertical: 6,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
item,
|
item,
|
||||||
style: GoogleFonts.poppins(fontSize: 11.5),
|
style: GoogleFonts.poppins(fontSize: 11.5),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
searchFieldProps: TextFieldProps(
|
searchFieldProps: TextFieldProps(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search ...",
|
hintText: "Search ...",
|
||||||
@ -1230,15 +1245,15 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
),
|
),
|
||||||
dropdownBuilder:
|
dropdownBuilder:
|
||||||
(context, selectedItem) => Align(
|
(context, selectedItem) => Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
selectedItem ?? "Select ",
|
selectedItem ?? "Select ",
|
||||||
style: GoogleFonts.poppins(
|
style: GoogleFonts.poppins(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
onChanged: (String? newValue) {
|
onChanged: (String? newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
// Find the country_code based on selected country_name
|
// Find the country_code based on selected country_name
|
||||||
@ -1688,7 +1703,9 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
errorMessages.remove("deposit_on_cash");
|
errorMessages.remove("deposit_on_cash");
|
||||||
errorMessages.remove("deposit_on_card");
|
errorMessages.remove("deposit_on_card");
|
||||||
// errorMessages["deposit_on_card"] = "";
|
// errorMessages["deposit_on_card"] = "";
|
||||||
|
setState(() {
|
||||||
|
userEdited = true;
|
||||||
|
});
|
||||||
_validateCashAmount(
|
_validateCashAmount(
|
||||||
value,
|
value,
|
||||||
); // Call validation when text changes
|
); // Call validation when text changes
|
||||||
@ -1744,6 +1761,7 @@ class _ForexScreenState extends State<ForexScreen> {
|
|||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
errorMessages.remove("deposit_on_cash");
|
errorMessages.remove("deposit_on_cash");
|
||||||
errorMessages.remove("deposit_on_card");
|
errorMessages.remove("deposit_on_card");
|
||||||
|
userEdited = true;
|
||||||
_validateCardAmount(
|
_validateCardAmount(
|
||||||
value,
|
value,
|
||||||
); // Call validation when text changes
|
); // Call validation when text changes
|
||||||
|
|||||||
@ -409,10 +409,13 @@ class _FlightListWidgetState extends State<FlightListWidget> {
|
|||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Image.asset(
|
Padding(
|
||||||
'assets/images/IconsImg/alternate.png',
|
padding: const EdgeInsets.only(left: 10),
|
||||||
width: 25,
|
child: Image.asset(
|
||||||
height: 25,
|
'assets/images/IconsImg/alternate.png',
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"$toPlaceCountry",
|
"$toPlaceCountry",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user