GSI - Employe Self Service Mobile
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.

848 lines
40 KiB

2 months ago
  1. import 'package:dio/dio.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:fluttertoast/fluttertoast.dart';
  4. import 'package:google_fonts/google_fonts.dart';
  5. import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
  6. import 'dart:developer' as logDev;
  7. import '../SlipGaji/background.dart';
  8. List<String> fileAttach = [""];
  9. TextEditingController shortTermTeksController = TextEditingController();
  10. TextEditingController longTermTeksController = TextEditingController();
  11. bool visibleStrengthCompetency = false;
  12. bool visibleAreaDevCompetency = false;
  13. List<String> _selectedItems = [];
  14. class IDPScreen extends StatefulWidget {
  15. const IDPScreen({super.key});
  16. @override
  17. State<IDPScreen> createState() => _IDPScreenState();
  18. }
  19. class _IDPScreenState extends State<IDPScreen> {
  20. final List<TextEditingController> _requirement = [TextEditingController()];
  21. final List<TextEditingController> _actual = [TextEditingController()];
  22. final List<String> competencyItems = [
  23. 'Vision and Business Sense',
  24. 'Customer Focus',
  25. 'Interpersonal Skill',
  26. 'Analysis and Judgement',
  27. 'Planning and Driving Action',
  28. 'Leading and Motivating',
  29. 'Team Work',
  30. 'Drive, Courage, and Integrity'
  31. ];
  32. late List <String> idCompetency;
  33. late String strIDCompetency;
  34. var selectedCompetency;
  35. //Form Key
  36. final _formKey = GlobalKey<FormState>();
  37. void initState(){
  38. shortTermTeksController.clear();
  39. longTermTeksController.clear();
  40. WidgetsBinding.instance.addPostFrameCallback((_) {
  41. _selectedItems;
  42. _addField();
  43. });
  44. super.initState();
  45. }
  46. _addField(){
  47. setState(() {
  48. _requirement.add(TextEditingController());
  49. _actual.add(TextEditingController());
  50. });
  51. }
  52. _removeItem(i){
  53. setState(() {
  54. _requirement.removeAt(i);
  55. _actual.removeAt(i);
  56. });
  57. }
  58. void _submit (){
  59. final isValid = _formKey.currentState!.validate();
  60. if (!isValid){
  61. return;
  62. }
  63. _formKey.currentState!.save();
  64. FormData formData = FormData.fromMap({});
  65. for (int i = 0; i < _requirement.length; i++){
  66. formData.fields.add(MapEntry("requirement[]", _requirement[i].text));
  67. formData.fields.add(MapEntry("actual[]", _actual[i].text));
  68. }
  69. }
  70. @override
  71. Widget build(BuildContext context) {
  72. var size = MediaQuery.sizeOf(context);
  73. void _showMultiSelectStrength() async {
  74. final List<String>? results = await showDialog(
  75. context: context,
  76. builder: (BuildContext context) {
  77. return MultiSelectStrength(items: competencyItems);
  78. },
  79. );
  80. // Update UI
  81. if (results != null) {
  82. setState(() {
  83. _selectedItems = results;
  84. });
  85. }
  86. }
  87. void _showMultiSelectDevelop() async {
  88. final List<String>? results = await showDialog(
  89. context: context,
  90. builder: (BuildContext context) {
  91. return MultiSelectDevelop(items: competencyItems);
  92. },
  93. );
  94. // Update UI
  95. if (results != null) {
  96. setState(() {
  97. _selectedItems = results;
  98. });
  99. }
  100. }
  101. return Scaffold(
  102. body: SingleChildScrollView(
  103. child: Column(
  104. children: <Widget>[
  105. Stack(
  106. children: [
  107. WavyHeader(),
  108. Container(
  109. margin: EdgeInsets.only(top: MediaQuery.of(context).size.height/6 - 20),
  110. padding: EdgeInsets.fromLTRB(20, 5, 25, 5),
  111. child: Row(
  112. mainAxisAlignment: MainAxisAlignment.end,
  113. crossAxisAlignment: CrossAxisAlignment.end,
  114. children: [
  115. Text(
  116. 'IDP\t\t',
  117. maxLines: 2,
  118. style: GoogleFonts.luckiestGuy(
  119. fontSize: 28,
  120. color: Color(0xFF4858A7),
  121. fontStyle: FontStyle.italic,
  122. ),
  123. ),
  124. Image.asset("assets/icons/menu/ic_idp_2.png",
  125. width: 40,
  126. height: 40,
  127. ),
  128. ],
  129. )),
  130. SafeArea(
  131. child: Container(
  132. width: MediaQuery.of(context).size.width,
  133. margin: EdgeInsets.only(
  134. top: MediaQuery.of(context).size.height / 5,
  135. left: 10,
  136. right: 10,
  137. bottom : 15,
  138. ),
  139. child: Column(
  140. children: [
  141. InkWell(
  142. child: Container(
  143. margin: EdgeInsets.only(top: 5, bottom: 15),
  144. padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
  145. width: double.infinity,
  146. decoration: BoxDecoration(
  147. borderRadius: BorderRadius.circular(5),
  148. gradient: LinearGradient(colors: [
  149. Color(0xFF2D4059),
  150. Color(0xFF2D4059),
  151. /*Color(0xFFEAFFD0),
  152. Color(0xFF95E1D3),*/
  153. ])),
  154. child: Row(
  155. mainAxisAlignment: MainAxisAlignment.center,
  156. children: [
  157. Text('See IDP History\t\t',
  158. textAlign: TextAlign.center,
  159. style: TextStyle(
  160. color: Colors.white,
  161. fontSize: 17,
  162. fontWeight: FontWeight.w500)),
  163. Image.asset(
  164. 'assets/images/ic_arrow_white.png',
  165. width: 30,
  166. height: 30,
  167. )
  168. ],
  169. )),
  170. onTap: () {
  171. /* Navigator.push(context, MaterialPageRoute(
  172. builder: (context) => HistoryReimburse()));*/
  173. },
  174. ),
  175. Container(
  176. child: Card(
  177. elevation: 10,
  178. child: Container(
  179. decoration: BoxDecoration(
  180. color: Color(0XFFFAF7EE),
  181. borderRadius: BorderRadius.circular(10)),
  182. child: Column(
  183. children: [
  184. Container(
  185. margin: EdgeInsets.only(
  186. left: 10, right: 10, top: 15, bottom: 10),
  187. child: Text('IDP Submission', style:
  188. GoogleFonts.josefinSans(fontSize: 19, fontWeight: FontWeight.bold, decoration: TextDecoration.underline,
  189. decorationStyle: TextDecorationStyle.dashed),),
  190. ),
  191. Container(
  192. margin: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 10),
  193. child: Column(
  194. children: [
  195. Align(
  196. alignment: Alignment.centerLeft,
  197. child: Text(
  198. 'Career Aspiration',
  199. style: GoogleFonts.inconsolata(
  200. fontSize: 16, fontWeight: FontWeight.bold),
  201. ),
  202. ),
  203. Container(
  204. margin: EdgeInsets.only(left: 10),
  205. child: Column(
  206. children: [
  207. Container(
  208. margin: EdgeInsets.only(top: 10),
  209. child: Align(
  210. alignment: Alignment.centerLeft,
  211. child: Text(
  212. 'Short Term Goals (1 - 2 Years)',
  213. style: GoogleFonts.inconsolata(
  214. fontSize: 16, fontWeight: FontWeight.bold),
  215. ),
  216. ),
  217. ),
  218. Container(
  219. margin: EdgeInsets.only(top: 7),
  220. decoration: BoxDecoration(
  221. color: Colors.white,
  222. borderRadius:
  223. BorderRadius.circular(5)),
  224. child: Padding(
  225. padding: EdgeInsets.only(
  226. left: 10,
  227. right: 10,
  228. top: 5,
  229. bottom: 5),
  230. child: TextFormField(
  231. keyboardType: TextInputType.multiline,
  232. controller: shortTermTeksController,
  233. maxLines: null,
  234. textInputAction:
  235. TextInputAction.done,
  236. decoration: InputDecoration(
  237. border:
  238. InputBorder.none,
  239. hintText: "ex. Be a team leader")),
  240. )),
  241. Container(
  242. margin: EdgeInsets.only(top: 10),
  243. child: Align(
  244. alignment: Alignment.centerLeft,
  245. child: Text(
  246. 'Long Term Goals (3 - 5 Years)',
  247. style: GoogleFonts.inconsolata(
  248. fontSize: 16, fontWeight: FontWeight.bold),
  249. ),
  250. ),
  251. ),
  252. Container(
  253. margin: EdgeInsets.only(top: 7),
  254. decoration: BoxDecoration(
  255. color: Colors.white,
  256. borderRadius:
  257. BorderRadius.circular(5)),
  258. child: Padding(
  259. padding: EdgeInsets.only(
  260. left: 10,
  261. right: 10,
  262. top: 5,
  263. bottom: 5),
  264. child: TextFormField(
  265. keyboardType: TextInputType.multiline,
  266. controller: longTermTeksController,
  267. maxLines: null,
  268. textInputAction:
  269. TextInputAction.done,
  270. decoration: InputDecoration(
  271. border:
  272. InputBorder.none,
  273. hintText: "ex. Be a team leader")),
  274. )),
  275. ],
  276. ),
  277. )
  278. ],
  279. ),
  280. ),
  281. Container(
  282. margin: EdgeInsets.only(
  283. left: 10, right: 10, top: 10, bottom: 10),
  284. child: Column(
  285. children: [
  286. Align(
  287. alignment: Alignment.centerLeft,
  288. child: Text(
  289. 'Strength Area Competency',
  290. style: GoogleFonts.inconsolata(
  291. fontSize: 16, fontWeight: FontWeight.bold),
  292. ),
  293. ),
  294. ElevatedButton(
  295. onPressed: _showMultiSelectStrength,
  296. child: Container(
  297. width: double.infinity,
  298. child: Text(
  299. "Choose Competency",
  300. style: TextStyle(
  301. color: Colors.white,
  302. fontSize: 16,
  303. fontWeight:
  304. FontWeight.w400),
  305. ),
  306. ),
  307. ),
  308. Visibility(
  309. visible: visibleStrengthCompetency,
  310. child: Container(
  311. alignment: Alignment.centerLeft,
  312. margin: EdgeInsets.only(
  313. left: 15,
  314. right: 15,
  315. bottom: 5),
  316. child: Text(_selectedItems.toString(),
  317. overflow:
  318. TextOverflow.ellipsis,
  319. maxLines: 1,
  320. style: TextStyle(
  321. color: Colors.black54),
  322. ),
  323. ),
  324. )
  325. ],
  326. ),
  327. ),
  328. Container(
  329. margin: EdgeInsets.only(
  330. left: 10, right: 10, top: 10, bottom: 10),
  331. child: Column(
  332. children: [
  333. Align(
  334. alignment: Alignment.centerLeft,
  335. child: Text(
  336. 'Area of Development/Improvement',
  337. style: GoogleFonts.inconsolata(
  338. fontSize: 16, fontWeight: FontWeight.bold),
  339. ),
  340. ),
  341. ElevatedButton(
  342. onPressed: _showMultiSelectDevelop,
  343. child: Container(
  344. width: double.infinity,
  345. child: Text(
  346. "Choose Competency",
  347. style: TextStyle(
  348. color: Colors.white,
  349. fontSize: 16,
  350. fontWeight:
  351. FontWeight.w400),
  352. ),
  353. ),
  354. ),
  355. Visibility(
  356. visible: visibleAreaDevCompetency,
  357. child: Container(
  358. alignment: Alignment.centerLeft,
  359. margin: EdgeInsets.only(
  360. left: 15,
  361. right: 15,
  362. bottom: 5),
  363. child: Text(_selectedItems.toString(),
  364. overflow:
  365. TextOverflow.ellipsis,
  366. maxLines: 1,
  367. style: TextStyle(
  368. color: Colors.black54),
  369. ),
  370. ),
  371. ),
  372. ],
  373. ),
  374. ),
  375. Container(
  376. margin: EdgeInsets.only(
  377. left: 10, right: 10, top: 10, bottom: 10),
  378. child: Column(
  379. children: [
  380. Align(
  381. alignment: Alignment.centerLeft,
  382. child: Text(
  383. 'Focus of Development',
  384. style: GoogleFonts.inconsolata(
  385. fontSize: 16, fontWeight: FontWeight.bold),
  386. ),
  387. ),
  388. ListView.builder(
  389. shrinkWrap: true,
  390. itemCount: _requirement.length,
  391. itemBuilder: (context, index) {
  392. return Padding(
  393. padding: const EdgeInsets.only(top: 15),
  394. child: Row(
  395. children: [
  396. Expanded(
  397. child: Container(
  398. padding: const EdgeInsets.symmetric(horizontal: 10),
  399. //height: 60,
  400. alignment: Alignment.center,
  401. decoration: BoxDecoration(
  402. color: const Color(0xFF2E384E),
  403. borderRadius: BorderRadius.circular(5),
  404. ),
  405. child: DropdownButton(
  406. // menuMaxHeight: size.height * 0.31,
  407. dropdownColor: Colors.grey.shade300,
  408. value: this.selectedCompetency,
  409. isExpanded: true,
  410. isDense: true,
  411. underline: SizedBox(),
  412. hint: Text(
  413. '\t\tChoose Category',
  414. style: TextStyle(
  415. color: Colors.black54),
  416. ),
  417. onChanged: (value) {
  418. print(value);
  419. setState(() {
  420. selectedCompetency = value!;
  421. for (int i = 0; i < competencyItems.length; i++){
  422. if (selectedCompetency == competencyItems.elementAt(i)){
  423. strIDCompetency = idCompetency.elementAt(i);
  424. }
  425. }
  426. logDev.log(strIDCompetency, name: "ID Competency");
  427. });
  428. },
  429. items: competencyItems
  430. .map(
  431. (e) => DropdownMenuItem(
  432. value: e,
  433. child:
  434. Text("\t\t" + e)),
  435. )
  436. .toList(),
  437. ),
  438. ),
  439. ),
  440. SizedBox(width: 5),
  441. Expanded(
  442. child: Container(
  443. padding: const EdgeInsets.symmetric(horizontal: 10),
  444. //height: 60,
  445. alignment: Alignment.center,
  446. decoration: BoxDecoration(
  447. color: const Color(0xFF2E384E),
  448. borderRadius: BorderRadius.circular(5),
  449. ),
  450. child: TextFormField(
  451. controller: _requirement[index],
  452. autofocus: false,
  453. style: const TextStyle(color: Color(0xFFF8F8FF)),
  454. decoration: const InputDecoration(
  455. border: InputBorder.none,
  456. hintText: "Requirement",
  457. hintStyle: TextStyle(
  458. color: Color.fromARGB(255, 132, 140, 155)),
  459. ),
  460. ),
  461. ),
  462. ),
  463. SizedBox(width: 5),
  464. Expanded(
  465. child: Container(
  466. padding: const EdgeInsets.symmetric(horizontal: 10),
  467. //height: 60,
  468. alignment: Alignment.center,
  469. decoration: BoxDecoration(
  470. color: const Color(0xFF2E384E),
  471. borderRadius: BorderRadius.circular(5),
  472. ),
  473. child: TextFormField(
  474. controller: _requirement[index],
  475. autofocus: false,
  476. style: const TextStyle(color: Color(0xFFF8F8FF)),
  477. decoration: const InputDecoration(
  478. border: InputBorder.none,
  479. hintText: "Actual",
  480. hintStyle: TextStyle(
  481. color: Color.fromARGB(255, 132, 140, 155)),
  482. ),
  483. ),
  484. ),
  485. ),
  486. index != 0
  487. ? GestureDetector(
  488. onTap: (){
  489. setState(() {
  490. _requirement[index].clear();
  491. _requirement[index].dispose();
  492. _requirement.removeAt(index);
  493. });
  494. },
  495. child: const Icon(
  496. Icons.delete,
  497. color: Color(0xFF6B74D6),
  498. size: 40,
  499. ),
  500. )
  501. : const SizedBox()
  502. ],
  503. ),
  504. );
  505. },
  506. ),
  507. const SizedBox(
  508. height: 10,
  509. ),
  510. GestureDetector(
  511. onTap: () {
  512. setState(() {
  513. _requirement.add(TextEditingController());
  514. });
  515. },
  516. child: Center(
  517. child: Container(
  518. padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
  519. decoration: BoxDecoration(
  520. color: const Color(0xFF444C60),
  521. borderRadius: BorderRadius.circular(5)),
  522. child: Text("Add More +",
  523. style:
  524. GoogleFonts.nunito(color: const Color(0xFFF8F8FF))),
  525. ),
  526. ),
  527. ),
  528. ],
  529. ),
  530. ),
  531. InkWell(
  532. child: Container(
  533. margin: EdgeInsets.only(left: 10, right: 10, bottom: 15),
  534. padding: EdgeInsets.fromLTRB(
  535. 10, 10, 10, 10),
  536. width: double.infinity,
  537. decoration: BoxDecoration(
  538. borderRadius:
  539. BorderRadius.circular(5),
  540. gradient: LinearGradient(colors: [
  541. Color(0xFFFF9945),
  542. Color(0xFFFc6076)
  543. ])),
  544. child: Text('Submit',
  545. textAlign: TextAlign.center,
  546. style: TextStyle(
  547. color: Colors.white,
  548. fontSize: 17,
  549. fontWeight: FontWeight.w500)),
  550. ),
  551. onTap: () async {
  552. ProgressDialog loading = ProgressDialog(context);
  553. loading = ProgressDialog(context,
  554. type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
  555. loading.style(
  556. message: 'Please Wait .....',
  557. borderRadius: 3,
  558. backgroundColor: Colors.white,
  559. progressWidget: CircularProgressIndicator(),
  560. elevation: 10.0,
  561. padding: EdgeInsets.all(10),
  562. insetAnimCurve: Curves.easeInOut,
  563. progress: 0.0,
  564. maxProgress: 100.0,
  565. progressTextStyle: TextStyle(
  566. color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
  567. messageTextStyle: TextStyle(
  568. color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
  569. if (!validateFormReimburse(context)){
  570. return;
  571. } else if (validateFormReimburse(context)){
  572. await loading.show();
  573. }
  574. },
  575. )
  576. ],
  577. ),
  578. ),
  579. ),
  580. ),
  581. ],
  582. ),
  583. ),
  584. ),
  585. ],
  586. ),
  587. ],
  588. )),
  589. );
  590. }
  591. //Validasi Form Reimburse
  592. bool validateFormReimburse(BuildContext context) {
  593. bool result = true;
  594. if (shortTermTeksController.text.toString().isEmpty) {
  595. Fluttertoast.showToast(
  596. msg: "Short Term Goals Required!",
  597. toastLength: Toast.LENGTH_SHORT,
  598. gravity: ToastGravity.CENTER,
  599. timeInSecForIosWeb: 1,
  600. textColor: Colors.white,
  601. fontSize: 16.0);
  602. result = false;
  603. } else if (longTermTeksController.text.toString().isEmpty) {
  604. Fluttertoast.showToast(
  605. msg: "Short Term Goals Required!",
  606. toastLength: Toast.LENGTH_SHORT,
  607. gravity: ToastGravity.CENTER,
  608. timeInSecForIosWeb: 1,
  609. textColor: Colors.white,
  610. fontSize: 16.0);
  611. result = false;
  612. }
  613. return result;
  614. }
  615. }
  616. class MultiSelectStrength extends StatefulWidget {
  617. final List<String> items;
  618. const MultiSelectStrength({Key? key, required this.items}) : super(key: key);
  619. @override
  620. State<StatefulWidget> createState() => _MultiSelectStrength();
  621. }
  622. class _MultiSelectStrength extends State<MultiSelectStrength> {
  623. // this variable holds the selected items
  624. final List<String> _selectedItems = [];
  625. // This function is triggered when a checkbox is checked or unchecked
  626. void _itemChange(String itemValue, bool isSelected) {
  627. setState(() {
  628. if (isSelected) {
  629. _selectedItems.add(itemValue);
  630. } else {
  631. _selectedItems.remove(itemValue);
  632. }
  633. });
  634. }
  635. // this function is called when the Cancel button is pressed
  636. void _cancel() {
  637. Navigator.pop(context);
  638. }
  639. // this function is called when the Submit button is tapped
  640. void _submit() {
  641. Navigator.pop(context, _selectedItems);
  642. visibleStrengthCompetency = true;
  643. }
  644. @override
  645. Widget build(BuildContext context) {
  646. return AlertDialog(
  647. title: const Text('Select Competency'),
  648. content: SingleChildScrollView(
  649. child: ListBody(
  650. children: widget.items
  651. .map((item) => CheckboxListTile(
  652. value: _selectedItems.contains(item),
  653. title: Text(item),
  654. controlAffinity: ListTileControlAffinity.leading,
  655. onChanged: (isChecked) => _itemChange(item, isChecked!),
  656. ))
  657. .toList(),
  658. ),
  659. ),
  660. actions: [
  661. TextButton(
  662. onPressed: _cancel,
  663. child: const Text('Cancel'),
  664. ),
  665. ElevatedButton(
  666. onPressed: _submit,
  667. child: const Text('Submit'),
  668. ),
  669. ],
  670. );
  671. }
  672. }
  673. class MultiSelectDevelop extends StatefulWidget {
  674. final List<String> items;
  675. const MultiSelectDevelop({Key? key, required this.items}) : super(key: key);
  676. @override
  677. State<StatefulWidget> createState() => _MultiSelectDevelop();
  678. }
  679. class _MultiSelectDevelop extends State<MultiSelectDevelop> {
  680. // this variable holds the selected items
  681. final List<String> _selectedItems = [];
  682. // This function is triggered when a checkbox is checked or unchecked
  683. void _itemChange(String itemValue, bool isSelected) {
  684. setState(() {
  685. if (isSelected) {
  686. _selectedItems.add(itemValue);
  687. } else {
  688. _selectedItems.remove(itemValue);
  689. }
  690. });
  691. }
  692. // this function is called when the Cancel button is pressed
  693. void _cancel() {
  694. Navigator.pop(context);
  695. }
  696. // this function is called when the Submit button is tapped
  697. void _submit() {
  698. Navigator.pop(context, _selectedItems);
  699. visibleAreaDevCompetency = true;
  700. }
  701. @override
  702. Widget build(BuildContext context) {
  703. return AlertDialog(
  704. title: const Text('Select Competency'),
  705. content: SingleChildScrollView(
  706. child: ListBody(
  707. children: widget.items
  708. .map((item) => CheckboxListTile(
  709. value: _selectedItems.contains(item),
  710. title: Text(item),
  711. controlAffinity: ListTileControlAffinity.leading,
  712. onChanged: (isChecked) => _itemChange(item, isChecked!),
  713. ))
  714. .toList(),
  715. ),
  716. ),
  717. actions: [
  718. TextButton(
  719. onPressed: _cancel,
  720. child: const Text('Cancel'),
  721. ),
  722. ElevatedButton(
  723. onPressed: _submit,
  724. child: const Text('Submit'),
  725. ),
  726. ],
  727. );
  728. }
  729. }
  730. alertDialogFailedRetrievedData(BuildContext context){
  731. Widget okButton = TextButton(
  732. child: Text("Refresh"),
  733. onPressed: () {
  734. Navigator.of(context, rootNavigator: true).pop();
  735. Navigator.pushReplacement(context, MaterialPageRoute(
  736. builder: (context) => IDPScreen()));
  737. },
  738. );
  739. Widget noButton = TextButton(
  740. child: Text("Back"),
  741. onPressed: () {
  742. Navigator.of(context, rootNavigator: true).pop();
  743. Navigator.pop(context);
  744. },
  745. );
  746. // set up the AlertDialog
  747. AlertDialog alert = AlertDialog(
  748. title: Text("Employee Self Service"),
  749. content: Text("Failed to Retrieve Data"),
  750. actions: [
  751. noButton,
  752. okButton,
  753. ],
  754. );
  755. // show the dialog
  756. showDialog(
  757. context: context,
  758. barrierDismissible: false,
  759. builder: (BuildContext context) {
  760. return alert;
  761. },
  762. );
  763. }
  764. alertDialogFailedResponse(BuildContext context){
  765. Widget okButton = TextButton(
  766. child: Text("Refresh"),
  767. onPressed: () {
  768. Navigator.of(context, rootNavigator: true).pop();
  769. Navigator.pushReplacement(context, MaterialPageRoute(
  770. builder: (context) => IDPScreen()));
  771. },
  772. );
  773. Widget noButton = TextButton(
  774. child: Text("Back"),
  775. onPressed: () {
  776. Navigator.of(context, rootNavigator: true).pop();
  777. Navigator.pop(context);
  778. },
  779. );
  780. // set up the AlertDialog
  781. AlertDialog alert = AlertDialog(
  782. title: Text("Employee Self Service"),
  783. content: Text("Server Response Error"),
  784. actions: [
  785. noButton,
  786. okButton,
  787. ],
  788. );
  789. // show the dialog
  790. showDialog(
  791. context: context,
  792. barrierDismissible: false,
  793. builder: (BuildContext context) {
  794. return alert;
  795. },
  796. );
  797. }