WIP
This commit is contained in:
parent
defe7f3401
commit
65a70cd8de
|
@ -9,20 +9,29 @@
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"args": [
|
"args": [
|
||||||
"--no-enable-impeller"
|
"--no-enable-impeller",
|
||||||
|
" --enable-experiment=macros"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "flutter-freaccesss-hub (profile mode)",
|
"name": "flutter-freaccesss-hub (profile mode)",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"flutterMode": "profile"
|
"flutterMode": "profile",
|
||||||
|
"args": [
|
||||||
|
"--no-enable-impeller",
|
||||||
|
" --enable-experiment=macros"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "flutter-freaccesss-hub (release mode)",
|
"name": "flutter-freaccesss-hub (release mode)",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"flutterMode": "release"
|
"flutterMode": "release",
|
||||||
|
"args": [
|
||||||
|
"--no-enable-impeller",
|
||||||
|
" --enable-experiment=macros"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -15,10 +15,7 @@ class DocumentPageBloc extends Bloc<DocumentPageEvent, DocumentPageState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
static DocumentPageBloc create(DocumentPageModel model) {
|
static DocumentPageBloc create(DocumentPageModel model) {
|
||||||
final initialState = DocumentPageState(
|
final initialState = DocumentPageState();
|
||||||
categories: [],
|
|
||||||
documents: [],
|
|
||||||
);
|
|
||||||
return DocumentPageBloc._(model, initialState);
|
return DocumentPageBloc._(model, initialState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,15 +63,15 @@ class DocumentPageBloc extends Bloc<DocumentPageEvent, DocumentPageState> {
|
||||||
|
|
||||||
Future<void> _unselectDocument(
|
Future<void> _unselectDocument(
|
||||||
UnselectDocumentEvent event, Emitter<DocumentPageState> emit) async {
|
UnselectDocumentEvent event, Emitter<DocumentPageState> emit) async {
|
||||||
final docs = await model.generateDocuments(state.page, state.query);
|
// final docs = await model.generateDocuments(state.page, state.query);
|
||||||
final cats = await model.generateCategories();
|
// final cats = await model.generateCategories();
|
||||||
|
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
currentDocument: null,
|
currentDocument: null,
|
||||||
isDocumentSelected: false,
|
isDocumentSelected: false,
|
||||||
documents: docs.$2,
|
// documents: docs.$2,
|
||||||
categories: cats,
|
// categories: cats,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -113,18 +110,14 @@ class DocumentPageState {
|
||||||
final int? count;
|
final int? count;
|
||||||
final dynamic page;
|
final dynamic page;
|
||||||
final Query? query;
|
final Query? query;
|
||||||
final List<Document?> documents;
|
|
||||||
final List<Category?> categories;
|
|
||||||
|
|
||||||
const DocumentPageState({
|
const DocumentPageState({
|
||||||
this.query,
|
this.query,
|
||||||
this.count,
|
this.count,
|
||||||
this.page,
|
this.page,
|
||||||
this.uri,
|
this.uri,
|
||||||
required this.documents,
|
|
||||||
this.currentDocument,
|
this.currentDocument,
|
||||||
this.isCategorySelected = false,
|
this.isCategorySelected = false,
|
||||||
required this.categories,
|
|
||||||
this.currentCategory,
|
this.currentCategory,
|
||||||
this.isDocumentSelected = false,
|
this.isDocumentSelected = false,
|
||||||
});
|
});
|
||||||
|
@ -147,11 +140,9 @@ class DocumentPageState {
|
||||||
count: count ?? this.count,
|
count: count ?? this.count,
|
||||||
page: page ?? this.page,
|
page: page ?? this.page,
|
||||||
//
|
//
|
||||||
documents: documents ?? this.documents,
|
|
||||||
currentDocument: currentDocument ?? this.currentDocument,
|
currentDocument: currentDocument ?? this.currentDocument,
|
||||||
isDocumentSelected: isDocumentSelected ?? this.isDocumentSelected,
|
isDocumentSelected: isDocumentSelected ?? this.isDocumentSelected,
|
||||||
//
|
//
|
||||||
categories: categories ?? this.categories,
|
|
||||||
currentCategory: currentCategory ?? this.currentCategory,
|
currentCategory: currentCategory ?? this.currentCategory,
|
||||||
isCategorySelected: isCategorySelected ?? this.isCategorySelected,
|
isCategorySelected: isCategorySelected ?? this.isCategorySelected,
|
||||||
);
|
);
|
||||||
|
|
|
@ -36,6 +36,7 @@ class DocumentPageModel extends FlutterFlowModel<DocumentPage> {
|
||||||
/// [documentItemBuilder]
|
/// [documentItemBuilder]
|
||||||
DocumentItem documentItemBuilder<T extends Document>(
|
DocumentItem documentItemBuilder<T extends Document>(
|
||||||
BuildContext context, T item, int index) {
|
BuildContext context, T item, int index) {
|
||||||
|
print('ItemBuilder -> $index');
|
||||||
return DocumentItem(
|
return DocumentItem(
|
||||||
document: item,
|
document: item,
|
||||||
onPressed: onView,
|
onPressed: onView,
|
||||||
|
|
|
@ -17,7 +17,9 @@ class DocumentViewScreen extends StatefulScreen {
|
||||||
class _DocumentViewScreenState extends ScreenState<DocumentViewScreen> {
|
class _DocumentViewScreenState extends ScreenState<DocumentViewScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
action() => context.read<DocumentPageBloc>().add(UnselectDocumentEvent());
|
action() {
|
||||||
|
context.read<DocumentPageBloc>().add(UnselectDocumentEvent());
|
||||||
|
}
|
||||||
|
|
||||||
final String title = widget.doc.description;
|
final String title = widget.doc.description;
|
||||||
final theme = FlutterFlowTheme.of(context);
|
final theme = FlutterFlowTheme.of(context);
|
||||||
|
@ -35,7 +37,7 @@ class _DocumentViewScreenState extends ScreenState<DocumentViewScreen> {
|
||||||
Widget buildBody(BuildContext context) {
|
Widget buildBody(BuildContext context) {
|
||||||
// final PDFViewerKey _viewerKey = PDFViewerKey();
|
// final PDFViewerKey _viewerKey = PDFViewerKey();
|
||||||
|
|
||||||
return PDFViewer(
|
return ReadView(
|
||||||
// search: _viewerKey,
|
// search: _viewerKey,
|
||||||
title: widget.doc.description,
|
title: widget.doc.description,
|
||||||
url: widget.uri.toString(),
|
url: widget.uri.toString(),
|
|
@ -14,9 +14,9 @@ import 'package:hub/shared/widgets/widgets.dart';
|
||||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
part 'document_manager_screen.dart';
|
|
||||||
part 'document_page_widget.dart';
|
part 'document_page_widget.dart';
|
||||||
part 'document_viewer_screen.dart';
|
part 'document_screen_manager.dart';
|
||||||
|
part 'document_screen_viewer.dart';
|
||||||
part 'document_page_model.dart';
|
part 'document_page_model.dart';
|
||||||
part 'document_item_component.dart';
|
part 'document_item_component.dart';
|
||||||
part 'document_page_bloc.dart';
|
part 'document_page_bloc.dart';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
part of '../widgets.dart';
|
part of 'widgets.dart';
|
||||||
|
|
||||||
// typedef PDFViewerKey = GlobalKey<SfPdfViewerState>;
|
// typedef PDFViewerKey = GlobalKey<SfPdfViewerState>;
|
||||||
|
|
||||||
|
@ -18,21 +18,21 @@ abstract interface class Viewer extends StatelessComponent {
|
||||||
Widget buildViewer(BuildContext context);
|
Widget buildViewer(BuildContext context);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PDFViewer extends StatefulWidget {
|
class ReadView extends StatefulWidget {
|
||||||
final String url;
|
final String url;
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
const PDFViewer({
|
const ReadView({
|
||||||
super.key,
|
super.key,
|
||||||
required this.url,
|
required this.url,
|
||||||
required this.title,
|
required this.title,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PDFViewer> createState() => PDFViewerState();
|
State<ReadView> createState() => ReadViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class PDFViewerState extends State<PDFViewer> {
|
class ReadViewState extends State<ReadView> {
|
||||||
late PdfController _pdfController;
|
late PdfController _pdfController;
|
||||||
|
|
||||||
Future<PdfController> _initializePdf() async {
|
Future<PdfController> _initializePdf() async {
|
|
@ -22,10 +22,8 @@ part 'model.dart';
|
||||||
part 'entity.dart';
|
part 'entity.dart';
|
||||||
|
|
||||||
/// [View]'s
|
/// [View]'s
|
||||||
part 'view/list_view.dart';
|
part 'list_view.dart';
|
||||||
part 'view/carousel_view.dart';
|
part 'carousel_view.dart';
|
||||||
|
part 'read_view.dart';
|
||||||
/// [Viewer]
|
|
||||||
part 'viewer/viewer.dart';
|
|
||||||
|
|
||||||
part 'text.dart';
|
part 'text.dart';
|
||||||
|
|
Loading…
Reference in New Issue