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 createState() { return TestPromptState(); } } class TestPromptState extends State { @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); }); }, child: Text("Show prompt")) ], ), ); } }