skycap_audio_manager 1.1.0+3 copy "skycap_audio_manager: ^1.1.0+3" to clipboard
skycap_audio_manager: ^1.1.0+3 copied to clipboard

A simple and customizable Flutter audio player package.

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';
import 'package:skycap_audio_manager/extras/audio_exports.dart';
import 'package:skycap_audio_manager/extras/audio_metadata.dart';
import 'package:skycap_audio_manager/gen/fonts.gen.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 GetMaterialApp(
      theme: ThemeData.light(useMaterial3: true).copyWith(
        primaryColor: Colors.black,
        cardColor: Colors.white.withOpacity(0.5),
        textTheme: TextTheme(

          headlineSmall: TextStyle(
              fontSize: 18, fontWeight: FontWeight.w600, color: Colors.black),
          bodyLarge: TextStyle(
              fontFamily: FontFamily.poppins, // Font family used
              color:
                  Colors.black, // Text color for better visibility in dark mode
              fontSize: 14),

          titleLarge: TextStyle(
              fontFamily: FontFamily.poppins, // Font family used
              color:
                  Colors.black, // Text color for better visibility in dark mode
              fontSize: 14),
          headlineMedium: TextStyle(
              fontFamily: FontFamily.poppins, // Font family used
              color:
                  Colors.black, // Text color for better visibility in dark mode
              fontSize: 14),
          // Medium display text style configuration
          displayMedium: TextStyle(
            fontFamily: FontFamily.poppins, // Font family used
            color: Colors.black, // Text color
            fontSize: 14,
          ),
        ),
      ),
      darkTheme: ThemeData.dark(useMaterial3: true).copyWith(
          primaryColor: Colors.white70,
          cardColor: Colors.white,
          textTheme: TextTheme(

            headlineSmall: TextStyle(
                fontSize: 18, fontWeight: FontWeight.w600, color: Colors.white),
            bodyLarge: TextStyle(
                fontFamily: FontFamily.poppins, // Font family used
                color: Colors
                    .white, // Text color for better visibility in dark mode
                fontSize: 14),
            titleLarge: TextStyle(
                fontFamily: FontFamily.poppins, // Font family used
                color: Colors
                    .white, // Text color for better visibility in dark mode
                fontSize: 14),

            // Medium display text style
            headlineMedium: TextStyle(
              fontFamily: FontFamily.poppins, // Font family used
              color:
                  Colors.white, // Text color for better visibility in dark mode
              fontSize: 14,
            ),
          )),
      themeMode: ThemeMode.system,
      home: HomePage(),
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: [
        const Locale('en', 'US'), // English
        const Locale('he', 'IL'), // Hebrew
        const Locale('de', 'AT'), // Hebrew
        const Locale('hi', 'HI'), // Hebrew
        // ... other locales the app supports
      ],
    );
  }
}



/// Second Pages
class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.red,
        title: const Text('Home Page'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            _buildPlayerButton(
              title: "Play Music",
              onPressed: () {
                NavigationRoutes.openAudioPlayer(
                    title: 'Audio Header',
                    items: [
                      AudioMetadata(
                          album: 'Test Album',
                          title: 'Song Maan1',

                          audioLink: 'https://p320.djpunjab.is/data/48/57180/306937/Hawa%20De%20Bulle%20-%20Sharry%20Maan.mp3', )
                    ]);
              },
            ),
            const SizedBox(height: 50),
            _buildPlayerButton(
                onPressed: () async {
                  var file = await NavigationRoutes.openAudioRecorder(
                      maxDuration: Duration(seconds: 10),
                      title: "Recorder",
                      description: "");
                  if (kDebugMode) {
                    print('File Path : ${file?.path}');
                  }
                },
                title: 'Audio Decoder'),
            const SizedBox(height: 50),
            _buildPlayerButton(
                onPressed: () async {
                  NavigationRoutes.openVideoPlayer(
                      videoPath:
                      'https://www.w3schools.com/tags/mov_bbb.mp4',
                      title: 'Video');
                },
                title: 'Video Player'),
          ],
        ),
      ),
    );
  }

  /// Helper method to create a "Play Music" button.
  Widget _buildPlayerButton(
      {required String title, required VoidCallback onPressed}) {
    return ElevatedButton(
      onPressed: () {
        onPressed.call();
      },
      child: Text(title),
    );
  }
}
5
likes
140
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A simple and customizable Flutter audio player package.

Repository

Documentation

API reference

License

MIT (license)

Dependencies

audio_session, chewie, flutter, flutter_localizations, get, intl, just_audio, path_provider, record, video_player

More

Packages that depend on skycap_audio_manager