mirror of
https://github.com/madari-media/madari-oss.git
synced 2026-04-20 10:02:05 +00:00
34 lines
965 B
Dart
34 lines
965 B
Dart
//
|
|
// Simple password dialog
|
|
//
|
|
import 'package:flutter/material.dart';
|
|
|
|
Future<String?> passwordDialog(BuildContext context) async {
|
|
final textController = TextEditingController();
|
|
return await showDialog<String?>(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
builder: (context) {
|
|
return AlertDialog(
|
|
title: const Text('Enter password'),
|
|
content: TextField(
|
|
controller: textController,
|
|
autofocus: true,
|
|
keyboardType: TextInputType.visiblePassword,
|
|
obscureText: true,
|
|
onSubmitted: (value) => Navigator.of(context).pop(value),
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.of(context).pop(null),
|
|
child: const Text('Cancel'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.of(context).pop(textController.text),
|
|
child: const Text('OK'),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|