From d1b74a706b2aacee32f4f5e5573675e460be3ce4 Mon Sep 17 00:00:00 2001 From: jantunesmesias Date: Fri, 23 Aug 2024 10:13:39 -0300 Subject: [PATCH] WIP --- .../menu_button_item_widget.dart | 2 +- .../menu_component/menu_component_widget.dart | 320 +++++++++++------- .../menu_staggered_view_component_widget.dart | 147 +++++--- pubspec.lock | 40 +-- 4 files changed, 311 insertions(+), 198 deletions(-) diff --git a/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart b/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart index 0b551ee8..7a3aedd7 100644 --- a/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart +++ b/lib/components/atomic_components/menu_button_item/menu_button_item_widget.dart @@ -34,7 +34,7 @@ class _MenuButtonWidgetState extends State { await widget.action?.call(); }, child: Container( - width: 100.0, + width: 120.0, height: 100.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).primaryBackground, diff --git a/lib/components/organism_components/menu_component/menu_component_widget.dart b/lib/components/organism_components/menu_component/menu_component_widget.dart index 906715ee..2d6d10a3 100644 --- a/lib/components/organism_components/menu_component/menu_component_widget.dart +++ b/lib/components/organism_components/menu_component/menu_component_widget.dart @@ -55,133 +55,203 @@ class _MenuComponentWidgetState extends State { Widget build(BuildContext context) { final options = () { if (widget.item == MenuItem.button) { - return [ - MenuButtonWidget( - icon: Icons.event, - action: () async { - await _model.scheduleCompleteVisitAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Complete\nSchedule', - ptText: 'Agenda\nCompleta', + if (_model.isGrid == false) + return [ + MenuButtonWidget( + icon: FFIcons.kvector1, + action: () async { + await _model.scheduleVisitOptAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Schedule\nVisit', + ptText: 'Agendar\nVisita', + ), ), - ), - MenuButtonWidget( - icon: Icons.perm_contact_calendar_outlined, - action: () async { - await _model.scheduleProvisionalVisitAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Provisional\nSchedule', - ptText: 'Agenda\nProvisória', + MenuButtonWidget( + icon: FFIcons.khome, + action: () async { + await _model.registerVisitorOptAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Register\nVisitor', + ptText: 'Cadastro\nde Visitante', + ), ), - ), - MenuButtonWidget( - icon: Icons.event_repeat, - action: () async { - await _model.fastPassAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Fast\nSchedule', - ptText: 'Agenda\nRápida', + MenuButtonWidget( + icon: Icons.qr_code, + action: () async { + await _model.accessQRCodeOptAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'QRCode\nAccess', + ptText: 'QRCode\nde Acesso', + ), ), - ), - MenuButtonWidget( - icon: FFIcons.khome, - action: () async { - await _model.registerVisitorOptAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Register\nVisitor', - ptText: 'Cadastro\nde Visitante', + MenuButtonWidget( + icon: Icons.people, + action: () async { + await _model.peopleOnThePropertyAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Poeple on\nthe Property', + ptText: 'Pessoas na\nPropriedade', + ), ), - ), - MenuButtonWidget( - icon: Icons.qr_code, - action: () async { - await _model.accessQRCodeOptAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'QRCode\nAccess', - ptText: 'QRCode\nde Acesso', + MenuButtonWidget( + icon: Icons.history_sharp, + action: () async { + await _model.consultHistoriesAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Consult\nHistories', + ptText: 'Consultar\nHistóricos', + ), ), - ), - MenuButtonWidget( - icon: Icons.group_add, - action: () async { - await _model.peopleOnThePropertyAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Poeple on\nthe Property', - ptText: 'Pessoas na\nPropriedade', + MenuButtonWidget( + icon: Icons.settings, + action: () async { + await _model.preferencesSettings(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Preferences\nSettings', + ptText: 'Preferências \nde Configurações', + ), ), - ), - MenuButtonWidget( - icon: Icons.history_sharp, - action: () async { - await _model.liberationHistoryAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Liberations\nHistory', - ptText: 'Consultar\nLiberações', + ]; + else + return [ + MenuButtonWidget( + icon: Icons.event, + action: () async { + await _model.scheduleCompleteVisitAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Complete\nSchedule', + ptText: 'Agenda\nCompleta', + ), ), - ), - MenuButtonWidget( - icon: Icons.key, - action: () async { - await _model.accessHistoryAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Access\nHistory', - ptText: 'Consultar\nAcessos', + MenuButtonWidget( + icon: Icons.pending_actions, + action: () async { + await _model.scheduleProvisionalVisitAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Provisional\nSchedule', + ptText: 'Agenda\nProvisória', + ), ), - ), - MenuButtonWidget( - icon: Icons.group, - action: () async { - await _model.visitHistoryAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Visit\nHistory', - ptText: 'Consultar\nVisitas', + MenuButtonWidget( + icon: Icons.confirmation_num_outlined, + action: () async { + await _model.fastPassAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Fast\nVisit', + ptText: 'Agendar\nVisita', + ), ), - ), - MenuButtonWidget( - icon: Icons.sms_outlined, - action: () async { - await _model.consultHistoriesAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Messages\nHistory', - ptText: 'Consultar\nMensagens', + MenuButtonWidget( + icon: FFIcons.khome, + action: () async { + await _model.registerVisitorOptAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Register\nVisitor', + ptText: 'Cadastro\nde Visitante', + ), ), - ), - MenuButtonWidget( - icon: Icons.settings, - action: () async { - await _model.preferencesSettings(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Settings', - ptText: 'Configurações', + MenuButtonWidget( + icon: Icons.qr_code, + action: () async { + await _model.accessQRCodeOptAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'QRCode\nAccess', + ptText: 'QRCode\nde Acesso', + ), ), - ), - ]; + MenuButtonWidget( + icon: Icons.groups, + action: () async { + await _model.peopleOnThePropertyAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Poeple on\nthe Property', + ptText: 'Pessoas na\nPropriedade', + ), + ), + MenuButtonWidget( + icon: Icons.group_add_outlined, + action: () async { + await _model.liberationHistoryAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Liberation\nHistory', + ptText: 'Consultar\nLiberation', + ), + ), + MenuButtonWidget( + icon: Icons.key_outlined, + action: () async { + await _model.accessHistoryAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Access\nHistory', + ptText: 'Consultar\nAccessos', + ), + ), + MenuButtonWidget( + icon: Icons.people_outline_sharp, + action: () async { + await _model.visitHistoryAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Visit\nHistory', + ptText: 'Consultar\nVisitas', + ), + ), + MenuButtonWidget( + icon: Icons.chat_outlined, + action: () async { + await _model.messageHistoryAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Message\nHistory', + ptText: 'Consultar\nMessages', + ), + ), + MenuButtonWidget( + icon: Icons.settings, + action: () async { + await _model.preferencesSettings(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Preferences\nSettings', + ptText: 'Preferências \nde Configurações', + ), + ), + ]; } if (widget.item == MenuItem.card) { return [ - MenuButtonWidget( + MenuCardItem( icon: FFIcons.kvector1, action: () async { await _model.scheduleVisitOptAction(context); @@ -192,7 +262,7 @@ class _MenuComponentWidgetState extends State { ptText: 'Agendar\nVisita', ), ), - MenuButtonWidget( + MenuCardItem( icon: FFIcons.khome, action: () async { await _model.registerVisitorOptAction(context); @@ -203,7 +273,7 @@ class _MenuComponentWidgetState extends State { ptText: 'Cadastro\nde Visitante', ), ), - MenuButtonWidget( + MenuCardItem( icon: Icons.qr_code, action: () async { await _model.accessQRCodeOptAction(context); @@ -214,7 +284,7 @@ class _MenuComponentWidgetState extends State { ptText: 'QRCode\nde Acesso', ), ), - MenuButtonWidget( + MenuCardItem( icon: Icons.people, action: () async { await _model.peopleOnThePropertyAction(context); @@ -225,7 +295,7 @@ class _MenuComponentWidgetState extends State { ptText: 'Pessoas\nna Propriedade', ), ), - MenuButtonWidget( + MenuCardItem( icon: Icons.history_sharp, action: () async { await _model.consultHistoriesAction(context); @@ -236,15 +306,15 @@ class _MenuComponentWidgetState extends State { ptText: 'Consultar\nHistoricos', ), ), - MenuButtonWidget( + MenuCardItem( icon: Icons.settings, action: () async { await _model.preferencesSettings(context); setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - enText: 'Settings', - ptText: 'Configuração', + enText: 'Preferences\nSettings', + ptText: 'Preferências\nde Configuração', ), ), ]; @@ -324,8 +394,8 @@ class _MenuComponentWidgetState extends State { setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - enText: 'Settings', - ptText: 'Configuração', + enText: 'Preferences Settings', + ptText: 'Preferências de Configuração', ), ), ]; @@ -340,10 +410,10 @@ class _MenuComponentWidgetState extends State { widget.item == MenuItem.button) { if (_model.isGrid == true) { return wrapWithModel( - model: _model.menuListViewComponentModel, + model: _model.menuStaggeredViewComponentModel, updateCallback: () => setState(() {}), updateOnChange: true, - child: MenuListViewComponentWidget( + child: MenuStaggeredViewComponentWidget( options: options, expandable: widget.expandable, item: widget.item, @@ -351,6 +421,7 @@ class _MenuComponentWidgetState extends State { await _model.changeMenuStyle(context); setState(() {}); }, + isGrid: _model.isGrid, ), ); } else { @@ -366,6 +437,7 @@ class _MenuComponentWidgetState extends State { await _model.changeMenuStyle(context); setState(() {}); }, + isGrid: _model.isGrid, ), ); } diff --git a/lib/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_widget.dart b/lib/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_widget.dart index 0afffeec..a572414c 100644 --- a/lib/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_widget.dart +++ b/lib/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_widget.dart @@ -7,16 +7,17 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; class MenuStaggeredViewComponentWidget extends StatefulWidget { - const MenuStaggeredViewComponentWidget({ - super.key, - required this.changeMenuStyle, - required this.expandable, - required this.item, - required this.options, - }); + const MenuStaggeredViewComponentWidget( + {super.key, + required this.changeMenuStyle, + required this.expandable, + required this.item, + required this.options, + required this.isGrid}); final bool expandable; final MenuItem item; + final bool isGrid; final List options; final Future Function()? changeMenuStyle; @@ -86,57 +87,97 @@ class _MenuStaggeredViewComponentWidgetState ); } - Align collapseExpandMethod(BuildContext context) { - return Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Container( - decoration: const BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(0.0), - bottomRight: Radius.circular(0.0), - topLeft: Radius.circular(0.0), - topRight: Radius.circular(0.0), + Widget collapseExpandMethod(BuildContext context) { + if (widget.isGrid == true) { + return Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(0.0), + bottomRight: Radius.circular(0.0), + topLeft: Radius.circular(0.0), + topRight: Radius.circular(0.0), + ), + ), + alignment: const AlignmentDirectional(0.0, 0.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + Text( + FFLocalizations.of(context).getVariableText( + enText: 'Minimize', + ptText: 'Minimizar', + ), + style: FlutterFlowTheme.of(context).title1.override( + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 12.0, + fontWeight: FontWeight.w600, + fontStyle: FontStyle.normal, + ), + ), + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: FlutterFlowIconButton( + borderColor: Colors.transparent, + borderRadius: 20.0, + borderWidth: 1.0, + buttonSize: 50.0, + fillColor: const Color(0x00FFFFFF), + icon: Icon( + Icons.keyboard_arrow_up_sharp, + color: FlutterFlowTheme.of(context).primary, + ), + onPressed: () async { + await widget.changeMenuStyle?.call(); + }, + ), + ), + ], ), ), - alignment: const AlignmentDirectional(0.0, 0.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Text( - FFLocalizations.of(context).getVariableText( - enText: 'Minimize', - ptText: 'Minimizar', - ), - style: FlutterFlowTheme.of(context).title1.override( - fontFamily: 'Nunito', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 12.0, - fontWeight: FontWeight.w600, - fontStyle: FontStyle.normal, - ), + ); + } else { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + FFLocalizations.of(context).getVariableText( + enText: 'Expand', + ptText: 'Expandir', ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: FlutterFlowIconButton( - borderColor: Colors.transparent, - borderRadius: 20.0, - borderWidth: 1.0, - buttonSize: 50.0, - fillColor: const Color(0x00FFFFFF), - icon: Icon( - Icons.keyboard_arrow_up_sharp, - color: FlutterFlowTheme.of(context).primary, + style: FlutterFlowTheme.of(context).title1.override( + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 12.0, + fontWeight: FontWeight.w600, + fontStyle: FontStyle.normal, ), - onPressed: () async { - await widget.changeMenuStyle?.call(); - }, + ), + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: FlutterFlowIconButton( + borderColor: Colors.transparent, + borderRadius: 20.0, + borderWidth: 0.0, + buttonSize: 50.0, + fillColor: const Color(0x00FFFFFF), + icon: Icon( + Icons.keyboard_arrow_down_outlined, + color: FlutterFlowTheme.of(context).primary, ), + onPressed: () async { + await widget.changeMenuStyle?.call(); + }, ), - ], - ), - ), - ); + ), + ], + ); + } } } diff --git a/pubspec.lock b/pubspec.lock index 056e6ffc..ab70e828 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -817,18 +817,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: @@ -905,10 +905,10 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" maybe_just_nothing: dependency: transitive description: @@ -921,10 +921,10 @@ packages: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.12.0" mime: dependency: transitive description: @@ -1286,10 +1286,10 @@ packages: dependency: transitive description: name: sqflite_common - sha256: "7b41b6c3507854a159e24ae90a8e3e9cc01eb26a477c118d6dca065b5f55453e" + sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4" url: "https://pub.dev" source: hosted - version: "2.5.4+2" + version: "2.5.4" stack_trace: dependency: transitive description: @@ -1342,10 +1342,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.0" timeago: dependency: "direct main" description: @@ -1510,10 +1510,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "14.2.4" + version: "14.2.1" web: dependency: transitive description: @@ -1526,10 +1526,10 @@ packages: dependency: "direct main" description: name: webview_flutter - sha256: ec81f57aa1611f8ebecf1d2259da4ef052281cb5ad624131c93546c79ccc7736 + sha256: "6869c8786d179f929144b4a1f86e09ac0eddfe475984951ea6c634774c16b522" url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "4.8.0" webview_flutter_android: dependency: transitive description: @@ -1550,10 +1550,10 @@ packages: dependency: transitive description: name: webview_flutter_wkwebview - sha256: "1942a12224ab31e9508cf00c0c6347b931b023b8a4f0811e5dec3b06f94f117d" + sha256: "9c62cc46fa4f2d41e10ab81014c1de470a6c6f26051a2de32111b2ee55287feb" url: "https://pub.dev" source: hosted - version: "3.15.0" + version: "3.14.0" win32: dependency: "direct overridden" description: @@ -1595,5 +1595,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.24.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0"