mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-08 16:27:31 +00:00
68 lines
1.9 KiB
Dart
68 lines
1.9 KiB
Dart
import 'package:auto_size_text/auto_size_text.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:gap/gap.dart';
|
|
import 'package:spotube/collections/formatters.dart';
|
|
|
|
class SummaryCard extends StatelessWidget {
|
|
final double title;
|
|
final String unit;
|
|
final String description;
|
|
|
|
final MaterialColor color;
|
|
|
|
const SummaryCard({
|
|
super.key,
|
|
required this.title,
|
|
required this.unit,
|
|
required this.description,
|
|
required this.color,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final ThemeData(:textTheme, :brightness) = Theme.of(context);
|
|
|
|
return Card(
|
|
color: brightness == Brightness.dark ? color.shade100 : color.shade50,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 15),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
AutoSizeText.rich(
|
|
TextSpan(
|
|
children: [
|
|
TextSpan(
|
|
text: compactNumberFormatter.format(title),
|
|
style: textTheme.headlineLarge?.copyWith(
|
|
color: color.shade900,
|
|
),
|
|
),
|
|
TextSpan(
|
|
text: " $unit",
|
|
style: textTheme.titleMedium?.copyWith(
|
|
color: color.shade900,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
maxLines: 1,
|
|
),
|
|
const Gap(5),
|
|
AutoSizeText(
|
|
description,
|
|
maxLines: 1,
|
|
minFontSize: 9,
|
|
style: textTheme.labelMedium!.copyWith(
|
|
color: color.shade900,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|