add card item template component

This commit is contained in:
FlutterFlow 2024-07-03 11:50:01 +00:00
parent c0363c12f8
commit 8169362451
3 changed files with 365 additions and 4 deletions

View File

@ -44,8 +44,8 @@
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
6436409127A31CD500820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 6436409F27A31CD400820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6436409D27A31CDC00820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 6436409C27A31CDE00820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -225,8 +225,8 @@
6436409C27A31CD800820AF7 /* InfoPlist.strings */ = { 6436409C27A31CD800820AF7 /* InfoPlist.strings */ = {
isa = PBXVariantGroup; isa = PBXVariantGroup;
children = ( children = (
6436409127A31CD500820AF7 /* pt */, 6436409F27A31CD400820AF7 /* pt */,
6436409D27A31CDC00820AF7 /* en */, 6436409C27A31CDE00820AF7 /* en */,
); );
name = InfoPlist.strings; name = InfoPlist.strings;
sourceTree = "<group>"; sourceTree = "<group>";

View File

@ -0,0 +1,13 @@
import '/flutter_flow/flutter_flow_util.dart';
import 'card_item_template_component_widget.dart'
show CardItemTemplateComponentWidget;
import 'package:flutter/material.dart';
class CardItemTemplateComponentModel
extends FlutterFlowModel<CardItemTemplateComponentWidget> {
@override
void initState(BuildContext context) {}
@override
void dispose() {}
}

View File

@ -0,0 +1,348 @@
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
import 'card_item_template_component_model.dart';
export 'card_item_template_component_model.dart';
class CardItemTemplateComponentWidget extends StatefulWidget {
const CardItemTemplateComponentWidget({
super.key,
required this.labelsKeyValues,
required this.statusKeyValue,
required this.imageKeyValue,
required this.onTapCardItemAction,
});
final List<String>? labelsKeyValues;
final List<String>? statusKeyValue;
final String? imageKeyValue;
final Future Function()? onTapCardItemAction;
@override
State<CardItemTemplateComponentWidget> createState() =>
_CardItemTemplateComponentWidgetState();
}
class _CardItemTemplateComponentWidgetState
extends State<CardItemTemplateComponentWidget> {
late CardItemTemplateComponentModel _model;
@override
void setState(VoidCallback callback) {
super.setState(callback);
_model.onUpdate();
}
@override
void initState() {
super.initState();
_model = createModel(context, () => CardItemTemplateComponentModel());
}
@override
void dispose() {
_model.maybeDispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
return InkWell(
splashColor: Colors.transparent,
focusColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () async {
await widget.onTapCardItemAction?.call();
},
child: Card(
clipBehavior: Clip.antiAliasWithSaveLayer,
color: FlutterFlowTheme.of(context).secondaryBackground,
elevation: 5.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
child: Container(
width: 350.0,
height: 115.0,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).secondaryBackground,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Container(
width: 100.0,
height: 100.0,
decoration: const BoxDecoration(),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
mainAxisSize: MainAxisSize.max,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Text(
valueOrDefault<String>(
widget.labelsKeyValues?[1],
'KeyValue',
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
),
Text(
valueOrDefault<String>(
widget.labelsKeyValues?[1],
'KeyValue',
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
),
]
.divide(const SizedBox(width: 1.0))
.addToStart(const SizedBox(width: 10.0)),
),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
valueOrDefault<String>(
widget.labelsKeyValues?[1],
'KeyValue',
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
),
Text(
valueOrDefault<String>(
widget.labelsKeyValues?[1],
'KeyValue',
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
),
]
.divide(const SizedBox(width: 1.0))
.addToStart(const SizedBox(width: 10.0)),
),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
valueOrDefault<String>(
widget.labelsKeyValues?[1],
'KeyValue',
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
),
Text(
valueOrDefault<String>(
widget.labelsKeyValues?[1],
'KeyValue',
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
),
]
.divide(const SizedBox(width: 1.0))
.addToStart(const SizedBox(width: 10.0)),
),
].divide(const SizedBox(height: 1.0)),
),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Align(
alignment: const AlignmentDirectional(0.0, 0.0),
child: Container(
width: 200.0,
height: 27.0,
decoration: BoxDecoration(
color: valueOrDefault<Color>(
() {
if (widget.statusKeyValue?.first ==
widget.statusKeyValue?.last) {
return FlutterFlowTheme.of(context)
.success;
} else if ((widget.statusKeyValue?.first ==
widget.statusKeyValue?.last) ||
(widget.statusKeyValue?.first ==
widget.statusKeyValue?.last) ||
(widget.statusKeyValue?.first ==
widget.statusKeyValue?.last) ||
(widget.statusKeyValue?.first ==
widget.statusKeyValue?.last)) {
return FlutterFlowTheme.of(context).error;
} else if ((widget.statusKeyValue?.first ==
widget.statusKeyValue?.first) ==
(widget.statusKeyValue?.first ==
widget.statusKeyValue?.last)) {
return FlutterFlowTheme.of(context)
.warning;
} else {
return FlutterFlowTheme.of(context)
.primary;
}
}(),
FlutterFlowTheme.of(context).primary,
),
borderRadius: BorderRadius.circular(5.0),
),
child: Align(
alignment: const AlignmentDirectional(0.0, 0.0),
child: Text(
() {
if (widget.statusKeyValue?.first ==
widget.statusKeyValue?.last) {
return FFLocalizations.of(context)
.getVariableText(
ptText: 'Ativo',
enText: 'Active',
);
} else if ((widget.statusKeyValue?.first ==
widget.statusKeyValue?.last) ||
(widget.statusKeyValue?.first ==
widget.statusKeyValue?.last) ||
(widget.statusKeyValue?.first ==
widget.statusKeyValue?.last) ||
(widget.statusKeyValue?.first ==
widget.statusKeyValue?.last)) {
return FFLocalizations.of(context)
.getVariableText(
ptText: 'Cancelado',
enText: 'Canceled',
);
} else {
return FFLocalizations.of(context)
.getVariableText(
ptText: 'Pendente',
enText: 'Pending',
);
}
}(),
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),
),
),
),
),
),
],
),
].divide(const SizedBox(height: 5.0)),
),
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(10.0, 10.0, 10.0, 10.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(22.0),
child: CachedNetworkImage(
fadeInDuration: const Duration(milliseconds: 500),
fadeOutDuration: const Duration(milliseconds: 500),
imageUrl: valueOrDefault<String>(
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.imageKeyValue}&tipo=${widget.imageKeyValue}',
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
),
fit: BoxFit.cover,
),
),
),
],
),
),
),
);
}
}