fix: Create chat dialog crashes sometimes and power level textfield does not validate input

This commit is contained in:
krille-chan 2023-10-28 10:09:40 +02:00
commit 5665cac15c
No known key found for this signature in database
3 changed files with 16 additions and 5 deletions

View file

@ -61,6 +61,16 @@ Future<int?> showPermissionChooser(
initialText: currentLevel.toString(),
keyboardType: TextInputType.number,
autocorrect: false,
validator: (text) {
if (text == null) {
return L10n.of(context)!.pleaseEnterANumber;
}
final level = int.tryParse(text);
if (level == null || level < 0) {
return L10n.of(context)!.pleaseEnterANumber;
}
return null;
},
),
],
);