This commit is contained in:
jantunesmessias 2025-02-18 18:02:39 -03:00
parent ecd9408f35
commit f0350c1bd9
13 changed files with 386 additions and 293 deletions

View File

@ -1 +0,0 @@
part of 'index.dart';

View File

@ -1 +0,0 @@
part of 'index.dart';

View File

@ -1 +0,0 @@
part of 'index.dart';

View File

@ -1 +0,0 @@
part of 'index.dart';

View File

@ -1 +0,0 @@
part of 'index.dart';

View File

@ -1 +0,0 @@
part of 'index.dart';

View File

@ -1 +0,0 @@
part of 'index.dart';

View File

@ -1 +0,0 @@
part of 'index.dart';

View File

@ -18,14 +18,13 @@ import 'package:rxdart/rxdart.dart' as rx;
part 'documents.rxb.g.dart'; part 'documents.rxb.g.dart';
/// ----------------------------------------------- /// -----------------------------------------------
/// [TypeDefs] /// [TypeDefs] -----------------------------------
/// ----------------------------------------------- /// -----------------------------------------------
typedef DocumentKey = GlobalKey<DocumentPageState>; typedef DocumentKey = GlobalKey<DocumentPageState>;
/// ----------------------------------------------- /// -----------------------------------------------
/// [Pages] ---------------------------------------
/// [Page]
/// ----------------------------------------------- /// -----------------------------------------------
class DocumentPage extends StatefulPage { 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> { class DocumentPageModel extends FlutterFlowModel<DocumentPage> {
@ -346,7 +475,7 @@ class DocumentPageModel extends FlutterFlowModel<DocumentPage> {
} }
/// ----------------------------------------------- /// -----------------------------------------------
/// [BLoC] /// [BLoCs] ---------------------------------------
/// ----------------------------------------------- /// -----------------------------------------------
extension RxdartStartWithExtension<T> on Stream<T?> { extension RxdartStartWithExtension<T> on Stream<T?> {
@ -390,142 +519,7 @@ class DocumentPageBloc extends $DocumentPageBloc {
} }
/// ----------------------------------------------- /// -----------------------------------------------
/// [Screens] /// [Interfaces] ---------------------------------
/// -----------------------------------------------
/// [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]
/// ----------------------------------------------- /// -----------------------------------------------
abstract interface class Archive extends Entity {} abstract interface class Archive extends Entity {}
@ -590,7 +584,7 @@ interface class Category extends Archive {
} }
/// ----------------------------------------------- /// -----------------------------------------------
/// [Widgets] /// [Components] -------------------------------------
/// ----------------------------------------------- /// -----------------------------------------------
// ignore: must_be_immutable // ignore: must_be_immutable

View File

@ -1,25 +1,23 @@
part of 'widgets.dart'; part of 'widgets.dart';
/// [TypeDefs] /// [TypeDefs] ----------------------------------------------------
typedef EnhancedListViewKey<B, H, F, Q> typedef EnhancedListViewKey<BodyType, HeaderType, FooterType, QueryType>
= GlobalKey<EnhancedListViewState<B, H, F, Q>>; = 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( /// [Extensions] ----------------------------------------------------
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]
extension PaginatedListMergeExtensions<T> extension PaginatedListMergeExtensions<T>
on Stream<Result<EnhancedPaginatedList<T>>> { on Stream<Result<EnhancedPaginatedList<T>>> {
Stream<EnhancedPaginatedList<T>> mergeWithPaginatedList( Stream<EnhancedPaginatedList<T>> mergeWithPaginatedList(
@ -72,9 +70,7 @@ extension QueryBlocStreamExtensions<T> on Stream<bool> {
}); });
} }
/// [Widgets] /// [Interfaces] ----------------------------------------------------
/// [EnhancedListView]
interface class EnhancedPaginatedList<T> extends PaginatedList<T> { interface class EnhancedPaginatedList<T> extends PaginatedList<T> {
@override @override
@ -145,13 +141,29 @@ interface class EnhancedPaginatedList<T> extends PaginatedList<T> {
Future<void> awaitLoad() async => Future.value(); Future<void> awaitLoad() async => Future.value();
} }
abstract interface class EnhancedListViewBase<T, H, F, Q> abstract interface class EnhancedListViewBase<BodyType, HeaderType, FooterType,
extends StatefulWidget { QueryType> extends StatefulWidget {
const EnhancedListViewBase({super.key}); const EnhancedListViewBase({super.key});
} }
abstract interface class EnhancedListViewBaseState<T> abstract interface class EnhancedListViewBaseState<BodyType, HeaderType,
extends State<EnhancedListViewBase> {} 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> class EnhancedListView<BodyType, HeaderType, FooterType, QueryType>
extends EnhancedListViewBase<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 FooterItemsBuilder<FooterType>? footerItems;
final PaginatedListViewFooterBuilder<FooterType>? footerBuilder; final PaginatedListViewFooterBuilder<FooterType>? footerBuilder;
EnhancedListView({ const EnhancedListView({
Key? key, Key? key,
required this.bodyItems, required this.bodyItems,
required this.bodyBuilder, required this.bodyBuilder,
@ -179,10 +191,8 @@ class EnhancedListView<BodyType, HeaderType, FooterType, QueryType>
} }
class EnhancedListViewState<ItemType, HeaderType, FooterType, QueryType> class EnhancedListViewState<ItemType, HeaderType, FooterType, QueryType>
extends State< extends State<EnhancedListView<ItemType, HeaderType, FooterType, QueryType>>
EnhancedListView<ItemType, HeaderType, FooterType, QueryType>> { with EnhancedListViewMixin<ItemType, HeaderType, FooterType, QueryType> {
late EnhancedListViewBloc<ItemType, HeaderType, FooterType, QueryType> bloc;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -197,12 +207,6 @@ class EnhancedListViewState<ItemType, HeaderType, FooterType, QueryType>
bloc.events.loadFooterItems(); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final header = StreamBuilder<List<HeaderType>>( final header = StreamBuilder<List<HeaderType>>(
@ -272,7 +276,7 @@ class EnhancedListViewState<ItemType, HeaderType, FooterType, QueryType>
} }
} }
/// [Utils] /// [Utils] ----------------------------------------------------
class EnhancedListTile<T extends Widget> extends StatelessWidget { class EnhancedListTile<T extends Widget> extends StatelessWidget {
const EnhancedListTile( const EnhancedListTile(
@ -336,7 +340,7 @@ class AuthorizationError implements Exception {
AuthorizationError(this.message); AuthorizationError(this.message);
} }
/// [State Management] /// [Blocs] ----------------------------------------------------
Stream<bool> get loadingState => Stream<bool>.empty(); Stream<bool> get loadingState => Stream<bool>.empty();
Stream<Exception> get errorState => Stream<Exception>.empty(); Stream<Exception> get errorState => Stream<Exception>.empty();
@ -345,23 +349,25 @@ abstract class EnhancedListViewRepository<T> {
int page, int pageSize, PaginatedListViewBodyBuilder<T> builder); 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 loadBodyItems({bool reset = false, dynamic query = null});
void loadHeaderItems(); void loadHeaderItems();
void loadFooterItems(); void loadFooterItems();
} }
abstract class EnhancedListViewStates<T, H, F, Q> { abstract class EnhancedListViewStates<BodyType, HeaderType, FooterType,
Stream<List<T>> get bodyItems; QueryType> {
Stream<List<H>> get headerItems; Stream<List<BodyType>> get bodyItems;
Stream<List<F>> get footerItems; Stream<List<HeaderType>> get headerItems;
Stream<List<FooterType>> get footerItems;
Stream<bool> get isLoading; Stream<bool> get isLoading;
Stream<String> get errors; Stream<String> get errors;
} }
@RxBloc() class EnhancedListViewBloc<BodyType, HeaderType, FooterType, QueryType>
class EnhancedListViewBloc<T, H, F, Q> extends $EnhancedListViewBloc<BodyType, HeaderType, FooterType,
extends $EnhancedListViewBloc<T, H, F, Q?> { QueryType?> {
EnhancedListViewBloc({ EnhancedListViewBloc({
required this.bodyItemsBuilder, required this.bodyItemsBuilder,
required this.headerItemsBuilder, required this.headerItemsBuilder,
@ -384,24 +390,24 @@ class EnhancedListViewBloc<T, H, F, Q>
.addTo(_compositeSubscription); .addTo(_compositeSubscription);
} }
final BodyItemsBuilder<T, Q?> bodyItemsBuilder; final BodyItemsBuilder<BodyType, QueryType?> bodyItemsBuilder;
final HeaderItemsBuilder<H> headerItemsBuilder; final HeaderItemsBuilder<HeaderType> headerItemsBuilder;
final FooterItemsBuilder<F> footerItemsBuilder; 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 _isLoading = BehaviorSubject<bool>.seeded(false);
final _errors = BehaviorSubject<String>(); final _errors = BehaviorSubject<String>();
Stream<List<T>> _fetchBodyItems(bool reset, Q? query) async* { Stream<List<BodyType>> _fetchBodyItems(bool reset, QueryType? query) async* {
try { try {
_isLoading.add(true); _isLoading.add(true);
final items = await bodyItemsBuilder(1, 10, query); final items = await bodyItemsBuilder(1, 10, query);
yield items.whereType<T>().toList(); yield items.whereType<BodyType>().toList();
} catch (e) { } catch (e) {
_errors.add(e.toString()); _errors.add(e.toString());
} finally { } finally {
@ -409,11 +415,11 @@ class EnhancedListViewBloc<T, H, F, Q>
} }
} }
Stream<List<H>> _fetchHeaderItems() async* { Stream<List<HeaderType>> _fetchHeaderItems() async* {
try { try {
_isLoading.add(true); _isLoading.add(true);
final items = await headerItemsBuilder(); final items = await headerItemsBuilder();
yield items.whereType<H>().toList(); yield items.whereType<HeaderType>().toList();
} catch (e) { } catch (e) {
_errors.add(e.toString()); _errors.add(e.toString());
} finally { } finally {
@ -421,11 +427,11 @@ class EnhancedListViewBloc<T, H, F, Q>
} }
} }
Stream<List<F>> _fetchFooterItems() async* { Stream<List<FooterType>> _fetchFooterItems() async* {
try { try {
_isLoading.add(true); _isLoading.add(true);
final items = await footerItemsBuilder(); final items = await footerItemsBuilder();
yield items.whereType<F>().toList(); yield items.whereType<FooterType>().toList();
} catch (e) { } catch (e) {
_errors.add(e.toString()); _errors.add(e.toString());
} finally { } 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)); _$loadBodyItemsEvent.add((query: query, reset: true));
} }
void filterHeaderItems(Q query) { void filterHeaderItems(QueryType query) {
_$loadHeaderItemsEvent.add(null); _$loadHeaderItemsEvent.add(null);
} }
void filterFooterItems(Q query) { void filterFooterItems(QueryType query) {
_$loadFooterItemsEvent.add(null); _$loadFooterItemsEvent.add(null);
} }
@ -456,13 +462,112 @@ class EnhancedListViewBloc<T, H, F, Q>
} }
@override @override
Stream<List<T>> _mapToBodyItemsState() => _bodyItems.stream; Stream<List<BodyType>> _mapToBodyItemsState() => _bodyItems.stream;
@override @override
Stream<String> _mapToErrorsState() => _errors.stream; Stream<String> _mapToErrorsState() => _errors.stream;
@override @override
Stream<List<F>> _mapToFooterItemsState() => _footerItems.stream; Stream<List<FooterType>> _mapToFooterItemsState() => _footerItems.stream;
@override @override
Stream<List<H>> _mapToHeaderItemsState() => _headerItems.stream; Stream<List<HeaderType>> _mapToHeaderItemsState() => _headerItems.stream;
@override @override
Stream<bool> _mapToIsLoadingState() => _isLoading.stream; 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});

View File

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_pdfview/flutter_pdfview.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:hub/flutter_flow/index.dart'; import 'package:hub/flutter_flow/index.dart';

View File

@ -1,108 +1,108 @@
// dart format width=80 // // dart format width=80
// GENERATED CODE - DO NOT MODIFY BY HAND // // GENERATED CODE - DO NOT MODIFY BY HAND
// ************************************************************************** // // **************************************************************************
// Generator: RxBlocGeneratorForAnnotation // // Generator: RxBlocGeneratorForAnnotation
// ************************************************************************** // // **************************************************************************
part of 'widgets.dart'; part of 'widgets.dart';
/// Used as a contractor for the bloc, events and states classes // /// Used as a contractor for the bloc, events and states classes
/// @nodoc // /// @nodoc
abstract class EnhancedListViewBlocType extends RxBlocTypeBase { // abstract class EnhancedListViewBlocType extends RxBlocTypeBase {
EnhancedListViewEvents get events; // EnhancedListViewEvents get events;
EnhancedListViewStates get states; // EnhancedListViewStates get states;
} // }
/// [$EnhancedListViewBloc<T, H, F, Q>] extended by the [EnhancedListViewBloc<T, H, F, Q>] // /// [$EnhancedListViewBloc<BodyType, HeaderType, FooterType, QueryType>] extended by the [EnhancedListViewBloc<BodyType, HeaderType, FooterType, QueryType>]
/// @nodoc // /// @nodoc
abstract class $EnhancedListViewBloc<T, H, F, Q> extends RxBlocBase // abstract class $EnhancedListViewBloc<BodyType, HeaderType, FooterType, QueryType> extends RxBlocBase
implements // implements
EnhancedListViewEvents, // EnhancedListViewEvents,
EnhancedListViewStates, // EnhancedListViewStates,
EnhancedListViewBlocType { // EnhancedListViewBlocType {
final _compositeSubscription = CompositeSubscription(); // final _compositeSubscription = CompositeSubscription();
/// Тhe [Subject] where events sink to by calling [loadBodyItems] // /// Тhe [Subject] where events sink to by calling [loadBodyItems]
final _$loadBodyItemsEvent = PublishSubject<({bool reset, dynamic query})>(); // final _$loadBodyItemsEvent = PublishSubject<({bool reset, dynamic query})>();
/// Тhe [Subject] where events sink to by calling [loadHeaderItems] // /// Тhe [Subject] where events sink to by calling [loadHeaderItems]
final _$loadHeaderItemsEvent = PublishSubject<void>(); // final _$loadHeaderItemsEvent = PublishSubject<void>();
/// Тhe [Subject] where events sink to by calling [loadFooterItems] // /// Тhe [Subject] where events sink to by calling [loadFooterItems]
final _$loadFooterItemsEvent = PublishSubject<void>(); // final _$loadFooterItemsEvent = PublishSubject<void>();
/// The state of [bodyItems] implemented in [_mapToBodyItemsState] // /// The state of [bodyItems] implemented in [_mapToBodyItemsState]
late final Stream<List<T>> _bodyItemsState = _mapToBodyItemsState(); // late final Stream<List<T>> _bodyItemsState = _mapToBodyItemsState();
/// The state of [headerItems] implemented in [_mapToHeaderItemsState] // /// The state of [headerItems] implemented in [_mapToHeaderItemsState]
late final Stream<List<H>> _headerItemsState = _mapToHeaderItemsState(); // late final Stream<List<H>> _headerItemsState = _mapToHeaderItemsState();
/// The state of [footerItems] implemented in [_mapToFooterItemsState] // /// The state of [footerItems] implemented in [_mapToFooterItemsState]
late final Stream<List<F>> _footerItemsState = _mapToFooterItemsState(); // late final Stream<List<F>> _footerItemsState = _mapToFooterItemsState();
/// The state of [isLoading] implemented in [_mapToIsLoadingState] // /// The state of [isLoading] implemented in [_mapToIsLoadingState]
late final Stream<bool> _isLoadingState = _mapToIsLoadingState(); // late final Stream<bool> _isLoadingState = _mapToIsLoadingState();
/// The state of [errors] implemented in [_mapToErrorsState] // /// The state of [errors] implemented in [_mapToErrorsState]
late final Stream<String> _errorsState = _mapToErrorsState(); // late final Stream<String> _errorsState = _mapToErrorsState();
@override // @override
void loadBodyItems({ // void loadBodyItems({
bool reset = false, // bool reset = false,
dynamic query = null, // dynamic query = null,
}) => // }) =>
_$loadBodyItemsEvent.add(( // _$loadBodyItemsEvent.add((
reset: reset, // reset: reset,
query: query, // query: query,
)); // ));
@override // @override
void loadHeaderItems() => _$loadHeaderItemsEvent.add(null); // void loadHeaderItems() => _$loadHeaderItemsEvent.add(null);
@override // @override
void loadFooterItems() => _$loadFooterItemsEvent.add(null); // void loadFooterItems() => _$loadFooterItemsEvent.add(null);
@override // @override
Stream<List<T>> get bodyItems => _bodyItemsState; // Stream<List<T>> get bodyItems => _bodyItemsState;
@override // @override
Stream<List<H>> get headerItems => _headerItemsState; // Stream<List<H>> get headerItems => _headerItemsState;
@override // @override
Stream<List<F>> get footerItems => _footerItemsState; // Stream<List<F>> get footerItems => _footerItemsState;
@override // @override
Stream<bool> get isLoading => _isLoadingState; // Stream<bool> get isLoading => _isLoadingState;
@override // @override
Stream<String> get errors => _errorsState; // 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 // @override
EnhancedListViewEvents get events => this; // EnhancedListViewEvents get events => this;
@override // @override
EnhancedListViewStates get states => this; // EnhancedListViewStates get states => this;
@override // @override
void dispose() { // void dispose() {
_$loadBodyItemsEvent.close(); // _$loadBodyItemsEvent.close();
_$loadHeaderItemsEvent.close(); // _$loadHeaderItemsEvent.close();
_$loadFooterItemsEvent.close(); // _$loadFooterItemsEvent.close();
_compositeSubscription.dispose(); // _compositeSubscription.dispose();
super.dispose(); // super.dispose();
} // }
} // }
// ignore: unused_element // // ignore: unused_element
typedef _LoadBodyItemsEventArgs = ({bool reset, dynamic query}); // typedef _LoadBodyItemsEventArgs = ({bool reset, dynamic query});

View File

@ -37,6 +37,8 @@ dependencies:
fpdart: ^1.1.1 fpdart: ^1.1.1
# Pacotes de UI # Pacotes de UI
flutter_pdfview: ^1.4.0
pdfx: ^2.8.0
auto_size_text: 3.0.0 auto_size_text: 3.0.0
barcode_widget: ^2.0.4 barcode_widget: ^2.0.4
infinite_scroll_pagination: ^4.1.0 infinite_scroll_pagination: ^4.1.0
@ -55,7 +57,6 @@ dependencies:
percent_indicator: ^4.2.3 percent_indicator: ^4.2.3
page_transition: ^2.2.1 page_transition: ^2.2.1
share_plus: ^10.1.4 share_plus: ^10.1.4
pdfx: ^2.8.0
dropdown_button2: ^2.3.9 dropdown_button2: ^2.3.9
# Firebase # Firebase