fixes for exiting IT and editing original message

This commit is contained in:
Matthew 2024-06-07 22:17:48 -04:00
parent 27c641e8e4
commit 40c4045f86
2 changed files with 23 additions and 7 deletions

View file

@ -61,11 +61,9 @@ class ITController {
}
void closeIT() {
//if they close it before choosing anything, just put their text back
//if they close it before completing, just put their text back
//PTODO - explore using last itStep
if (choreographer.currentText.isEmpty) {
choreographer.textController.text = sourceText ?? "";
}
choreographer.textController.text = sourceText ?? "";
clear();
}
@ -217,8 +215,20 @@ class ITController {
Future<void> onEditSourceTextSubmit(String newSourceText) async {
try {
sourceText = newSourceText;
_isOpen = true;
_isEditingSourceText = false;
_itStartData = ITStartData(newSourceText, choreographer.l1LangCode);
completedITSteps = [];
currentITStep = null;
nextITStep = null;
goldRouteTracker = GoldRouteTracker.defaultTracker;
payLoadIds = [];
_setSourceText();
getTranslationData(false);
/*sourceText = newSourceText;
final String currentText = choreographer.currentText;
choreographer.startLoading();
@ -241,7 +251,7 @@ class ITController {
storedGoldContinuances: goldRouteTracker.continuances,
);
_addPayloadId(responses[1]);
_addPayloadId(responses[1]);*/
} catch (err, stack) {
debugger(when: kDebugMode);
if (err is! http.Response) {
@ -252,6 +262,7 @@ class ITController {
);
} finally {
choreographer.stopLoading();
choreographer.textController.text = "";
}
}

View file

@ -184,7 +184,12 @@ class OriginalText extends StatelessWidget {
),
),
),
if (!controller.isEditingSourceText && controller.sourceText != null)
if (
!controller.isEditingSourceText
&& controller.sourceText != null
&& controller.completedITSteps.length
< controller.goldRouteTracker.continuances.length
)
IconButton(
onPressed: () => controller.setIsEditingSourceText(true),
icon: const Icon(Icons.edit_outlined),