The import format gains the blocks lessons need: tables (rows of cells), callouts (a kind, a title, blocks inside, but no table or callout), spoilers, quotes and dividers; and runs of text gain a reading shown as furigana, a colour, underline and strikethrough. A line break is a "\n" in the text. Still simple blocks turned into rich text here, so a change of the editor's own format never breaks a file written before. A table's columns are as wide as their longest line, narrowed alike to fit a phone, where the cells wrap. A studyset's Import › Learning paths now takes several files at once, one path each, stored in the order of their names, so a chapter's lessons come in with one pick. Every file is read before anything is stored: one that can't be read is named, and nothing comes in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
32 lines
838 B
Dart
32 lines
838 B
Dart
import 'package:halkyon_learn_flutter/src/core/files/file_picker.dart';
|
|
|
|
/// A [FilePicker] that "picks" [next], if set, and notes what it was asked
|
|
/// for.
|
|
class FakeFilePicker() implements FilePicker {
|
|
/// What the next pick gives; null as if the person cancelled.
|
|
PickedFile? next;
|
|
|
|
/// What the next pick of several gives; [next] alone if null.
|
|
List<PickedFile>? nextMany;
|
|
|
|
/// The extensions of each pick asked for, in order.
|
|
final asked = <List<String>>[];
|
|
|
|
@override
|
|
Future<PickedFile?> pick({
|
|
required String label,
|
|
required List<String> extensions,
|
|
}) async {
|
|
asked.add(extensions);
|
|
return next;
|
|
}
|
|
|
|
@override
|
|
Future<List<PickedFile>> pickMany({
|
|
required String label,
|
|
required List<String> extensions,
|
|
}) async {
|
|
asked.add(extensions);
|
|
return nextMany ?? [?next];
|
|
}
|
|
}
|