wip: bloc for files
This commit is contained in:
		| @@ -17,13 +17,16 @@ class LoadableStateConsumer<TController extends Bloc<LoadableHydratedBlocEvent<T | ||||
|   final Widget Function(TState state, bool loading) child; | ||||
|   final void Function(TState state)? onLoad; | ||||
|   final bool wrapWithScrollView; | ||||
|   const LoadableStateConsumer({required this.child, this.onLoad, this.wrapWithScrollView = false, super.key}); | ||||
|   final TController? controllerByValue; | ||||
|   const LoadableStateConsumer({required this.child, this.onLoad, this.wrapWithScrollView = false, this.controllerByValue = null, super.key}); | ||||
|  | ||||
|   static Duration animationDuration = const Duration(milliseconds: 200); | ||||
|  | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     var loadableState = context.watch<TController>().state; | ||||
|     var loadableState = controllerByValue != null | ||||
|         ? controllerByValue!.state | ||||
|         : context.watch<TController>().state; | ||||
|  | ||||
|     if(!loadableState.isLoading && onLoad != null) { | ||||
|       WidgetsBinding.instance.addPostFrameCallback((timeStamp) => onLoad!(loadableState.data)); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user