No Description

main.dart 1.4KB

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