advanced_media_picker 0.0.16 copy "advanced_media_picker: ^0.0.16" to clipboard
advanced_media_picker: ^0.0.16 copied to clipboard

This plugin displays a gallery with user's Albums and Photos with ability to take photo and video.

example/lib/main.dart

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

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

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ValueListenableBuilder<List<XFile>>(
              valueListenable: selectedFiles,
              builder:
                  (BuildContext context, List<XFile> value, Widget? child) {
                return Column(
                  children: value.map((XFile file) {
                    return Text(file.path);
                  }).toList(),
                );
              },
            ),
            MyButton(),
          ],
        ),
      ),
    );
  }
}

final ValueNotifier<List<XFile>> selectedFiles =
    ValueNotifier<List<XFile>>(<XFile>[]);

class MyButton extends StatelessWidget {
  MyButton({super.key});

  final PickerController controller = PickerController();

  @override
  Widget build(BuildContext context) {
    return Center(
      child: ElevatedButton(
        child: const Text('Open Picker'),
        onPressed: () async {
          final List<XFile> result = await AdvancedMediaPicker.openPicker(
            context: context,
            controller: controller,
            isNeedVideoCamera: false,
            isNeedToShowCamera: true,
            style: PickerStyle(),
            cameraStyle: CameraStyle(),
            allowedTypes: PickerAssetType.imageAndVideo,
            maxVideoDuration: 60,
            selectionLimit: 2,
          );
          print('#result# : $result');
          selectedFiles.value = result;
        },
      ),
    );
  }
}
13
likes
0
pub points
67%
popularity

Publisher

unverified uploader

This plugin displays a gallery with user's Albums and Photos with ability to take photo and video.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

camera, camerawesome_fork, collection, cross_file, file_picker, flutter, flutter_sticky_header, photo_manager, photo_manager_image_provider, video_thumbnail

More

Packages that depend on advanced_media_picker