chore: relayout shimmer track tiles

This commit is contained in:
Kingkor Roy Tirtho 2023-06-25 17:29:24 +06:00
parent 925fa86271
commit ea401cf5fe

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/extensions/theme.dart'; import 'package:spotube/extensions/theme.dart';
@ -26,21 +27,7 @@ class ShimmerTrackTilePainter extends CustomPainter {
canvas.drawRRect( canvas.drawRRect(
RRect.fromRectAndRadius( 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 Radius.circular(5), const Radius.circular(5),
), ),
Paint()..color = foreground, Paint()..color = foreground,
@ -48,7 +35,29 @@ class ShimmerTrackTilePainter extends CustomPainter {
canvas.drawRRect( canvas.drawRRect(
RRect.fromRectAndRadius( RRect.fromRectAndRadius(
const Rect.fromLTWH(95, 30, 170, 7), 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(70, 30, 170, 7),
const Radius.circular(5), const Radius.circular(5),
), ),
Paint()..color = foreground, Paint()..color = foreground,
@ -81,7 +90,7 @@ class ShimmerTrackTile extends StatelessWidget {
return Padding( return Padding(
padding: const EdgeInsets.only(bottom: 8.0, left: 8, right: 8), padding: const EdgeInsets.only(bottom: 8.0, left: 8, right: 8),
child: CustomPaint( child: CustomPaint(
size: const Size(double.infinity, 50), size: const Size(double.infinity, 60),
painter: ShimmerTrackTilePainter( painter: ShimmerTrackTilePainter(
background: shimmerTheme.shimmerBackgroundColor ?? background: shimmerTheme.shimmerBackgroundColor ??
theme.scaffoldBackgroundColor, theme.scaffoldBackgroundColor,
@ -98,7 +107,7 @@ class ShimmerTrackTile extends StatelessWidget {
(BuildContext context, int index) => Padding( (BuildContext context, int index) => Padding(
padding: const EdgeInsets.only(bottom: 8.0, left: 8, right: 8), padding: const EdgeInsets.only(bottom: 8.0, left: 8, right: 8),
child: CustomPaint( child: CustomPaint(
size: const Size(double.infinity, 50), size: const Size(double.infinity, 60),
painter: ShimmerTrackTilePainter( painter: ShimmerTrackTilePainter(
background: shimmerTheme.shimmerBackgroundColor ?? background: shimmerTheme.shimmerBackgroundColor ??
theme.scaffoldBackgroundColor, theme.scaffoldBackgroundColor,