diff --git a/lib/page/addInformasi/addInfromasi.dart b/lib/page/addInformasi/addInfromasi.dart index f7c9b13cc5e8f4554b3c39e174122ea7e502a579..62635dd171a46fc57d601d8c3a685c891f97406a 100644 --- a/lib/page/addInformasi/addInfromasi.dart +++ b/lib/page/addInformasi/addInfromasi.dart @@ -16,6 +16,7 @@ class AddInformasi extends StatefulWidget{ class AddInformasiState extends State<AddInformasi> { File _image; + TextEditingController deskripsiController = TextEditingController(); var rating = 0.0; var tag = ''; final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); @@ -59,6 +60,21 @@ class AddInformasiState extends State<AddInformasi> { print('_image : $_image'); }); } + Future _clearImage() async { + + setState(() { + _image = null; + print('_image : $_image'); + }); + } + + Future _clearCheckBox() async{ + fasilitas.forEach((k, v) { + var key = k; + fasilitas[key]=false; + }); + } + Widget build(BuildContext context) { return Scaffold( @@ -154,14 +170,53 @@ class AddInformasiState extends State<AddInformasi> { Container( margin: EdgeInsets.fromLTRB(0, 30, 0, 10), alignment: Alignment.center, - child: ButtonTheme( - key: Key("Simpan Button"), - minWidth: double.infinity, - height: 40, - child: submitButton( - 'Simpan', Color(0xff3A903A), Colors.white, - Color(0xff3A903A), Colors.white, _validateLoginInput), - ) + child: Row( + children: <Widget>[ + Expanded( + child: ButtonTheme( + key: Key("Batal Button"), + minWidth: double.infinity, + height: 40, + child: RaisedButton( + padding: EdgeInsets.symmetric(vertical: 15), + highlightElevation: 0.0, + splashColor: Color(0xff3A903A), + highlightColor: Color(0xff3A903A), + elevation: 0.0, + color: Colors.white70, + shape: RoundedRectangleBorder( + borderRadius: new BorderRadius.all(Radius.circular(10)), + side: BorderSide(color: Color(0xff3A903A)) + ), + + child: Text( + 'Batal', + style: TextStyle(fontSize: 20, color: Colors.black, fontWeight: FontWeight.bold), + ), + onPressed: (){ + _resetInput(); + } + + ), + + ), + ), + + SizedBox(width: 5,), + Expanded( + child : ButtonTheme( + key: Key("Simpan Button"), + minWidth: double.infinity, + height: 40, + child: submitButton( + 'Simpan', Color(0xff3A903A), Colors.white, + Color(0xff3A903A), Colors.white, _validateLoginInput), + ), + + ), + + ], + ), ), ], @@ -176,7 +231,7 @@ class AddInformasiState extends State<AddInformasi> { ); } - TextEditingController deskripsiController = TextEditingController(); + addInfo(String tag, String deskripsi, String rating) async { for(MapEntry<String, bool> me in fasilitas.entries) if(me.value == true) tag = tag + tags[me.key] + ' '; @@ -218,6 +273,15 @@ class AddInformasiState extends State<AddInformasi> { } } + void _resetInput() async{ + deskripsiController.clear(); + rating = 0.0; + _clearImage(); + _clearCheckBox(); + + + } + } \ No newline at end of file