mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 13:05:11 +00:00
fix: Create chat dialog crashes sometimes and power level textfield does not validate input
This commit is contained in:
parent
c29f9bd44a
commit
5665cac15c
3 changed files with 16 additions and 5 deletions
|
@ -2533,5 +2533,6 @@
|
|||
"placeholders": {
|
||||
"seconds": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"pleaseEnterANumber": "Please enter a number greater than 0"
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class LoadProfileBottomSheet extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder<ProfileInformation>(
|
||||
future: Matrix.of(context)
|
||||
future: Matrix.of(outerContext)
|
||||
.client
|
||||
.getUserProfile(userId)
|
||||
.timeout(const Duration(seconds: 3)),
|
||||
|
@ -138,7 +138,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
if (reason == null || reason.single.isEmpty) return;
|
||||
final result = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context).client.reportContent(
|
||||
future: () => Matrix.of(widget.outerContext).client.reportContent(
|
||||
user.roomId!,
|
||||
user.eventId,
|
||||
reason: reason.single,
|
||||
|
@ -203,7 +203,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
case UserBottomSheetAction.message:
|
||||
final roomIdResult = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context)
|
||||
future: () => Matrix.of(widget.outerContext)
|
||||
.client
|
||||
.startDirectChat(user?.id ?? widget.profile!.userId),
|
||||
);
|
||||
|
@ -215,7 +215,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||
if (await askConfirmation()) {
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => Matrix.of(context)
|
||||
future: () => Matrix.of(widget.outerContext)
|
||||
.client
|
||||
.ignoreUser(user?.id ?? widget.profile!.userId),
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue