simple_audio_recorder 0.2.3 copy "simple_audio_recorder: ^0.2.3" to clipboard
simple_audio_recorder: ^0.2.3 copied to clipboard

Simple layout for audio recording

example/lib/main.dart

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

void main() => runApp(const App());

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

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

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

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  String? _audioPath;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Simple Audio Recorder')),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            ElevatedButton(
              onPressed: () async {
                final audioPath = await SimpleAudioRecorder.open(
                  context,
                  recordConfig: const RecordConfig(
                    encoder: AudioEncoder.opus,
                  ),
                );
                if (audioPath != null) {
                  setState(() {
                    _audioPath = audioPath;
                  });
                }
              },
              child: const Text('Open Audio Recorder'),
            ),
            if (_audioPath != null) ...[
              const SizedBox(
                height: 24,
              ),
              AudioPlayerWidget(
                key: UniqueKey(),
                audioPath: _audioPath!,
              ),
            ],
          ],
        ),
      ),
    );
  }
}
2
likes
140
points
6
downloads

Publisher

unverified uploader

Weekly Downloads

Simple layout for audio recording

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, just_audio, path_provider, record, sound_waveform, uuid, wakelock_plus

More

Packages that depend on simple_audio_recorder