AutoTestView.dart 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import 'package:autocomplete_textfield/autocomplete_textfield.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:get_it/get_it.dart';
  4. import 'package:ustest/BuildHistoryList.dart';
  5. import 'Services/BuildService.dart';
  6. import 'Services/NotificationReceivedArgs.dart';
  7. class AutoTestView extends StatefulWidget {
  8. @override
  9. State<StatefulWidget> createState() {
  10. // TODO: implement createState
  11. return _AutoTestView();
  12. }
  13. }
  14. class _AutoTestView extends State<AutoTestView> {
  15. String? selectedType = "我申请的";
  16. @override
  17. Widget build(BuildContext context) {
  18. final items = <String>["我申请的", "我组织的", "我参与的"];
  19. int selectedState = 0;
  20. if (selectedType == "我申请的") {
  21. selectedState = 0;
  22. } else if (selectedType == "我组织的") {
  23. selectedState = 1;
  24. } else {
  25. selectedState = 2;
  26. }
  27. GlobalKey<AutoCompleteTextFieldState<String>> typeKey = GlobalKey();
  28. GlobalKey listKey = GlobalKey();
  29. return Scaffold(
  30. body: Center(
  31. child: Column(
  32. children: [
  33. Row(
  34. children: [],
  35. ),
  36. Padding(
  37. padding: const EdgeInsets.all(8.0),
  38. child: DropdownButtonFormField<String>(
  39. key: typeKey,
  40. value: selectedType,
  41. decoration: InputDecoration(hintText: "Select one state"),
  42. items: items
  43. .map((e) => DropdownMenuItem<String>(
  44. child: Text(e),
  45. value: e,
  46. ))
  47. .toList(),
  48. onChanged: (value) {
  49. selectedType = value;
  50. },
  51. )),
  52. Row(
  53. children: [
  54. TextButton.icon(
  55. onPressed: () => setState(() {}),
  56. icon: Icon(Icons.search),
  57. label: Text("Search")),
  58. ],
  59. ),
  60. Expanded(child: Center()),
  61. ],
  62. ),
  63. ),
  64. );
  65. }
  66. }