mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-06-08 14:42:39 -04:00
busy handling
This commit is contained in:
parent
43b01c7555
commit
c6f017b0d1
23 changed files with 307 additions and 179 deletions
|
@ -1,5 +1,6 @@
|
|||
import 'package:async_tools/async_tools.dart';
|
||||
import 'package:awesome_extensions/awesome_extensions.dart';
|
||||
import 'package:bloc_tools/bloc_tools.dart';
|
||||
import 'package:blurry_modal_progress_hud/blurry_modal_progress_hud.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
@ -77,6 +78,17 @@ extension AsyncValueBuilderExt<T> on AsyncValue<T> {
|
|||
data: (d) => debugPage('AsyncValue should not be data here'));
|
||||
}
|
||||
|
||||
extension BusyAsyncValueBuilderExt<T> on BlocBusyState<AsyncValue<T>> {
|
||||
Widget builder(Widget Function(BuildContext, T) builder) =>
|
||||
AbsorbPointer(absorbing: busy, child: state.builder(builder));
|
||||
Widget buildNotData(
|
||||
{Widget Function()? loading,
|
||||
Widget Function(Object, StackTrace?)? error}) =>
|
||||
AbsorbPointer(
|
||||
absorbing: busy,
|
||||
child: state.buildNotData(loading: loading, error: error));
|
||||
}
|
||||
|
||||
class AsyncBlocBuilder<B extends StateStreamable<AsyncValue<S>>, S>
|
||||
extends BlocBuilder<B, AsyncValue<S>> {
|
||||
AsyncBlocBuilder({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue