Automatically prompt for file selection

This commit is contained in:
Matthew
2018-05-14 19:20:14 +02:00
parent d3e74325d3
commit 7757f5da32

View File

@ -19,8 +19,16 @@ class _Uploader extends State<Uploader> {
TextEditingController descriptionController = new TextEditingController(); TextEditingController descriptionController = new TextEditingController();
bool uploading = false; bool uploading = false;
bool promted = false;
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (file == null && promted == false){
_selectImage();
setState(() {promted = true;});
}
return file == null return file == null
? new IconButton( ? new IconButton(
icon: new Icon(Icons.file_upload), onPressed: _selectImage) icon: new Icon(Icons.file_upload), onPressed: _selectImage)