bottom_navbar_player 0.0.1 copy "bottom_navbar_player: ^0.0.1" to clipboard
bottom_navbar_player: ^0.0.1 copied to clipboard

outdated

A Flutter plugin to play media in BottomNavigationBar.

example/lib/main.dart

import 'package:bottom_navbar_player/bottom_navbar_player.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) {
    final bottomNavBarPlayer = BottomNavBarPlayer();
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Bottom NavBar Player'),
        ),
        body: Center(
            child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            /// For when the sound is played over the http URL [sourceType: SourceType.url]
            MaterialButton(
              onPressed: () => bottomNavBarPlayer.play(
                  'https://download.samplelib.com/mp3/sample-9s.mp3',
                  sourceType: SourceType.url),
              child: const Text('play from URL'),
            ),

            /// For when the sound is played over the asset path [sourceType: SourceType.asset]
            MaterialButton(
              onPressed: () => bottomNavBarPlayer.play('assets/audio.mp3',
                  sourceType: SourceType.asset),
              child: const Text('play from Asset'),
            ),

            /// For when the sound is played through the file stored in the memory [sourceType: SourceType.file]
            MaterialButton(
              onPressed: () => bottomNavBarPlayer.play(
                  '/storage/sdcard/Download/audio_file.mp3',
                  sourceType: SourceType.file),
              child: const Text('play from File'),
            ),
          ],
        )),
        bottomSheet: bottomNavBarPlayer.view(),
      ),
    );
  }
}
6
likes
0
points
120
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin to play media in BottomNavigationBar.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, just_audio, plugin_platform_interface

More

Packages that depend on bottom_navbar_player