christian_picker_image 0.0.3 copy "christian_picker_image: ^0.0.3" to clipboard
christian_picker_image: ^0.0.3 copied to clipboard

outdated

A new Flutter project.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:christian_picker_image/christian_picker_image.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  static const MethodChannel _channel = const MethodChannel('christian_picker_image');

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await ChristianPickerImage.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  void _pickImage() async {
    // final List<dynamic> images = await _channel.invokeMethod(
    //   'pickImages',
    //   <String, dynamic>{
    //     "maxImages": 5
    //   },);

    List<File> images  = await ChristianPickerImage.pickImages(maxImages: 5);

    print(images);

  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: $_platformVersion\n'),
        ),
        floatingActionButton: Column(
          mainAxisAlignment: MainAxisAlignment.end,
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.only(top: 16.0),
              child: FloatingActionButton(
                onPressed: () {
                  _pickImage();
                },
                tooltip: 'Take a Photo',
                child: const Icon(Icons.photo_library),
              ),
            ),
          ],
        )
      ),
    );
  }
}
43
likes
0
pub points
56%
popularity

Publisher

unverified uploader

A new Flutter project.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on christian_picker_image