45 lines
1.1 KiB
Dart
45 lines
1.1 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> {
|
|
@override
|
|
Widget build(BuildContext context) => buildBody(context);
|
|
DocumentPageModel model = DocumentPageModel();
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
model.initState(context);
|
|
}
|
|
|
|
Widget buildBody(BuildContext context) {
|
|
return BlocProvider<DocumentPageBloc>(
|
|
create: (context) => DocumentPageBloc.create(model),
|
|
child: BlocBuilder<DocumentPageBloc, DocumentPageState>(
|
|
builder: (context, state) {
|
|
print('Bloc -> ${state.isCategorySelected}');
|
|
|
|
if (state.isDocumentSelected)
|
|
return DocumentViewScreen(
|
|
doc: state.currentDocument!,
|
|
uri: state.uri!,
|
|
);
|
|
else
|
|
return DocumentManagerScreen(
|
|
model: model,
|
|
state: state,
|
|
);
|
|
}),
|
|
);
|
|
}
|
|
}
|