whatsapp_camera 1.0.0 copy "whatsapp_camera: ^1.0.0" to clipboard
whatsapp_camera: ^1.0.0 copied to clipboard

This is a package to open a camera along with a photo gallery, to simplify the steps of the end user

example/lib/main.dart

import 'dart:io';

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

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: Home());
  }
}

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

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  final files = ValueNotifier(<File>[]);

  @override
  void initState() {
    files.addListener(() => setState(() {}));
    super.initState();
  }

  @override
  void dispose() {
    files.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("whatsapp camera")),
      floatingActionButton: FloatingActionButton(
        child: const Icon(Icons.camera),
        onPressed: () async {
          List<File>? res = await Navigator.push(
            context,
            MaterialPageRoute(
              builder: (context) => const WhatsappCamera(),
            ),
          );
          if (res != null) files.value = res;
        },
      ),
      body: ListView.builder(
        itemCount: files.value.length,
        itemBuilder: (context, index) {
          return SizedBox(
            height: 200,
            width: 200,
            child: Image.file(files.value[index]),
          );
        },
      ),
    );
  }
}
44
likes
140
points
138
downloads

Publisher

unverified uploader

Weekly Downloads

This is a package to open a camera along with a photo gallery, to simplify the steps of the end user

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

camera_camera, file_picker, flutter, flutter_sliding_up_panel, permission_handler, photo_gallery, photo_view

More

Packages that depend on whatsapp_camera