fluffychat/lib/pangea/choreographer/models/span_card_model.dart
ggurdin 027158e286
1435 refactor into function specific groupings (#1440)
* fix: deleted unreferenced files

* fix: sort files based on function
2025-01-14 14:00:30 -05:00

39 lines
1.3 KiB
Dart

import 'package:fluffychat/pangea/choreographer/controllers/choreographer.dart';
import 'package:fluffychat/pangea/choreographer/models/pangea_match_model.dart';
import 'package:fluffychat/pangea/common/utils/error_handler.dart';
class SpanCardModel {
// IGCTextData igcTextData;
int matchIndex;
Future<void> Function({required int matchIndex, required int choiceIndex})
onReplacementSelect;
Future<void> Function(String) onSentenceRewrite;
void Function() onIgnore;
void Function() onITStart;
Choreographer choreographer;
SpanCardModel({
// required this.igcTextData,
required this.matchIndex,
required this.onReplacementSelect,
required this.onSentenceRewrite,
required this.onIgnore,
required this.onITStart,
required this.choreographer,
});
PangeaMatch? get pangeaMatch {
if (choreographer.igc.igcTextData == null) return null;
if (matchIndex >= choreographer.igc.igcTextData!.matches.length) {
ErrorHandler.logError(
m: "matchIndex out of bounds in span card",
data: {
"matchIndex": matchIndex,
"matchesLength": choreographer.igc.igcTextData?.matches.length,
},
);
return null;
}
return choreographer.igc.igcTextData?.matches[matchIndex];
}
}