flutter_timer_camera 1.0.4 copy "flutter_timer_camera: ^1.0.4" to clipboard
flutter_timer_camera: ^1.0.4 copied to clipboard

A Flutter package that allows you to open the camera and capture images with a timer logic. Perfect for those moments when you need a delay before the shot!

example/lib/main.dart

import 'dart:io';

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

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  runApp(const App());
}

class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: _Home(),
    );
  }
}

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

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

class _HomeState extends State<_Home> {
  XFile? currentImage;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Timer Camera'),
        centerTitle: true,
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            ElevatedButton(
              onPressed: () {
                showTimerCamera(
                  context: context,
                  onSubmit: (XFile? capturedImage) {
                    setState(() {
                      currentImage = capturedImage;
                    });
                  },
                );
              },
              child: const Text('Open Camera 1'),
            ),
            ElevatedButton(
              onPressed: () {
                showTimerCamera(
                  context: context,
                  defaultTimerOptionIndex: 1,
                  timerOptions: [
                    TimerOption(label: 'zero', startCounter: 0),
                    TimerOption(label: '5sec', startCounter: 5),
                    TimerOption(label: '8sec', startCounter: 8),
                  ],
                  onSubmit: (capturedImage) {
                    setState(() {
                      currentImage = capturedImage;
                    });
                  },
                );
              },
              child: const Text('Open Camera 2'),
            ),
            currentImage == null
                ? const SizedBox.shrink()
                : SizedBox(
                    width: 300,
                    height: 300,
                    child: Image.file(File(currentImage!.path)),
                  ),
          ],
        ),
      ),
    );
  }
}
3
likes
130
points
48
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that allows you to open the camera and capture images with a timer logic. Perfect for those moments when you need a delay before the shot!

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

camera, camera_platform_interface, custom_sliding_segmented_control, flutter, flutter_riverpod, freezed_annotation

More

Packages that depend on flutter_timer_camera