mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 14:56:20 +01:00
Improve error handling
This commit is contained in:
parent
ea8d351187
commit
e165c618fe
1 changed files with 21 additions and 6 deletions
|
@ -39,13 +39,18 @@ class _ShareAlbumDialogState extends State<ShareAlbumDialog> {
|
|||
|
||||
@override
|
||||
build(BuildContext context) {
|
||||
return BlocBuilder<ListShareeBloc, ListShareeBlocState>(
|
||||
return BlocListener<ListShareeBloc, ListShareeBlocState>(
|
||||
bloc: _shareeBloc,
|
||||
builder: (_, shareeState) =>
|
||||
BlocBuilder<ListShareBloc, ListShareBlocState>(
|
||||
bloc: _shareBloc,
|
||||
builder: (context, shareState) =>
|
||||
_buildContent(context, shareeState, shareState),
|
||||
listener: (context, shareeState) =>
|
||||
_onListShareeBlocStateChanged(context, shareeState),
|
||||
child: BlocBuilder<ListShareeBloc, ListShareeBlocState>(
|
||||
bloc: _shareeBloc,
|
||||
builder: (_, shareeState) =>
|
||||
BlocBuilder<ListShareBloc, ListShareBlocState>(
|
||||
bloc: _shareBloc,
|
||||
builder: (context, shareState) =>
|
||||
_buildContent(context, shareeState, shareState),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -122,6 +127,16 @@ class _ShareAlbumDialogState extends State<ShareAlbumDialog> {
|
|||
);
|
||||
}
|
||||
|
||||
void _onListShareeBlocStateChanged(
|
||||
BuildContext context, ListShareeBlocState state) {
|
||||
if (state is ListShareeBlocFailure) {
|
||||
SnackBarManager().showSnackBar(SnackBar(
|
||||
content: Text(exception_util.toUserString(state.exception, context)),
|
||||
duration: k.snackBarDurationNormal,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
void _onShareePressed(
|
||||
BuildContext context, Sharee sharee, Share? share) async {
|
||||
final shareRepo = ShareRepo(ShareRemoteDataSource());
|
||||
|
|
Loading…
Reference in a new issue