ios_system_sound 0.0.2 copy "ios_system_sound: ^0.0.2" to clipboard
ios_system_sound: ^0.0.2 copied to clipboard

PlatformiOS

Playing UI Sound Effects or Invoking Vibration Using System Sound Services on iOS. 使用系统声音服务(System Sound Services)播放 iOS 系统 UI 音效或触发振动的 Flutter 插件。

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:ios_system_sound/ios_system_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> {
  final _iosSystemSoundPlugin = IosSystemSound();

  @override
  void initState() {
    super.initState();
  }

  void _onSoundTap(SystemSoundID soundId) {
    _iosSystemSoundPlugin.play(soundId);
  }

  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      home: CupertinoPageScaffold(
        backgroundColor: CupertinoDynamicColor.resolve(
          CupertinoColors.systemGroupedBackground,
          context,
        ),
        child: CustomScrollView(
          slivers: [
            const CupertinoSliverNavigationBar(
              largeTitle: Text('iOS System Sound'),
            ),
            SliverPadding(
              padding: EdgeInsets.only(
                top: 16.0,
                bottom: MediaQuery.of(context).padding.bottom,
              ),
              sliver: SliverToBoxAdapter(
                child: CupertinoFormSection.insetGrouped(
                  children: SystemSoundID.values.map((soundId) {
                    return CupertinoListTile(
                      title: Text(soundId.name),
                      subtitle: Text('ID: ${soundId.value}'),
                      trailing: CupertinoListTileChevron(),
                      onTap: () => _onSoundTap(soundId),
                    );
                  }).toList(),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
150
points
181
downloads

Documentation

API reference

Publisher

verified publishernoob-coder.com

Weekly Downloads

Playing UI Sound Effects or Invoking Vibration Using System Sound Services on iOS. 使用系统声音服务(System Sound Services)播放 iOS 系统 UI 音效或触发振动的 Flutter 插件。

Repository (GitHub)
View/report issues

Topics

#sound #voice #audio #system-sound #cupertino

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on ios_system_sound

Packages that implement ios_system_sound