Update flutter

This commit is contained in:
2024-04-26 01:14:49 +02:00
parent b26636d400
commit 67237c0a50
91 changed files with 709 additions and 1906 deletions

View File

@@ -1,8 +1,9 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:tangocard_reader/models/data_entry.dart';
import 'package:yokutango_mobile_reader/models/data_entry.dart';
// TODO: merge
@@ -28,16 +29,28 @@ Future<Map<File, List<YokutangoEntry>>> get tangocardFilePaths => rootBundle
),
);
Future<Map<File, List<KanjiEntry>>> get kanjicardFilePaths => rootBundle
.loadString('AssetManifest.json')
.then(
(json) => jsonDecode(json)
.keys
.where((String key) =>
key.contains(RegExp(r'yokutango/kanji/kanji_\d+.json')))
.toList(),
)
.then(
Future<Map<File, List<KanjiEntry>>> get kanjicardFilePaths =>
rootBundle.loadString('AssetManifest.json').then(
(json) {
final jsonKeys = jsonDecode(json).keys;
final kanjiPaths = jsonKeys
.where((String key) =>
RegExp(r'assets/yokutango/kanji/kanji_\d+.json')
.matchAsPrefix(key) !=
null)
.toList();
final kanaPaths = jsonKeys
.where((String key) =>
RegExp(r'assets/yokutango/kanji/(?:hiragana|katakana).json')
.matchAsPrefix(key) !=
null)
.toList();
return kanaPaths + kanjiPaths;
},
).then(
(l) async => Map.fromIterables(
l.map<File>((f) => File(f)),
await Future.wait<List<KanjiEntry>>(l.map<Future<List<KanjiEntry>>>(