scanbot_image_picker 1.0.0-beta2 copy "scanbot_image_picker: ^1.0.0-beta2" to clipboard
scanbot_image_picker: ^1.0.0-beta2 copied to clipboard

outdated

Simple Image Picker with single and multiple selection capability.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:scanbot_image_picker/scanbot_image_picker_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

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

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

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

    if (!mounted) return;

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Image Picker'),
        ),
        body: Center(
            child: TextButton(
          child: const Text("Pick Images"),
          style: ButtonStyle(
            foregroundColor: MaterialStateProperty.all<Color>(Colors.blue),
          ),
          onPressed: () {
            pickImageFromPhotoGallery();
          },
        )),
      ),
    );
  }

  /// picks multiple images from photo gallery and prints the output of selected image uris.
  Future pickImagesFromPhotoGallery() async {
    var uris = await ScanbotImagePickerFlutter.pickImagesAsync();
    for (var uri in uris) {
      print(uri.path);
    }
  }

  /// picks single image from photo gallery and prints the output of selected image uris.
  Future pickImageFromPhotoGallery() async {
    var uri = await ScanbotImagePickerFlutter.pickImageAsync();
    print(uri.path);
  }
}
3
likes
0
pub points
80%
popularity

Publisher

verified publisherscanbot.io

Simple Image Picker with single and multiple selection capability.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, image_picker

More

Packages that depend on scanbot_image_picker