LibAC-flutter/lib/tests/prompt.dart
2025-01-31 14:23:15 -07:00

58 lines
1.6 KiB
Dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:libacflutter/Alert.dart';
import 'package:libacflutter/Constants.dart';
import 'package:libacflutter/Prompt.dart';
class TestPrompt extends StatefulWidget {
const TestPrompt({super.key});
@override
State<StatefulWidget> createState() {
return TestPromptState();
}
}
class TestPromptState extends State<TestPrompt> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Input Prompt Test"),
backgroundColor: LibACFlutterConstants.TITLEBAR_COLOR,
),
body: Column(
children: [
ElevatedButton(
onPressed: () async {
var reply = await showAdaptiveDialog(
context: context,
builder: (buildx) {
return InputPrompt(
title: "Test",
prompt: "Enter a value",
currentValue: "",
type: InputPromptType.Text,
);
});
// Show a alert dialog with the reply content
showAdaptiveDialog(
context: context,
builder: (buildx) {
return Alert(
title: "Test Result",
body: reply,
dismissAction: () {
exit(0);
},
);
});
},
child: Text("Show prompt"))
],
),
);
}
}