anandnet / Harmony-Music

A cross platform App for streaming Music
GNU General Public License v3.0
1.04k stars 81 forks source link

can you please add animation on lyrics page and make it more beautiful #262

Closed tesliantech closed 2 months ago

tesliantech commented 2 months ago

Is your feature request related to a problem or new idea? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] or new idea

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

tesliantech commented 2 months ago

here updated widgetfile import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_lyric/lyrics_reader.dart'; import 'package:get/get.dart';

import '../../widgets/loader.dart'; import '../player_controller.dart';

class LyricsWidget extends StatefulWidget { final EdgeInsetsGeometry padding; const LyricsWidget({super.key, required this.padding});

@override _LyricsWidgetState createState() => _LyricsWidgetState(); }

class _LyricsWidgetState extends State with SingleTickerProviderStateMixin { late AnimationController _animationController; late Animation<Color?> _colorAnimation;

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

_animationController = AnimationController(
  duration: const Duration(seconds: 3),
  vsync: this,
  upperBound: 1.0,
)..repeat(reverse: true);

_colorAnimation = ColorTween(
  begin: Colors.purpleAccent,
  end: Colors.blueAccent,
).animate(_animationController);

}

@override void dispose() { _animationController.dispose(); super.dispose(); }

@override Widget build(BuildContext context) { final playerController = Get.find();

return Obx(
  () => Stack(
    children: [
      AnimatedBuilder(
        animation: _animationController,
        builder: (context, child) => Container(
          decoration: BoxDecoration(
            gradient: LinearGradient(
              colors: [Colors.purple, Colors.blue],
              begin: Alignment.topLeft,
              end: Alignment.bottomRight,
              stops: [0.0, _animationController.value],
            ),
            borderRadius: BorderRadius.circular(15),
          ),
        ),
      ),
      BackdropFilter(
        filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
        child: Container(
          decoration: BoxDecoration(
            color: Colors.black.withOpacity(0.3),
            borderRadius: BorderRadius.circular(15),
          ),
        ),
      ),
      Center(
        child: playerController.isLyricsLoading.isTrue
            ? const Center(
                child: LoadingIndicator(),
              )
            : playerController.lyricsMode.toInt() == 1
                ? SingleChildScrollView(
                    physics: const BouncingScrollPhysics(),
                    padding: widget.padding,
                    child: Obx(
                      () => Text(
                        playerController.lyrics["plainLyrics"] == "NA"
                            ? "lyricsNotAvailable".tr
                            : playerController.lyrics["plainLyrics"],
                        textAlign: TextAlign.center,
                        style: TextStyle(
                          fontSize: 24,
                          fontWeight: FontWeight.bold,
                          color: _colorAnimation.value,
                          shadows: [
                            Shadow(
                              offset: Offset(0, 0),
                              blurRadius: 10.0,
                              color:
                                  _colorAnimation.value!.withOpacity(0.6),
                            ),
                          ],
                        ),
                      ),
                    ),
                  )
                : IgnorePointer(
                    child: LyricsReader(
                      padding: const EdgeInsets.only(left: 5, right: 5),
                      lyricUi: playerController.lyricUi,
                      position: playerController
                          .progressBarStatus.value.current.inMilliseconds,
                      model: LyricsModelBuilder.create()
                          .bindLyricToMain(
                              playerController.lyrics['synced'].toString())
                          .getModel(),
                      emptyBuilder: () => Center(
                        child: Text(
                          "syncedLyricsNotAvailable".tr,
                          style: TextStyle(
                            fontSize: 24,
                            fontWeight: FontWeight.bold,
                            color: _colorAnimation.value,
                            shadows: [
                              Shadow(
                                offset: Offset(0, 0),
                                blurRadius: 10.0,
                                color:
                                    _colorAnimation.value!.withOpacity(0.6),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ),
                  ),
      ),
    ],
  ),
);

} }