Fakultas Ilmu Komputer UI

Commit 31417f0c authored by Bayukanta Iqbal Gunawan's avatar Bayukanta Iqbal Gunawan
Browse files

[GREEN] adding clear button, should be working fine functionally

parent 6ebf218c
Pipeline #42292 passed with stages
in 2 minutes and 48 seconds
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment