I have a screen where there is a list populating items, now I want to add dropdown list above the list, so I am confused on how to implement it.
Following is a code snippet:
body: BlocProvider(
create: (_) => HomeCubit()..fetchUsers(),
child: BlocBuilder<HomeCubit, HomeState>(
builder: (context, state) {
switch (state.status) {
case HomeStatus.failure:
return const Center(child: Text('failed to fetch topics'));
case HomeStatus.success:
// if (state.topics.isEmpty) {
// return const Center(child: Text('no users'));
// }
return _buildUserList(state);
default:
return Center(child: CircularProgressIndicator(color: Theme.of(context).primaryColor));
}
},
),
),
);
I want to know how I can call HomeCubit()..getdropdownitems() items method so that I can display a dropdown just above the fetchusers list.