Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

lhamycodes/amlv

Open more actions menu

Repository files navigation

AMLV

Apple Music Lyric Viewer, a Flutter package inspired by Apple Music's Lyrics Viewer, this package provides a widget that displays lyrics(srt, lrc, json) in a beautiful way.

Installation

How to install it? Follow Instructions

Use Case

  • Music Player
  • Audio Book Player
  • Podcast Player
  • Karaoke App

Features

  • Support for srt, lrc, json lyrics parsing
  • Support for creating custom lyric parsers
  • Support for customizing the lyrics widget
  • Support for playing lyrics in sync with audio

Preview

Usage

import 'const.dart';
import 'package:flutter/material.dart';
import 'package:amlv/amlv.dart';

void main() async {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'AMLV Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  LrcLyricParser parser = LrcLyricParser();
  Lyric? lyric;

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

  _loadLyrics() async {
    lyric = await parser.parse(lrcLyrics, UrlSource(lrcUrlSource));
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return lyric != null
        ? LyricViewer(
            lyric: lyric!,
            onLyricChanged: (LyricLine line, String source) {
              // ignore: avoid_print
              print("$source: [${line.time}] ${line.content}");
            },
            onCompleted: () {
              // ignore: avoid_print
              print("Completed");
            },
            gradientColor1: const Color(0xFFCC9934),
            gradientColor2: const Color(0xFF444341),
          )
        : const SizedBox();
  }
}

LICENSE

License: MIT

MIT License

Copyright (c) 2023 lhamy.codes

LICENSE file

About

Inspired by Apple Music's Lyrics Viewer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.