implement changing username
This commit is contained in:
29
flutter/lib/utils/dialogs.dart
Normal file
29
flutter/lib/utils/dialogs.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UIDialogs {
|
||||
static Future<String?> showTextInput(BuildContext context, String title, String hintText) {
|
||||
var _textFieldController = TextEditingController();
|
||||
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(title),
|
||||
content: TextField(
|
||||
autofocus: true,
|
||||
controller: _textFieldController,
|
||||
decoration: InputDecoration(hintText: hintText),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(_textFieldController.text),
|
||||
child: Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user