相关的DropdownButtons并引发onChange事件

问题描述

我有两个DropdownButton小部件。第二个内容取决于第一个选择。第二个DropdownButton将启动第三个小部件的刷新。当第一个DropdownButton填充后,如何启动第二个DropdownButton的刷新?然后,当第二个 class ParentBloc { Stream<List<Parent>> get items => _controller.asyncMap(...); Future<List<Parent>> _callApi() { // call endpoint /parents } } class ChildBloc { ChildBloc(this.parentId); int parentId; Stream<List<Child>> get items => _controller.asyncMap(...); Future<List<Child>> _callApi() { // call endpoint /parents/$parentId/children } } // This bloc created at init state ParentBloc parentBloc; // This bloc will be created only after value will // be selected in the Parent dropdownbutton because // I need to know `parentId`. ChildBloc childBloc; @override void initState() { super.initState(); parentBloc = ParentBloc(); } @override Widget build(BuildContext context) { return Row( children: [ StreamBuilder<List<Parent>>( stream: parentBloc.items,builder: (context,snapshot) { return DropdownButton( items: snapshot.data.map((item) { return DropdownButtonItem(); }),); } ),// Content of this widget depends on above one StreamBuilder<List<Child>>( stream: childBloc.items,// Content of this widget depends on above one StreamBuilder<List<Grandchild>>( stream: grandchildBloc.items,snapshot) { return ListView(),] ); } 也被填充时,如何刷新第三个窗口小部件?

display: flex

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)