beep_sound 0.0.3
beep_sound: ^0.0.3 copied to clipboard
A very lite module to play system sounds and beep for flutter apps (no sound files)
example/lib/main.dart
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:beep_sound/beep_sound.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Plugin example app')),
body:
Platform.isIOS
? ListView.builder(
itemCount: IOSSoundID.values.length,
itemBuilder: (c, i) {
var item = IOSSoundID.values[i];
return ListTile(
title: Text(item.name),
onTap: () {
BeepSound().playSysSound(item.value);
},
);
},
)
: ListView.builder(
itemCount: AndroidSoundIDs.values.length,
itemBuilder: (c, i) {
var item = AndroidSoundIDs.values[i];
return ListTile(
title: Text(item.name),
onTap: () {
BeepSound().playSysSound(item.value);
},
);
},
),
),
);
}
}