diff --git a/assets/images/persons.png:Zone.Identifier b/assets/images/persons.png:Zone.Identifier deleted file mode 100644 index 04e4eb86..00000000 --- a/assets/images/persons.png:Zone.Identifier +++ /dev/null @@ -1,4 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -ReferrerUrl=https://www.google.com/ -HostUrl=https://w7.pngwing.com/pngs/144/173/png-transparent-person-icon-illustration-computer-icons-icon-design-symbol-person-symbol-miscellaneous-monochrome-sticker.png diff --git a/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart b/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart index 911d27db..349fb22b 100644 --- a/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart +++ b/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart @@ -11,16 +11,14 @@ import 'card_item_template_component_model.dart'; export 'card_item_template_component_model.dart'; -/// - class CardItemTemplateComponentWidget extends StatefulWidget { const CardItemTemplateComponentWidget({ - super.key, + Key? key, required this.labelsHashMap, required this.statusHashMap, required this.imagePath, required this.onTapCardItemAction, - }); + }) : super(key: key); final Map? labelsHashMap; final List?> statusHashMap; @@ -35,23 +33,17 @@ class CardItemTemplateComponentWidget extends StatefulWidget { class _CardItemTemplateComponentWidgetState extends State { late CardItemTemplateComponentModel _model; - LinkedHashMap get labelsLinkedHashMap => - LinkedHashMap.from(widget.labelsHashMap ?? {}); - List> get statusLinkedHashMap => - widget.statusHashMap - .map((map) => LinkedHashMap.from(map ?? {})) - .toList(); - - @override - void setState(VoidCallback callback) { - super.setState(callback); - _model.onUpdate(); - } + late LinkedHashMap labelsLinkedHashMap; + late List> statusLinkedHashMap; @override void initState() { super.initState(); _model = createModel(context, () => CardItemTemplateComponentModel()); + labelsLinkedHashMap = LinkedHashMap.from(widget.labelsHashMap ?? {}); + statusLinkedHashMap = widget.statusHashMap + .map((map) => LinkedHashMap.from(map ?? {})) + .toList(); } @override @@ -65,147 +57,147 @@ class _CardItemTemplateComponentWidgetState } List _generateLabels() { - List labels = []; - double width = MediaQuery.of(context).size.width; + return labelsLinkedHashMap.entries.map((entry) { + final key = entry.key; + final text = entry.value.toString(); - for (var key in labelsLinkedHashMap.keys) { - String text = labelsLinkedHashMap[key].toString(); - - Widget widget = Row( - children: [ - Text( - key, - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).bodyMediumFamily), - color: FlutterFlowTheme.of(context).primaryText, - ), - ), - const SizedBox(width: 2.5), - SizedBox( - width: 225, - child: Text( - text, - overflow: TextOverflow.ellipsis, + return Container( + color: FlutterFlowTheme.of(context).primary, + child: Row( + children: [ + Text( + key, 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), + color: FlutterFlowTheme.of(context).primaryText, ), ), - ) - ], + Expanded( + child: Text( + text, + overflow: TextOverflow.ellipsis, + 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 Flexible(child: SizedBox(width: 25))), + ), ); - - labels.add(widget); - } - - return labels; + }).toList(); } Widget _generateImage() { - return Container( - width: 100, - height: 100, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(20), - child: CachedNetworkImage( - fadeInDuration: const Duration(milliseconds: 500), - fadeOutDuration: const Duration(milliseconds: 500), - imageUrl: widget.imagePath ?? '', - fit: BoxFit.cover, + return Flexible( + child: SizedBox( + width: 100, + height: 100, + child: ClipRRect( + borderRadius: BorderRadius.circular(20), + child: CachedNetworkImage( + fadeInDuration: const Duration(milliseconds: 500), + fadeOutDuration: const Duration(milliseconds: 500), + imageUrl: widget.imagePath ?? '', + fit: BoxFit.cover, + ), ), ), ); } List _generateStatus() { - List status = []; + return statusLinkedHashMap.expand((statusLinked) { + return statusLinked.entries.map((entry) { + final text = entry.key; + final color = entry.value; - statusLinkedHashMap.expand((statusLinked) { - statusLinked.forEach((text, color) { - Widget widget = Container( + return Container( padding: const EdgeInsets.all(5), decoration: BoxDecoration( - color: color, borderRadius: BorderRadius.circular(5)), + color: color, + borderRadius: BorderRadius.circular(5), + ), child: Text( text, overflow: TextOverflow.ellipsis, style: TextStyle( - color: FlutterFlowTheme.of(context).info, - fontSize: 12, - fontWeight: FontWeight.bold), + color: FlutterFlowTheme.of(context).info, + fontSize: 12, + fontWeight: FontWeight.bold, + ), ), ); - - status.add(widget); - }); - - return []; + }).toList(); }).toList(); - - return status; } - Widget _smallScreen() { - return Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - _generateImage(), - const SizedBox(height: 5), - Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ..._generateLabels(), - const SizedBox(height: 5), - Wrap( - spacing: 8, - runSpacing: 8, - children: _generateStatus(), - ) - ]), - ], - ); - } + Widget _buildContent() { + final screenWidth = MediaQuery.of(context).size.width; - Widget _largeScreen() { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ..._generateLabels(), - const SizedBox(height: 5), - Wrap( - spacing: 8, - runSpacing: 8, - children: _generateStatus(), - ) - ]), - _generateImage() - ], - ); + if (screenWidth > 360) { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Container( + color: FlutterFlowTheme.of(context).error, + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ..._generateLabels(), + const SizedBox(height: 5), + Wrap( + spacing: 8, + runSpacing: 8, + children: _generateStatus(), + ), + ], + ), + ), + ), + _generateImage(), + ], + ); + } else { + return Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _generateImage(), + const SizedBox(height: 5), + Expanded( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ..._generateLabels(), + const SizedBox(height: 5), + Wrap( + spacing: 8, + runSpacing: 8, + children: _generateStatus(), + ), + ], + ), + ), + ], + ); + } } @override Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - double screenHeight = MediaQuery.of(context).size.height; - context.watch(); return InkWell( @@ -226,16 +218,10 @@ class _CardItemTemplateComponentWidgetState child: Container( width: double.infinity, decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, + color: FlutterFlowTheme.of(context).warning, ), padding: const EdgeInsets.all(8), - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - screenWidth > 360 ? _largeScreen() : _smallScreen(), - ], - ), + child: _buildContent(), ), ), ), diff --git a/lib/pages/home_page/home_page_widget.dart b/lib/pages/home_page/home_page_widget.dart index a204977f..c2405bcc 100644 --- a/lib/pages/home_page/home_page_widget.dart +++ b/lib/pages/home_page/home_page_widget.dart @@ -166,12 +166,24 @@ class _HomePageWidgetState extends State { color: Color(0xFF1AAB5F), ), child: Align( - alignment: AlignmentDirectional.bottomCenter, + alignment: AlignmentDirectional.center, child: Row( mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const SizedBox(), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), + child: IconButton( + icon: const Icon( + Icons.menu_rounded, + color: Colors.white, + size: 28.0, + ), + onPressed: () async { + scaffoldKey.currentState!.openEndDrawer(); + }, + ), + ), Row( children: [ ClipRRect( @@ -196,20 +208,7 @@ class _HomePageWidgetState extends State { ), ], ), - Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 0.0, 0.0), - child: IconButton( - icon: const Icon( - Icons.menu_rounded, - color: Colors.white, - size: 28.0, - ), - onPressed: () async { - scaffoldKey.currentState!.openEndDrawer(); - }, - ), - ), + const SizedBox(), ], ), ),