voice_message_package 2.2.1 voice_message_package: ^2.2.1 copied to clipboard
Flutter package to play/puase voice message in chat messengers.
import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart';
import 'package:voice_message_package/voice_message_package.dart';
void main() => runApp(const MyApp());
///
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => Sizer(
builder: (_, __, ___) => MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(height: 50.h),
VoiceMessageView(
controller: VoiceController(
audioSrc:
'https://dl.solahangs.com/Music/1403/02/H/128/Hiphopologist%20-%20Shakkak%20%28128%29.mp3',
maxDuration: const Duration(seconds: 10),
isFile: false,
onComplete: () {
/// do something on complete
},
onPause: () {
/// do something on pause
},
onPlaying: () {
/// do something on playing
},
onError: (err) {
/// do somethin on error
},
),
innerPadding: 12,
cornerRadius: 20,
),
SizedBox(height: 80.h),
],
),
),
),
),
),
);
}