Keine Beschreibung

main.dart 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import 'package:flutter/material.dart';
  2. import 'package:photo/photo.dart';
  3. void main() => runApp(new MyApp());
  4. class MyApp extends StatelessWidget {
  5. // This widget is the root of your application.
  6. @override
  7. Widget build(BuildContext context) {
  8. return new MaterialApp(
  9. title: 'Pick Image Demo',
  10. theme: new ThemeData(
  11. primarySwatch: Colors.blue,
  12. ),
  13. home: new MyHomePage(title: 'Pick Image Demo'),
  14. );
  15. }
  16. }
  17. class MyHomePage extends StatefulWidget {
  18. MyHomePage({Key key, this.title}) : super(key: key);
  19. final String title;
  20. @override
  21. _MyHomePageState createState() => new _MyHomePageState();
  22. }
  23. class _MyHomePageState extends State<MyHomePage> {
  24. void _pickImage() async{
  25. var imgList = await PhotoPicker.pickImage(
  26. context: context,
  27. themeColor: Colors.green,
  28. padding: 5.0,
  29. dividerColor: Colors.deepOrange,
  30. disableColor: Colors.grey.shade300,
  31. itemRadio: 0.88,
  32. );
  33. print(imgList);
  34. }
  35. @override
  36. Widget build(BuildContext context) {
  37. return new Scaffold(
  38. appBar: new AppBar(
  39. title: new Text(widget.title),
  40. ),
  41. body: Container(),
  42. floatingActionButton: new FloatingActionButton(
  43. onPressed: _pickImage,
  44. tooltip: 'pickImage',
  45. child: new Icon(Icons.add),
  46. ),
  47. );
  48. }
  49. }