Skip to content

Instantly share code, notes, and snippets.

@javawolfpack
Created January 11, 2019 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javawolfpack/069d717593e7c00194bbd96b8e82bf19 to your computer and use it in GitHub Desktop.
Save javawolfpack/069d717593e7c00194bbd96b8e82bf19 to your computer and use it in GitHub Desktop.
Trying to make an ImageFormField
class ImageFormState extends FormFieldState<File> {
File _image;
Future getImage() async {
var image = await ImagePicker.pickImage(source: ImageSource.camera);
this._image= image;
}
@override
Widget build(BuildContext context) {
return _image == null
? new RaisedButton(
onPressed: () {
getImage();
},
child: Text('Select Image'),
):
new Image.file(_image);
}
}
class ImageFormField extends FormField<File> {
@override
FormFieldState<File> createState() => ImageFormState();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment