summaryrefslogtreecommitdiff
path: root/lib/screens
diff options
context:
space:
mode:
Diffstat (limited to 'lib/screens')
-rw-r--r--lib/screens/level.dart6
-rw-r--r--lib/screens/level_selection.dart28
2 files changed, 19 insertions, 15 deletions
diff --git a/lib/screens/level.dart b/lib/screens/level.dart
index e2b2195..9c5823b 100644
--- a/lib/screens/level.dart
+++ b/lib/screens/level.dart
@@ -244,11 +244,7 @@ class _LevelState extends State<Level> with SingleTickerProviderStateMixin {
)),
),
body: Stack(children: [
- Arrows(
- notes: notes,
- position: _position != null
- ? _position!.inMilliseconds.toDouble()
- : 0.0),
+ Arrows(notes: notes),
Positioned(
top: 50,
width: MediaQuery.of(context).size.width,
diff --git a/lib/screens/level_selection.dart b/lib/screens/level_selection.dart
index 41eb4f7..7241ad7 100644
--- a/lib/screens/level_selection.dart
+++ b/lib/screens/level_selection.dart
@@ -62,16 +62,24 @@ class _LevelSelectionState extends State<LevelSelection> {
try {
// List all files and folders in the directory
List<Simfile> simfiles = directory
- .listSync()
- .where((entity) => FileSystemEntity.isDirectorySync(entity.path))
- .map((entity) {
- Simfile simfile = Simfile(entity.path);
- simfile.load();
- return simfile;
- }).toList();
- simfiles.sort((a, b) => a.tags['TITLE']!.compareTo(b.tags['TITLE']!));
-
- return simfiles;
+ .listSync(recursive: true)
+ .where((entity) => entity.path.endsWith('.sm'))
+ .map((entity) => Simfile(entity.path))
+ .toList();
+
+ List<bool> successfullLoads =
+ await Future.wait(simfiles.map((simfile) => simfile.load()));
+ List<Simfile> simfilesFiltered = [];
+ for (int i = 0; i < simfiles.length; i++) {
+ if (successfullLoads[i]) {
+ simfilesFiltered.add(simfiles[i]);
+ }
+ }
+
+ simfilesFiltered
+ .sort((a, b) => a.tags['TITLE']!.compareTo(b.tags['TITLE']!));
+
+ return simfilesFiltered;
} catch (e) {
print("Error reading directory: $e");
return [];