WIP
This commit is contained in:
parent
f0350c1bd9
commit
e1772649ec
|
@ -68,7 +68,7 @@ class DocumentPageState extends PageState<DocumentPage> {
|
||||||
Widget _buildDocumentViewScreen(
|
Widget _buildDocumentViewScreen(
|
||||||
AsyncSnapshot<(Document, Uri)?> snapshot, DocumentPageBlocType bloc) {
|
AsyncSnapshot<(Document, Uri)?> snapshot, DocumentPageBlocType bloc) {
|
||||||
if (snapshot.hasData) {
|
if (snapshot.hasData) {
|
||||||
return DocumentViewScreen(
|
return DocumentViewerScreen(
|
||||||
doc: snapshot.data!,
|
doc: snapshot.data!,
|
||||||
bloc: bloc,
|
bloc: bloc,
|
||||||
);
|
);
|
||||||
|
@ -83,7 +83,7 @@ class DocumentPageState extends PageState<DocumentPage> {
|
||||||
/// -----------------------------------------------
|
/// -----------------------------------------------
|
||||||
|
|
||||||
class DocumentManagerScreen extends StatelessScreen {
|
class DocumentManagerScreen extends StatelessScreen {
|
||||||
final DocumentPageModel model;
|
final DocumentModel model;
|
||||||
final DocumentPageState state;
|
final DocumentPageState state;
|
||||||
|
|
||||||
const DocumentManagerScreen({
|
const DocumentManagerScreen({
|
||||||
|
@ -130,8 +130,8 @@ class DocumentManagerScreen extends StatelessScreen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DocumentViewScreen extends StatefulScreen {
|
class DocumentViewerScreen extends StatefulScreen {
|
||||||
const DocumentViewScreen({
|
const DocumentViewerScreen({
|
||||||
super.key,
|
super.key,
|
||||||
required this.doc,
|
required this.doc,
|
||||||
required this.bloc,
|
required this.bloc,
|
||||||
|
@ -141,10 +141,11 @@ class DocumentViewScreen extends StatefulScreen {
|
||||||
final DocumentPageBlocType bloc;
|
final DocumentPageBlocType bloc;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ScreenState<DocumentViewScreen> createState() => _DocumentViewScreenState();
|
ScreenState<DocumentViewerScreen> createState() =>
|
||||||
|
_DocumentViewerScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DocumentViewScreenState extends ScreenState<DocumentViewScreen> {
|
class _DocumentViewerScreenState extends ScreenState<DocumentViewerScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final String title = widget.doc.$1.description;
|
final String title = widget.doc.$1.description;
|
||||||
|
@ -213,9 +214,9 @@ class _DocumentViewScreenState extends ScreenState<DocumentViewScreen> {
|
||||||
/// [Models] --------------------------------------
|
/// [Models] --------------------------------------
|
||||||
/// -----------------------------------------------
|
/// -----------------------------------------------
|
||||||
|
|
||||||
class DocumentPageModel extends FlutterFlowModel<DocumentPage> {
|
class DocumentModel extends FlutterFlowModel<DocumentPage> {
|
||||||
final DocumentPageBlocType bloc;
|
final DocumentPageBlocType bloc;
|
||||||
DocumentPageModel(this.bloc);
|
DocumentModel(this.bloc);
|
||||||
|
|
||||||
late EnhancedListViewKey<Document, Search, Category, Query>
|
late EnhancedListViewKey<Document, Search, Category, Query>
|
||||||
vehicleScreenManager;
|
vehicleScreenManager;
|
||||||
|
@ -495,10 +496,10 @@ abstract class DocumentPageBlocStates {
|
||||||
|
|
||||||
@RxBloc()
|
@RxBloc()
|
||||||
class DocumentPageBloc extends $DocumentPageBloc {
|
class DocumentPageBloc extends $DocumentPageBloc {
|
||||||
late final DocumentPageModel model;
|
late final DocumentModel model;
|
||||||
|
|
||||||
DocumentPageBloc(BuildContext context) {
|
DocumentPageBloc(BuildContext context) {
|
||||||
model = DocumentPageModel(this);
|
model = DocumentModel(this);
|
||||||
model.initState(context);
|
model.initState(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:hub/flutter_flow/index.dart';
|
||||||
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
|
|
||||||
|
mixin Template {
|
||||||
|
PreferredSizeWidget buildAppBar(
|
||||||
|
String title,
|
||||||
|
BuildContext context, [
|
||||||
|
dynamic Function()? backAction,
|
||||||
|
dynamic Function()? frontAction,
|
||||||
|
]) {
|
||||||
|
final theme = FlutterFlowTheme.of(context);
|
||||||
|
return AppBar(
|
||||||
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
title: Text(
|
||||||
|
title,
|
||||||
|
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context).headlineMediumFamily),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
leading: _backButton(context, theme, backAction),
|
||||||
|
centerTitle: true,
|
||||||
|
elevation: 0.0,
|
||||||
|
actions: _frontButton(context, theme, frontAction),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> _frontButton(BuildContext context, FlutterFlowTheme theme,
|
||||||
|
dynamic Function()? action) {
|
||||||
|
if (action == null) return [];
|
||||||
|
return [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async => await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => action(),
|
||||||
|
),
|
||||||
|
icon: Icon(
|
||||||
|
Symbols.info_i_rounded,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget? _backButton(BuildContext context, FlutterFlowTheme theme,
|
||||||
|
dynamic Function()? onPressed) {
|
||||||
|
if (onPressed == null) return null;
|
||||||
|
return FlutterFlowIconButton(
|
||||||
|
key: ValueKey<String>('BackNavigationAppBar'),
|
||||||
|
borderColor: Colors.transparent,
|
||||||
|
borderRadius: 30.0,
|
||||||
|
borderWidth: 1.0,
|
||||||
|
buttonSize: 60.0,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
color: theme.primaryText,
|
||||||
|
size: 30.0,
|
||||||
|
),
|
||||||
|
onPressed: onPressed,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,71 +1,5 @@
|
||||||
part of 'widgets.dart';
|
part of 'widgets.dart';
|
||||||
|
|
||||||
mixin Template {
|
|
||||||
PreferredSizeWidget buildAppBar(
|
|
||||||
String title,
|
|
||||||
BuildContext context, [
|
|
||||||
dynamic Function()? backAction,
|
|
||||||
dynamic Function()? frontAction,
|
|
||||||
]) {
|
|
||||||
final theme = FlutterFlowTheme.of(context);
|
|
||||||
return AppBar(
|
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
automaticallyImplyLeading: false,
|
|
||||||
title: Text(
|
|
||||||
title,
|
|
||||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
fontSize: 16.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).headlineMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
leading: _backButton(context, theme, backAction),
|
|
||||||
centerTitle: true,
|
|
||||||
elevation: 0.0,
|
|
||||||
actions: _frontButton(context, theme, frontAction),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Widget> _frontButton(BuildContext context, FlutterFlowTheme theme,
|
|
||||||
dynamic Function()? action) {
|
|
||||||
if (action == null) return [];
|
|
||||||
return [
|
|
||||||
IconButton(
|
|
||||||
onPressed: () async => await showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => action(),
|
|
||||||
),
|
|
||||||
icon: Icon(
|
|
||||||
Symbols.info_i_rounded,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget? _backButton(BuildContext context, FlutterFlowTheme theme,
|
|
||||||
dynamic Function()? onPressed) {
|
|
||||||
if (onPressed == null) return null;
|
|
||||||
return FlutterFlowIconButton(
|
|
||||||
key: ValueKey<String>('BackNavigationAppBar'),
|
|
||||||
borderColor: Colors.transparent,
|
|
||||||
borderRadius: 30.0,
|
|
||||||
borderWidth: 1.0,
|
|
||||||
buttonSize: 60.0,
|
|
||||||
icon: Icon(
|
|
||||||
Icons.keyboard_arrow_left,
|
|
||||||
color: theme.primaryText,
|
|
||||||
size: 30.0,
|
|
||||||
),
|
|
||||||
onPressed: onPressed,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// [PageWidget]
|
/// [PageWidget]
|
||||||
|
|
||||||
abstract class PageWidget<T> extends Widget {
|
abstract class PageWidget<T> extends Widget {
|
||||||
|
|
|
@ -3,11 +3,9 @@ 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: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';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:hub/shared/mixins/template_mixin.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:pdfx/pdfx.dart';
|
import 'package:pdfx/pdfx.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
Loading…
Reference in New Issue