addEditDescriptionText method
Future<void>
addEditDescriptionText( - String descriptionText
)
Implementation
Future<void> addEditDescriptionText(String descriptionText) async {
await trigger(EventsKeys.eventDescriptionTextField);
final createEditEventFinder = find.byKey(createEditEventKey);
await createEditEventFinder.should(findsOneWidget);
final editorState = (tester.firstState(createEditEventFinder)
as CreateEventPageConsumerState)
.textEditorState;
assert(editorState.editable, 'Not editable');
assert(editorState.selection != null, 'No selection');
await editorState.insertTextAtPosition(descriptionText);
await editorState.insertNewLine();
await editorState.insertTextAtCurrentSelection(
'This is a second line of text with some ',
);
final lastSelectable = editorState.getLastSelectable()!;
final transaction = editorState.transaction;
transaction.insertText(
lastSelectable.$1,
40,
'bold text',
attributes: {'bold': true},
);
await editorState.apply(transaction);
}