Skip to content

Commit

Permalink
feat: Implement a glowing light to lyrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Losses committed Dec 14, 2024
1 parent 196e7f7 commit 7b38baa
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions lib/screens/lyrics/widgets/lyric_section.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import 'dart:ui';

import 'package:fluent_ui/fluent_ui.dart';

import '../../../messages/all.dart';

const double fontSize = 24;
const fontWeight = FontWeight.w600;

class LyricSection extends StatefulWidget {
final LyricContentLineSection section;
final int currentTimeMilliseconds;
Expand Down Expand Up @@ -79,7 +84,8 @@ class _LyricSectionState extends State<LyricSection>
if (widget.currentTimeMilliseconds >= widget.section.endTime) {
return 1.0;
} else if (widget.currentTimeMilliseconds > widget.section.startTime) {
return (widget.currentTimeMilliseconds - widget.section.startTime) / duration;
return (widget.currentTimeMilliseconds - widget.section.startTime) /
duration;
}
return 0.0;
}
Expand All @@ -96,7 +102,8 @@ class _LyricSectionState extends State<LyricSection>
Text(
widget.section.content,
style: TextStyle(
fontSize: 20,
fontSize: fontSize,
fontWeight: fontWeight,
color: widget.isPassed
? theme.resources.textFillColorPrimary
: theme.resources.textFillColorPrimary.withAlpha(160),
Expand All @@ -110,15 +117,38 @@ class _LyricSectionState extends State<LyricSection>
child: Text(
widget.section.content,
style: TextStyle(
fontSize: 20,
fontSize: fontSize,
fontWeight: fontWeight,
color: theme.resources.textFillColorPrimary,
),
),
),
),
if (widget.isActive)
ImageFiltered(
imageFilter: ImageFilter.blur(
sigmaX: 3,
sigmaY: 3,
tileMode: TileMode.decal,
),
child: ClipRect(
child: Align(
alignment: Alignment.centerLeft,
widthFactor: _animation.value,
child: Text(
widget.section.content,
style: TextStyle(
fontSize: fontSize,
fontWeight: fontWeight,
color: theme.resources.textFillColorPrimary,
),
),
),
),
),
],
);
},
);
}
}
}

0 comments on commit 7b38baa

Please sign in to comment.