mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-09 02:36:31 +01:00
Improve error handling
This commit is contained in:
parent
ea8d351187
commit
e165c618fe
1 changed files with 21 additions and 6 deletions
|
@ -39,7 +39,11 @@ class _ShareAlbumDialogState extends State<ShareAlbumDialog> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
build(BuildContext context) {
|
build(BuildContext context) {
|
||||||
return BlocBuilder<ListShareeBloc, ListShareeBlocState>(
|
return BlocListener<ListShareeBloc, ListShareeBlocState>(
|
||||||
|
bloc: _shareeBloc,
|
||||||
|
listener: (context, shareeState) =>
|
||||||
|
_onListShareeBlocStateChanged(context, shareeState),
|
||||||
|
child: BlocBuilder<ListShareeBloc, ListShareeBlocState>(
|
||||||
bloc: _shareeBloc,
|
bloc: _shareeBloc,
|
||||||
builder: (_, shareeState) =>
|
builder: (_, shareeState) =>
|
||||||
BlocBuilder<ListShareBloc, ListShareBlocState>(
|
BlocBuilder<ListShareBloc, ListShareBlocState>(
|
||||||
|
@ -47,6 +51,7 @@ class _ShareAlbumDialogState extends State<ShareAlbumDialog> {
|
||||||
builder: (context, shareState) =>
|
builder: (context, shareState) =>
|
||||||
_buildContent(context, shareeState, 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(
|
void _onShareePressed(
|
||||||
BuildContext context, Sharee sharee, Share? share) async {
|
BuildContext context, Sharee sharee, Share? share) async {
|
||||||
final shareRepo = ShareRepo(ShareRemoteDataSource());
|
final shareRepo = ShareRepo(ShareRemoteDataSource());
|
||||||
|
|
Loading…
Reference in a new issue