fix: uninitialized error in members setting page (#4834)

This commit is contained in:
Lucas.Xu 2024-03-07 09:28:31 +08:00 committed by GitHub
parent f5cb8b6d25
commit f484675008
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 5 deletions

View File

@ -113,8 +113,7 @@ class WorkspaceMenuItem extends StatelessWidget {
return BlocProvider(
create: (_) =>
WorkspaceMemberBloc(userProfile: userProfile, workspace: workspace)
..add(const WorkspaceMemberEvent.initial())
..add(const WorkspaceMemberEvent.getWorkspaceMembers()),
..add(const WorkspaceMemberEvent.initial()),
child: BlocBuilder<WorkspaceMemberBloc, WorkspaceMemberState>(
builder: (context, state) {
final members = state.members;

View File

@ -38,6 +38,8 @@ class WorkspaceMemberBloc
workspaceId = '';
});
}
add(const WorkspaceMemberEvent.getWorkspaceMembers());
},
getWorkspaceMembers: () async {
final members = await _getWorkspaceMembers();

View File

@ -27,9 +27,7 @@ class WorkspaceMembersPage extends StatelessWidget {
Widget build(BuildContext context) {
return BlocProvider<WorkspaceMemberBloc>(
create: (context) => WorkspaceMemberBloc(userProfile: userProfile)
..add(
const WorkspaceMemberEvent.getWorkspaceMembers(),
),
..add(const WorkspaceMemberEvent.initial()),
child: BlocBuilder<WorkspaceMemberBloc, WorkspaceMemberState>(
builder: (context, state) {
return SingleChildScrollView(