flutter_web_image_picker 0.0.1 flutter_web_image_picker: ^0.0.1 copied to clipboard
A package designed for input images on web flutter.
import 'package:flutter/material.dart';
import 'package:flutter_web_image_picker/flutter_web_image_picker.dart';
void main() {
runApp(App());
}
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: ImagePickerPage(),
);
}
}
class ImagePickerPage extends StatefulWidget {
@override
_ImagePickerPageState createState() => _ImagePickerPageState();
}
class _ImagePickerPageState extends State<ImagePickerPage> {
Image image;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(image?.semanticLabel ?? ""),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.open_in_browser),
onPressed: () async {
final _image = await WebImagePicker.pickImage();
setState(() {
image = _image;
});
},
),
body: Center(child: image != null ? image : Text('No data...')),
);
}
}