rwa_camera 0.0.31 copy "rwa_camera: ^0.0.31" to clipboard
rwa_camera: ^0.0.31 copied to clipboard

This is custom camera with flash mode and multiple photo camera preview all you need to do is call OpenCamera and wait for List of XFile which will contain the list of image that the user have taken. [...]

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:rwa_camera/CameraModule/OpenCamera.dart';

void main() {
  runApp(HomePage());
}

class HomePage extends StatelessWidget {
  const HomePage({Key key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MainPage(),
    );
  }
}

class MainPage extends StatefulWidget {

   MainPage({
    Key key,
  }) : super(key: key);

  @override
  _MainPageState createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  List<XFile> listImageFile = [];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: [
            Row(
              children: [
                Column(children: [
                  ElevatedButton(
                      onPressed: () async {
                        listImageFile.addAll(await Navigator.push(
                            context,
                            new MaterialPageRoute(
                                builder: (context) => new OpenCamera(
                                  switchCamera: true,
                                  totalQuestion: 1,
                                ))));
                        setState(() {

                        });

                      },
                      child: Text('default')),
                  ElevatedButton(
                      onPressed: () async {

                        listImageFile.addAll(await Navigator.push(
                            context,
                            new MaterialPageRoute(
                                builder: (context) => new OpenCamera(
                                  switchCamera: true,
                                  totalQuestion: 1,
                                  uiStyle: UiStyle.smooth,

                                ))));
                        setState(() {

                        });
                      },
                      child: Text('smooth')),
                  ElevatedButton(
                      onPressed: () async {

                        listImageFile.addAll(await Navigator.push(
                            context,
                            new MaterialPageRoute(
                                builder: (context) => new OpenCamera(
                                  switchCamera: true,
                                  totalQuestion: 1,
                                  uiStyle: UiStyle.overlay,

                                ))));
                        setState(() {

                        });
                      },
                      child: Text('overlay')),
                  ElevatedButton(
                      onPressed: () async {

                        listImageFile.addAll(await Navigator.push(
                            context,
                            new MaterialPageRoute(
                                builder: (context) => new OpenCamera(
                                  switchCamera: true,
                                  totalQuestion: 1,
                                  uiStyle: UiStyle.cropOverlay,

                                ))));
                        setState(() {

                        });
                      },
                      child: Text('crop')),
                ],),
                Column(children: [
                  ElevatedButton(
                      onPressed: () async {
                        listImageFile.addAll(await Navigator.push(
                            context,
                            new MaterialPageRoute(
                                builder: (context) => new OpenCamera(
                                  switchCamera: true,
                                  totalQuestion: 5,
                                ))));
                        setState(() {

                        });

                      },
                      child: Text('default')),
                  ElevatedButton(
                      onPressed: () async {

                        listImageFile.addAll(await Navigator.push(
                            context,
                            new MaterialPageRoute(
                                builder: (context) => new OpenCamera(
                                  switchCamera: true,
                                  totalQuestion: 5,
                                  uiStyle: UiStyle.smooth,

                                ))));
                        setState(() {

                        });
                      },
                      child: Text('smooth')),
                  ElevatedButton(
                      onPressed: () async {

                        listImageFile.addAll(await Navigator.push(
                            context,
                            new MaterialPageRoute(
                                builder: (context) => new OpenCamera(
                                  switchCamera: true,
                                  totalQuestion: 5,
                                  uiStyle: UiStyle.overlay,

                                ))));
                        setState(() {

                        });
                      },
                      child: Text('overlay')),
                  ElevatedButton(
                      onPressed: () async {

                        listImageFile.addAll(await Navigator.push(
                            context,
                            new MaterialPageRoute(
                                builder: (context) => new OpenCamera(
                                  switchCamera: true,
                                  totalQuestion: 5,
                                  uiStyle: UiStyle.cropOverlay,

                                ))));
                        setState(() {

                        });
                      },
                      child: Text('crop')),
                ],)
              ],
            ),
            Divider(
              thickness: 3,
              color: Colors.black,
            ),
            Expanded(
              child: GridView.count(
                // Create a grid with 2 columns. If you change the scrollDirection to
                // horizontal, this produces 2 rows.
                crossAxisCount: 3,
                // Generate 100 widgets that display their index in the List.
                children: List.generate(listImageFile.length, (index) {
                  return Center(
                    child: Image.file(File(listImageFile[index].path)),
                  );
                }),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
40
points
13
downloads

Publisher

verified publisherrealwishall.com

Weekly Downloads

This is custom camera with flash mode and multiple photo camera preview all you need to do is call OpenCamera and wait for List of XFile which will contain the list of image that the user have taken. By deafult it take only one image but we can change it to as many image as we want.

Homepage

License

MIT (license)

Dependencies

camera, flutter, image_editor, toast, wechat_assets_picker

More

Packages that depend on rwa_camera