Initial commit
This commit is contained in:
parent
e9cb58e7e0
commit
8d20540b0f
134 changed files with 4750 additions and 0 deletions
69
test/testPrompt.dart
Normal file
69
test/testPrompt.dart
Normal file
|
@ -0,0 +1,69 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:libacflutter/Constants.dart';
|
||||
import 'package:libacflutter/Prompt.dart';
|
||||
|
||||
void main() {
|
||||
test("Test the input prompt", () async {
|
||||
runApp(WidgetTester(route: "/testprompt"));
|
||||
});
|
||||
}
|
||||
|
||||
class WidgetTester extends StatelessWidget {
|
||||
String route;
|
||||
|
||||
WidgetTester({required this.route});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData.dark(),
|
||||
routes: {"/testprompt": (context) => TestPrompt()},
|
||||
home: TestPrompt(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TestPrompt extends StatefulWidget {
|
||||
@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: "",
|
||||
);
|
||||
});
|
||||
|
||||
// Show a alert dialog with the reply content
|
||||
showAdaptiveDialog(
|
||||
context: context,
|
||||
builder: (buildx) {
|
||||
return Alert(title: "Test Result", body: reply);
|
||||
});
|
||||
},
|
||||
child: Text("Show prompt"))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue