Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.68 KB | None | 0 0
  1. // import 'package:date_utils/date_utils.dart';
  2. import 'package:firecek/modules/home/user_pro.dart';
  3. import 'package:firecek/modules/schedule/schedule_create.dart';
  4. import 'package:firecek/modules/schedule/schedule_reschedule.dart';
  5. import 'package:flutter/material.dart';
  6. // import 'package:intl/date_symbol_data_local.dart';
  7. import 'package:table_calendar/table_calendar.dart';
  8. import 'schedule_modal.dart';
  9. import 'package:firecek/database/modal.dart';
  10. import 'package:shared_preferences/shared_preferences.dart';
  11. import 'package:http/http.dart' as http;
  12. import 'dart:convert';
  13. import 'package:after_layout/after_layout.dart';
  14.  
  15.  
  16. Future<ScheduleResponse> fetchSchedule(http.Client client) async {
  17. SharedPreferences prefs = await SharedPreferences.getInstance();
  18. String kodeUser = prefs.getString('kodeUser');
  19. String kodeCustomer = prefs.getString('kodeCustomer');
  20. String token = prefs.getString('apiKey');
  21.  
  22. final response = await client.get(Modal.schedule +
  23. '?kode_user=$kodeUser&token=$token&kode_customer=$kodeCustomer&datetime=${DateTime.now()}');
  24. final responseDecode = jsonDecode(response.body);
  25. ScheduleResponse data = ScheduleResponse.fromJson(responseDecode);
  26. return data;
  27. }
  28.  
  29. Future<ScheduleCreateDeleteUpdateResponse> post(String url, var body) async {
  30. return await http.post(Uri.encodeFull(url),
  31. body: body,
  32. headers: {'Accept': 'application/json'}).then((http.Response response) {
  33. final int statusCode = response.statusCode;
  34. if (statusCode < 200 || statusCode > 400 || json == null) {
  35. throw new Exception("Error while fetching data");
  36. }
  37. return ScheduleCreateDeleteUpdateResponse.fromJson(json.decode(response.body));
  38. });
  39. }
  40.  
  41. Future<SelectedScheduleResponse> postSelectedSchedule(String url, var body) async {
  42. return await http.post(Uri.encodeFull(url),
  43. body: body,
  44. headers: {'Accept': 'application/json'}).then((http.Response response) {
  45. final int statusCode = response.statusCode;
  46. if (statusCode < 200 || statusCode > 400 || json == null) {
  47. throw new Exception("Error while fetching data");
  48. }
  49. return SelectedScheduleResponse.fromJson(json.decode(response.body));
  50. });
  51. }
  52.  
  53. class Schedule extends StatefulWidget {
  54.  
  55. final msg;
  56. Schedule({this.msg});
  57.  
  58. @override
  59. State<StatefulWidget> createState() => _ScheduleState();
  60. }
  61.  
  62. class _ScheduleState extends State<Schedule> with AfterLayoutMixin<Schedule>{
  63.  
  64. DateTime _selectedDay;
  65. Map<DateTime, List> _events;
  66. Map<DateTime, List> _getEvents;
  67. Map<DateTime, List> _visibleEvents;
  68.  
  69. DateTime _selectedDate;
  70. SelectedScheduleResponse _selectedDateData;
  71. bool _selectedDateApiCall = false;
  72.  
  73. final GlobalKey<ScaffoldState> _scheduleScaffoldKey = GlobalKey<ScaffoldState>();
  74.  
  75. @override
  76. void initState(){
  77. _selectedDay = DateTime.now();
  78. _events = {};
  79. _getEvents = {};
  80. _visibleEvents = _events;
  81.  
  82. super.initState();
  83. }
  84.  
  85. @override
  86. void afterFirstLayout(BuildContext context) {
  87. setState(() {
  88. _events = _getEvents;
  89. _visibleEvents = _events;
  90. });
  91.  
  92. if (widget.msg != null) {
  93. _scheduleScaffoldKey.currentState.showSnackBar(
  94. SnackBar(
  95. content: Text(widget.msg),
  96. )
  97. );
  98. }
  99. }
  100.  
  101. Future _deleteSchedule(String noJadwal) async {
  102. SharedPreferences prefs = await SharedPreferences.getInstance();
  103. String kodeUser = prefs.getString('kodeUser');
  104. String token = prefs.getString('apiKey');
  105.  
  106. post(Modal.scheduleDelete, {
  107. 'kode_user': kodeUser,
  108. 'token': token,
  109. 'no_jadwal': noJadwal
  110. }).then((response){
  111. print(response.msg);
  112.  
  113. if (response.msgCode == 200) {
  114. Navigator.push(context, MaterialPageRoute(
  115. builder: (context) => Schedule(msg: 'Agenda dihapus')
  116. ));
  117. }
  118. },onError: (error){
  119. print(error.toString());
  120. });
  121. }
  122.  
  123. Future _getScheduleOnSelectedDate(DateTime datetime) async {
  124. SharedPreferences prefs = await SharedPreferences.getInstance();
  125. String kodeUser = prefs.getString('kodeUser');
  126. String token = prefs.getString('apiKey');
  127. String kodeCustomer = prefs.getString('kodeCustomer');
  128.  
  129. // EventList(mode: 'selectedDate');
  130.  
  131. postSelectedSchedule(Modal.schedule, {
  132. 'kode_user': kodeUser,
  133. 'token': token,
  134. 'kode_customer': kodeCustomer,
  135. 'datetime': datetime.toString()
  136. }).then((response){
  137. print(response.msg);
  138.  
  139. setState(() {
  140. _selectedDateData = response;
  141. _selectedDateApiCall = false;
  142. });
  143. },onError: (error){
  144. print(error.toString());
  145. });
  146. }
  147.  
  148. Future _navigateAndDisplayInput(BuildContext context) async {
  149. // Navigator.push returns a Future that will complete after we call
  150. // Navigator.pop on the Selection Screen!
  151. final result = await Navigator.push(
  152. context,
  153. MaterialPageRoute(builder: (context) => ScheduleCreate()),
  154. );
  155.  
  156. // After the Selection Screen returns a result, hide any previous snackbars
  157. // and show the new result!
  158. if (result != null) {
  159. _scheduleScaffoldKey.currentState.showSnackBar(
  160. SnackBar(
  161. content: Text("$result"),
  162. )
  163. );
  164. }
  165. }
  166.  
  167. Future _rescheduleEvent(BuildContext context, String noJadwal) async {
  168. // Navigator.push returns a Future that will complete after we call
  169. // Navigator.pop on the Selection Screen!
  170. final result = await Navigator.push(
  171. context,
  172. MaterialPageRoute(builder: (context) => ScheduleReschedule(noJadwal: noJadwal,)),
  173. );
  174.  
  175. // After the Selection Screen returns a result, hide any previous snackbars
  176. // and show the new result!
  177. if (result != null) {
  178. _scheduleScaffoldKey.currentState.showSnackBar(
  179. SnackBar(
  180. content: Text("$result"),
  181. )
  182. );
  183. }
  184. }
  185.  
  186. Future _deleteConfirmation(String scheduleTitle, String noJadwal) {
  187. return showDialog(
  188. context: context,
  189. builder: (context){
  190. return AlertDialog(
  191. shape: RoundedRectangleBorder(
  192. borderRadius: BorderRadius.all(Radius.circular(10.0))
  193. ),
  194. content: Column(
  195. mainAxisSize: MainAxisSize.min,
  196. children: <Widget>[
  197. Row(
  198. children: <Widget>[
  199. Expanded(
  200. child: Text('Hapus agenda $scheduleTitle?'),
  201. )
  202. ],
  203. ),
  204. SizedBox(height: 25.0),
  205. Row(
  206. children: <Widget>[
  207. Expanded(
  208. child: OutlineButton(
  209. onPressed: (){
  210. _deleteSchedule(noJadwal);
  211. Navigator.pop(context);
  212. },
  213. child: Text('Hapus',style: TextStyle(fontWeight: FontWeight.bold,color: Colors.red),),
  214. ),
  215. ),
  216. SizedBox(width: 20.0),
  217. Expanded(
  218. child: OutlineButton(
  219. onPressed: (){
  220. Navigator.pop(context);
  221. },
  222. child: Text('Batal',style: TextStyle(fontWeight: FontWeight.bold,color: Theme.of(context).primaryColor),),
  223. ),
  224. )
  225. ],
  226. )
  227. ],
  228. ),
  229. );
  230. }
  231. );
  232. }
  233.  
  234. @override
  235. Widget build(BuildContext context) {
  236. return WillPopScope(
  237. onWillPop: (){
  238. return Navigator.pushReplacement(context, MaterialPageRoute(
  239. builder: (context) => Home()
  240. ));
  241. },
  242. child: Scaffold(
  243. key: _scheduleScaffoldKey,
  244. floatingActionButton: FloatingActionButton(
  245. child: Icon(Icons.add),
  246. tooltip: 'Tambah Agenda',
  247. onPressed: () {
  248. _navigateAndDisplayInput(context);
  249. },
  250. ),
  251. appBar: AppBar(
  252. leading: IconButton(
  253. icon: Icon(Icons.arrow_back),
  254. onPressed: (){
  255. Navigator.pushReplacement(context, MaterialPageRoute(
  256. builder: (context) => Home()
  257. ));
  258. },
  259. ),
  260. title: Text('Agenda Inspeksi'),
  261. centerTitle: true,
  262. elevation: 0.0,
  263. ),
  264. body: Container(
  265. child: ListView(
  266. children: <Widget>[
  267. Stack(
  268. children: <Widget>[
  269. Column(
  270. children: <Widget>[
  271. Container(
  272. height: MediaQuery.of(context).size.height * .25,
  273. color: Theme.of(context).primaryColor,
  274. ),
  275. Container(
  276. height: MediaQuery.of(context).size.height * .75,
  277. color: Colors.white,
  278. )
  279. ],
  280. ),
  281. Padding(
  282. padding: EdgeInsets.only(left: 10.0,top: 20.0,right: 10.0),
  283. child: Row(
  284. children: <Widget>[
  285. Expanded(
  286. child: SizedBox(
  287. child: Column(
  288. children: <Widget>[
  289. FutureBuilder(
  290. future: fetchSchedule(http.Client()),
  291. builder: (context, snapshot){
  292.  
  293. print('>>>>>>> ${snapshot.connectionState}');
  294. if (snapshot.hasError) print(snapshot.error);
  295.  
  296. if (snapshot.connectionState == ConnectionState.done) {
  297. return _scheduleCalendar(snapshot.data);
  298. } else {
  299. return Center(
  300. child: CircularProgressIndicator(
  301. backgroundColor: Colors.white,
  302. ),
  303. );
  304. }
  305. },
  306. ),
  307. ],
  308. ),
  309. ),
  310. )
  311. ],
  312. ),
  313. ),
  314. ],
  315. ),
  316. Container(height: 20.0)
  317. ],
  318. ),
  319. ),
  320. )
  321. );
  322. }
  323.  
  324. Widget _buildTableCalendar() {
  325. return TableCalendar(
  326. locale: 'en_US',
  327. events: _visibleEvents,
  328. // holidays: _visibleHolidays,
  329. initialCalendarFormat: CalendarFormat.month,
  330. formatAnimation: FormatAnimation.slide,
  331. startingDayOfWeek: StartingDayOfWeek.monday,
  332. availableGestures: AvailableGestures.all,
  333. availableCalendarFormats: const {
  334. CalendarFormat.month: 'Month',
  335. CalendarFormat.twoWeeks: '2 weeks',
  336. CalendarFormat.week: 'Week',
  337. },
  338. onDaySelected: (datetime, list){
  339. setState(() {
  340. _selectedDate = datetime;
  341. _selectedDateApiCall = true;
  342. });
  343.  
  344. _getScheduleOnSelectedDate(datetime);
  345. },
  346. calendarStyle: CalendarStyle(
  347. selectedColor: Colors.red,
  348. todayColor: Theme.of(context).primaryColor,
  349. markersColor: Colors.blue,
  350. ),
  351. headerStyle: HeaderStyle(
  352. formatButtonTextStyle:
  353. TextStyle().copyWith(color: Colors.white, fontSize: 15.0),
  354. formatButtonDecoration: BoxDecoration(
  355. color: Theme.of(context).primaryColor,
  356. borderRadius: BorderRadius.circular(16.0),
  357. ),
  358. )
  359. );
  360. }
  361.  
  362. _updateCalendar(int day) {
  363. if (day > 0) {
  364. _getEvents[_selectedDay.subtract(Duration(days: day.abs()))] = [''];
  365. } else {
  366. _getEvents[_selectedDay.add(Duration(days: day.abs()))] = [''];
  367. }
  368.  
  369. return Container();
  370. }
  371.  
  372. Widget _updateMarker(ScheduleResponse data) {
  373. data.data.map(
  374. (event) => _updateCalendar(event['day_margin'])
  375. ).toList();
  376. return Container();
  377. }
  378.  
  379. Widget _eventList(ScheduleResponse data) {
  380. if (_selectedDate == null) {
  381. if (data.currentDate.length > 0) {
  382. data.data.map(
  383. (event) => _updateCalendar(event['day_margin'])
  384. ).toList();
  385.  
  386. return Column(
  387. children: data.currentDate.map((index) {
  388. return Column(
  389. children: <Widget>[
  390. Divider(),
  391. SizedBox(height: 10.0),
  392. Row(
  393. children: <Widget>[
  394. Container(
  395. height: 165.0,
  396. decoration: BoxDecoration(
  397. borderRadius: BorderRadius.all(Radius.circular(5.0)),
  398. color: index['category'] == 'USER'
  399. ? Colors.orange
  400. : Theme.of(context).primaryColor,
  401. ),
  402. width: 8.0,
  403. ),
  404. SizedBox(width: 10.0),
  405. Column(
  406. crossAxisAlignment: CrossAxisAlignment.start,
  407. children: <Widget>[
  408. // _updateCalendar(index['day_margin']),
  409. Text(index['title'] ?? '-',style: TextStyle(fontWeight: FontWeight.bold)),
  410. SizedBox(height: 5.0),
  411. Row(
  412. children: <Widget>[
  413. Icon(Icons.calendar_today,size: 13.0,),
  414. SizedBox(width: 5.0),
  415. Text('Mulai: ${index['date_from'] ?? '-'}'),
  416. ],
  417. ),
  418. Row(
  419. children: <Widget>[
  420. Icon(Icons.calendar_today,size: 13.0,),
  421. SizedBox(width: 5.0),
  422. Text('Berakhir: ${index['date_to'] ?? '-'}'),
  423. ],
  424. ),
  425. SizedBox(height: 10.0),
  426. Text('Jenis Agenda: ${index['type']}'),
  427. SizedBox(height: 10.0),
  428. Text('Keterangan: ${index['note'] ?? '-'}'),
  429. SizedBox(height: 10.0),
  430. Row(
  431. children: <Widget>[
  432. OutlineButton(
  433. shape: RoundedRectangleBorder(
  434. borderRadius: BorderRadius.all(Radius.circular(10.0))
  435. ),
  436. child: Text('Ubah Agenda'),
  437. onPressed: (){
  438. _rescheduleEvent(context, index['no_jadwal']);
  439. },
  440. ),
  441. SizedBox(width: 10.0),
  442. OutlineButton(
  443. shape: RoundedRectangleBorder(
  444. borderRadius: BorderRadius.all(Radius.circular(10.0))
  445. ),
  446. child: Text('Hapus'),
  447. onPressed: (){
  448. _deleteConfirmation('${index["title"] ?? ""}','${index["no_jadwal"]}');
  449. },
  450. )
  451. ],
  452. )
  453. ],
  454. )
  455. ],
  456. ),
  457. SizedBox(height: 10.0)
  458. ],
  459. );
  460. }).toList(),
  461. );
  462. } else {
  463. return Column(
  464. crossAxisAlignment: CrossAxisAlignment.start,
  465. children: <Widget>[
  466. Divider(),
  467. SizedBox(height: 10.0),
  468. Text('Tidak ada agenda',style: TextStyle(color: Colors.grey)),
  469. SizedBox(height: 10.0),
  470. ],
  471. );
  472. }
  473. } else {
  474. return _selectedDateApiCall
  475. ? Center(
  476. child: CircularProgressIndicator(),
  477. )
  478. : Column(
  479. children: _selectedDateData.data.map((index) {
  480. return Column(
  481. children: <Widget>[
  482. Divider(),
  483. SizedBox(height: 10.0),
  484. Row(
  485. children: <Widget>[
  486. Container(
  487. height: 165.0,
  488. decoration: BoxDecoration(
  489. borderRadius: BorderRadius.all(Radius.circular(5.0)),
  490. color: index.category == 'USER'
  491. ? Colors.orange
  492. : Theme.of(context).primaryColor,
  493. ),
  494. width: 8.0,
  495. ),
  496. SizedBox(width: 10.0),
  497. Column(
  498. crossAxisAlignment: CrossAxisAlignment.start,
  499. children: <Widget>[
  500. Text(index.title ?? '-',style: TextStyle(fontWeight: FontWeight.bold)),
  501. SizedBox(height: 5.0),
  502. Row(
  503. children: <Widget>[
  504. Icon(Icons.calendar_today,size: 13.0,),
  505. SizedBox(width: 5.0),
  506. Text('Mulai: ${index.dateFrom ?? '-'}'),
  507. ],
  508. ),
  509. Row(
  510. children: <Widget>[
  511. Icon(Icons.calendar_today,size: 13.0,),
  512. SizedBox(width: 5.0),
  513. Text('Berakhir: ${index.dateTo ?? '-'}'),
  514. ],
  515. ),
  516. SizedBox(height: 10.0),
  517. Text('Jenis Agenda: ${index.type}'),
  518. SizedBox(height: 10.0),
  519. Text('Keterangan: ${index.note ?? '-'}'),
  520. SizedBox(height: 10.0),
  521. Row(
  522. children: <Widget>[
  523. OutlineButton(
  524. shape: RoundedRectangleBorder(
  525. borderRadius: BorderRadius.all(Radius.circular(10.0))
  526. ),
  527. child: Text('Ubah Agenda'),
  528. onPressed: (){
  529. // Navigator.push(context, MaterialPageRoute(
  530. // builder: (context) => ScheduleReschedule(noJadwal: index['no_jadwal'])
  531. // ));
  532. _rescheduleEvent(context, index.noJadwal);
  533. },
  534. ),
  535. SizedBox(width: 10.0),
  536. OutlineButton(
  537. shape: RoundedRectangleBorder(
  538. borderRadius: BorderRadius.all(Radius.circular(10.0))
  539. ),
  540. child: Text('Hapus'),
  541. onPressed: (){
  542. _deleteConfirmation('${index.title ?? ""}','${index.noJadwal}');
  543. },
  544. )
  545. ],
  546. )
  547. ],
  548. )
  549. ],
  550. ),
  551. SizedBox(height: 10.0)
  552. ],
  553. );
  554. }).toList(),
  555. );
  556. }
  557. }
  558.  
  559. Widget _scheduleCalendar(ScheduleResponse data) {
  560. return Column(
  561. children: <Widget>[
  562. Card(
  563. shape: RoundedRectangleBorder(
  564. borderRadius: BorderRadius.all(
  565. Radius.circular(10.0))),
  566. elevation: 3.0,
  567. child: Column(
  568. children: <Widget>[
  569. _buildTableCalendar(),
  570. ],
  571. ),
  572. ),
  573. SizedBox(height: 10.0),
  574. Card(
  575. child: Column(
  576. children: <Widget>[
  577. Container(
  578. child: Padding(
  579. padding: EdgeInsets.only(left: 10.0,right: 10.0,top: 10.0),
  580. child: Column(
  581. children: <Widget>[
  582. Row(
  583. children: <Widget>[
  584. Text('Agenda Inspeksi',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 20.0))
  585. ],
  586. ),
  587. _eventList(data)
  588. // _updateMarker(data),
  589. // EventList(todayDate: data, mode: 'todayDate'),
  590. ],
  591. ),
  592. ),
  593. )
  594. ],
  595. ),
  596. elevation: 3.0,
  597. )
  598. ],
  599. );
  600. }
  601. }
  602.  
  603. class EventList extends StatefulWidget {
  604. final ScheduleResponse todayDate;
  605. final SelectedScheduleResponse selectedDate;
  606. final String mode;
  607.  
  608. EventList({this.todayDate, this.selectedDate, this.mode});
  609.  
  610. @override
  611. State<StatefulWidget> createState() => EventListState();
  612. }
  613.  
  614. class EventListState extends State<EventList> {
  615. String test;
  616.  
  617. @override
  618. Widget build(BuildContext context) {
  619.  
  620. print(widget.mode);
  621.  
  622. return widget.mode == 'todayDate'
  623. ? Column(
  624. children: widget.todayDate.currentDate.map((index) {
  625. return Column(
  626. children: <Widget>[
  627. Divider(),
  628. SizedBox(height: 10.0),
  629. Row(
  630. children: <Widget>[
  631. Container(
  632. height: 165.0,
  633. decoration: BoxDecoration(
  634. borderRadius: BorderRadius.all(Radius.circular(5.0)),
  635. color: index['category'] == 'USER'
  636. ? Colors.orange
  637. : Theme.of(context).primaryColor,
  638. ),
  639. width: 8.0,
  640. ),
  641. SizedBox(width: 10.0),
  642. Column(
  643. crossAxisAlignment: CrossAxisAlignment.start,
  644. children: <Widget>[
  645. // _updateCalendar(index['day_margin']),
  646. Text(index['title'] ?? '-',style: TextStyle(fontWeight: FontWeight.bold)),
  647. SizedBox(height: 5.0),
  648. Row(
  649. children: <Widget>[
  650. Icon(Icons.calendar_today,size: 13.0,),
  651. SizedBox(width: 5.0),
  652. Text('Mulai: ${index['date_from'] ?? '-'}'),
  653. ],
  654. ),
  655. Row(
  656. children: <Widget>[
  657. Icon(Icons.calendar_today,size: 13.0,),
  658. SizedBox(width: 5.0),
  659. Text('Berakhir: ${index['date_to'] ?? '-'}'),
  660. ],
  661. ),
  662. SizedBox(height: 10.0),
  663. Text('Jenis Agenda: ${index['type']}'),
  664. SizedBox(height: 10.0),
  665. Text('Keterangan: ${index['note'] ?? '-'}'),
  666. SizedBox(height: 10.0),
  667. Row(
  668. children: <Widget>[
  669. OutlineButton(
  670. shape: RoundedRectangleBorder(
  671. borderRadius: BorderRadius.all(Radius.circular(10.0))
  672. ),
  673. child: Text('Ubah Agenda'),
  674. onPressed: (){
  675. // _rescheduleEvent(context, index['no_jadwal']);
  676. },
  677. ),
  678. SizedBox(width: 10.0),
  679. OutlineButton(
  680. shape: RoundedRectangleBorder(
  681. borderRadius: BorderRadius.all(Radius.circular(10.0))
  682. ),
  683. child: Text('Hapus'),
  684. onPressed: (){
  685. // _deleteConfirmation('${index["title"] ?? ""}','${index["no_jadwal"]}');
  686. },
  687. )
  688. ],
  689. )
  690. ],
  691. )
  692. ],
  693. ),
  694. SizedBox(height: 10.0)
  695. ],
  696. );
  697. }).toList(),
  698. )
  699. : Column(
  700. children: widget.selectedDate.data.map((index) {
  701. return Column(
  702. children: <Widget>[
  703. Divider(),
  704. SizedBox(height: 10.0),
  705. Row(
  706. children: <Widget>[
  707. Container(
  708. height: 165.0,
  709. decoration: BoxDecoration(
  710. borderRadius: BorderRadius.all(Radius.circular(5.0)),
  711. color: index.category== 'USER'
  712. ? Colors.orange
  713. : Theme.of(context).primaryColor,
  714. ),
  715. width: 8.0,
  716. ),
  717. SizedBox(width: 10.0),
  718. Column(
  719. crossAxisAlignment: CrossAxisAlignment.start,
  720. children: <Widget>[
  721. // _updateCalendar(index['day_margin']),
  722. Text(index.title ?? '-',style: TextStyle(fontWeight: FontWeight.bold)),
  723. SizedBox(height: 5.0),
  724. Row(
  725. children: <Widget>[
  726. Icon(Icons.calendar_today,size: 13.0,),
  727. SizedBox(width: 5.0),
  728. Text('Mulai: ${index.dateFrom ?? '-'}'),
  729. ],
  730. ),
  731. Row(
  732. children: <Widget>[
  733. Icon(Icons.calendar_today,size: 13.0,),
  734. SizedBox(width: 5.0),
  735. Text('Berakhir: ${index.dateTo ?? '-'}'),
  736. ],
  737. ),
  738. SizedBox(height: 10.0),
  739. Text('Jenis Agenda: ${index.type}'),
  740. SizedBox(height: 10.0),
  741. Text('Keterangan: ${index.note ?? '-'}'),
  742. SizedBox(height: 10.0),
  743. Row(
  744. children: <Widget>[
  745. OutlineButton(
  746. shape: RoundedRectangleBorder(
  747. borderRadius: BorderRadius.all(Radius.circular(10.0))
  748. ),
  749. child: Text('Ubah Agenda'),
  750. onPressed: (){
  751. // _rescheduleEvent(context, index['no_jadwal']);
  752. },
  753. ),
  754. SizedBox(width: 10.0),
  755. OutlineButton(
  756. shape: RoundedRectangleBorder(
  757. borderRadius: BorderRadius.all(Radius.circular(10.0))
  758. ),
  759. child: Text('Hapus'),
  760. onPressed: (){
  761. // _deleteConfirmation('${index["title"] ?? ""}','${index["no_jadwal"]}');
  762. },
  763. )
  764. ],
  765. )
  766. ],
  767. )
  768. ],
  769. ),
  770. SizedBox(height: 10.0)
  771. ],
  772. );
  773. }).toList(),
  774. );
  775. }
  776. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement