You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
849 lines
40 KiB
849 lines
40 KiB
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
|
|
|
|
import 'dart:developer' as logDev;
|
|
import '../SlipGaji/background.dart';
|
|
|
|
List<String> fileAttach = [""];
|
|
TextEditingController shortTermTeksController = TextEditingController();
|
|
TextEditingController longTermTeksController = TextEditingController();
|
|
|
|
bool visibleStrengthCompetency = false;
|
|
bool visibleAreaDevCompetency = false;
|
|
List<String> _selectedItems = [];
|
|
|
|
|
|
class IDPScreen extends StatefulWidget {
|
|
const IDPScreen({super.key});
|
|
|
|
@override
|
|
State<IDPScreen> createState() => _IDPScreenState();
|
|
}
|
|
|
|
class _IDPScreenState extends State<IDPScreen> {
|
|
final List<TextEditingController> _requirement = [TextEditingController()];
|
|
final List<TextEditingController> _actual = [TextEditingController()];
|
|
final List<String> competencyItems = [
|
|
'Vision and Business Sense',
|
|
'Customer Focus',
|
|
'Interpersonal Skill',
|
|
'Analysis and Judgement',
|
|
'Planning and Driving Action',
|
|
'Leading and Motivating',
|
|
'Team Work',
|
|
'Drive, Courage, and Integrity'
|
|
];
|
|
|
|
late List <String> idCompetency;
|
|
late String strIDCompetency;
|
|
var selectedCompetency;
|
|
|
|
//Form Key
|
|
final _formKey = GlobalKey<FormState>();
|
|
|
|
void initState(){
|
|
shortTermTeksController.clear();
|
|
longTermTeksController.clear();
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
_selectedItems;
|
|
_addField();
|
|
});
|
|
super.initState();
|
|
}
|
|
|
|
_addField(){
|
|
setState(() {
|
|
_requirement.add(TextEditingController());
|
|
_actual.add(TextEditingController());
|
|
});
|
|
}
|
|
|
|
_removeItem(i){
|
|
setState(() {
|
|
_requirement.removeAt(i);
|
|
_actual.removeAt(i);
|
|
});
|
|
}
|
|
|
|
void _submit (){
|
|
final isValid = _formKey.currentState!.validate();
|
|
if (!isValid){
|
|
return;
|
|
}
|
|
_formKey.currentState!.save();
|
|
|
|
FormData formData = FormData.fromMap({});
|
|
|
|
for (int i = 0; i < _requirement.length; i++){
|
|
formData.fields.add(MapEntry("requirement[]", _requirement[i].text));
|
|
formData.fields.add(MapEntry("actual[]", _actual[i].text));
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var size = MediaQuery.sizeOf(context);
|
|
|
|
void _showMultiSelectStrength() async {
|
|
final List<String>? results = await showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return MultiSelectStrength(items: competencyItems);
|
|
},
|
|
);
|
|
|
|
// Update UI
|
|
if (results != null) {
|
|
setState(() {
|
|
_selectedItems = results;
|
|
});
|
|
}
|
|
}
|
|
|
|
void _showMultiSelectDevelop() async {
|
|
final List<String>? results = await showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return MultiSelectDevelop(items: competencyItems);
|
|
},
|
|
);
|
|
|
|
// Update UI
|
|
if (results != null) {
|
|
setState(() {
|
|
_selectedItems = results;
|
|
});
|
|
}
|
|
}
|
|
|
|
return Scaffold(
|
|
body: SingleChildScrollView(
|
|
child: Column(
|
|
children: <Widget>[
|
|
Stack(
|
|
children: [
|
|
WavyHeader(),
|
|
Container(
|
|
margin: EdgeInsets.only(top: MediaQuery.of(context).size.height/6 - 20),
|
|
padding: EdgeInsets.fromLTRB(20, 5, 25, 5),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
Text(
|
|
'IDP\t\t',
|
|
maxLines: 2,
|
|
style: GoogleFonts.luckiestGuy(
|
|
fontSize: 28,
|
|
color: Color(0xFF4858A7),
|
|
fontStyle: FontStyle.italic,
|
|
),
|
|
),
|
|
Image.asset("assets/icons/menu/ic_idp_2.png",
|
|
width: 40,
|
|
height: 40,
|
|
),
|
|
],
|
|
)),
|
|
SafeArea(
|
|
child: Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
margin: EdgeInsets.only(
|
|
top: MediaQuery.of(context).size.height / 5,
|
|
left: 10,
|
|
right: 10,
|
|
bottom : 15,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
InkWell(
|
|
child: Container(
|
|
margin: EdgeInsets.only(top: 5, bottom: 15),
|
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(5),
|
|
gradient: LinearGradient(colors: [
|
|
Color(0xFF2D4059),
|
|
Color(0xFF2D4059),
|
|
/*Color(0xFFEAFFD0),
|
|
Color(0xFF95E1D3),*/
|
|
])),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text('See IDP History\t\t',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 17,
|
|
fontWeight: FontWeight.w500)),
|
|
Image.asset(
|
|
'assets/images/ic_arrow_white.png',
|
|
width: 30,
|
|
height: 30,
|
|
)
|
|
],
|
|
)),
|
|
onTap: () {
|
|
/* Navigator.push(context, MaterialPageRoute(
|
|
builder: (context) => HistoryReimburse()));*/
|
|
},
|
|
),
|
|
Container(
|
|
child: Card(
|
|
elevation: 10,
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: Color(0XFFFAF7EE),
|
|
borderRadius: BorderRadius.circular(10)),
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
left: 10, right: 10, top: 15, bottom: 10),
|
|
child: Text('IDP Submission', style:
|
|
GoogleFonts.josefinSans(fontSize: 19, fontWeight: FontWeight.bold, decoration: TextDecoration.underline,
|
|
decorationStyle: TextDecorationStyle.dashed),),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 10),
|
|
child: Column(
|
|
children: [
|
|
Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
'Career Aspiration',
|
|
style: GoogleFonts.inconsolata(
|
|
fontSize: 16, fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(left: 10),
|
|
child: Column(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(top: 10),
|
|
child: Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
'Short Term Goals (1 - 2 Years)',
|
|
style: GoogleFonts.inconsolata(
|
|
fontSize: 16, fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 7),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius:
|
|
BorderRadius.circular(5)),
|
|
child: Padding(
|
|
padding: EdgeInsets.only(
|
|
left: 10,
|
|
right: 10,
|
|
top: 5,
|
|
bottom: 5),
|
|
child: TextFormField(
|
|
keyboardType: TextInputType.multiline,
|
|
controller: shortTermTeksController,
|
|
maxLines: null,
|
|
textInputAction:
|
|
TextInputAction.done,
|
|
decoration: InputDecoration(
|
|
border:
|
|
InputBorder.none,
|
|
hintText: "ex. Be a team leader")),
|
|
)),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 10),
|
|
child: Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
'Long Term Goals (3 - 5 Years)',
|
|
style: GoogleFonts.inconsolata(
|
|
fontSize: 16, fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: 7),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius:
|
|
BorderRadius.circular(5)),
|
|
child: Padding(
|
|
padding: EdgeInsets.only(
|
|
left: 10,
|
|
right: 10,
|
|
top: 5,
|
|
bottom: 5),
|
|
child: TextFormField(
|
|
keyboardType: TextInputType.multiline,
|
|
controller: longTermTeksController,
|
|
maxLines: null,
|
|
textInputAction:
|
|
TextInputAction.done,
|
|
decoration: InputDecoration(
|
|
border:
|
|
InputBorder.none,
|
|
hintText: "ex. Be a team leader")),
|
|
)),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
left: 10, right: 10, top: 10, bottom: 10),
|
|
child: Column(
|
|
children: [
|
|
Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
'Strength Area Competency',
|
|
style: GoogleFonts.inconsolata(
|
|
fontSize: 16, fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
ElevatedButton(
|
|
onPressed: _showMultiSelectStrength,
|
|
child: Container(
|
|
width: double.infinity,
|
|
child: Text(
|
|
"Choose Competency",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16,
|
|
fontWeight:
|
|
FontWeight.w400),
|
|
),
|
|
),
|
|
),
|
|
Visibility(
|
|
visible: visibleStrengthCompetency,
|
|
child: Container(
|
|
alignment: Alignment.centerLeft,
|
|
margin: EdgeInsets.only(
|
|
left: 15,
|
|
right: 15,
|
|
bottom: 5),
|
|
child: Text(_selectedItems.toString(),
|
|
overflow:
|
|
TextOverflow.ellipsis,
|
|
maxLines: 1,
|
|
style: TextStyle(
|
|
color: Colors.black54),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
left: 10, right: 10, top: 10, bottom: 10),
|
|
child: Column(
|
|
children: [
|
|
Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
'Area of Development/Improvement',
|
|
style: GoogleFonts.inconsolata(
|
|
fontSize: 16, fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
ElevatedButton(
|
|
onPressed: _showMultiSelectDevelop,
|
|
child: Container(
|
|
width: double.infinity,
|
|
child: Text(
|
|
"Choose Competency",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16,
|
|
fontWeight:
|
|
FontWeight.w400),
|
|
),
|
|
),
|
|
),
|
|
Visibility(
|
|
visible: visibleAreaDevCompetency,
|
|
child: Container(
|
|
alignment: Alignment.centerLeft,
|
|
margin: EdgeInsets.only(
|
|
left: 15,
|
|
right: 15,
|
|
bottom: 5),
|
|
child: Text(_selectedItems.toString(),
|
|
overflow:
|
|
TextOverflow.ellipsis,
|
|
maxLines: 1,
|
|
style: TextStyle(
|
|
color: Colors.black54),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
left: 10, right: 10, top: 10, bottom: 10),
|
|
child: Column(
|
|
children: [
|
|
Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Text(
|
|
'Focus of Development',
|
|
style: GoogleFonts.inconsolata(
|
|
fontSize: 16, fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
ListView.builder(
|
|
shrinkWrap: true,
|
|
itemCount: _requirement.length,
|
|
itemBuilder: (context, index) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(top: 15),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
|
//height: 60,
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF2E384E),
|
|
borderRadius: BorderRadius.circular(5),
|
|
),
|
|
child: DropdownButton(
|
|
// menuMaxHeight: size.height * 0.31,
|
|
dropdownColor: Colors.grey.shade300,
|
|
value: this.selectedCompetency,
|
|
isExpanded: true,
|
|
isDense: true,
|
|
underline: SizedBox(),
|
|
|
|
hint: Text(
|
|
'\t\tChoose Category',
|
|
style: TextStyle(
|
|
color: Colors.black54),
|
|
),
|
|
onChanged: (value) {
|
|
print(value);
|
|
setState(() {
|
|
selectedCompetency = value!;
|
|
for (int i = 0; i < competencyItems.length; i++){
|
|
if (selectedCompetency == competencyItems.elementAt(i)){
|
|
strIDCompetency = idCompetency.elementAt(i);
|
|
}
|
|
}
|
|
logDev.log(strIDCompetency, name: "ID Competency");
|
|
});
|
|
},
|
|
items: competencyItems
|
|
.map(
|
|
(e) => DropdownMenuItem(
|
|
value: e,
|
|
child:
|
|
Text("\t\t" + e)),
|
|
)
|
|
.toList(),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: 5),
|
|
Expanded(
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
|
//height: 60,
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF2E384E),
|
|
borderRadius: BorderRadius.circular(5),
|
|
),
|
|
child: TextFormField(
|
|
controller: _requirement[index],
|
|
autofocus: false,
|
|
style: const TextStyle(color: Color(0xFFF8F8FF)),
|
|
decoration: const InputDecoration(
|
|
border: InputBorder.none,
|
|
hintText: "Requirement",
|
|
hintStyle: TextStyle(
|
|
color: Color.fromARGB(255, 132, 140, 155)),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: 5),
|
|
Expanded(
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
|
//height: 60,
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF2E384E),
|
|
borderRadius: BorderRadius.circular(5),
|
|
),
|
|
child: TextFormField(
|
|
controller: _requirement[index],
|
|
autofocus: false,
|
|
style: const TextStyle(color: Color(0xFFF8F8FF)),
|
|
decoration: const InputDecoration(
|
|
border: InputBorder.none,
|
|
hintText: "Actual",
|
|
hintStyle: TextStyle(
|
|
color: Color.fromARGB(255, 132, 140, 155)),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
index != 0
|
|
? GestureDetector(
|
|
onTap: (){
|
|
setState(() {
|
|
_requirement[index].clear();
|
|
_requirement[index].dispose();
|
|
_requirement.removeAt(index);
|
|
});
|
|
},
|
|
child: const Icon(
|
|
Icons.delete,
|
|
color: Color(0xFF6B74D6),
|
|
size: 40,
|
|
),
|
|
)
|
|
: const SizedBox()
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
const SizedBox(
|
|
height: 10,
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
setState(() {
|
|
_requirement.add(TextEditingController());
|
|
});
|
|
},
|
|
child: Center(
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF444C60),
|
|
borderRadius: BorderRadius.circular(5)),
|
|
child: Text("Add More +",
|
|
style:
|
|
GoogleFonts.nunito(color: const Color(0xFFF8F8FF))),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
InkWell(
|
|
child: Container(
|
|
margin: EdgeInsets.only(left: 10, right: 10, bottom: 15),
|
|
padding: EdgeInsets.fromLTRB(
|
|
10, 10, 10, 10),
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.circular(5),
|
|
gradient: LinearGradient(colors: [
|
|
Color(0xFFFF9945),
|
|
Color(0xFFFc6076)
|
|
])),
|
|
child: Text('Submit',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 17,
|
|
fontWeight: FontWeight.w500)),
|
|
),
|
|
onTap: () async {
|
|
ProgressDialog loading = ProgressDialog(context);
|
|
loading = ProgressDialog(context,
|
|
type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
|
|
loading.style(
|
|
message: 'Please Wait .....',
|
|
borderRadius: 3,
|
|
backgroundColor: Colors.white,
|
|
progressWidget: CircularProgressIndicator(),
|
|
elevation: 10.0,
|
|
padding: EdgeInsets.all(10),
|
|
insetAnimCurve: Curves.easeInOut,
|
|
progress: 0.0,
|
|
maxProgress: 100.0,
|
|
progressTextStyle: TextStyle(
|
|
color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
|
|
messageTextStyle: TextStyle(
|
|
color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
|
|
|
|
if (!validateFormReimburse(context)){
|
|
return;
|
|
} else if (validateFormReimburse(context)){
|
|
await loading.show();
|
|
|
|
}
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
)),
|
|
);
|
|
}
|
|
|
|
//Validasi Form Reimburse
|
|
bool validateFormReimburse(BuildContext context) {
|
|
bool result = true;
|
|
if (shortTermTeksController.text.toString().isEmpty) {
|
|
Fluttertoast.showToast(
|
|
msg: "Short Term Goals Required!",
|
|
toastLength: Toast.LENGTH_SHORT,
|
|
gravity: ToastGravity.CENTER,
|
|
timeInSecForIosWeb: 1,
|
|
textColor: Colors.white,
|
|
fontSize: 16.0);
|
|
result = false;
|
|
} else if (longTermTeksController.text.toString().isEmpty) {
|
|
Fluttertoast.showToast(
|
|
msg: "Short Term Goals Required!",
|
|
toastLength: Toast.LENGTH_SHORT,
|
|
gravity: ToastGravity.CENTER,
|
|
timeInSecForIosWeb: 1,
|
|
textColor: Colors.white,
|
|
fontSize: 16.0);
|
|
result = false;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
class MultiSelectStrength extends StatefulWidget {
|
|
final List<String> items;
|
|
const MultiSelectStrength({Key? key, required this.items}) : super(key: key);
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => _MultiSelectStrength();
|
|
}
|
|
|
|
class _MultiSelectStrength extends State<MultiSelectStrength> {
|
|
// this variable holds the selected items
|
|
final List<String> _selectedItems = [];
|
|
|
|
// This function is triggered when a checkbox is checked or unchecked
|
|
void _itemChange(String itemValue, bool isSelected) {
|
|
setState(() {
|
|
if (isSelected) {
|
|
_selectedItems.add(itemValue);
|
|
} else {
|
|
_selectedItems.remove(itemValue);
|
|
}
|
|
});
|
|
}
|
|
|
|
// this function is called when the Cancel button is pressed
|
|
void _cancel() {
|
|
Navigator.pop(context);
|
|
}
|
|
|
|
// this function is called when the Submit button is tapped
|
|
void _submit() {
|
|
Navigator.pop(context, _selectedItems);
|
|
visibleStrengthCompetency = true;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AlertDialog(
|
|
title: const Text('Select Competency'),
|
|
content: SingleChildScrollView(
|
|
child: ListBody(
|
|
children: widget.items
|
|
.map((item) => CheckboxListTile(
|
|
value: _selectedItems.contains(item),
|
|
title: Text(item),
|
|
controlAffinity: ListTileControlAffinity.leading,
|
|
onChanged: (isChecked) => _itemChange(item, isChecked!),
|
|
))
|
|
.toList(),
|
|
),
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: _cancel,
|
|
child: const Text('Cancel'),
|
|
),
|
|
ElevatedButton(
|
|
onPressed: _submit,
|
|
child: const Text('Submit'),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class MultiSelectDevelop extends StatefulWidget {
|
|
final List<String> items;
|
|
const MultiSelectDevelop({Key? key, required this.items}) : super(key: key);
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => _MultiSelectDevelop();
|
|
}
|
|
|
|
class _MultiSelectDevelop extends State<MultiSelectDevelop> {
|
|
// this variable holds the selected items
|
|
final List<String> _selectedItems = [];
|
|
|
|
// This function is triggered when a checkbox is checked or unchecked
|
|
void _itemChange(String itemValue, bool isSelected) {
|
|
setState(() {
|
|
if (isSelected) {
|
|
_selectedItems.add(itemValue);
|
|
} else {
|
|
_selectedItems.remove(itemValue);
|
|
}
|
|
});
|
|
}
|
|
|
|
// this function is called when the Cancel button is pressed
|
|
void _cancel() {
|
|
Navigator.pop(context);
|
|
}
|
|
|
|
// this function is called when the Submit button is tapped
|
|
void _submit() {
|
|
Navigator.pop(context, _selectedItems);
|
|
visibleAreaDevCompetency = true;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AlertDialog(
|
|
title: const Text('Select Competency'),
|
|
content: SingleChildScrollView(
|
|
child: ListBody(
|
|
children: widget.items
|
|
.map((item) => CheckboxListTile(
|
|
value: _selectedItems.contains(item),
|
|
title: Text(item),
|
|
controlAffinity: ListTileControlAffinity.leading,
|
|
onChanged: (isChecked) => _itemChange(item, isChecked!),
|
|
))
|
|
.toList(),
|
|
),
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: _cancel,
|
|
child: const Text('Cancel'),
|
|
),
|
|
ElevatedButton(
|
|
onPressed: _submit,
|
|
child: const Text('Submit'),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
alertDialogFailedRetrievedData(BuildContext context){
|
|
Widget okButton = TextButton(
|
|
child: Text("Refresh"),
|
|
onPressed: () {
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
Navigator.pushReplacement(context, MaterialPageRoute(
|
|
builder: (context) => IDPScreen()));
|
|
},
|
|
);
|
|
|
|
Widget noButton = TextButton(
|
|
child: Text("Back"),
|
|
onPressed: () {
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
);
|
|
|
|
// set up the AlertDialog
|
|
AlertDialog alert = AlertDialog(
|
|
title: Text("Employee Self Service"),
|
|
content: Text("Failed to Retrieve Data"),
|
|
actions: [
|
|
noButton,
|
|
okButton,
|
|
],
|
|
);
|
|
|
|
// show the dialog
|
|
showDialog(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
builder: (BuildContext context) {
|
|
return alert;
|
|
},
|
|
);
|
|
}
|
|
|
|
alertDialogFailedResponse(BuildContext context){
|
|
Widget okButton = TextButton(
|
|
child: Text("Refresh"),
|
|
onPressed: () {
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
Navigator.pushReplacement(context, MaterialPageRoute(
|
|
builder: (context) => IDPScreen()));
|
|
},
|
|
);
|
|
|
|
Widget noButton = TextButton(
|
|
child: Text("Back"),
|
|
onPressed: () {
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
);
|
|
|
|
// set up the AlertDialog
|
|
AlertDialog alert = AlertDialog(
|
|
title: Text("Employee Self Service"),
|
|
content: Text("Server Response Error"),
|
|
actions: [
|
|
noButton,
|
|
okButton,
|
|
],
|
|
);
|
|
|
|
// show the dialog
|
|
showDialog(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
builder: (BuildContext context) {
|
|
return alert;
|
|
},
|
|
);
|
|
}
|