openTextSegmentationDialog method
A helper function for opening a text segmentation dialog.
Implementation
Future<void> openTextSegmentationDialog({
required String sourceText,
List<String>? segmentedText,
Function(JidoujishoTextSelection)? onSelect,
Function(JidoujishoTextSelection)? onSearch,
}) async {
if (sourceText.trim().isEmpty) {
return;
}
segmentedText ??= targetLanguage.textToWords(sourceText);
await showDialog(
context: _navigatorKey.currentContext!,
builder: (context) => TextSegmentationDialogPage(
sourceText: sourceText,
segmentedText: segmentedText!,
onSelect: onSelect,
onSearch: onSearch,
),
);
}