little code cleanup
This commit is contained in:
parent
5c0763f0a9
commit
929909a000
1 changed files with 21 additions and 20 deletions
|
|
@ -71,6 +71,16 @@ class PangeaTextController extends TextEditingController {
|
|||
choreographer.igc.igcTextData!.getTopMatchIndexForOffset(
|
||||
selection.baseOffset,
|
||||
);
|
||||
|
||||
// if autoplay on and it start then just start it
|
||||
if (matchIndex != -1 &&
|
||||
choreographer.itAutoPlayEnabled &&
|
||||
choreographer.igc.igcTextData!.matches[matchIndex].isITStart) {
|
||||
return choreographer.onITStart(
|
||||
choreographer.igc.igcTextData!.matches[matchIndex],
|
||||
);
|
||||
}
|
||||
|
||||
final Widget? cardToShow = matchIndex != -1
|
||||
? SpanCard(
|
||||
scm: SpanCardModel(
|
||||
|
|
@ -82,8 +92,8 @@ class PangeaTextController extends TextEditingController {
|
|||
debugPrint("onSentenceRewrite $tokenIndex $sentenceRewrite");
|
||||
}),
|
||||
onIgnore: () => choreographer.onIgnoreMatch(
|
||||
cursorOffset: selection.baseOffset,
|
||||
),
|
||||
cursorOffset: selection.baseOffset,
|
||||
),
|
||||
onITStart: () {
|
||||
choreographer.onITStart(
|
||||
choreographer.igc.igcTextData!.matches[matchIndex],
|
||||
|
|
@ -96,24 +106,15 @@ class PangeaTextController extends TextEditingController {
|
|||
: null;
|
||||
|
||||
if (cardToShow != null) {
|
||||
if (
|
||||
choreographer.itAutoPlayEnabled &&
|
||||
choreographer.igc.igcTextData!.matches[matchIndex].isITStart
|
||||
) {
|
||||
choreographer.onITStart(
|
||||
choreographer.igc.igcTextData!.matches[matchIndex],
|
||||
);
|
||||
} else {
|
||||
OverlayUtil.showPositionedCard(
|
||||
context: context,
|
||||
cardSize: matchIndex != -1 &&
|
||||
choreographer.igc.igcTextData!.matches[matchIndex].isITStart
|
||||
? const Size(350, 260)
|
||||
: const Size(350, 400),
|
||||
cardToShow: cardToShow,
|
||||
transformTargetId: choreographer.inputTransformTargetKey,
|
||||
);
|
||||
}
|
||||
OverlayUtil.showPositionedCard(
|
||||
context: context,
|
||||
cardSize: matchIndex != -1 &&
|
||||
choreographer.igc.igcTextData!.matches[matchIndex].isITStart
|
||||
? const Size(350, 260)
|
||||
: const Size(350, 400),
|
||||
cardToShow: cardToShow,
|
||||
transformTargetId: choreographer.inputTransformTargetKey,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue