[Flutter] Force a username before subscribing
This commit is contained in:
@@ -28,6 +28,40 @@ class UIDialogs {
|
||||
);
|
||||
}
|
||||
|
||||
static Future<String?> showUsernameRequiredDialog(BuildContext context) {
|
||||
var _textFieldController = TextEditingController();
|
||||
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Username Required'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Please set a public username to subscribe to channels from other users.'),
|
||||
SizedBox(height: 16),
|
||||
TextField(
|
||||
autofocus: true,
|
||||
controller: _textFieldController,
|
||||
decoration: InputDecoration(hintText: 'Enter username'),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(_textFieldController.text),
|
||||
child: Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Future<bool> showConfirmDialog(BuildContext context, String title, {String? text, String? okText, String? cancelText}) {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
|
||||
Reference in New Issue
Block a user