x now exits from any menu

where x represents the last menu option to exit the menu or application
This commit is contained in:
Vishal 2022-11-05 13:01:53 +05:30
parent 710a81c320
commit a217fd9570
2 changed files with 9 additions and 11 deletions

View File

@ -298,6 +298,10 @@ int showMenu(List<String> menuOptions, String menuName) {
stdout.write("Type menu option/number: ");
String? userOptionInput = stdin.readLineSync();
String userOption = userOptionInput??"";
userOption = userOption.trim();
if( userOption == 'x') {
userOption = menuOptions.length.toString();
}
if( int.tryParse(userOption) != null) {
try{
int? valueOption = int.tryParse(userOption);
@ -332,8 +336,9 @@ Future<void> otherMenuUi(Store node) async {
'Change number of days printed', // 6
'Delete event', // 7
'Application stats', // 8
'Go back to main menu', // 9
'Help and About'], // 10
'Help and About', // 9
'Go back to main menu'], // 10
"Other Menu"); // menu name
print('You picked: $option');
@ -524,11 +529,11 @@ Future<void> otherMenuUi(Store node) async {
break;
case 9:
continueOtherMenu = false;
print(helpAndAbout);
break;
case 10:
print(helpAndAbout);
continueOtherMenu = false;
break;

View File

@ -310,7 +310,6 @@ $gUsage
KNOWN ISSUES
------------
* Does not get all the events, or in other words, does not properly get all the events from their own relays, and thus misses some events.
* Does not work on Tor network
ABOUT
@ -349,12 +348,6 @@ var terminalColumns = gDefaultTextWidth;
if( stdout.hasTerminal )
terminalColumns = stdout.terminalColumns;
//print(gCommentColor);
lines.forEach((line) {print(line.length > terminalColumns ? line.substring(0, terminalColumns) : line );});
//print(gColorEndMarker);
//print("\n$intro\n");
}