WIP
This commit is contained in:
parent
ecd9408f35
commit
f0350c1bd9
|
@ -1 +0,0 @@
|
|||
part of 'index.dart';
|
|
@ -1 +0,0 @@
|
|||
part of 'index.dart';
|
|
@ -1 +0,0 @@
|
|||
part of 'index.dart';
|
|
@ -1 +0,0 @@
|
|||
part of 'index.dart';
|
|
@ -1 +0,0 @@
|
|||
part of 'index.dart';
|
|
@ -1 +0,0 @@
|
|||
part of 'index.dart';
|
|
@ -1 +0,0 @@
|
|||
part of 'index.dart';
|
|
@ -1 +0,0 @@
|
|||
part of 'index.dart';
|
|
@ -18,14 +18,13 @@ import 'package:rxdart/rxdart.dart' as rx;
|
|||
part 'documents.rxb.g.dart';
|
||||
|
||||
/// -----------------------------------------------
|
||||
/// [TypeDefs]
|
||||
/// [TypeDefs] -----------------------------------
|
||||
/// -----------------------------------------------
|
||||
|
||||
typedef DocumentKey = GlobalKey<DocumentPageState>;
|
||||
|
||||
/// -----------------------------------------------
|
||||
|
||||
/// [Page]
|
||||
/// [Pages] ---------------------------------------
|
||||
/// -----------------------------------------------
|
||||
|
||||
class DocumentPage extends StatefulPage {
|
||||
|
@ -79,9 +78,139 @@ class DocumentPageState extends PageState<DocumentPage> {
|
|||
}
|
||||
}
|
||||
|
||||
/// -----------------------------------------------
|
||||
/// [Screens] ------------------------------------
|
||||
/// -----------------------------------------------
|
||||
|
||||
/// [Model]
|
||||
class DocumentManagerScreen extends StatelessScreen {
|
||||
final DocumentPageModel model;
|
||||
final DocumentPageState state;
|
||||
|
||||
const DocumentManagerScreen({
|
||||
super.key,
|
||||
required this.model,
|
||||
required this.state,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String title = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Documents',
|
||||
ptText: 'Documentos',
|
||||
);
|
||||
final theme = FlutterFlowTheme.of(context);
|
||||
action() => Navigator.pop(context);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.primaryBackground,
|
||||
appBar: buildAppBar(title, context, action),
|
||||
body: buildBody(context),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildBody(BuildContext context) {
|
||||
final SizedBox space = SizedBox(height: 30);
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: EnhancedListView<Document, Search, Category, Query>(
|
||||
key: model.vehicleScreenManager,
|
||||
headerBuilder: model.itemHeaderBuilder<Search>,
|
||||
headerItems: model.generateHeaderItems<Search>,
|
||||
bodyBuilder: model.itemBodyBuilder<Document>,
|
||||
bodyItems: model.generateBodyItems<Document, Query>,
|
||||
footerBuilder: model.itemFooterBuilder<Category>,
|
||||
footerItems: model.generateFooterItems<Category>,
|
||||
),
|
||||
),
|
||||
] //
|
||||
.addToStart(space)
|
||||
.addToEnd(space),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DocumentViewScreen extends StatefulScreen {
|
||||
const DocumentViewScreen({
|
||||
super.key,
|
||||
required this.doc,
|
||||
required this.bloc,
|
||||
});
|
||||
|
||||
final (Document, Uri) doc;
|
||||
final DocumentPageBlocType bloc;
|
||||
|
||||
@override
|
||||
ScreenState<DocumentViewScreen> createState() => _DocumentViewScreenState();
|
||||
}
|
||||
|
||||
class _DocumentViewScreenState extends ScreenState<DocumentViewScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String title = widget.doc.$1.description;
|
||||
final theme = FlutterFlowTheme.of(context);
|
||||
final locale = FFLocalizations.of(context);
|
||||
|
||||
backAction() => widget.bloc.events.unselectDocument();
|
||||
infoAction() => DetailsComponentWidget(
|
||||
buttons: [],
|
||||
statusHashMap: [],
|
||||
labelsHashMap: Map<String, String>.from({
|
||||
locale.getVariableText(
|
||||
enText: 'Description',
|
||||
ptText: 'Descrição',
|
||||
): widget.doc.$1.description,
|
||||
locale.getVariableText(
|
||||
enText: 'Type',
|
||||
ptText: 'Tipo',
|
||||
): widget.doc.$1.type,
|
||||
locale.getVariableText(
|
||||
enText: 'Category',
|
||||
ptText: 'Categoria',
|
||||
): widget.doc.$1.category.title,
|
||||
locale.getVariableText(
|
||||
enText: 'Person',
|
||||
ptText: 'Pessoa',
|
||||
): widget.doc.$1.person,
|
||||
locale.getVariableText(
|
||||
enText: 'Property',
|
||||
ptText: 'Propriedade',
|
||||
): widget.doc.$1.property,
|
||||
locale.getVariableText(
|
||||
enText: 'Created At',
|
||||
ptText: 'Criado em',
|
||||
): widget.doc.$1.createdAt,
|
||||
locale.getVariableText(
|
||||
enText: 'Updated At',
|
||||
ptText: 'Atualizado em',
|
||||
): widget.doc.$1.updatedAt,
|
||||
}),
|
||||
);
|
||||
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (didPop, result) => backAction(),
|
||||
child: Scaffold(
|
||||
backgroundColor: theme.primaryBackground,
|
||||
appBar: buildAppBar(title, context, backAction, infoAction),
|
||||
body: buildBody(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildBody(BuildContext context) {
|
||||
// final PDFViewerKey _viewerKey = PDFViewerKey();
|
||||
|
||||
return ReadView(
|
||||
// search: _viewerKey,
|
||||
title: widget.doc.$1.description,
|
||||
url: widget.doc.$2.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// -----------------------------------------------
|
||||
/// [Models] --------------------------------------
|
||||
/// -----------------------------------------------
|
||||
|
||||
class DocumentPageModel extends FlutterFlowModel<DocumentPage> {
|
||||
|
@ -346,7 +475,7 @@ class DocumentPageModel extends FlutterFlowModel<DocumentPage> {
|
|||
}
|
||||
|
||||
/// -----------------------------------------------
|
||||
/// [BLoC]
|
||||
/// [BLoCs] ---------------------------------------
|
||||
/// -----------------------------------------------
|
||||
|
||||
extension RxdartStartWithExtension<T> on Stream<T?> {
|
||||
|
@ -390,142 +519,7 @@ class DocumentPageBloc extends $DocumentPageBloc {
|
|||
}
|
||||
|
||||
/// -----------------------------------------------
|
||||
/// [Screens]
|
||||
/// -----------------------------------------------
|
||||
|
||||
/// [DocumentManagerScreen]
|
||||
|
||||
class DocumentManagerScreen extends StatelessScreen {
|
||||
final DocumentPageModel model;
|
||||
final DocumentPageState state;
|
||||
|
||||
const DocumentManagerScreen({
|
||||
super.key,
|
||||
required this.model,
|
||||
required this.state,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String title = FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Documents',
|
||||
ptText: 'Documentos',
|
||||
);
|
||||
final theme = FlutterFlowTheme.of(context);
|
||||
action() => Navigator.pop(context);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.primaryBackground,
|
||||
appBar: buildAppBar(title, context, action),
|
||||
body: buildBody(context),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildBody(BuildContext context) {
|
||||
final SizedBox space = SizedBox(height: 30);
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: EnhancedListView<Document, Search, Category, Query>(
|
||||
key: model.vehicleScreenManager,
|
||||
headerBuilder: model.itemHeaderBuilder<Search>,
|
||||
headerItems: model.generateHeaderItems<Search>,
|
||||
bodyBuilder: model.itemBodyBuilder<Document>,
|
||||
bodyItems: model.generateBodyItems<Document, Query>,
|
||||
footerBuilder: model.itemFooterBuilder<Category>,
|
||||
footerItems: model.generateFooterItems<Category>,
|
||||
),
|
||||
),
|
||||
] //
|
||||
.addToStart(space)
|
||||
.addToEnd(space),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// [DocumentViewScreen]
|
||||
|
||||
class DocumentViewScreen extends StatefulScreen {
|
||||
const DocumentViewScreen({
|
||||
super.key,
|
||||
required this.doc,
|
||||
required this.bloc,
|
||||
});
|
||||
|
||||
final (Document, Uri) doc;
|
||||
final DocumentPageBlocType bloc;
|
||||
|
||||
@override
|
||||
ScreenState<DocumentViewScreen> createState() => _DocumentViewScreenState();
|
||||
}
|
||||
|
||||
class _DocumentViewScreenState extends ScreenState<DocumentViewScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String title = widget.doc.$1.description;
|
||||
final theme = FlutterFlowTheme.of(context);
|
||||
final locale = FFLocalizations.of(context);
|
||||
|
||||
backAction() => widget.bloc.events.unselectDocument();
|
||||
infoAction() => DetailsComponentWidget(
|
||||
buttons: [],
|
||||
statusHashMap: [],
|
||||
labelsHashMap: Map<String, String>.from({
|
||||
locale.getVariableText(
|
||||
enText: 'Description',
|
||||
ptText: 'Descrição',
|
||||
): widget.doc.$1.description,
|
||||
locale.getVariableText(
|
||||
enText: 'Type',
|
||||
ptText: 'Tipo',
|
||||
): widget.doc.$1.type,
|
||||
locale.getVariableText(
|
||||
enText: 'Category',
|
||||
ptText: 'Categoria',
|
||||
): widget.doc.$1.category.title,
|
||||
locale.getVariableText(
|
||||
enText: 'Person',
|
||||
ptText: 'Pessoa',
|
||||
): widget.doc.$1.person,
|
||||
locale.getVariableText(
|
||||
enText: 'Property',
|
||||
ptText: 'Propriedade',
|
||||
): widget.doc.$1.property,
|
||||
locale.getVariableText(
|
||||
enText: 'Created At',
|
||||
ptText: 'Criado em',
|
||||
): widget.doc.$1.createdAt,
|
||||
locale.getVariableText(
|
||||
enText: 'Updated At',
|
||||
ptText: 'Atualizado em',
|
||||
): widget.doc.$1.updatedAt,
|
||||
}),
|
||||
);
|
||||
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (didPop, result) => backAction(),
|
||||
child: Scaffold(
|
||||
backgroundColor: theme.primaryBackground,
|
||||
appBar: buildAppBar(title, context, backAction, infoAction),
|
||||
body: buildBody(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildBody(BuildContext context) {
|
||||
// final PDFViewerKey _viewerKey = PDFViewerKey();
|
||||
|
||||
return ReadView(
|
||||
// search: _viewerKey,
|
||||
title: widget.doc.$1.description,
|
||||
url: widget.doc.$2.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// -----------------------------------------------
|
||||
/// [Interfaces]
|
||||
/// [Interfaces] ---------------------------------
|
||||
/// -----------------------------------------------
|
||||
|
||||
abstract interface class Archive extends Entity {}
|
||||
|
@ -590,7 +584,7 @@ interface class Category extends Archive {
|
|||
}
|
||||
|
||||
/// -----------------------------------------------
|
||||
/// [Widgets]
|
||||
/// [Components] -------------------------------------
|
||||
/// -----------------------------------------------
|
||||
|
||||
// ignore: must_be_immutable
|
||||
|
|
|
@ -1,25 +1,23 @@
|
|||
part of 'widgets.dart';
|
||||
|
||||
/// [TypeDefs]
|
||||
/// [TypeDefs] ----------------------------------------------------
|
||||
|
||||
typedef EnhancedListViewKey<B, H, F, Q>
|
||||
= GlobalKey<EnhancedListViewState<B, H, F, Q>>;
|
||||
typedef EnhancedListViewKey<BodyType, HeaderType, FooterType, QueryType>
|
||||
= GlobalKey<
|
||||
EnhancedListViewState<BodyType, HeaderType, FooterType, QueryType>>;
|
||||
typedef PaginatedListViewHeaderBuilder<HeaderType> = Widget Function(
|
||||
Future<List<HeaderType?>> Function() headerItems);
|
||||
typedef PaginatedListViewBodyBuilder<BodyType> = Widget Function(
|
||||
BuildContext context, BodyType item, int index);
|
||||
typedef PaginatedListViewFooterBuilder<FooterType> = Widget Function(
|
||||
Future<List<FooterType?>> Function() footerItems);
|
||||
typedef Query<QueryType> = QueryType?;
|
||||
typedef BodyItemsBuilder<BodyType, QueryType> = Future<List<BodyType?>>
|
||||
Function(int page, int pageSize, QueryType query);
|
||||
typedef HeaderItemsBuilder<HeaderType> = Future<List<HeaderType?>> Function();
|
||||
typedef FooterItemsBuilder<FooterType> = Future<List<FooterType?>> Function();
|
||||
|
||||
typedef PaginatedListViewHeaderBuilder<H> = Widget Function(
|
||||
Future<List<H?>> Function() headerItems);
|
||||
typedef PaginatedListViewBodyBuilder<T> = Widget Function(
|
||||
BuildContext context, T item, int index);
|
||||
typedef PaginatedListViewFooterBuilder<F> = Widget Function(
|
||||
Future<List<F?>> Function() footerItems);
|
||||
|
||||
typedef Query<T> = T?;
|
||||
|
||||
typedef BodyItemsBuilder<T, Q> = Future<List<T?>> Function(
|
||||
int page, int pageSize, Q query);
|
||||
typedef HeaderItemsBuilder<H> = Future<List<H?>> Function();
|
||||
typedef FooterItemsBuilder<F> = Future<List<F?>> Function();
|
||||
|
||||
/// [Extensions]
|
||||
/// [Extensions] ----------------------------------------------------
|
||||
extension PaginatedListMergeExtensions<T>
|
||||
on Stream<Result<EnhancedPaginatedList<T>>> {
|
||||
Stream<EnhancedPaginatedList<T>> mergeWithPaginatedList(
|
||||
|
@ -72,9 +70,7 @@ extension QueryBlocStreamExtensions<T> on Stream<bool> {
|
|||
});
|
||||
}
|
||||
|
||||
/// [Widgets]
|
||||
|
||||
/// [EnhancedListView]
|
||||
/// [Interfaces] ----------------------------------------------------
|
||||
|
||||
interface class EnhancedPaginatedList<T> extends PaginatedList<T> {
|
||||
@override
|
||||
|
@ -145,13 +141,29 @@ interface class EnhancedPaginatedList<T> extends PaginatedList<T> {
|
|||
Future<void> awaitLoad() async => Future.value();
|
||||
}
|
||||
|
||||
abstract interface class EnhancedListViewBase<T, H, F, Q>
|
||||
extends StatefulWidget {
|
||||
abstract interface class EnhancedListViewBase<BodyType, HeaderType, FooterType,
|
||||
QueryType> extends StatefulWidget {
|
||||
const EnhancedListViewBase({super.key});
|
||||
}
|
||||
|
||||
abstract interface class EnhancedListViewBaseState<T>
|
||||
extends State<EnhancedListViewBase> {}
|
||||
abstract interface class EnhancedListViewBaseState<BodyType, HeaderType,
|
||||
FooterType, QueryType>
|
||||
extends State<
|
||||
EnhancedListViewBase<BodyType, HeaderType, FooterType, QueryType>> {}
|
||||
|
||||
/// [Mixins] ----------------------------------------------------
|
||||
|
||||
mixin EnhancedListViewMixin<BodyType, HeaderType, FooterType, QueryType> {
|
||||
late EnhancedListViewBloc<BodyType, HeaderType, FooterType, QueryType> bloc;
|
||||
|
||||
void filterBodyItems(QueryType query) => bloc.filterBodyItems(query);
|
||||
|
||||
void filterHeaderItems(QueryType query) => bloc.filterHeaderItems(query);
|
||||
|
||||
void filterFooterItems(QueryType query) => bloc.filterFooterItems(query);
|
||||
}
|
||||
|
||||
/// [Widgets] ----------------------------------------------------
|
||||
|
||||
class EnhancedListView<BodyType, HeaderType, FooterType, QueryType>
|
||||
extends EnhancedListViewBase<BodyType, HeaderType, FooterType, QueryType> {
|
||||
|
@ -162,7 +174,7 @@ class EnhancedListView<BodyType, HeaderType, FooterType, QueryType>
|
|||
final FooterItemsBuilder<FooterType>? footerItems;
|
||||
final PaginatedListViewFooterBuilder<FooterType>? footerBuilder;
|
||||
|
||||
EnhancedListView({
|
||||
const EnhancedListView({
|
||||
Key? key,
|
||||
required this.bodyItems,
|
||||
required this.bodyBuilder,
|
||||
|
@ -179,10 +191,8 @@ class EnhancedListView<BodyType, HeaderType, FooterType, QueryType>
|
|||
}
|
||||
|
||||
class EnhancedListViewState<ItemType, HeaderType, FooterType, QueryType>
|
||||
extends State<
|
||||
EnhancedListView<ItemType, HeaderType, FooterType, QueryType>> {
|
||||
late EnhancedListViewBloc<ItemType, HeaderType, FooterType, QueryType> bloc;
|
||||
|
||||
extends State<EnhancedListView<ItemType, HeaderType, FooterType, QueryType>>
|
||||
with EnhancedListViewMixin<ItemType, HeaderType, FooterType, QueryType> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
@ -197,12 +207,6 @@ class EnhancedListViewState<ItemType, HeaderType, FooterType, QueryType>
|
|||
bloc.events.loadFooterItems();
|
||||
}
|
||||
|
||||
void filterBodyItems(Query query) => bloc.filterBodyItems(query);
|
||||
|
||||
void filterHeaderItems(Query query) => bloc.filterHeaderItems(query);
|
||||
|
||||
void filterFooterItems(Query query) => bloc.filterFooterItems(query);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final header = StreamBuilder<List<HeaderType>>(
|
||||
|
@ -272,7 +276,7 @@ class EnhancedListViewState<ItemType, HeaderType, FooterType, QueryType>
|
|||
}
|
||||
}
|
||||
|
||||
/// [Utils]
|
||||
/// [Utils] ----------------------------------------------------
|
||||
|
||||
class EnhancedListTile<T extends Widget> extends StatelessWidget {
|
||||
const EnhancedListTile(
|
||||
|
@ -336,7 +340,7 @@ class AuthorizationError implements Exception {
|
|||
AuthorizationError(this.message);
|
||||
}
|
||||
|
||||
/// [State Management]
|
||||
/// [Blocs] ----------------------------------------------------
|
||||
Stream<bool> get loadingState => Stream<bool>.empty();
|
||||
Stream<Exception> get errorState => Stream<Exception>.empty();
|
||||
|
||||
|
@ -345,23 +349,25 @@ abstract class EnhancedListViewRepository<T> {
|
|||
int page, int pageSize, PaginatedListViewBodyBuilder<T> builder);
|
||||
}
|
||||
|
||||
abstract class EnhancedListViewEvents<T, H, F, Q> {
|
||||
abstract class EnhancedListViewEvents<BodyType, HeaderType, FooterType,
|
||||
QueryType> {
|
||||
void loadBodyItems({bool reset = false, dynamic query = null});
|
||||
void loadHeaderItems();
|
||||
void loadFooterItems();
|
||||
}
|
||||
|
||||
abstract class EnhancedListViewStates<T, H, F, Q> {
|
||||
Stream<List<T>> get bodyItems;
|
||||
Stream<List<H>> get headerItems;
|
||||
Stream<List<F>> get footerItems;
|
||||
abstract class EnhancedListViewStates<BodyType, HeaderType, FooterType,
|
||||
QueryType> {
|
||||
Stream<List<BodyType>> get bodyItems;
|
||||
Stream<List<HeaderType>> get headerItems;
|
||||
Stream<List<FooterType>> get footerItems;
|
||||
Stream<bool> get isLoading;
|
||||
Stream<String> get errors;
|
||||
}
|
||||
|
||||
@RxBloc()
|
||||
class EnhancedListViewBloc<T, H, F, Q>
|
||||
extends $EnhancedListViewBloc<T, H, F, Q?> {
|
||||
class EnhancedListViewBloc<BodyType, HeaderType, FooterType, QueryType>
|
||||
extends $EnhancedListViewBloc<BodyType, HeaderType, FooterType,
|
||||
QueryType?> {
|
||||
EnhancedListViewBloc({
|
||||
required this.bodyItemsBuilder,
|
||||
required this.headerItemsBuilder,
|
||||
|
@ -384,24 +390,24 @@ class EnhancedListViewBloc<T, H, F, Q>
|
|||
.addTo(_compositeSubscription);
|
||||
}
|
||||
|
||||
final BodyItemsBuilder<T, Q?> bodyItemsBuilder;
|
||||
final HeaderItemsBuilder<H> headerItemsBuilder;
|
||||
final FooterItemsBuilder<F> footerItemsBuilder;
|
||||
final BodyItemsBuilder<BodyType, QueryType?> bodyItemsBuilder;
|
||||
final HeaderItemsBuilder<HeaderType> headerItemsBuilder;
|
||||
final FooterItemsBuilder<FooterType> footerItemsBuilder;
|
||||
|
||||
final _bodyItems = BehaviorSubject<List<T>>.seeded([]);
|
||||
final _bodyItems = BehaviorSubject<List<BodyType>>.seeded([]);
|
||||
|
||||
final _headerItems = BehaviorSubject<List<H>>.seeded([]);
|
||||
final _headerItems = BehaviorSubject<List<HeaderType>>.seeded([]);
|
||||
|
||||
final _footerItems = BehaviorSubject<List<F>>.seeded([]);
|
||||
final _footerItems = BehaviorSubject<List<FooterType>>.seeded([]);
|
||||
|
||||
final _isLoading = BehaviorSubject<bool>.seeded(false);
|
||||
final _errors = BehaviorSubject<String>();
|
||||
|
||||
Stream<List<T>> _fetchBodyItems(bool reset, Q? query) async* {
|
||||
Stream<List<BodyType>> _fetchBodyItems(bool reset, QueryType? query) async* {
|
||||
try {
|
||||
_isLoading.add(true);
|
||||
final items = await bodyItemsBuilder(1, 10, query);
|
||||
yield items.whereType<T>().toList();
|
||||
yield items.whereType<BodyType>().toList();
|
||||
} catch (e) {
|
||||
_errors.add(e.toString());
|
||||
} finally {
|
||||
|
@ -409,11 +415,11 @@ class EnhancedListViewBloc<T, H, F, Q>
|
|||
}
|
||||
}
|
||||
|
||||
Stream<List<H>> _fetchHeaderItems() async* {
|
||||
Stream<List<HeaderType>> _fetchHeaderItems() async* {
|
||||
try {
|
||||
_isLoading.add(true);
|
||||
final items = await headerItemsBuilder();
|
||||
yield items.whereType<H>().toList();
|
||||
yield items.whereType<HeaderType>().toList();
|
||||
} catch (e) {
|
||||
_errors.add(e.toString());
|
||||
} finally {
|
||||
|
@ -421,11 +427,11 @@ class EnhancedListViewBloc<T, H, F, Q>
|
|||
}
|
||||
}
|
||||
|
||||
Stream<List<F>> _fetchFooterItems() async* {
|
||||
Stream<List<FooterType>> _fetchFooterItems() async* {
|
||||
try {
|
||||
_isLoading.add(true);
|
||||
final items = await footerItemsBuilder();
|
||||
yield items.whereType<F>().toList();
|
||||
yield items.whereType<FooterType>().toList();
|
||||
} catch (e) {
|
||||
_errors.add(e.toString());
|
||||
} finally {
|
||||
|
@ -433,15 +439,15 @@ class EnhancedListViewBloc<T, H, F, Q>
|
|||
}
|
||||
}
|
||||
|
||||
void filterBodyItems(Q query) {
|
||||
void filterBodyItems(QueryType query) {
|
||||
_$loadBodyItemsEvent.add((query: query, reset: true));
|
||||
}
|
||||
|
||||
void filterHeaderItems(Q query) {
|
||||
void filterHeaderItems(QueryType query) {
|
||||
_$loadHeaderItemsEvent.add(null);
|
||||
}
|
||||
|
||||
void filterFooterItems(Q query) {
|
||||
void filterFooterItems(QueryType query) {
|
||||
_$loadFooterItemsEvent.add(null);
|
||||
}
|
||||
|
||||
|
@ -456,13 +462,112 @@ class EnhancedListViewBloc<T, H, F, Q>
|
|||
}
|
||||
|
||||
@override
|
||||
Stream<List<T>> _mapToBodyItemsState() => _bodyItems.stream;
|
||||
Stream<List<BodyType>> _mapToBodyItemsState() => _bodyItems.stream;
|
||||
@override
|
||||
Stream<String> _mapToErrorsState() => _errors.stream;
|
||||
@override
|
||||
Stream<List<F>> _mapToFooterItemsState() => _footerItems.stream;
|
||||
Stream<List<FooterType>> _mapToFooterItemsState() => _footerItems.stream;
|
||||
@override
|
||||
Stream<List<H>> _mapToHeaderItemsState() => _headerItems.stream;
|
||||
Stream<List<HeaderType>> _mapToHeaderItemsState() => _headerItems.stream;
|
||||
@override
|
||||
Stream<bool> _mapToIsLoadingState() => _isLoading.stream;
|
||||
}
|
||||
|
||||
abstract class EnhancedListViewBlocType extends RxBlocTypeBase {
|
||||
EnhancedListViewEvents get events;
|
||||
EnhancedListViewStates get states;
|
||||
}
|
||||
|
||||
abstract class $EnhancedListViewBloc<BodyType, HeaderType, FooterType,
|
||||
QueryType> extends RxBlocBase
|
||||
implements
|
||||
EnhancedListViewEvents,
|
||||
EnhancedListViewStates,
|
||||
EnhancedListViewBlocType {
|
||||
final _compositeSubscription = CompositeSubscription();
|
||||
|
||||
/// Тhe [Subject] where events sink to by calling [loadBodyItems]
|
||||
final _$loadBodyItemsEvent = PublishSubject<({bool reset, dynamic query})>();
|
||||
|
||||
/// Тhe [Subject] where events sink to by calling [loadHeaderItems]
|
||||
final _$loadHeaderItemsEvent = PublishSubject<void>();
|
||||
|
||||
/// Тhe [Subject] where events sink to by calling [loadFooterItems]
|
||||
final _$loadFooterItemsEvent = PublishSubject<void>();
|
||||
|
||||
/// The state of [bodyItems] implemented in [_mapToBodyItemsState]
|
||||
late final Stream<List<BodyType>> _bodyItemsState = _mapToBodyItemsState();
|
||||
|
||||
/// The state of [headerItems] implemented in [_mapToHeaderItemsState]
|
||||
late final Stream<List<HeaderType>> _headerItemsState =
|
||||
_mapToHeaderItemsState();
|
||||
|
||||
/// The state of [footerItems] implemented in [_mapToFooterItemsState]
|
||||
late final Stream<List<FooterType>> _footerItemsState =
|
||||
_mapToFooterItemsState();
|
||||
|
||||
/// The state of [isLoading] implemented in [_mapToIsLoadingState]
|
||||
late final Stream<bool> _isLoadingState = _mapToIsLoadingState();
|
||||
|
||||
/// The state of [errors] implemented in [_mapToErrorsState]
|
||||
late final Stream<String> _errorsState = _mapToErrorsState();
|
||||
|
||||
@override
|
||||
void loadBodyItems({
|
||||
bool reset = false,
|
||||
dynamic query = null,
|
||||
}) =>
|
||||
_$loadBodyItemsEvent.add((
|
||||
reset: reset,
|
||||
query: query,
|
||||
));
|
||||
|
||||
@override
|
||||
void loadHeaderItems() => _$loadHeaderItemsEvent.add(null);
|
||||
|
||||
@override
|
||||
void loadFooterItems() => _$loadFooterItemsEvent.add(null);
|
||||
|
||||
@override
|
||||
Stream<List<BodyType>> get bodyItems => _bodyItemsState;
|
||||
|
||||
@override
|
||||
Stream<List<HeaderType>> get headerItems => _headerItemsState;
|
||||
|
||||
@override
|
||||
Stream<List<FooterType>> get footerItems => _footerItemsState;
|
||||
|
||||
@override
|
||||
Stream<bool> get isLoading => _isLoadingState;
|
||||
|
||||
@override
|
||||
Stream<String> get errors => _errorsState;
|
||||
|
||||
Stream<List<BodyType>> _mapToBodyItemsState();
|
||||
|
||||
Stream<List<HeaderType>> _mapToHeaderItemsState();
|
||||
|
||||
Stream<List<FooterType>> _mapToFooterItemsState();
|
||||
|
||||
Stream<bool> _mapToIsLoadingState();
|
||||
|
||||
Stream<String> _mapToErrorsState();
|
||||
|
||||
@override
|
||||
EnhancedListViewEvents get events => this;
|
||||
|
||||
@override
|
||||
EnhancedListViewStates get states => this;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_$loadBodyItemsEvent.close();
|
||||
_$loadHeaderItemsEvent.close();
|
||||
_$loadFooterItemsEvent.close();
|
||||
_compositeSubscription.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// ignore: unused_element
|
||||
typedef _LoadBodyItemsEventArgs = ({bool reset, dynamic query});
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:io';
|
|||
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_pdfview/flutter_pdfview.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:hub/flutter_flow/index.dart';
|
||||
|
|
|
@ -1,108 +1,108 @@
|
|||
// dart format width=80
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// // dart format width=80
|
||||
// // GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
// **************************************************************************
|
||||
// Generator: RxBlocGeneratorForAnnotation
|
||||
// **************************************************************************
|
||||
// // **************************************************************************
|
||||
// // Generator: RxBlocGeneratorForAnnotation
|
||||
// // **************************************************************************
|
||||
|
||||
part of 'widgets.dart';
|
||||
|
||||
/// Used as a contractor for the bloc, events and states classes
|
||||
/// @nodoc
|
||||
abstract class EnhancedListViewBlocType extends RxBlocTypeBase {
|
||||
EnhancedListViewEvents get events;
|
||||
EnhancedListViewStates get states;
|
||||
}
|
||||
// /// Used as a contractor for the bloc, events and states classes
|
||||
// /// @nodoc
|
||||
// abstract class EnhancedListViewBlocType extends RxBlocTypeBase {
|
||||
// EnhancedListViewEvents get events;
|
||||
// EnhancedListViewStates get states;
|
||||
// }
|
||||
|
||||
/// [$EnhancedListViewBloc<T, H, F, Q>] extended by the [EnhancedListViewBloc<T, H, F, Q>]
|
||||
/// @nodoc
|
||||
abstract class $EnhancedListViewBloc<T, H, F, Q> extends RxBlocBase
|
||||
implements
|
||||
EnhancedListViewEvents,
|
||||
EnhancedListViewStates,
|
||||
EnhancedListViewBlocType {
|
||||
final _compositeSubscription = CompositeSubscription();
|
||||
// /// [$EnhancedListViewBloc<BodyType, HeaderType, FooterType, QueryType>] extended by the [EnhancedListViewBloc<BodyType, HeaderType, FooterType, QueryType>]
|
||||
// /// @nodoc
|
||||
// abstract class $EnhancedListViewBloc<BodyType, HeaderType, FooterType, QueryType> extends RxBlocBase
|
||||
// implements
|
||||
// EnhancedListViewEvents,
|
||||
// EnhancedListViewStates,
|
||||
// EnhancedListViewBlocType {
|
||||
// final _compositeSubscription = CompositeSubscription();
|
||||
|
||||
/// Тhe [Subject] where events sink to by calling [loadBodyItems]
|
||||
final _$loadBodyItemsEvent = PublishSubject<({bool reset, dynamic query})>();
|
||||
// /// Тhe [Subject] where events sink to by calling [loadBodyItems]
|
||||
// final _$loadBodyItemsEvent = PublishSubject<({bool reset, dynamic query})>();
|
||||
|
||||
/// Тhe [Subject] where events sink to by calling [loadHeaderItems]
|
||||
final _$loadHeaderItemsEvent = PublishSubject<void>();
|
||||
// /// Тhe [Subject] where events sink to by calling [loadHeaderItems]
|
||||
// final _$loadHeaderItemsEvent = PublishSubject<void>();
|
||||
|
||||
/// Тhe [Subject] where events sink to by calling [loadFooterItems]
|
||||
final _$loadFooterItemsEvent = PublishSubject<void>();
|
||||
// /// Тhe [Subject] where events sink to by calling [loadFooterItems]
|
||||
// final _$loadFooterItemsEvent = PublishSubject<void>();
|
||||
|
||||
/// The state of [bodyItems] implemented in [_mapToBodyItemsState]
|
||||
late final Stream<List<T>> _bodyItemsState = _mapToBodyItemsState();
|
||||
// /// The state of [bodyItems] implemented in [_mapToBodyItemsState]
|
||||
// late final Stream<List<T>> _bodyItemsState = _mapToBodyItemsState();
|
||||
|
||||
/// The state of [headerItems] implemented in [_mapToHeaderItemsState]
|
||||
late final Stream<List<H>> _headerItemsState = _mapToHeaderItemsState();
|
||||
// /// The state of [headerItems] implemented in [_mapToHeaderItemsState]
|
||||
// late final Stream<List<H>> _headerItemsState = _mapToHeaderItemsState();
|
||||
|
||||
/// The state of [footerItems] implemented in [_mapToFooterItemsState]
|
||||
late final Stream<List<F>> _footerItemsState = _mapToFooterItemsState();
|
||||
// /// The state of [footerItems] implemented in [_mapToFooterItemsState]
|
||||
// late final Stream<List<F>> _footerItemsState = _mapToFooterItemsState();
|
||||
|
||||
/// The state of [isLoading] implemented in [_mapToIsLoadingState]
|
||||
late final Stream<bool> _isLoadingState = _mapToIsLoadingState();
|
||||
// /// The state of [isLoading] implemented in [_mapToIsLoadingState]
|
||||
// late final Stream<bool> _isLoadingState = _mapToIsLoadingState();
|
||||
|
||||
/// The state of [errors] implemented in [_mapToErrorsState]
|
||||
late final Stream<String> _errorsState = _mapToErrorsState();
|
||||
// /// The state of [errors] implemented in [_mapToErrorsState]
|
||||
// late final Stream<String> _errorsState = _mapToErrorsState();
|
||||
|
||||
@override
|
||||
void loadBodyItems({
|
||||
bool reset = false,
|
||||
dynamic query = null,
|
||||
}) =>
|
||||
_$loadBodyItemsEvent.add((
|
||||
reset: reset,
|
||||
query: query,
|
||||
));
|
||||
// @override
|
||||
// void loadBodyItems({
|
||||
// bool reset = false,
|
||||
// dynamic query = null,
|
||||
// }) =>
|
||||
// _$loadBodyItemsEvent.add((
|
||||
// reset: reset,
|
||||
// query: query,
|
||||
// ));
|
||||
|
||||
@override
|
||||
void loadHeaderItems() => _$loadHeaderItemsEvent.add(null);
|
||||
// @override
|
||||
// void loadHeaderItems() => _$loadHeaderItemsEvent.add(null);
|
||||
|
||||
@override
|
||||
void loadFooterItems() => _$loadFooterItemsEvent.add(null);
|
||||
// @override
|
||||
// void loadFooterItems() => _$loadFooterItemsEvent.add(null);
|
||||
|
||||
@override
|
||||
Stream<List<T>> get bodyItems => _bodyItemsState;
|
||||
// @override
|
||||
// Stream<List<T>> get bodyItems => _bodyItemsState;
|
||||
|
||||
@override
|
||||
Stream<List<H>> get headerItems => _headerItemsState;
|
||||
// @override
|
||||
// Stream<List<H>> get headerItems => _headerItemsState;
|
||||
|
||||
@override
|
||||
Stream<List<F>> get footerItems => _footerItemsState;
|
||||
// @override
|
||||
// Stream<List<F>> get footerItems => _footerItemsState;
|
||||
|
||||
@override
|
||||
Stream<bool> get isLoading => _isLoadingState;
|
||||
// @override
|
||||
// Stream<bool> get isLoading => _isLoadingState;
|
||||
|
||||
@override
|
||||
Stream<String> get errors => _errorsState;
|
||||
// @override
|
||||
// Stream<String> get errors => _errorsState;
|
||||
|
||||
Stream<List<T>> _mapToBodyItemsState();
|
||||
// Stream<List<T>> _mapToBodyItemsState();
|
||||
|
||||
Stream<List<H>> _mapToHeaderItemsState();
|
||||
// Stream<List<H>> _mapToHeaderItemsState();
|
||||
|
||||
Stream<List<F>> _mapToFooterItemsState();
|
||||
// Stream<List<F>> _mapToFooterItemsState();
|
||||
|
||||
Stream<bool> _mapToIsLoadingState();
|
||||
// Stream<bool> _mapToIsLoadingState();
|
||||
|
||||
Stream<String> _mapToErrorsState();
|
||||
// Stream<String> _mapToErrorsState();
|
||||
|
||||
@override
|
||||
EnhancedListViewEvents get events => this;
|
||||
// @override
|
||||
// EnhancedListViewEvents get events => this;
|
||||
|
||||
@override
|
||||
EnhancedListViewStates get states => this;
|
||||
// @override
|
||||
// EnhancedListViewStates get states => this;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_$loadBodyItemsEvent.close();
|
||||
_$loadHeaderItemsEvent.close();
|
||||
_$loadFooterItemsEvent.close();
|
||||
_compositeSubscription.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// void dispose() {
|
||||
// _$loadBodyItemsEvent.close();
|
||||
// _$loadHeaderItemsEvent.close();
|
||||
// _$loadFooterItemsEvent.close();
|
||||
// _compositeSubscription.dispose();
|
||||
// super.dispose();
|
||||
// }
|
||||
// }
|
||||
|
||||
// ignore: unused_element
|
||||
typedef _LoadBodyItemsEventArgs = ({bool reset, dynamic query});
|
||||
// // ignore: unused_element
|
||||
// typedef _LoadBodyItemsEventArgs = ({bool reset, dynamic query});
|
||||
|
|
|
@ -37,6 +37,8 @@ dependencies:
|
|||
fpdart: ^1.1.1
|
||||
|
||||
# Pacotes de UI
|
||||
flutter_pdfview: ^1.4.0
|
||||
pdfx: ^2.8.0
|
||||
auto_size_text: 3.0.0
|
||||
barcode_widget: ^2.0.4
|
||||
infinite_scroll_pagination: ^4.1.0
|
||||
|
@ -55,7 +57,6 @@ dependencies:
|
|||
percent_indicator: ^4.2.3
|
||||
page_transition: ^2.2.1
|
||||
share_plus: ^10.1.4
|
||||
pdfx: ^2.8.0
|
||||
dropdown_button2: ^2.3.9
|
||||
|
||||
# Firebase
|
||||
|
|
Loading…
Reference in New Issue