55 lines
1.4 KiB
Dart
55 lines
1.4 KiB
Dart
part of 'index.dart';
|
|
|
|
typedef DocumentKey = GlobalKey<FREDocumentPageState>;
|
|
|
|
class DocumentPage extends StatefulPage {
|
|
const DocumentPage({super.key});
|
|
|
|
@override
|
|
State<DocumentPage> createState() => FREDocumentPageState();
|
|
}
|
|
|
|
class FREDocumentPageState<T extends DocumentPage>
|
|
extends PageState<DocumentPage> {
|
|
DocumentPageModel model = DocumentPageModel();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final String title = FFLocalizations.of(context).getVariableText(
|
|
enText: 'Documents',
|
|
ptText: 'Documentos',
|
|
);
|
|
final theme = FlutterFlowTheme.of(context);
|
|
|
|
return Scaffold(
|
|
backgroundColor: theme.primaryBackground,
|
|
appBar: buildAppBar(title, context),
|
|
body: buildBody(context),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
Widget buildBody(BuildContext context) {
|
|
return FutureBuilder<void>(
|
|
future: initAsync(),
|
|
builder: (context, snapshot) {
|
|
return DocumentManagerScreen(model: model);
|
|
},
|
|
);
|
|
// return DocumentViewScreen(document: documents.first);
|
|
}
|
|
|
|
Future<void> initAsync() async {
|
|
final documents = await model.generateDocuments(model.page, model.query);
|
|
final categories = await model.generateCategories(model.documents);
|
|
model.documents = documents.$2;
|
|
model.categories = categories;
|
|
log('-> generateDocuments: $documents');
|
|
log('-> generateCategories: $categories');
|
|
}
|
|
}
|