fancy_audio_recorder 0.0.2 fancy_audio_recorder: ^0.0.2 copied to clipboard
Simple audio recorder ready to use (Like instant soup).
import 'dart:developer';
import 'package:fancy_audio_recorder/fancy_audio_recorder.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Fancy Sample App',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Fancy Sample App'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String? audioPath;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
AudioRecorderButton(
maxRecordTime: const Duration(seconds: 80),
onRecordComplete: (audioPath) {
log('$audioPath');
setState(() {
this.audioPath = audioPath;
});
},
),
Text('$audioPath'),
],
),
));
}
}