import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:ustest/BuildHistoryList.dart'; import 'Services/BuildService.dart'; import 'Services/NotificationReceivedArgs.dart'; class PublishView extends StatefulWidget { @override State createState() { // TODO: implement createState return _PublishView(); } } class _PublishView extends State { String? selectedType = "我申请的"; @override Widget build(BuildContext context) { final items = ["我申请的", "我组织的", "我参与的"]; int selectedState = 0; if (selectedType == "我申请的") { selectedState = 0; } else if (selectedType == "我组织的") { selectedState = 1; } else { selectedState = 2; } GlobalKey> typeKey = GlobalKey(); GlobalKey listKey = GlobalKey(); return Scaffold( body: Center( child: Column( children: [ Row( children: [ TextButton.icon( onPressed: () => onApplyConsultation(context), icon: Icon(Icons.add), label: Text("Apply")), ], ), Padding( padding: const EdgeInsets.all(8.0), child: DropdownButtonFormField( key: typeKey, value: selectedType, decoration: InputDecoration(hintText: "Select one state"), items: items .map((e) => DropdownMenuItem( child: Text(e), value: e, )) .toList(), onChanged: (value) { selectedType = value; }, )), Row( children: [ TextButton.icon( onPressed: () => setState(() {}), icon: Icon(Icons.search), label: Text("Search")), ], ), Expanded(child: Center()), ], ), ), ); } void onApplyConsultation(context) { print("onApplyConsultation click"); Navigator.of(context).pushNamed('/applyconsultation'); } }