Skip to content

kosratdev/flutter-camera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flutter_camera

style: effective dart

A Flutter app example to access camera features.

Features

  • Display live camera preview.
  • Capture photos.
  • Switch between front and back cameras.
  • Control flash mode.
  • Display the captured imaged.

Getting Started

To use this example, add flutter_camera as a dependency in your pubspec.yaml file.

Usage

Here's a simple example of how to use the FlutterCameraScreen widget:

import 'dart:async';

import 'package:camera/camera.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_camera/camera/flutter_camera_screen.dart';

List<CameraDescription> _cameras = <CameraDescription>[];

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  try {
    _cameras = await availableCameras();
  } on CameraException catch (e) {
    if (kDebugMode) {
      debugPrint('Error fetching cameras: ${e.code} - ${e.description}');
    }
  }
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: FlutterCameraScreen(cameras: _cameras));
  }
}

For more detailed implementation, please refer to the flutter_camera_screen.dart widget.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors