soundify 0.1.0 copy "soundify: ^0.1.0" to clipboard
soundify: ^0.1.0 copied to clipboard

A powerful Flutter library for contextual audio and sensory feedback.

example/main.dart

import 'package:flutter/material.dart';
import 'package:soundify/soundify.dart';

/// Entry point of the application.
void main() {
  runApp(const MyApp());
}

/// Root widget of the Soundify demo application.
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    // Create a Soundify instance with predefined rules.
    final soundify = Soundify(
      rules: [
        SoundRules.swipe(minVelocity: 600.0), // Plays on swipe with velocity
        SoundRules.shake(), // Plays on device shake
        SoundRules.tap(), // Plays on tap
        SoundRules.stateSuccess(), // Plays on 'success' state
        SoundRules.announce(text: 'Action completed'), // Speaks a message
        SoundRules.beep(frequency: 440.0), // Beeps on 'beep' event
      ],
    );

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Soundify Demo')),
        body: SoundifyWrapper(
          soundify: soundify,
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                const Text('Swipe, Tap, or Shake Me!'),

                /// Button that triggers the 'success' rule.
                ElevatedButton(
                  onPressed: () => soundify.trigger(null, data: 'success'),
                  child: const Text('Success'),
                ),

                /// Button that triggers the 'beep' rule.
                ElevatedButton(
                  onPressed: () => soundify.trigger(null, data: 'beep'),
                  child: const Text('Beep'),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
3
likes
150
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

A powerful Flutter library for contextual audio and sensory feedback.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

audioplayers, flutter, flutter_tts, haptic_feedback, sensors_plus

More

Packages that depend on soundify