feat: displayCount
This commit is contained in:
@@ -21,7 +21,6 @@ Widget buildStatisticTile({
|
||||
required List<Player> players,
|
||||
required BuildContext context,
|
||||
double? width,
|
||||
int itemCount = 5,
|
||||
}) {
|
||||
final filteredMatches = _getFilterMatches(statistic, matches);
|
||||
final filteredPlayers = _getFilteredPlayers(
|
||||
@@ -46,7 +45,6 @@ Widget buildStatisticTile({
|
||||
title: translateStatisticTypeToString(statistic.type, context),
|
||||
width: width ?? MediaQuery.sizeOf(context).width * 0.95,
|
||||
values: values,
|
||||
itemCount: itemCount,
|
||||
barColor: _getStatisticColor(statistic),
|
||||
statistic: statistic,
|
||||
);
|
||||
@@ -297,7 +295,6 @@ Widget buildSkeletonStatisticTile({required BuildContext context}) {
|
||||
title: 'Skeleton title',
|
||||
width: MediaQuery.sizeOf(context).width * 0.95,
|
||||
values: values,
|
||||
itemCount: count,
|
||||
barColor: _colorPalette[Random().nextInt(_colorPalette.length)],
|
||||
statistic: Statistic(
|
||||
type: StatisticType.totalMatches,
|
||||
|
||||
@@ -26,7 +26,6 @@ class StatisticsTile extends StatelessWidget {
|
||||
required this.title,
|
||||
required this.width,
|
||||
required this.values,
|
||||
required this.itemCount,
|
||||
required this.barColor,
|
||||
required this.statistic,
|
||||
});
|
||||
@@ -43,9 +42,6 @@ class StatisticsTile extends StatelessWidget {
|
||||
/// A list of tuples containing labels and their corresponding numeric values.
|
||||
final List<(Player, num)> values;
|
||||
|
||||
/// The maximum number of items to display.
|
||||
final int itemCount;
|
||||
|
||||
/// The color of the bars representing the values.
|
||||
final Color barColor;
|
||||
|
||||
@@ -74,7 +70,7 @@ class StatisticsTile extends StatelessWidget {
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final maxBarWidth = constraints.maxWidth * 0.8;
|
||||
final displayCount = min(values.length, itemCount);
|
||||
final displayCount = min(values.length, statistic.displayCount);
|
||||
final displayValues = values.take(displayCount).toList();
|
||||
final maxVal = displayValues.isNotEmpty
|
||||
? displayValues.fold<num>(
|
||||
|
||||
Reference in New Issue
Block a user