Skip to content

Commit

Permalink
chore: relayout shimmer track tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Jun 25, 2023
1 parent 925fa86 commit ea401cf
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions lib/components/shared/shimmers/shimmer_track_tile.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:spotube/collections/spotube_icons.dart';

import 'package:spotube/extensions/theme.dart';

Expand Down Expand Up @@ -26,29 +27,37 @@ class ShimmerTrackTilePainter extends CustomPainter {

canvas.drawRRect(
RRect.fromRectAndRadius(
const Rect.fromLTWH(5, 5, 40, 40),
Rect.fromLTWH(0, 0, size.height, size.height),
const Radius.circular(5),
),
Paint()..color = foreground,
);

canvas.drawCircle(
const Offset(70, 25),
15,
Paint()..color = foreground,
);

canvas.drawRRect(
RRect.fromRectAndRadius(
const Rect.fromLTWH(95, 10, 100, 10),
const Rect.fromLTWH(70, 10, 100, 10),
const Radius.circular(5),
),
Paint()..color = foreground,
);

// draw Icons.play
const icon = Icons.play_arrow_outlined;
TextPainter textPainter = TextPainter(textDirection: TextDirection.rtl);
textPainter.text = TextSpan(
text: String.fromCharCode(icon.codePoint),
style: TextStyle(
fontSize: 40.0,
fontFamily: icon.fontFamily,
color: background,
),
);
textPainter.layout();
textPainter.paint(canvas, const Offset(10, 10));

canvas.drawRRect(
RRect.fromRectAndRadius(
const Rect.fromLTWH(95, 30, 170, 7),
const Rect.fromLTWH(70, 30, 170, 7),
const Radius.circular(5),
),
Paint()..color = foreground,
Expand Down Expand Up @@ -81,7 +90,7 @@ class ShimmerTrackTile extends StatelessWidget {
return Padding(
padding: const EdgeInsets.only(bottom: 8.0, left: 8, right: 8),
child: CustomPaint(
size: const Size(double.infinity, 50),
size: const Size(double.infinity, 60),
painter: ShimmerTrackTilePainter(
background: shimmerTheme.shimmerBackgroundColor ??
theme.scaffoldBackgroundColor,
Expand All @@ -98,7 +107,7 @@ class ShimmerTrackTile extends StatelessWidget {
(BuildContext context, int index) => Padding(
padding: const EdgeInsets.only(bottom: 8.0, left: 8, right: 8),
child: CustomPaint(
size: const Size(double.infinity, 50),
size: const Size(double.infinity, 60),
painter: ShimmerTrackTilePainter(
background: shimmerTheme.shimmerBackgroundColor ??
theme.scaffoldBackgroundColor,
Expand Down

0 comments on commit ea401cf

Please sign in to comment.