image_picker_pro_max 0.0.1 copy "image_picker_pro_max: ^0.0.1" to clipboard
image_picker_pro_max: ^0.0.1 copied to clipboard

A package that allows you to use the native photo picker on Android

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:photo_picker/entity/media.dart';
import 'package:photo_picker/photo_picker.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

class _MyAppState extends State<MyApp> {
  final _photoPickerPlugin = PhotoPicker();

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

  Media? media;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              TextButton(
                  onPressed: () async {

                  },
                  child: const Text("Request permission")),
              Text("FILE: ${media.toString()}"),
              TextButton(
                  onPressed: () async {
                    final isGranted = await _photoPickerPlugin.requestPermission();
                    if (isGranted == false) {
                      return;
                    }
                    final result = await _photoPickerPlugin.pickMedia();
                    setState(() {
                      media = result;
                    });
                  },
                  child: const Text("Picker")),
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
130
points
25
downloads

Publisher

unverified uploader

Weekly Downloads

A package that allows you to use the native photo picker on Android

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on image_picker_pro_max