sparrow_camera 1.0.2 copy "sparrow_camera: ^1.0.2" to clipboard
sparrow_camera: ^1.0.2 copied to clipboard

flutter camera

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';

import 'package:sparrow_camera/sparrow_camera.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        // body: SparrowCameraView(),
        body: SparrowCamera(
          enableAudio: true,
          enableZoom: false,
          maxCount: 6,
          maxRecordingTime: 20,
          onFile: (file) {
            print("filePath=${file.path}");
          },
          onMessage: (message) {
            print("message=$message");
          },
          onPreview: (file) {
            print("file=${file?.path}");
          },
        ),
      ),
    );
  }
}