mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
feat: UI 2.0 and other Improvements (#357)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
9ca06eaa37
commit
e7b5bb40ff
169 changed files with 4584 additions and 3626 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:iconsax_plus/iconsax_plus.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:iconsax_plus/iconsax_plus.dart';
|
||||
|
||||
import 'package:fladder/models/book_model.dart';
|
||||
import 'package:fladder/models/item_base_model.dart';
|
||||
|
|
@ -41,6 +41,37 @@ extension ItemBaseModelsBooleans on List<ItemBaseModel> {
|
|||
}
|
||||
return groupedItems;
|
||||
}
|
||||
|
||||
FladderItemType get getMostCommonType {
|
||||
final Map<FladderItemType, int> counts = {};
|
||||
|
||||
for (final item in this) {
|
||||
final type = item.type;
|
||||
counts[type] = (counts[type] ?? 0) + 1;
|
||||
}
|
||||
|
||||
return counts.entries.reduce((a, b) => a.value >= b.value ? a : b).key;
|
||||
}
|
||||
|
||||
double? getMostCommonAspectRatio({double tolerance = 0.01}) {
|
||||
final Map<int, List<double>> buckets = {};
|
||||
|
||||
for (final item in this) {
|
||||
final aspectRatio = item.primaryRatio;
|
||||
if (aspectRatio == null) continue;
|
||||
|
||||
final bucketKey = (aspectRatio / tolerance).round();
|
||||
|
||||
buckets.putIfAbsent(bucketKey, () => []).add(aspectRatio);
|
||||
}
|
||||
|
||||
if (buckets.isEmpty) return null;
|
||||
|
||||
final mostCommonBucket = buckets.entries.reduce((a, b) => a.value.length >= b.value.length ? a : b);
|
||||
|
||||
final average = mostCommonBucket.value.reduce((a, b) => a + b) / mostCommonBucket.value.length;
|
||||
return average;
|
||||
}
|
||||
}
|
||||
|
||||
enum ItemActions {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
|
@ -23,7 +22,7 @@ import 'package:fladder/screens/photo_viewer/photo_viewer_screen.dart';
|
|||
import 'package:fladder/screens/shared/adaptive_dialog.dart';
|
||||
import 'package:fladder/screens/shared/fladder_snackbar.dart';
|
||||
import 'package:fladder/screens/video_player/video_player.dart';
|
||||
import 'package:fladder/util/adaptive_layout.dart';
|
||||
import 'package:fladder/util/adaptive_layout/adaptive_layout.dart';
|
||||
import 'package:fladder/util/list_extensions.dart';
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
import 'package:fladder/util/refresh_state.dart';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue