Initial commit
This commit is contained in:
parent
e9cb58e7e0
commit
8d20540b0f
134 changed files with 4750 additions and 0 deletions
78
lib/Prompt.dart
Normal file
78
lib/Prompt.dart
Normal file
|
@ -0,0 +1,78 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
///
|
||||
class InputPrompt extends StatefulWidget {
|
||||
String title;
|
||||
String prompt;
|
||||
String currentValue;
|
||||
|
||||
InputPrompt(
|
||||
{super.key,
|
||||
required this.title,
|
||||
required this.prompt,
|
||||
required this.currentValue});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return InputPromptState(
|
||||
title: title, prompt: prompt, currentValue: currentValue);
|
||||
}
|
||||
}
|
||||
|
||||
class InputPromptState extends State<InputPrompt> {
|
||||
String title;
|
||||
String prompt;
|
||||
String currentValue;
|
||||
TextEditingController textField = TextEditingController();
|
||||
|
||||
InputPromptState(
|
||||
{required this.title, required this.prompt, required this.currentValue}) {
|
||||
textField.text = currentValue;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(title),
|
||||
content: SizedBox(
|
||||
width: 200,
|
||||
height: 100,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(prompt),
|
||||
TextField(
|
||||
controller: textField,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context, textField.text);
|
||||
},
|
||||
child: Text("Submit")),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context, "");
|
||||
},
|
||||
child: Text("Cancel"))
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Alert extends StatelessWidget {
|
||||
String title;
|
||||
String body;
|
||||
|
||||
Alert({required this.title, required this.body, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(title),
|
||||
content: Text(body),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue