WIP
This commit is contained in:
parent
e1772649ec
commit
23a6b6d1d9
|
@ -64,218 +64,225 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
|
|||
// CachedNetworkImage.evictFromCache(widget.imagePath ?? '');
|
||||
final double limitedBodyFontSize =
|
||||
LimitedFontSizeUtil.getBodyFontSize(context);
|
||||
return Container(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: MediaQuery.of(context).size.width,
|
||||
maxHeight: MediaQuery.of(context).size.height,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(25.0)),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
if (widget.imagePath != null && widget.imagePath != '')
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.3,
|
||||
height: MediaQuery.of(context).size.width * 0.3,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Container(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: MediaQuery.of(context).size.width,
|
||||
maxHeight: MediaQuery.of(context).size.height,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(25.0)),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
if (widget.imagePath != null && widget.imagePath != '')
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.3,
|
||||
height: MediaQuery.of(context).size.width * 0.3,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: CachedNetworkImage(
|
||||
fadeInDuration: const Duration(milliseconds: 100),
|
||||
fadeOutDuration: const Duration(milliseconds: 100),
|
||||
imageUrl: widget.imagePath!,
|
||||
fit: BoxFit.cover,
|
||||
useOldImageOnUrlChange: true,
|
||||
),
|
||||
),
|
||||
child: CachedNetworkImage(
|
||||
fadeInDuration: const Duration(milliseconds: 100),
|
||||
fadeOutDuration: const Duration(milliseconds: 100),
|
||||
imageUrl: widget.imagePath!,
|
||||
fit: BoxFit.cover,
|
||||
useOldImageOnUrlChange: true,
|
||||
),
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.03),
|
||||
Row(
|
||||
children: statusLinkedHashMap.expand((linkedHashMap) {
|
||||
return linkedHashMap.entries
|
||||
.map((MapEntry<String, Color> item) {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width * 0.05,
|
||||
),
|
||||
child: TextFormField(
|
||||
autofocus: false,
|
||||
canRequestFocus: false,
|
||||
readOnly: true,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: item.value,
|
||||
),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: item.value,
|
||||
labelText: item.key,
|
||||
labelStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily: FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: FlutterFlowTheme.of(context).info,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily,
|
||||
),
|
||||
fontSize: limitedBodyFontSize,
|
||||
),
|
||||
hintStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily: FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).info,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily,
|
||||
),
|
||||
fontSize: limitedBodyFontSize,
|
||||
),
|
||||
focusedBorder: InputBorder.none,
|
||||
errorBorder: InputBorder.none,
|
||||
focusedErrorBorder: InputBorder.none,
|
||||
suffixIcon: Icon(
|
||||
Icons.info,
|
||||
color: FlutterFlowTheme.of(context).info,
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.03),
|
||||
Row(
|
||||
children: statusLinkedHashMap.expand((linkedHashMap) {
|
||||
return linkedHashMap.entries
|
||||
.map((MapEntry<String, Color> item) {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: MediaQuery.of(context).size.width * 0.05,
|
||||
),
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).info,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
child: TextFormField(
|
||||
autofocus: false,
|
||||
canRequestFocus: false,
|
||||
readOnly: true,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: item.value,
|
||||
),
|
||||
fontSize: limitedBodyFontSize,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: null,
|
||||
keyboardType: TextInputType.name,
|
||||
validator: _model.textController1Validator
|
||||
.asValidator(context),
|
||||
filled: true,
|
||||
fillColor: item.value,
|
||||
labelText: item.key,
|
||||
labelStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily: FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: FlutterFlowTheme.of(context).info,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts:
|
||||
GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily,
|
||||
),
|
||||
fontSize: limitedBodyFontSize,
|
||||
),
|
||||
hintStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily: FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).info,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts:
|
||||
GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context)
|
||||
.labelMediumFamily,
|
||||
),
|
||||
fontSize: limitedBodyFontSize,
|
||||
),
|
||||
focusedBorder: InputBorder.none,
|
||||
errorBorder: InputBorder.none,
|
||||
focusedErrorBorder: InputBorder.none,
|
||||
suffixIcon: Icon(
|
||||
Icons.info,
|
||||
color: FlutterFlowTheme.of(context).info,
|
||||
),
|
||||
),
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: FlutterFlowTheme.of(context)
|
||||
.bodyMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).info,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
),
|
||||
fontSize: limitedBodyFontSize,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: null,
|
||||
keyboardType: TextInputType.name,
|
||||
validator: _model.textController1Validator
|
||||
.asValidator(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
}).toList(),
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.03),
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: labelsLinkedHashMap.length,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
String key = labelsLinkedHashMap.keys.elementAt(index);
|
||||
String value = labelsLinkedHashMap[key]!;
|
||||
// return Text('key: $key, value: $value');
|
||||
return TextFormField(
|
||||
readOnly: true,
|
||||
initialValue: value,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
),
|
||||
fontSize: limitedBodyFontSize,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
labelText: key,
|
||||
filled: true,
|
||||
fillColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground, // Change border color here
|
||||
),
|
||||
),
|
||||
labelStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
),
|
||||
),
|
||||
hintStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground, // Change border color here
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground, // Change border color here
|
||||
),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground, // Change border color here
|
||||
),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground, // Change border color here
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
}).toList(),
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.03),
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: labelsLinkedHashMap.length,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
String key = labelsLinkedHashMap.keys.elementAt(index);
|
||||
String value = labelsLinkedHashMap[key]!;
|
||||
// return Text('key: $key, value: $value');
|
||||
return TextFormField(
|
||||
readOnly: true,
|
||||
initialValue: value,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
),
|
||||
fontSize: limitedBodyFontSize,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
labelText: key,
|
||||
filled: true,
|
||||
fillColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground, // Change border color here
|
||||
),
|
||||
),
|
||||
labelStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
),
|
||||
),
|
||||
hintStyle: FlutterFlowTheme.of(context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
FlutterFlowTheme.of(context).labelMediumFamily,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground, // Change border color here
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground, // Change border color here
|
||||
),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground, // Change border color here
|
||||
),
|
||||
),
|
||||
focusedErrorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
borderSide: BorderSide(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.primaryBackground, // Change border color here
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
if (widget.buttons!.isNotEmpty || widget.buttons != null)
|
||||
OverflowBar(
|
||||
overflowAlignment: OverflowBarAlignment.center,
|
||||
alignment: MainAxisAlignment.center,
|
||||
overflowSpacing: 2,
|
||||
spacing: 2,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: widget.buttons!,
|
||||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
],
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
if (widget.buttons!.isNotEmpty || widget.buttons != null)
|
||||
OverflowBar(
|
||||
overflowAlignment: OverflowBarAlignment.center,
|
||||
alignment: MainAxisAlignment.center,
|
||||
overflowSpacing: 2,
|
||||
spacing: 2,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: widget.buttons!,
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -23,6 +23,15 @@ part 'documents.rxb.g.dart';
|
|||
|
||||
typedef DocumentKey = GlobalKey<DocumentPageState>;
|
||||
|
||||
/// -----------------------------------------------
|
||||
/// [Extensions] ---------------------------------
|
||||
/// -----------------------------------------------
|
||||
|
||||
extension ExplicitRxdartStartWithExtension<T> on Stream<T?> {
|
||||
Stream<T?> rxdartStartWith(T? value) =>
|
||||
rx.StartWithExtension(this).startWith(value);
|
||||
}
|
||||
|
||||
/// -----------------------------------------------
|
||||
/// [Pages] ---------------------------------------
|
||||
/// -----------------------------------------------
|
||||
|
@ -146,45 +155,56 @@ class DocumentViewerScreen extends StatefulScreen {
|
|||
}
|
||||
|
||||
class _DocumentViewerScreenState extends ScreenState<DocumentViewerScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String title = widget.doc.$1.description;
|
||||
final theme = FlutterFlowTheme.of(context);
|
||||
final locale = FFLocalizations.of(context);
|
||||
final Color color = widget.doc.$1.category.color;
|
||||
;
|
||||
|
||||
backAction() => widget.bloc.events.unselectDocument();
|
||||
infoAction() => DetailsComponentWidget(
|
||||
buttons: [],
|
||||
statusHashMap: [],
|
||||
statusHashMap: [
|
||||
Map<String, Color>.from({
|
||||
widget.doc.$1.description: widget.doc.$1.category.color,
|
||||
})
|
||||
],
|
||||
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,
|
||||
if (widget.doc.$1.person.isNotEmpty)
|
||||
locale.getVariableText(
|
||||
enText: 'Person',
|
||||
ptText: 'Pessoa',
|
||||
): widget.doc.$1.person,
|
||||
if (widget.doc.$1.property.isNotEmpty)
|
||||
locale.getVariableText(
|
||||
enText: 'Property',
|
||||
ptText: 'Propriedade',
|
||||
): widget.doc.$1.property,
|
||||
locale.getVariableText(
|
||||
enText: 'Created At',
|
||||
ptText: 'Criado em',
|
||||
): widget.doc.$1.createdAt,
|
||||
): ValidatorUtil.toLocalDateTime(
|
||||
'yyyy-MM-dd', widget.doc.$1.createdAt),
|
||||
locale.getVariableText(
|
||||
enText: 'Updated At',
|
||||
ptText: 'Atualizado em',
|
||||
): widget.doc.$1.updatedAt,
|
||||
): ValidatorUtil.toLocalDateTime(
|
||||
'yyyy-MM-dd', widget.doc.$1.updatedAt),
|
||||
}),
|
||||
);
|
||||
|
||||
|
@ -200,10 +220,7 @@ class _DocumentViewerScreenState extends ScreenState<DocumentViewerScreen> {
|
|||
}
|
||||
|
||||
Widget buildBody(BuildContext context) {
|
||||
// final PDFViewerKey _viewerKey = PDFViewerKey();
|
||||
|
||||
return ReadView(
|
||||
// search: _viewerKey,
|
||||
title: widget.doc.$1.description,
|
||||
url: widget.doc.$2.toString(),
|
||||
);
|
||||
|
@ -256,7 +273,7 @@ class DocumentModel extends FlutterFlowModel<DocumentPage> {
|
|||
BuildContext context, T item, int index) {
|
||||
log('ItemBuilder -> $index');
|
||||
|
||||
return DocumentItem(
|
||||
return DocumentComponent(
|
||||
document: item,
|
||||
onPressed: onView,
|
||||
);
|
||||
|
@ -311,8 +328,8 @@ class DocumentModel extends FlutterFlowModel<DocumentPage> {
|
|||
|
||||
/// [Footer]
|
||||
|
||||
CategoryItem categoryItemBuilder<T>(T? item) {
|
||||
return CategoryItem(category: item! as Category);
|
||||
CategoryComponent categoryItemBuilder<T>(T? item) {
|
||||
return CategoryComponent(category: item! as Category);
|
||||
}
|
||||
|
||||
Widget itemFooterBuilder<T>(Future<List<T?>> Function() gen) =>
|
||||
|
@ -479,11 +496,6 @@ class DocumentModel extends FlutterFlowModel<DocumentPage> {
|
|||
/// [BLoCs] ---------------------------------------
|
||||
/// -----------------------------------------------
|
||||
|
||||
extension RxdartStartWithExtension<T> on Stream<T?> {
|
||||
Stream<T?> rxdartStartWith(T? value) =>
|
||||
rx.StartWithExtension(this).startWith(value);
|
||||
}
|
||||
|
||||
abstract class DocumentPageBlocEvents {
|
||||
void selectDocument(Document document);
|
||||
void unselectDocument();
|
||||
|
@ -589,11 +601,11 @@ interface class Category extends Archive {
|
|||
/// -----------------------------------------------
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class DocumentItem extends StatelessComponent {
|
||||
class DocumentComponent extends StatelessComponent {
|
||||
final Document document;
|
||||
void Function(Document, BuildContext) onPressed;
|
||||
|
||||
DocumentItem({
|
||||
DocumentComponent({
|
||||
super.key,
|
||||
required this.document,
|
||||
required this.onPressed,
|
||||
|
@ -721,20 +733,20 @@ class DocumentItem extends StatelessComponent {
|
|||
);
|
||||
}
|
||||
|
||||
DocumentItem copyWith({
|
||||
DocumentComponent copyWith({
|
||||
Document? document,
|
||||
}) {
|
||||
return DocumentItem(
|
||||
return DocumentComponent(
|
||||
document: document ?? this.document,
|
||||
onPressed: onPressed,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CategoryItem extends StatelessComponent {
|
||||
class CategoryComponent extends StatelessComponent {
|
||||
final Category category;
|
||||
|
||||
const CategoryItem({
|
||||
const CategoryComponent({
|
||||
super.key,
|
||||
required this.category,
|
||||
});
|
||||
|
|
|
@ -38,7 +38,7 @@ mixin Template {
|
|||
if (action == null) return [];
|
||||
return [
|
||||
IconButton(
|
||||
onPressed: () async => await showDialog(
|
||||
onPressed: () async => await showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => action(),
|
||||
),
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
part of 'widgets.dart';
|
||||
|
||||
// typedef PDFViewerKey = GlobalKey<SfPdfViewerState>;
|
||||
typedef ReadViewController = PdfController;
|
||||
typedef Document = PdfDocument;
|
||||
|
||||
abstract interface class Viewer extends StatelessComponent {
|
||||
final String src;
|
||||
|
@ -33,12 +35,10 @@ class ReadView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class ReadViewState extends State<ReadView> {
|
||||
late PdfController _pdfController;
|
||||
|
||||
Future<PdfController> _initializePdf() async {
|
||||
Future<ReadViewController> _initializePdf() async {
|
||||
final file = await downloadPdf(widget.url);
|
||||
final Future<PdfDocument> document = PdfDocument.openFile(file.path);
|
||||
return PdfController(document: document);
|
||||
final Future<Document> document = Document.openFile(file.path);
|
||||
return ReadViewController(document: document);
|
||||
}
|
||||
|
||||
Future<File> downloadPdf(String url) async {
|
||||
|
@ -106,11 +106,10 @@ class ReadViewState extends State<ReadView> {
|
|||
|
||||
Widget _buildPDFViewer() => Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: FutureBuilder<PdfController>(
|
||||
child: FutureBuilder<ReadViewController>(
|
||||
future: _initializePdf(),
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) return buildLoadingIndicator(context);
|
||||
|
||||
return PdfView(
|
||||
controller: snapshot.data!,
|
||||
renderer: (PdfPage page) => page.render(
|
||||
|
@ -120,7 +119,6 @@ class ReadViewState extends State<ReadView> {
|
|||
10.0, 10.0, page.width * 2, page.height * 2),
|
||||
forPrint: false,
|
||||
quality: 100,
|
||||
removeTempFile: true,
|
||||
format: PdfPageImageFormat.jpeg,
|
||||
backgroundColor: '#ffffff',
|
||||
),
|
||||
|
@ -130,10 +128,4 @@ class ReadViewState extends State<ReadView> {
|
|||
);
|
||||
|
||||
// Widget get progressIndicator => LoadingUtil.buildLoadingIndicator(context);
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_pdfController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue