@override
Widget build(BuildContext context) {
final AppStateManager manager = AppStateManager.of(context);
String textLetter = manager.appState.replacementsController.text;
String textCodeElec = manager.appState.replacementsController.value.text;
// log('data: ${manager.appState.textEditingDeltaHistory.length}');
if (textLetter.toLowerCase().startsWith('ap')) {
textCodeElec += ' 01';
textLetter = textLetter.substring(2);
}
if (textLetter.toLowerCase().startsWith('uyên')) {
textCodeElec += ' 02';
textLetter = textLetter.substring(2);
}
if (textLetter.toLowerCase().startsWith('oa')) {
textCodeElec += ' 98';
textLetter = textLetter.substring(2);
}
if (textLetter.toLowerCase().startsWith('áo')) {
textCodeElec += ' 9409';
textLetter = textLetter.substring(1);
}
if (textLetter.toLowerCase().startsWith('ch')) {
textCodeElec += ' 44';
textLetter = textLetter.substring(1);
}
if (textLetter.toLowerCase().startsWith('ng')) {
textCodeElec += ' 34';
textLetter = textLetter.substring(1);
}
log('sub1: ${textLetter}');
// log('sub2: ${textLetter.substring(1)}');
return Column(
children: [
_buildTextEditingDeltaViewCode(textCodeElec.trim()),// "nguyên choa" = 34 02 44 98
_buildTextEditingDeltaViewHeader(),
Expanded(
child: ListView.separated(
padding: const EdgeInsets.symmetric(horizontal: 35.0),
itemBuilder: (context, index) {
return _buildTextEditingDeltaHistoryViews(
manager.appState.textEditingDeltaHistory)[index];
},
itemCount: manager.appState.textEditingDeltaHistory.length,
separatorBuilder: (context, index) {
return const SizedBox(height: 2.0);
},
),
),
const SizedBox(height: 10),
],
);
}
I want the textfield to display as a sentence but it doesn't seem to be what I expected when I type "Nguyên Choa" it only shows 34 02 what I expected is "Nguyên Choa" = 34 02 44 98.I hope you experts can help me solve this difficult problem. I am truly grateful.