basic_beep 1.0.3
basic_beep: ^1.0.3 copied to clipboard
A lite module to play system sounds and beep for flutter mobile and web
import 'package:basic_beep/basic_beep.dart';
import 'package:basic_beep/data/models/android_sound_ids.dart';
import 'package:basic_beep/data/models/ios_sound_ids.dart';
import 'package:flutter/material.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
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Plugin example app')),
body: Center(
child: Column(
children: <Widget>[
ElevatedButton(
child: Text("Beep Success"),
onPressed: () => BasicBeep.beep(),
),
SizedBox(height: 8),
ElevatedButton(
child: Text("Beep Fail"),
onPressed: () => BasicBeep.beep(false),
),
SizedBox(height: 8),
ElevatedButton(
child: Text("Beep Android Custom"),
onPressed: () => BasicBeep.playSysSound(
AndroidSoundIDs.TONE_CDMA_ABBR_ALERT,
),
),
SizedBox(height: 8),
ElevatedButton(
child: Text("Beep something"),
onPressed: () => BasicBeep.playSysSound(41),
),
SizedBox(height: 8),
ElevatedButton(
child: Text("Beep iOS Custom"),
onPressed: () =>
BasicBeep.playSysSound(IosSoundIDs.AudioToneBusy),
),
],
),
),
),
);
}
}