500 lines
26 KiB
Dart
500 lines
26 KiB
Dart
import 'package:dropdown_search/dropdown_search.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../widgets/custom_text_field.dart';
|
|
import '../../widgets/custom_user_form.dart';
|
|
|
|
class PolicyCriteria extends StatefulWidget {
|
|
bool isDesktop;
|
|
String selectedTab;
|
|
bool isClass = true;
|
|
bool isCost = true;
|
|
|
|
PolicyCriteria(
|
|
{super.key,
|
|
required this.isDesktop,
|
|
required this.selectedTab,
|
|
required this.isClass,
|
|
required this.isCost});
|
|
@override
|
|
_PolicyCriteriaState createState() => _PolicyCriteriaState();
|
|
}
|
|
|
|
class _PolicyCriteriaState extends State<PolicyCriteria> {
|
|
String? selectedFirstApprovarType;
|
|
String? selectedService;
|
|
|
|
// bool isClass = true;
|
|
// bool isCost = true;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
fieldForPolicy();
|
|
// selectedService = widget.selectedTab;
|
|
}
|
|
|
|
void fieldForPolicy() {
|
|
print("fieldForPolicy - ${widget.selectedTab}");
|
|
}
|
|
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
SizedBox(height: 15),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"Selected Policy Criteria For ${widget.selectedTab} ",
|
|
style: TextStyle(
|
|
fontSize: 13,
|
|
color: Color(0xFF9E9DBD),
|
|
fontWeight: FontWeight.bold),
|
|
)
|
|
],
|
|
),
|
|
if (widget.isClass!) SizedBox(height: 15),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Container(
|
|
// color:Colors.grey,
|
|
padding:
|
|
const EdgeInsets.only(top: 5, bottom: 5, left: 5, right: 5),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if (widget.isClass!)
|
|
Row(
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text("Class",
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w200,
|
|
color: Colors.black)),
|
|
SizedBox(height: 5),
|
|
CustomTextFieldUserWrapper(
|
|
isFocused: false,
|
|
isDesktop: widget.isDesktop,
|
|
child: SizedBox(
|
|
height: 40,
|
|
child: TextField(
|
|
style: TextStyle(fontSize: 12),
|
|
// controller: controllers["Fname"],
|
|
// enabled: !isViewMode,
|
|
onChanged: (value) {},
|
|
decoration: InputDecoration(
|
|
labelText: "Class",
|
|
labelStyle: TextStyle(
|
|
fontSize: 12, color: Colors.grey),
|
|
floatingLabelBehavior:
|
|
FloatingLabelBehavior.never,
|
|
border: InputBorder.none,
|
|
contentPadding:
|
|
EdgeInsets.symmetric(vertical: 16),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 10),
|
|
if (widget.isCost!)
|
|
Row(
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text("Cost",
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w200,
|
|
color: Colors.black)),
|
|
SizedBox(height: 5),
|
|
CustomTextFieldUserWrapper(
|
|
isFocused: false,
|
|
isDesktop: widget.isDesktop,
|
|
child: SizedBox(
|
|
height: 40,
|
|
child: TextField(
|
|
style: TextStyle(fontSize: 12),
|
|
// controller: controllers["Fname"],
|
|
// enabled: !isViewMode,
|
|
onChanged: (value) {},
|
|
decoration: InputDecoration(
|
|
labelText: "Cost",
|
|
labelStyle: TextStyle(
|
|
fontSize: 12, color: Colors.grey),
|
|
floatingLabelBehavior:
|
|
FloatingLabelBehavior.never,
|
|
border: InputBorder.none,
|
|
contentPadding:
|
|
EdgeInsets.symmetric(vertical: 16),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
if (widget.isCost!) SizedBox(height: 15),
|
|
Expanded(
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
border: null,
|
|
// border: Border.all(
|
|
// color: Color(0xFFEBEBF7),
|
|
// ),
|
|
borderRadius: BorderRadius.circular(8),
|
|
// color: Colors.brown.shade200,
|
|
),
|
|
child: SingleChildScrollView(
|
|
scrollDirection: Axis.horizontal,
|
|
child: Container(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
Expanded(
|
|
child: Container(
|
|
width: widget.isDesktop
|
|
? MediaQuery.of(context).size.width * 0.62
|
|
: 600,
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey.shade50,
|
|
border: Border.all(
|
|
color: Colors.grey.shade50,
|
|
),
|
|
borderRadius: BorderRadius.circular(8)),
|
|
padding: const EdgeInsets.all(10),
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Text(
|
|
"Approver Name",
|
|
style: TextStyle(
|
|
color: Color(0xFF9E9DBD),
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 12),
|
|
),
|
|
Text(
|
|
"Notification",
|
|
style: TextStyle(
|
|
color: Color(0xFF9E9DBD),
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 12),
|
|
),
|
|
Text(
|
|
"Select",
|
|
style: TextStyle(
|
|
color: Color(0xFF9E9DBD),
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 12),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 200,
|
|
child: SingleChildScrollView(
|
|
scrollDirection: Axis.vertical,
|
|
child: Container(
|
|
// color: Colors.grey,
|
|
color: Colors.grey.shade50,
|
|
child: Column(children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(10),
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Text("Approver 1"),
|
|
CustomTextFieldUserWrapper(
|
|
isFocused: false,
|
|
isDesktop: widget.isDesktop,
|
|
child: SizedBox(
|
|
height: 40,
|
|
child: DropdownSearch<String>(
|
|
selectedItem:
|
|
selectedFirstApprovarType,
|
|
// enabled: !isViewMode,
|
|
popupProps: PopupProps.menu(
|
|
// showSearchBox: true,
|
|
fit: FlexFit
|
|
.loose, // Allows flexible height
|
|
constraints: BoxConstraints(
|
|
maxHeight: 250),
|
|
),
|
|
items: [
|
|
"Approve",
|
|
"Notification",
|
|
],
|
|
dropdownDecoratorProps:
|
|
DropDownDecoratorProps(
|
|
dropdownSearchDecoration:
|
|
InputDecoration(
|
|
border: InputBorder.none,
|
|
contentPadding:
|
|
EdgeInsets.symmetric(
|
|
horizontal: 1,
|
|
),
|
|
),
|
|
),
|
|
dropdownBuilder:
|
|
(context, selectedItem) =>
|
|
Align(
|
|
// Center-align selected item
|
|
alignment:
|
|
Alignment.centerLeft,
|
|
child: Text(
|
|
selectedItem ?? "Select",
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Colors
|
|
.blueAccent),
|
|
),
|
|
),
|
|
onChanged:
|
|
(String? newValue) {
|
|
setState(() {
|
|
// Find the country_code based on selected country_name
|
|
selectedFirstApprovarType =
|
|
newValue;
|
|
|
|
// print("selectedUserType - $selectedUserType");
|
|
|
|
// if (selectedCountry!.isNotEmpty) {
|
|
// errorMessages.remove("country_code");
|
|
// }
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
height: 25,
|
|
width: 25,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
border: Border.all(
|
|
color: Colors.grey,
|
|
width: 2),
|
|
),
|
|
child: Icon(
|
|
Icons.check_circle,
|
|
size: 20,
|
|
// color: Colors.green,
|
|
color: Colors.grey,
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
padding: const EdgeInsets.all(10),
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Text("Approver 2"),
|
|
CustomTextFieldUserWrapper(
|
|
isFocused: false,
|
|
isDesktop: widget.isDesktop,
|
|
child: SizedBox(
|
|
height: 40,
|
|
child: DropdownSearch<String>(
|
|
selectedItem:
|
|
selectedFirstApprovarType,
|
|
// enabled: !isViewMode,
|
|
popupProps: PopupProps.menu(
|
|
// showSearchBox: true,
|
|
fit: FlexFit
|
|
.loose, // Allows flexible height
|
|
constraints: BoxConstraints(
|
|
maxHeight: 250),
|
|
),
|
|
items: [
|
|
"Approve",
|
|
"Notification",
|
|
],
|
|
dropdownDecoratorProps:
|
|
DropDownDecoratorProps(
|
|
dropdownSearchDecoration:
|
|
InputDecoration(
|
|
border: InputBorder.none,
|
|
contentPadding:
|
|
EdgeInsets.symmetric(
|
|
horizontal: 1,
|
|
),
|
|
),
|
|
),
|
|
dropdownBuilder:
|
|
(context, selectedItem) =>
|
|
Align(
|
|
// Center-align selected item
|
|
alignment:
|
|
Alignment.centerLeft,
|
|
child: Text(
|
|
selectedItem ?? "Select",
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Colors
|
|
.blueAccent),
|
|
),
|
|
),
|
|
onChanged:
|
|
(String? newValue) {
|
|
setState(() {
|
|
// Find the country_code based on selected country_name
|
|
selectedFirstApprovarType =
|
|
newValue;
|
|
|
|
// print("selectedUserType - $selectedUserType");
|
|
|
|
// if (selectedCountry!.isNotEmpty) {
|
|
// errorMessages.remove("country_code");
|
|
// }
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
height: 25,
|
|
width: 25,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
border: Border.all(
|
|
color: Colors.green,
|
|
width: 2),
|
|
),
|
|
child: Icon(
|
|
Icons.check_circle,
|
|
size: 20,
|
|
color: Colors.green,
|
|
// color: Colors.grey,
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
padding: const EdgeInsets.all(10),
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Text("Approver 3"),
|
|
CustomTextFieldUserWrapper(
|
|
isFocused: false,
|
|
isDesktop: widget.isDesktop,
|
|
child: SizedBox(
|
|
height: 40,
|
|
child: DropdownSearch<String>(
|
|
selectedItem:
|
|
selectedFirstApprovarType,
|
|
// enabled: !isViewMode,
|
|
popupProps: PopupProps.menu(
|
|
// showSearchBox: true,
|
|
fit: FlexFit
|
|
.loose, // Allows flexible height
|
|
constraints: BoxConstraints(
|
|
maxHeight: 250),
|
|
),
|
|
items: [
|
|
"Approve",
|
|
"Notification",
|
|
],
|
|
dropdownDecoratorProps:
|
|
DropDownDecoratorProps(
|
|
dropdownSearchDecoration:
|
|
InputDecoration(
|
|
border: InputBorder.none,
|
|
contentPadding:
|
|
EdgeInsets.symmetric(
|
|
horizontal: 1,
|
|
),
|
|
),
|
|
),
|
|
dropdownBuilder:
|
|
(context, selectedItem) =>
|
|
Align(
|
|
// Center-align selected item
|
|
alignment:
|
|
Alignment.centerLeft,
|
|
child: Text(
|
|
selectedItem ?? "Select",
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Colors
|
|
.blueAccent),
|
|
),
|
|
),
|
|
onChanged:
|
|
(String? newValue) {
|
|
setState(() {
|
|
// Find the country_code based on selected country_name
|
|
selectedFirstApprovarType =
|
|
newValue;
|
|
|
|
// print("selectedUserType - $selectedUserType");
|
|
|
|
// if (selectedCountry!.isNotEmpty) {
|
|
// errorMessages.remove("country_code");
|
|
// }
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
height: 25,
|
|
width: 25,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
border: Border.all(
|
|
color: Colors.green,
|
|
width: 2),
|
|
),
|
|
child: Icon(
|
|
Icons.check_circle,
|
|
size: 20,
|
|
color: Colors.green,
|
|
// color: Colors.grey,
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
]),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|