diff --git a/assets/images/home.png b/assets/images/home.png new file mode 100644 index 00000000..6682503e Binary files /dev/null and b/assets/images/home.png differ diff --git a/assets/images/person.jpg b/assets/images/person.jpg new file mode 100755 index 00000000..1b53062d Binary files /dev/null and b/assets/images/person.jpg differ diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 8e5d3b01..a49e2b90 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -409,10 +409,11 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; @@ -557,11 +558,12 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -599,10 +601,11 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/69 1.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/69 1.png deleted file mode 100644 index 7e534e92..00000000 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/69 1.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/69 2.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/69 2.png deleted file mode 100644 index 7e534e92..00000000 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/69 2.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/69.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/69.png deleted file mode 100644 index 7e534e92..00000000 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/69.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json index dcf56cc8..a19a5492 100644 --- a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -1,17 +1,14 @@ { "images" : [ { - "filename" : "69.png", "idiom" : "universal", "scale" : "1x" }, { - "filename" : "69 1.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "69 2.png", "idiom" : "universal", "scale" : "3x" } diff --git a/lib/actions/actions.dart b/lib/actions/actions.dart index 37f9ae4e..e4305dd3 100644 --- a/lib/actions/actions.dart +++ b/lib/actions/actions.dart @@ -4,13 +4,11 @@ import 'package:flutter/material.dart'; // import 'package:hub/components/organisms/bottom_arrow_linked_locals/bottom_arrow_linked_locals_component_widget.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart'; -import 'package:hub/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart'; import 'package:hub/custom_code/actions/get_dev_u_u_i_d.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/random_data_util.dart'; -import 'package:hub/pages/home_page/home_page_model.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -139,29 +137,24 @@ Future singInLoginAction( AppState().userUUID = PhpGroup.loginCall.userUUID( (loginCall.jsonBody ?? ''), )!; - AppState().createdAt = dateTimeFormat( 'd/M/y H:mm:ss', getCurrentTimestamp, locale: FFLocalizations.of(context).languageCode, ); - AppState().updatedAt = '00/00/0000 00:00:00'; - AppState().status = PhpGroup.loginCall.userStatus((loginCall.jsonBody ?? ''))!; - AppState().userDevUUID = PhpGroup.loginCall.userDeviceId((loginCall.jsonBody ?? ''))!; - - AppState().name = - PhpGroup.loginCall.userName((loginCall.jsonBody ?? ''))!; - + PhpGroup.loginCall.userName((loginCall.jsonBody ?? ''))!; AppState().serialNumber = await getSerialNumber() ?? ''; - AppState().isLogged = true; + AppState().haveLocal = await checkLocals(context: context, model: model); + log('haveLocal in login: ${AppState().haveLocal}'); + toggleApp(context, AppState().haveLocal!); } else { if (PhpGroup.loginCall.msg((loginCall?.jsonBody ?? '')) == null) { DialogUtil.errorDefault(context); @@ -306,6 +299,7 @@ Future toggleSignUpPage(BuildContext context) async { } Future toggleApp(BuildContext context, bool haveLocal) async { + log('haveLocal in toggleApp: $haveLocal'); if (haveLocal == true) context.goNamed( 'homePage', @@ -398,24 +392,10 @@ Future checkLocals({ return false; } List locals = response.jsonBody['locais'] ?? []; - if (locals != null && locals.isEmpty) { - await toggleApp(context, false); + + if (locals.isEmpty) { return false; } else { - // else if (locals.where((local) => local['CLU_STATUS'] != 'A').isNotEmpty) { - // await showModalBottomSheet( - // isScrollControlled: true, - // backgroundColor: Colors.transparent, - // enableDrag: false, - // isDismissible: false, - // context: context, - // builder: (context) => Padding( - // padding: MediaQuery.viewInsetsOf(context), - // child: const BottomArrowLinkedLocalsComponentWidget(), - // ), - // ); - // } - await toggleApp(context, true); return true; } } diff --git a/lib/app_state.dart b/lib/app_state.dart index 3c6f0587..d6ae1b91 100644 --- a/lib/app_state.dart +++ b/lib/app_state.dart @@ -83,6 +83,7 @@ class AppState extends ChangeNotifier { await _safeInitAsync(() async { _devUUID = await secureStorage.getString('ff_devUUID') ?? _devUUID; }); + await _safeInitAsync(() async { _email = await secureStorage.getString('ff_email') ?? _email; }); @@ -215,6 +216,17 @@ class AppState extends ChangeNotifier { secureStorage.delete(key: 'panic'); } + bool? _haveLocal = null; + bool? get haveLocal => _haveLocal; + set haveLocal(bool? value) { + _haveLocal = value; + secureStorage.setBool('ff_have_local', value); + } + + void deleteHaveLocal() { + secureStorage.delete(key: 'ff_have_local'); + } + String _fingerprintPass = ''; String get fingerprintPass => _fingerprintPass; set fingerprintPass(String value) { @@ -297,6 +309,7 @@ class AppState extends ChangeNotifier { void deleteSerialNumber() { secureStorage.delete(key: 'ff_serialNumber'); + AppState().serialNumber = ''; } String _cliUUID = ''; @@ -308,6 +321,7 @@ class AppState extends ChangeNotifier { void deleteCliUUID() { secureStorage.delete(key: 'ff_cliUUID'); + AppState().cliUUID = ''; } String _userDevUUID = ''; @@ -319,6 +333,7 @@ class AppState extends ChangeNotifier { void deleteRemoteId() { secureStorage.delete(key: 'ff_user_dev_id'); + AppState().userDevUUID = ''; } String? _tokenAPNS = ''; @@ -336,6 +351,7 @@ class AppState extends ChangeNotifier { void deleteTokenAPNS() { secureStorage.delete(key: 'ff_tokenAPNS'); + AppState().tokenAPNS = ''; } String _ownerUUID = ''; @@ -347,6 +363,7 @@ class AppState extends ChangeNotifier { void deleteOwnerUUID() { secureStorage.delete(key: 'ff_ownerUUID'); + AppState().ownerUUID = ''; } String _userUUID = ''; @@ -358,6 +375,7 @@ class AppState extends ChangeNotifier { void deleteUserUUID() { secureStorage.delete(key: 'ff_userUUID'); + AppState().userUUID = ''; } String _devUUID = ''; @@ -369,6 +387,7 @@ class AppState extends ChangeNotifier { void deleteDevUUID() { secureStorage.delete(key: 'ff_devUUID'); + AppState().devUUID = ''; } String _email = ''; @@ -380,6 +399,7 @@ class AppState extends ChangeNotifier { void deleteEmail() { secureStorage.delete(key: 'ff_email'); + AppState().email = ''; } String _passwd = ''; @@ -391,6 +411,7 @@ class AppState extends ChangeNotifier { void deletePasswd() { secureStorage.delete(key: 'ff_passwd'); + AppState().passwd = ''; } String _device = ''; @@ -402,6 +423,7 @@ class AppState extends ChangeNotifier { void deleteDevice() { secureStorage.delete(key: 'ff_device'); + AppState().device = ''; } bool _isLogged = false; @@ -411,13 +433,6 @@ class AppState extends ChangeNotifier { secureStorage.setBool('ff_isLogged', value); } - bool _haveLocal = false; - bool get haveLocal => _haveLocal; - set haveLocal(bool value) { - _haveLocal = value; - secureStorage.setBool('ff_have_local', value); - } - void deleteIsLogged() { secureStorage.delete(key: 'ff_isLogged'); } @@ -431,6 +446,7 @@ class AppState extends ChangeNotifier { void deleteLocal() { secureStorage.delete(key: 'ff_local'); + AppState().local = ''; } String _token = ''; @@ -442,6 +458,7 @@ class AppState extends ChangeNotifier { void deleteToken() { secureStorage.delete(key: 'ff_token'); + AppState().token = ''; } String _createdAt = ''; @@ -453,6 +470,7 @@ class AppState extends ChangeNotifier { void deleteCreatedAt() { secureStorage.delete(key: 'ff_createdAt'); + AppState().createdAt = ''; } String _updatedAt = ''; @@ -464,6 +482,7 @@ class AppState extends ChangeNotifier { void deleteUpdatedAt() { secureStorage.delete(key: 'ff_updatedAt'); + AppState().updatedAt = ''; } String _status = ''; @@ -475,6 +494,7 @@ class AppState extends ChangeNotifier { void deleteStatus() { secureStorage.delete(key: 'ff_status'); + AppState().status = ''; } String _name = ''; @@ -486,6 +506,7 @@ class AppState extends ChangeNotifier { void deleteName() { secureStorage.delete(key: 'ff_name'); + AppState().name = ''; } void deleteAll() { @@ -548,7 +569,7 @@ extension FlutterSecureStorageExtensions on FlutterSecureStorage { await writeSync(key: key, value: value); Future getBool(String key) async => (await read(key: key)) == 'true'; - Future setBool(String key, bool value) async => + Future setBool(String key, bool? value) async => await writeSync(key: key, value: value.toString()); Future getInt(String key) async => diff --git a/lib/backend/api_requests/api_manager.dart b/lib/backend/api_requests/api_manager.dart index b2c1a248..7c474720 100644 --- a/lib/backend/api_requests/api_manager.dart +++ b/lib/backend/api_requests/api_manager.dart @@ -510,6 +510,11 @@ class ApiManager { result = ApiCallResponse(null, {}, -1, exception: e); } + log('API Call: $callName'); + log('URL: $apiUrl'); + log('Headers: $headers'); + log('Params$params'); + log('Response${result.jsonBody}'); return result; } } diff --git a/lib/backend/notifications/notification_service.dart b/lib/backend/notifications/notification_service.dart index 617dc2f0..50e82310 100644 --- a/lib/backend/notifications/notification_service.dart +++ b/lib/backend/notifications/notification_service.dart @@ -297,7 +297,6 @@ class NotificationService { break; default: - log('default'); break; } 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 f3f8edf7..8cb63095 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 @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/components/molecular_components/menu_item/menu_item.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; -import 'package:hub/flutter_flow/flutter_flow_util.dart'; class MenuButtonWidget extends MenuEntry { const MenuButtonWidget({ @@ -33,93 +32,69 @@ class _MenuButtonWidgetState extends State { onTap: () async { await widget.action?.call(); }, - child: Container( - width: 100.0, - height: 100.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - boxShadow: [ - BoxShadow( - blurRadius: 4.0, - color: FlutterFlowTheme.of(context).customColor5, - offset: const Offset( - 0.0, - 2.0, - ), - ) - ], - borderRadius: BorderRadius.circular(24.0), - shape: BoxShape.rectangle, - border: Border.all( - color: FlutterFlowTheme.of(context).alternate, - width: 0.5, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0), + child: Container( + width: 120.0, + height: 100.0, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryBackground, + boxShadow: [ + BoxShadow( + blurRadius: 4.0, + color: FlutterFlowTheme.of(context).customColor5, + offset: const Offset( + 0.0, + 2.0, + ), + ) + ], + borderRadius: BorderRadius.circular(24.0), + shape: BoxShape.rectangle, + border: Border.all( + color: FlutterFlowTheme.of(context).alternate, + width: 0.5, + ), ), - ), - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 0.0, 0.0), - child: Container( - width: 30.0, - height: 30.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context) - .primaryBackground, - shape: BoxShape.circle, - ), - alignment: const AlignmentDirectional(0.0, 0.0), - child: Icon( - widget.icon, - color: FlutterFlowTheme.of(context).accent1, - size: 24.0, - ), + child: Padding( + padding: const EdgeInsets.all(0.0), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.icon != null) + Container( + alignment: Alignment.topLeft, + padding: const EdgeInsets.only(left: 8.0), + child: Icon( + widget.icon, + size: 24.0, + color: FlutterFlowTheme.of(context).primaryText, + ), + ), + Flexible( + child: Padding( + padding: const EdgeInsets.only(left: 10.0), + child: Text( + widget.title ?? '', + overflow: TextOverflow.ellipsis, + maxLines: 2, + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context).titleLarge.override( + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap().containsKey('Nunito'), ), - ), - ), ), - ], + ), ), - ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Text( - widget.title ?? '', - style: FlutterFlowTheme.of(context).titleLarge.override( - fontFamily: 'Nunito', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Nunito'), - ), - ), - ), - ], - ), - ), - ].divide(const SizedBox(height: 0.0)), + ], + ), ), ), ), diff --git a/lib/components/atomic_components/menu_card_item/menu_card_item.dart b/lib/components/atomic_components/menu_card_item/menu_card_item.dart index 3e62f316..f4544500 100644 --- a/lib/components/atomic_components/menu_card_item/menu_card_item.dart +++ b/lib/components/atomic_components/menu_card_item/menu_card_item.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/components/molecular_components/menu_item/menu_item.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; -import 'package:hub/flutter_flow/flutter_flow_util.dart'; class MenuCardItem extends MenuEntry { const MenuCardItem({ @@ -36,54 +35,47 @@ class _MenuCardItemState extends State { child: Card( elevation: 0, color: FlutterFlowTheme.of(context).primaryBackground, - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 10.0, 0.0), - child: Container( - width: 30.0, - height: 30.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - shape: BoxShape.circle, - ), - alignment: const AlignmentDirectional(0.0, 0.0), - child: Icon( - widget.icon, - fill: null, - color: FlutterFlowTheme.of(context).accent1, - size: 24.0, - ), - ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 10.0, 0.0), + child: Container( + width: 30.0, + height: 30.0, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryBackground, + shape: BoxShape.circle, ), - ), - Align( alignment: const AlignmentDirectional(0.0, 0.0), - child: Text( - widget.title ?? '', - style: FlutterFlowTheme.of(context).titleLarge.override( - fontFamily: 'Nunito', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Nunito'), - ), + child: Icon( + widget.icon, + fill: null, + color: FlutterFlowTheme.of(context).accent1, + size: 24.0, ), ), - ], + ), ), - ), + Flexible( + child: Text( + widget.title ?? '', + // overflow: TextOverflow.ellipsis, + style: FlutterFlowTheme.of(context).titleLarge.override( + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), + ), + ), + ), + ], ), ), ); diff --git a/lib/components/molecular_components/message_opt_modal/opt_modal_model.dart b/lib/components/molecular_components/message_opt_modal/opt_modal_model.dart index 0963fec9..f7055ea5 100644 --- a/lib/components/molecular_components/message_opt_modal/opt_modal_model.dart +++ b/lib/components/molecular_components/message_opt_modal/opt_modal_model.dart @@ -1,8 +1,8 @@ +import 'package:flutter/material.dart'; + import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/form_field_controller.dart'; import 'opt_modal_widget.dart' show OptModalWidget; -import 'package:flutter/material.dart'; - class OptModalModel extends FlutterFlowModel { /// State fields for stateful widgets in this component. @@ -29,4 +29,4 @@ class OptModalModel extends FlutterFlowModel { textFieldFocusNode?.dispose(); textController?.dispose(); } -} \ No newline at end of file +} diff --git a/lib/components/molecular_components/message_opt_modal/opt_modal_widget.dart b/lib/components/molecular_components/message_opt_modal/opt_modal_widget.dart index 6bf0fd72..53a01170 100644 --- a/lib/components/molecular_components/message_opt_modal/opt_modal_widget.dart +++ b/lib/components/molecular_components/message_opt_modal/opt_modal_widget.dart @@ -1,12 +1,8 @@ -import 'dart:ffi'; - import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/components/molecular_components/message_opt_modal/opt_modal_model.dart'; -import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/flutter_flow/internationalization.dart'; class OptModalWidget extends StatefulWidget { final String defaultPersonType; @@ -85,7 +81,8 @@ class _OptModalWidgetState extends State { Navigator.pop(context, filterResult); } - Widget _buildCheckboxListTile(String key, List> options, double fontsize) { + Widget _buildCheckboxListTile( + String key, List> options, double fontsize) { return Column( children: [ Row( @@ -145,13 +142,13 @@ class _OptModalWidgetState extends State { checkboxShape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(100), ), - enableFeedback: true, side: BorderSide( width: 5, color: FlutterFlowTheme.of(context).secondaryText, ), - controlAffinity: ListTileControlAffinity.leading, // Adiciona esta linha + controlAffinity: + ListTileControlAffinity.leading, // Adiciona esta linha ); }, ), diff --git a/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart b/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart index a871fb25..c6cf3123 100644 --- a/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart +++ b/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart @@ -14,7 +14,7 @@ export 'local_profile_component_model.dart'; //// class LocalProfileComponentWidget extends StatefulWidget { - const LocalProfileComponentWidget({required bool localStatus, super.key}); + const LocalProfileComponentWidget({super.key}); @override State createState() => @@ -59,9 +59,9 @@ class _LocalProfileComponentWidgetState width: double.infinity, height: 119.0, decoration: BoxDecoration( - color: const Color(0xFF1AAB5F), + color: FlutterFlowTheme.of(context).primary, border: Border.all( - color: const Color(0xFF1AAB5F), + color: FlutterFlowTheme.of(context).primary, ), ), child: Row( @@ -72,44 +72,53 @@ class _LocalProfileComponentWidgetState child: Padding( padding: const EdgeInsets.all(2.0), child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - showModalBottomSheet( - isScrollControlled: true, - backgroundColor: const Color(0x00FFFFFF), - context: context, - enableDrag: false, - isDismissible: false, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: const SizedBox( - height: double.infinity, - child: BottomArrowLinkedLocalsComponentWidget(), - ), - ); - }, - ).then((value) => safeSetState(() {})); - }, - child: ClipRRect( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + showModalBottomSheet( + isScrollControlled: true, + backgroundColor: const Color(0x00FFFFFF), + context: context, + enableDrag: false, + isDismissible: false, + builder: (context) { + return Padding( + padding: MediaQuery.viewInsetsOf(context), + child: const SizedBox( + height: double.infinity, + child: + BottomArrowLinkedLocalsComponentWidget(), + ), + ); + }, + ).then((value) => safeSetState(() {})); + }, + child: ClipRRect( borderRadius: BorderRadius.circular(200.0), child: CachedNetworkImage( + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + image: DecorationImage( + image: imageProvider, + fit: BoxFit.cover, + ), + ), + ), imageUrl: valueOrDefault( 'https://freaccess.com.br/freaccess/Images/Clients/${AppState().cliUUID}.png', - 'assets/images/error_image.svg'), + 'assets/images/home.png'), width: 80.0, height: 80.0, fit: BoxFit.cover, alignment: const Alignment(0.0, 0.0), placeholder: (context, url) => - Image.asset('assets/images/error_image.svg'), + Image.asset('assets/images/home.png'), errorListener: (_) => - Image.asset('assets/images/error_image.svg'), + Image.asset('assets/images/home.png'), errorWidget: (_, __, ___) => - Image.asset('assets/images/error_image.svg'), + Image.asset('assets/images/home.png'), ), )), ), diff --git a/lib/components/organism_components/menu_component/menu_component_model.dart b/lib/components/organism_components/menu_component/menu_component_model.dart index 808b44bd..7d51c2b5 100644 --- a/lib/components/organism_components/menu_component/menu_component_model.dart +++ b/lib/components/organism_components/menu_component/menu_component_model.dart @@ -1,9 +1,8 @@ -import 'dart:developer'; - import 'package:flutter/material.dart'; import 'package:hub/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_model.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/reservation_page/reservation_page_widget.dart'; +import 'package:hub/shared/extensions/dialog_extensions.dart'; import '/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart'; import '/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart'; @@ -42,36 +41,97 @@ class MenuComponentModel extends FlutterFlowModel { isGrid = !isGrid; } - Future scheduleVisitOptAction(BuildContext context) async { - final isWpp = AppState().whatsapp; - final isProvisional = AppState().provisional; - log("isWpp ${isWpp ? 1 : 0}"); - - final routesListStr = [ + Future scheduleCompleteVisitAction(BuildContext context) async { + context.pushNamed( + 'scheduleCompleteVisitPage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + } + + Future deliverySchedule(BuildContext context) async { + final isProvisional = AppState().provisional; + if (isProvisional == true) { + context.pushNamed( + 'deliverySchedule', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + } else { + DialogUnavailable.unavailableFeature(context); + } + } + + Future provisionalSchedule(BuildContext context) async { + final isProvisional = AppState().provisional; + if (isProvisional == true) { + context.pushNamed( + 'provisionalSchedule', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + } else { + DialogUnavailable.unavailableFeature(context); + } + } + + Future fastPassAction(BuildContext context) async { + final isWpp = AppState().whatsapp; + if (isWpp) { + context.pushNamed( + 'fastPassPage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + } else { + DialogUnavailable.unavailableFeature(context); + } + } + + Future scheduleVisitOptAction(BuildContext context) async { + final routesListStr = [ + 'scheduleProvisionalVisitPage', + 'fastPassPage', 'scheduleCompleteVisitPage', - if (isProvisional) 'scheduleProvisionalVisitPage', - if (isWpp) 'fastPassPage', ]; final iconsListIcon = [ Icons.date_range_rounded, - if (isProvisional) Icons.date_range_rounded, - if (isWpp) Icons.date_range_rounded, + Icons.date_range_rounded, + Icons.date_range_rounded, ]; final nameListStr = [ + FFLocalizations.of(context).getVariableText( + ptText: 'Visita\nProvisória', + enText: 'Provisional\nSchedule', + ), + FFLocalizations.of(context).getVariableText( + ptText: 'Visita\nRápida', + enText: 'Fast\nSchedule', + ), FFLocalizations.of(context).getVariableText( ptText: 'Visita\nCompleta', enText: 'Complete\nSchedule', ), - if (isProvisional) - FFLocalizations.of(context).getVariableText( - ptText: 'Visita\nProvisória', - enText: 'Provisional\nSchedule', - ), - if (isWpp) - FFLocalizations.of(context).getVariableText( - ptText: 'Visita\nRápida', - enText: 'Fast\nSchedule', - ), ]; await showAdaptiveDialog( @@ -123,7 +183,6 @@ class MenuComponentModel extends FlutterFlowModel { ptText: 'Tem certeza', ), () async { AppState().deleteAll(); - // setState(() {}); context.goNamed( 'welcomePage', @@ -165,10 +224,11 @@ class MenuComponentModel extends FlutterFlowModel { } Future reservation(BuildContext context) async { - Navigator.push(context, MaterialPageRoute(builder: (context) => ReservationPageWidget())); + Navigator.push(context, + MaterialPageRoute(builder: (context) => ReservationPageWidget())); } - Future liberationHistoryOptAction(BuildContext context) async { + Future consultHistoriesAction(BuildContext context) async { await showAdaptiveDialog( // isScrollControlled: true, // backgroundColor: Colors.transparent, @@ -214,6 +274,45 @@ class MenuComponentModel extends FlutterFlowModel { ); } + Future liberationHistoryAction(BuildContext context) async { + context.pushNamed( + 'liberationHistory', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + } + + Future accessHistoryAction(BuildContext context) async { + context.pushNamed( + 'acessHistoryPage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + } + + Future visitHistoryAction(BuildContext context) async { + context.pushNamed( + 'scheduleCompleteVisitPage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + } + Future accessQRCodeOptAction(BuildContext context) async { context.pushNamed( 'qrCodePage', 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 ddbdda9a..5e04eed6 100644 --- a/lib/components/organism_components/menu_component/menu_component_widget.dart +++ b/lib/components/organism_components/menu_component/menu_component_widget.dart @@ -55,97 +55,232 @@ class _MenuComponentWidgetState extends State { Widget build(BuildContext context) { final options = () { if (widget.item == MenuItem.button) { - return [ - MenuButtonWidget( - icon: FFIcons.kvector1, - action: () async { - await _model.scheduleVisitOptAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Schedule\nVisit', - ptText: 'Agendar\nVisita', + if (_model.isGrid == true) + 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: FFIcons.khome, - action: () async { - await _model.registerVisitorOptAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Register\nVisitor', - ptText: 'Cadastro\nde Visitante', + 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.qr_code, - action: () async { - await _model.accessQRCodeOptAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'QRCode\nAccess', - ptText: 'QRCode\nde Acesso', + 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.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.people, + action: () async { + await _model.peopleOnThePropertyAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'People on\nthe Property', + ptText: 'Pessoas na\nPropriedade', + ), ), - ), - MenuButtonWidget( - icon: Icons.history_sharp, - action: () async { - await _model.liberationHistoryOptAction(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Consult\nHistories', - ptText: 'Consultar\nHistóricos', + 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.inventory_2_rounded, - action: () async { - await _model.packageOrder(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Orders', - ptText: 'Encomendas', + MenuButtonWidget( + icon: Icons.settings, + action: () async { + await _model.preferencesSettings(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Preferences\nSettings', + ptText: 'Opções\ndo Sistema', + ), ), - ), - MenuButtonWidget( - icon: Icons.event_available, - action: () async { - await _model.reservation(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Reservations', - ptText: 'Reservas', + ]; + else + return [ + MenuButtonWidget( + icon: Icons.engineering_outlined, + action: () async { + await _model.provisionalSchedule(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Provisional\nSchedule', + ptText: 'Agendar\nPrestadores', + ), ), - ), - 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.sports_motorsports_outlined, + action: () async { + await _model.deliverySchedule(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Delivery\nSchedule', + ptText: 'Agendar\nEntregas', + ), ), - ), - - ]; + MenuButtonWidget( + icon: Icons.share_location_outlined, + action: () async { + await _model.fastPassAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Fast\nVisit', + ptText: 'Agenda\nRápida', + ), + ), + 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.inventory_2_outlined, + action: () async { + await _model.packageOrder(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + ptText: 'Minhas\nEncomendas', + enText: 'My\nOrders', + ), + ), + MenuButtonWidget( + icon: Icons.event_available, + action: () async { + await _model.reservation(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + ptText: 'Reserva\nde Itens', + enText: 'Item\nReservation', + ), + ), + 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.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: 'People on\nthe Property', + ptText: 'Pessoas na\nPropriedade', + ), + ), + MenuButtonWidget( + icon: Icons.how_to_reg_outlined, + action: () async { + await _model.liberationHistoryAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Liberations\nHistory', + ptText: 'Consultar\nLiberações', + ), + ), + MenuButtonWidget( + icon: Icons.key_outlined, + action: () async { + await _model.accessHistoryAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Access\nHistory', + ptText: 'Consultar\nAcessos', + ), + ), + 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\nMensagens', + ), + ), + MenuButtonWidget( + icon: Icons.settings, + action: () async { + await _model.preferencesSettings(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Preferences\nSettings', + ptText: 'Opções\ndo Sistema', + ), + ), + ]; } if (widget.item == MenuItem.card) { return [ @@ -189,14 +324,14 @@ class _MenuComponentWidgetState extends State { setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - enText: 'Poeple on\nthe Property', + enText: 'People on\nthe Property', ptText: 'Pessoas\nna Propriedade', ), ), MenuCardItem( icon: Icons.history_sharp, action: () async { - await _model.liberationHistoryOptAction(context); + await _model.consultHistoriesAction(context); setState(() {}); }, title: FFLocalizations.of(context).getVariableText( @@ -242,14 +377,69 @@ class _MenuComponentWidgetState extends State { // if (MenuItem.tile) return [ MenuCardItem( - icon: FFIcons.kvector1, + icon: Icons.engineering_outlined, action: () async { - await _model.scheduleVisitOptAction(context); + await _model.provisionalSchedule(context); setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - enText: 'Schedule Visit', - ptText: 'Agendar Visita', + enText: 'Provisional Schedule', + ptText: 'Agendar Prestadores', + ), + ), + MenuCardItem( + icon: Icons.sports_motorsports_outlined, + action: () async { + await _model.deliverySchedule(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Delivery Schedule', + ptText: 'Agendar Entregas', + ), + ), + MenuCardItem( + icon: Icons.share_location_outlined, + action: () async { + await _model.fastPassAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Fast Visit', + ptText: 'Agenda Rápida', + ), + ), + MenuCardItem( + icon: Icons.event, + action: () async { + await _model.scheduleCompleteVisitAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Complete Schedule', + ptText: 'Agenda Completa', + ), + ), + MenuCardItem( + icon: Icons.inventory_2_outlined, + action: () async { + await _model.packageOrder(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + ptText: 'Minhas Encomendas', + enText: 'My Orders', + ), + ), + MenuCardItem( + icon: Icons.event_available, + action: () async { + await _model.reservation(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + ptText: 'Reserva de Itens', + enText: 'Item Reservation', ), ), MenuCardItem( @@ -275,25 +465,69 @@ class _MenuComponentWidgetState extends State { ), ), MenuCardItem( - icon: Icons.people, + icon: Icons.groups, action: () async { await _model.peopleOnThePropertyAction(context); setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - enText: 'Poeple on the Property', + enText: 'People on the Property', ptText: 'Pessoas na Propriedade', ), ), MenuCardItem( - icon: Icons.history_sharp, + icon: Icons.group_add_outlined, action: () async { - await _model.liberationHistoryOptAction(context); + await _model.liberationHistoryAction(context); setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - enText: 'Consult Histories', - ptText: 'Consultar Historicos', + enText: 'Liberations History', + ptText: 'Consultar Liberações', + ), + ), + MenuCardItem( + icon: Icons.key_outlined, + action: () async { + await _model.accessHistoryAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Access History', + ptText: 'Consultar Acessos', + ), + ), + MenuCardItem( + icon: Icons.people_outline_sharp, + action: () async { + await _model.visitHistoryAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Visit History', + ptText: 'Consultar Visitas', + ), + ), + MenuCardItem( + icon: Icons.chat_outlined, + action: () async { + await _model.messageHistoryAction(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Message History', + ptText: 'Consultar Mensagens', + ), + ), + MenuCardItem( + icon: Icons.settings, + action: () async { + await _model.preferencesSettings(context); + setState(() {}); + }, + title: FFLocalizations.of(context).getVariableText( + enText: 'Preferences Settings', + ptText: 'Opções do Sistema', ), ), MenuCardItem( @@ -307,44 +541,14 @@ class _MenuComponentWidgetState extends State { ptText: 'Sair da Conta', ), ), - MenuCardItem( - icon: Icons.inventory_2_rounded, - action: () async { - await _model.packageOrder(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Orders', - ptText: 'Encomendas', - ), - ), - MenuCardItem( - icon: Icons.event_available, - action: () async { - await _model.reservation(context); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Reservations', - ptText: 'Reservas', - ), - ), - MenuCardItem( - icon: Icons.settings, - action: () async { - await _model.preferencesSettings(context).then((value) => value); - setState(() {}); - }, - title: FFLocalizations.of(context).getVariableText( - enText: 'Preferences Settings', - ptText: 'Preferências de Configuração', - ), - ), + MenuCardItem(icon: null, action: () {}, title: ''), ]; }(); return Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0), + padding: const EdgeInsetsDirectional.only( + top: 10, + ), child: Builder( builder: (context) { if (widget.style == MenuView.list_grid && @@ -352,10 +556,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, @@ -363,6 +567,7 @@ class _MenuComponentWidgetState extends State { await _model.changeMenuStyle(context); setState(() {}); }, + isGrid: _model.isGrid, ), ); } else { @@ -378,6 +583,7 @@ class _MenuComponentWidgetState extends State { await _model.changeMenuStyle(context); setState(() {}); }, + isGrid: _model.isGrid, ), ); } diff --git a/lib/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart b/lib/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart index 8c042c9a..e7cd801a 100644 --- a/lib/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart +++ b/lib/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart @@ -56,20 +56,7 @@ class _MenuListViewComponentWidgetState @override Widget build(BuildContext context) { - return Wrap( - spacing: 0.0, - runSpacing: 0.0, - alignment: WrapAlignment.start, - crossAxisAlignment: WrapCrossAlignment.start, - direction: Axis.horizontal, - runAlignment: WrapAlignment.start, - verticalDirection: VerticalDirection.down, - clipBehavior: Clip.none, - children: [ - buildMenuItem(context), - if (widget.expandable) buildExpandableButton(context), - ], - ); + return buildMenuItem(context); } Widget buildMenuItem(BuildContext context) { @@ -115,30 +102,32 @@ class _MenuListViewComponentWidgetState ), ); case MenuItem.tile: - return SizedBox( - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.7, - child: ListView.separated( - padding: const EdgeInsets.symmetric(horizontal: 15), - shrinkWrap: true, - physics: const AlwaysScrollableScrollPhysics(), - scrollDirection: Axis.vertical, - itemCount: widget.options.length, - itemBuilder: (context, index) { - return SizedBox( - height: MediaQuery.of(context).size.height * 0.08, - width: MediaQuery.of(context).size.width * 0.08, - child: widget.options[index], - ); - }, - separatorBuilder: (context, index) { - return const Divider(thickness: 0.2); - }, - ), - ); + return buildMenuList(context); } } + Widget buildMenuList(BuildContext context) { + return SizedBox( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + child: ListView.separated( + padding: const EdgeInsets.symmetric(horizontal: 15), + shrinkWrap: true, + physics: const AlwaysScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + itemCount: widget.options.length, + itemBuilder: (context, index) { + return SizedBox( + child: widget.options[index], + ); + }, + separatorBuilder: (context, index) { + return const Divider(thickness: 0.2); + }, + ), + ); + } + Row buildExpandableButton(BuildContext context) { return Row( mainAxisSize: MainAxisSize.max, 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 e367e0b5..b47a20a4 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 @@ -1,29 +1,23 @@ import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; -import 'package:flutter_expandable_fab/flutter_expandable_fab.dart'; -import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; -import 'package:google_fonts/google_fonts.dart'; import 'package:hub/backend/schema/enums/enums.dart'; import 'package:hub/components/molecular_components/menu_item/menu_item.dart'; import 'package:hub/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_model.dart'; -import 'package:hub/flutter_flow/custom_icons.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; -import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/flutter_flow/internationalization.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; @@ -58,97 +52,136 @@ class _MenuStaggeredViewComponentWidgetState @override Widget build(BuildContext context) { - return Wrap( - spacing: 0.0, - runSpacing: 0.0, - alignment: WrapAlignment.start, - crossAxisAlignment: WrapCrossAlignment.start, - direction: Axis.horizontal, - runAlignment: WrapAlignment.start, - verticalDirection: VerticalDirection.down, - clipBehavior: Clip.none, + return Column( children: [ - Container( - width: double.infinity, - height: MediaQuery.sizeOf(context).height * 0.498, - decoration: const BoxDecoration(), - child: Padding( - padding: const EdgeInsets.all(14.0), - child: MasonryGridView.builder( - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - const SliverSimpleGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - ), - crossAxisSpacing: 10.0, - mainAxisSpacing: 10.0, - itemCount: widget.options.length, - padding: const EdgeInsets.fromLTRB( - 0, - 10.0, - 0, - 10.0, - ), - shrinkWrap: true, - itemBuilder: (context, index) { - return SizedBox( - height: 100, width: 100, child: widget.options[index]); - }, - ), + GridView.builder( + physics: const NeverScrollableScrollPhysics(), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 10.0, + mainAxisSpacing: 10.0, + childAspectRatio: 1, + mainAxisExtent: 100, ), - ), - 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), + itemCount: widget.options.length, + padding: const EdgeInsets.symmetric(horizontal: 14), + shrinkWrap: true, + itemBuilder: (context, index) { + return Container( + height: MediaQuery.of(context).size.height, + width: MediaQuery.of(context).size.width, + alignment: Alignment.center, + padding: const EdgeInsets.all(0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(0), + color: Colors.transparent, + boxShadow: const [ + BoxShadow( + color: Colors.transparent, + blurRadius: 4, + offset: Offset(0, 2), + ), + ], ), - ), - 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(); - }, - ), - ), - ], - ), - ), + child: Center(child: widget.options[index]), + ); + }, ), ], ); } + + 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(); + }, + ), + ), + ], + ), + ), + ); + } else { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + FFLocalizations.of(context).getVariableText( + enText: 'Expand', + ptText: 'Expandir', + ), + 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: 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/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 3159c9ca..47d9b7de 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 @@ -1,28 +1,24 @@ import 'dart:collection'; -import 'dart:developer'; -import 'package:auto_size_text/auto_size_text.dart'; -import 'package:flutter/cupertino.dart'; - -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'; -/// +import '/flutter_flow/flutter_flow_theme.dart'; +import '/flutter_flow/flutter_flow_util.dart'; +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; @@ -30,24 +26,24 @@ class CardItemTemplateComponentWidget extends StatefulWidget { final Future Function()? onTapCardItemAction; @override - State createState() => _CardItemTemplateComponentWidgetState(); + State createState() => + _CardItemTemplateComponentWidgetState(); } -class _CardItemTemplateComponentWidgetState extends State { +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 @@ -61,150 +57,148 @@ class _CardItemTemplateComponentWidgetState extends State _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( + return Padding( + padding: const EdgeInsets.symmetric(vertical: 2.0), + child: 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, - ), + 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, + const SizedBox(width: 8), + 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), - ), + fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + fontSize: 12.5, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), + ), ), - ) + ), ], - ); - - 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 ClipRRect( + borderRadius: BorderRadius.circular(20), + child: CachedNetworkImage( + fadeInDuration: const Duration(milliseconds: 500), + fadeOutDuration: const Duration(milliseconds: 500), + imageUrl: widget.imagePath ?? '', + fit: BoxFit.cover, + width: 90, + height: 90, ), ); } 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), + width: MediaQuery.of(context).size.width * 0.25, decoration: BoxDecoration( color: color, - borderRadius: BorderRadius.circular(5) + borderRadius: BorderRadius.circular(5), ), - child: Text( - text, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: FlutterFlowTheme.of(context).info, - fontSize: 12, - fontWeight: FontWeight.bold + child: Center( + child: Text( + text, + overflow: TextOverflow.ellipsis, + style: TextStyle( + 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( + Widget _buildContent() { + return LayoutBuilder( + builder: (context, constraints) { + if (constraints.maxWidth > 360) { + return Row( mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - ..._generateLabels(), - const SizedBox(height: 5), - Wrap( - spacing: 8, - runSpacing: 8, - children: _generateStatus(), - ) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ..._generateLabels(), + Wrap( + spacing: 8, + runSpacing: 4, + children: _generateStatus(), + ), + ] + .addToEnd(const SizedBox(height: 5)) + .divide(const SizedBox(height: 1)) + .addToStart(const SizedBox(height: 5)), + ), + ), + _generateImage(), ] - ), - ], - ); - } - - Widget _largeScreen() { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.start, + .addToEnd(const SizedBox(width: 10)) + .addToStart(const SizedBox(width: 10)), + ); + } else { + return Column( + mainAxisSize: MainAxisSize.min, children: [ - ..._generateLabels(), - const SizedBox(height: 5), - Wrap( - spacing: 8, - runSpacing: 8, - children: _generateStatus(), - ) - ] - ), - _generateImage() - ], + _generateImage(), + Container( + padding: const EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ..._generateLabels(), + Wrap( + spacing: 8, + runSpacing: 4, + children: _generateStatus(), + ), + ].divide(const SizedBox(height: 5)), + ), + ), + ].divide(const SizedBox(height: 5)), + ); + } + }, ); } @override Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - double screenHeight = MediaQuery.of(context).size.height; - context.watch(); return InkWell( @@ -222,20 +216,7 @@ class _CardItemTemplateComponentWidgetState extends State 360 ? _largeScreen() : _smallScreen(), - ], - ), - ), + child: _buildContent(), ), ), ); diff --git a/lib/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_model.dart b/lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart similarity index 94% rename from lib/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_model.dart rename to lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart index b01b75b7..b79236d8 100644 --- a/lib/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_model.dart +++ b/lib/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart @@ -1,11 +1,8 @@ -import 'package:hub/backend/api_requests/api_manager.dart'; -import 'package:hub/flutter_flow/flutter_flow_model.dart'; - - import 'package:flutter/material.dart'; -import 'package:hub/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart'; - -import '../../flutter_flow/internationalization.dart'; +import 'package:hub/backend/api_requests/api_manager.dart'; +import 'package:hub/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart'; +import 'package:hub/flutter_flow/flutter_flow_model.dart'; +import 'package:hub/flutter_flow/internationalization.dart'; class ScheduleProvisionalVisitPageModel extends FlutterFlowModel { @@ -93,4 +90,4 @@ class ScheduleProvisionalVisitPageModel notesFocusNode?.dispose(); notesTextController?.dispose(); } -} \ No newline at end of file +} diff --git a/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart b/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart new file mode 100644 index 00000000..0836e3cf --- /dev/null +++ b/lib/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart @@ -0,0 +1,1021 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:easy_debounce/easy_debounce.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:hub/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart'; +import 'package:hub/shared/utils/dialog_util.dart'; +import 'package:hub/shared/utils/log_util.dart'; +import 'package:provider/provider.dart'; + +import '/backend/api_requests/api_calls.dart'; +import '/flutter_flow/flutter_flow_theme.dart'; +import '/flutter_flow/flutter_flow_util.dart'; +import '/flutter_flow/flutter_flow_widgets.dart'; + +class ScheduleProvisionalVisitPageWidget extends StatefulWidget { + const ScheduleProvisionalVisitPageWidget({ + super.key, + }); + + @override + State createState() => + _ScheduleProvisionalVisitPageWidgetState(); +} + +class _ScheduleProvisionalVisitPageWidgetState + extends State { + late ScheduleProvisionalVisitPageModel _model; + + @override + void initState() { + super.initState(); + _model = createModel(context, () => ScheduleProvisionalVisitPageModel()); + + _model.personNameTextController ??= TextEditingController(); + _model.personNameFocusNode ??= FocusNode(); + + _model.dateTimeTextController ??= TextEditingController(); + _model.dateTimeFocusNode ??= FocusNode(); + + _model.notesTextController ??= TextEditingController(); + _model.notesFocusNode ??= FocusNode(); + } + + @override + void dispose() { + _model.dispose(); + + super.dispose(); + } + + bool _isFormValid() { + if (_model.personNameTextController.text == '' || + _model.personNameTextController.text.length > 80) { + return false; + } + + if (_model.dateTimeTextController.text == '') { + return false; + } + + return true; + } + + @override + Widget build(BuildContext context) { + context.watch(); + + return GestureDetector( + onTap: () => FocusScope.of(context).unfocus(), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Form( + key: _model.formKey, + autovalidateMode: AutovalidateMode.onUserInteraction, + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 24.0, 0.0, 24.0), + child: Text( + FFLocalizations.of(context).getText( + 'uj8acuab' /* Preencha os Campos Abaixo: */, + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + fontSize: 16.0, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + Container( + width: double.infinity, + decoration: BoxDecoration( + color: + FlutterFlowTheme.of(context).primaryBackground, + ), + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Align( + alignment: + const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context).getText( + '8d3679lf' /* Propriedade */, + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 10.0, 24.0, 10.0), + child: Container( + width: double.infinity, + height: 50.0, + decoration: BoxDecoration( + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(50.0), + bottomRight: Radius.circular(50.0), + topLeft: Radius.circular(50.0), + topRight: Radius.circular(50.0), + ), + border: Border.all( + color: FlutterFlowTheme.of(context) + .customColor5, + ), + ), + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + ClipRRect( + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(50.0), + bottomRight: Radius.circular(50.0), + topLeft: Radius.circular(50.0), + topRight: Radius.circular(50.0), + ), + child: CachedNetworkImage( + fadeInDuration: const Duration( + milliseconds: 200), + fadeOutDuration: const Duration( + milliseconds: 200), + imageUrl: + 'https://freaccess.com.br/freaccess/Images/Clients/${AppState().cliUUID}.png', + width: 35.0, + height: 35.0, + fit: BoxFit.contain, + memCacheWidth: 35, + memCacheHeight: 35, + ), + ), + Padding( + padding: const EdgeInsetsDirectional + .fromSTEB(15.0, 0.0, 0.0, 0.0), + child: Text( + AppState().local, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyMediumFamily), + ), + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + Container( + decoration: const BoxDecoration(), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Align( + alignment: + const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: + const EdgeInsetsDirectional.fromSTEB( + 24.0, 10.0, 0.0, 10.0), + child: Text( + FFLocalizations.of(context).getText( + 'z6aawgqa' /* Dados da Visita */, + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + Column( + mainAxisSize: MainAxisSize.max, + children: [ + Container( + height: 80.0, + decoration: const BoxDecoration(), + alignment: + const AlignmentDirectional(0.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional + .fromSTEB(24.0, 0.0, 24.0, 0.0), + child: SizedBox( + width: double.infinity, + child: TextFormField( + controller: + _model.personNameTextController, + focusNode: + _model.personNameFocusNode, + onChanged: (_) => + EasyDebounce.debounce( + '_model.personNameTextController', + const Duration(milliseconds: 500), + () => setState(() {}), + ), + autofocus: false, + textInputAction: + TextInputAction.next, + obscureText: false, + decoration: InputDecoration( + isDense: false, + labelText: + FFLocalizations.of(context) + .getText( + 'wehvxbz4' /* Nome / Apelido do Visitante */, + ), + labelStyle: + 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), + ), + 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( + borderSide: BorderSide( + color: FlutterFlowTheme.of( + context) + .customColor5, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of( + context) + .primary, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of( + context) + .error, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + focusedErrorBorder: + OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of( + context) + .error, + width: 0.5, + ), + borderRadius: + BorderRadius.circular(10.0), + ), + suffixIcon: Icon( + Icons.person, + color: + FlutterFlowTheme.of(context) + .accent1, + ), + ), + 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), + ), + textAlign: TextAlign.start, + maxLines: null, + validator: _model + .personNameTextControllerValidator + .asValidator(context), + ), + ), + ), + ), + ], + ), + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 80.0, + child: Stack( + alignment: const AlignmentDirectional( + 0.0, 0.0), + children: [ + Padding( + padding: const EdgeInsetsDirectional + .fromSTEB(24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: + _model.dateTimeTextController, + focusNode: + _model.dateTimeFocusNode, + onChanged: (_) => + EasyDebounce.debounce( + '_model.dateTimeTextController', + const Duration( + milliseconds: 500), + () => setState(() {}), + ), + readOnly: true, + autofocus: false, + obscureText: false, + decoration: InputDecoration( + isDense: false, + labelText: + FFLocalizations.of(context) + .getText( + '8zgsw5so' /* Data / Hora Limite da Visita */, + ), + labelStyle: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyMediumFamily), + ), + enabledBorder: + OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of( + context) + .customColor5, + width: 0.5, + ), + borderRadius: + BorderRadius.circular( + 8.0), + ), + focusedBorder: + OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of( + context) + .primary, + width: 0.5, + ), + borderRadius: + BorderRadius.circular( + 8.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of( + context) + .error, + width: 0.5, + ), + borderRadius: + BorderRadius.circular( + 8.0), + ), + focusedErrorBorder: + OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of( + context) + .error, + width: 0.5, + ), + borderRadius: + BorderRadius.circular( + 8.0), + ), + suffixIcon: Icon( + Icons.date_range, + color: FlutterFlowTheme.of( + context) + .accent1, + ), + ), + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyMediumFamily), + ), + textAlign: TextAlign.start, + validator: _model + .dateTimeTextControllerValidator + .asValidator(context), + ), + ), + Padding( + padding: const EdgeInsetsDirectional + .fromSTEB(24.0, 0.0, 24.0, 0.0), + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: + Colors.transparent, + onTap: () async { + final datePickedDate = + await showDatePicker( + context: context, + initialDate: + getCurrentTimestamp, + firstDate: + (getCurrentTimestamp ?? + DateTime(1900)), + lastDate: DateTime(2050), + builder: (context, child) { + return wrapInMaterialDatePickerTheme( + context, + child!, + headerBackgroundColor: + FlutterFlowTheme.of( + context) + .primary, + headerForegroundColor: + FlutterFlowTheme.of( + context) + .info, + headerTextStyle: + FlutterFlowTheme.of( + context) + .headlineLarge + .override( + fontFamily: FlutterFlowTheme.of( + context) + .headlineLargeFamily, + fontSize: 32.0, + letterSpacing: + 0.0, + fontWeight: + FontWeight + .w600, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of(context) + .headlineLargeFamily), + ), + pickerBackgroundColor: + FlutterFlowTheme.of( + context) + .secondaryBackground, + pickerForegroundColor: + FlutterFlowTheme.of( + context) + .primaryText, + selectedDateTimeBackgroundColor: + FlutterFlowTheme.of( + context) + .primary, + selectedDateTimeForegroundColor: + FlutterFlowTheme.of( + context) + .info, + actionButtonForegroundColor: + FlutterFlowTheme.of( + context) + .primaryText, + iconSize: 24.0, + ); + }, + ); + + TimeOfDay? datePickedTime; + if (datePickedDate != null) { + datePickedTime = + await showTimePicker( + context: context, + initialTime: + TimeOfDay.fromDateTime( + getCurrentTimestamp), + builder: (context, child) { + return wrapInMaterialTimePickerTheme( + context, + child!, + headerBackgroundColor: + FlutterFlowTheme.of( + context) + .primary, + headerForegroundColor: + FlutterFlowTheme.of( + context) + .info, + headerTextStyle: + FlutterFlowTheme.of( + context) + .headlineLarge + .override( + fontFamily: FlutterFlowTheme.of( + context) + .headlineLargeFamily, + fontSize: + 32.0, + letterSpacing: + 0.0, + fontWeight: + FontWeight + .w600, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of(context) + .headlineLargeFamily), + ), + pickerBackgroundColor: + FlutterFlowTheme.of( + context) + .secondaryBackground, + pickerForegroundColor: + FlutterFlowTheme.of( + context) + .info, + selectedDateTimeBackgroundColor: + FlutterFlowTheme.of( + context) + .primary, + pickerDialForegroundColor: + FlutterFlowTheme.of( + context) + .primaryText, + selectedDateTimeForegroundColor: + FlutterFlowTheme.of( + context) + .info, + actionButtonForegroundColor: + FlutterFlowTheme.of( + context) + .primaryText, + iconSize: 24.0, + ); + }, + ); + } + + if (datePickedDate != null && + datePickedTime != null) { + safeSetState(() { + _model.datePicked = + DateTime( + datePickedDate.year, + datePickedDate.month, + datePickedDate.day, + datePickedTime!.hour, + datePickedTime.minute, + ); + }); + } + setState(() { + _model.dateTimeTextController + ?.text = dateTimeFormat( + "dd/MM/yyyy HH:mm:ss", + _model.datePicked, + locale: FFLocalizations.of( + context) + .languageCode, + ); + _model.dateTimeTextController + ?.selection = + TextSelection.collapsed( + offset: _model + .dateTimeTextController! + .text + .length); + }); + }, + child: Container( + width: double.infinity, + height: 50.0, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular( + 8.0), + ), + alignment: + const AlignmentDirectional( + 0.0, 0.0), + ), + ), + ), + ], + ), + ), + ], + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 10.0, 0.0, 10.0), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Align( + alignment: const AlignmentDirectional( + 0.0, 0.0), + child: Container( + decoration: const BoxDecoration(), + alignment: const AlignmentDirectional( + 0.0, 0.0), + child: Align( + alignment: + const AlignmentDirectional( + 0.0, 0.0), + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: SizedBox( + width: double.infinity, + child: TextFormField( + controller: _model + .notesTextController, + focusNode: + _model.notesFocusNode, + autofocus: false, + textInputAction: + TextInputAction.next, + obscureText: false, + decoration: InputDecoration( + isDense: false, + labelText: + FFLocalizations.of( + context) + .getText( + 'cw8b3tbb' /* Observação da Visita */, + ), + labelStyle: 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), + ), + 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( + borderSide: BorderSide( + color: + FlutterFlowTheme.of( + context) + .customColor5, + width: 0.5, + ), + borderRadius: + BorderRadius.circular( + 10.0), + ), + focusedBorder: + OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of( + context) + .primary, + width: 0.5, + ), + borderRadius: + BorderRadius.circular( + 10.0), + ), + errorBorder: + OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of( + context) + .error, + width: 0.5, + ), + borderRadius: + BorderRadius.circular( + 10.0), + ), + focusedErrorBorder: + OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of( + context) + .error, + width: 0.5, + ), + borderRadius: + BorderRadius.circular( + 10.0), + ), + suffixIcon: Icon( + Icons.text_fields, + color: + FlutterFlowTheme.of( + context) + .accent1, + ), + ), + 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), + ), + textAlign: TextAlign.start, + maxLines: 3, + maxLength: 100, + maxLengthEnforcement: + MaxLengthEnforcement + .enforced, + validator: _model + .notesTextControllerValidator + .asValidator(context), + ), + ), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + FFButtonWidget( + onPressed: !_isFormValid() + ? null + : () async { + try { + _model.provVisitSchedule = await PhpGroup + .postProvVisitSchedulingCall + .call( + devUUID: AppState().devUUID, + userUUID: AppState().userUUID, + cliID: AppState().cliUUID, + atividade: 'putAgendamentoProv', + data: _model.dateTimeTextController.text, + motivo: _model.notesTextController.text, + nome: + _model.personNameTextController.text, + proID: AppState().ownerUUID, + ); + + if (PhpGroup.postProvVisitSchedulingCall + .error((_model.provVisitSchedule + ?.jsonBody ?? + '')) == + false) { + DialogUtil.success( + context, + FFLocalizations.of(context).getVariableText( + ptText: + "Agendamento Provisório Realizado com Sucesso!", + enText: + "Provisional Scheduling Successfully Completed")); + setState(() { + _model.dateTimeTextController?.clear(); + _model.personNameTextController + ?.clear(); + _model.notesTextController?.clear(); + }); + } else { + var message = PhpGroup + .postProvVisitSchedulingCall + .msg((_model.provVisitSchedule + ?.jsonBody ?? + '')); + if (message != null) { + DialogUtil.error(context, message); + } else { + DialogUtil.errorDefault(context); + } + } + + setState(() {}); + } catch (e, s) { + DialogUtil.errorDefault(context); + LogUtil.requestAPIFailed( + "processRequest.php", + "", + "Cadastrar Visita Provisória", + e, + s); + } + }, + showLoadingIndicator: true, + text: FFLocalizations.of(context) + .getText('bv5fg9sv' /* Enviar */), + options: FFButtonOptions( + width: 150.0, + height: 50.0, + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + iconPadding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 0.0), + color: FlutterFlowTheme.of(context).primary, + textStyle: FlutterFlowTheme.of(context) + .titleSmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .titleSmallFamily, + color: Colors.white, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey(FlutterFlowTheme.of(context) + .titleSmallFamily), + ), + elevation: 3.0, + borderSide: const BorderSide( + color: Colors.transparent, + width: 1.0, + ), + borderRadius: BorderRadius.circular(8.0), + disabledColor: + FlutterFlowTheme.of(context).customColor5, + disabledTextColor: Colors.white, + ), + ), + ], + ), + ), + ), + ], + ), + ] + .addToStart(const SizedBox(height: 4.0)) + .addToEnd(const SizedBox(height: 40.0)), + ), + ), + ); + } +} diff --git a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart index 419b80f9..d428e668 100644 --- a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart +++ b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart @@ -1,21 +1,21 @@ +import 'package:easy_debounce/easy_debounce.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_animate/flutter_animate.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:hub/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart'; import 'package:hub/shared/components/atoms/atom_terms_of_use.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/log_util.dart'; import 'package:hub/shared/utils/validator_util.dart'; +import '/actions/actions.dart' as action_blocks; import '/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart'; import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_widgets.dart'; -import '/actions/actions.dart' as action_blocks; -import 'package:easy_debounce/easy_debounce.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_animate/flutter_animate.dart'; -import 'package:google_fonts/google_fonts.dart'; import 'sign_in_template_component_model.dart'; + export 'sign_in_template_component_model.dart'; class SignInTemplateComponentWidget extends StatefulWidget { @@ -869,8 +869,6 @@ class _SignInTemplateComponentWidgetState } }, ), - - // You will have to add an action on this rich text to go to your login page. Padding( padding: const EdgeInsetsDirectional .fromSTEB(0.0, 12.0, 0.0, 12.0), diff --git a/lib/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart b/lib/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart index dfa1d517..eb3ab3dd 100644 --- a/lib/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart +++ b/lib/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart @@ -1,19 +1,19 @@ +import 'package:easy_debounce/easy_debounce.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_animate/flutter_animate.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:hub/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart'; import 'package:hub/shared/components/atoms/atom_terms_of_use.dart'; import 'package:hub/shared/utils/validator_util.dart'; +import 'package:provider/provider.dart'; +import '/actions/actions.dart' as action_blocks; import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_widgets.dart'; -import '/actions/actions.dart' as action_blocks; -import 'package:easy_debounce/easy_debounce.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_animate/flutter_animate.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:provider/provider.dart'; import 'sign_up_template_component_model.dart'; + export 'sign_up_template_component_model.dart'; class SignUpTemplateComponentWidget extends StatefulWidget { @@ -101,8 +101,10 @@ class _SignUpTemplateComponentWidgetState @override Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; - double screenHeight = MediaQuery.of(context).size.height; + final MediaQueryData mediaQuery = MediaQuery.of(context); + final double screenWidth = mediaQuery.size.width; + final double screenHeight = mediaQuery.size.height; + bool _isFormInvalid() { if (_model.nameRegisterFormTextController.text == '' || _model.emailRegisterFormTextController.text == '' || @@ -233,7 +235,7 @@ class _SignUpTemplateComponentWidgetState Form( key: _model.formKey, autovalidateMode: - AutovalidateMode.onUserInteraction, + AutovalidateMode.always, child: Column( mainAxisSize: MainAxisSize.max, children: [ diff --git a/lib/flutter_flow/nav/nav.dart b/lib/flutter_flow/nav/nav.dart index 4b5ad183..29220d92 100644 --- a/lib/flutter_flow/nav/nav.dart +++ b/lib/flutter_flow/nav/nav.dart @@ -2,13 +2,13 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; +import 'package:hub/pages/delivery_schedule_page/delivery_schedule_widget.dart'; import 'package:hub/pages/fast_pass_page/fast_pass_page_widget.dart'; import 'package:hub/pages/message_history_page/message_history_page_widget.dart'; -import 'package:hub/pages/no_connection_page/no_connection_page.dart'; import 'package:hub/pages/package_order_page/package_order_page.dart'; -import 'package:hub/pages/reservation_page/reservation_page_widget.dart'; -import 'package:hub/pages/preferences_settings_page/preferences_settings_widget.dart'; +import 'package:hub/pages/provisional_schedule_page/provisional_schedule_widget.dart'; import 'package:hub/pages/reception_page/reception_page_widget.dart'; +import 'package:hub/pages/reservation_page/reservation_page_widget.dart'; import 'package:provider/provider.dart'; import '/backend/schema/structs/index.dart'; @@ -72,7 +72,7 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter( name: '_initialize', path: '/', builder: (context, _) => AppState().isLogged - ? AppState().haveLocal + ? AppState().haveLocal == true ? const HomePageWidget() : const ReceptionPageWidget() : const WelcomePageWidget(), @@ -112,10 +112,14 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter( ), ), FFRoute( - name: 'scheduleProvisionalVisitPage', - path: '/scheduleProvisionalVisitPage', - builder: (context, params) => - const ScheduleProvisionalVisitPageWidget(), + name: 'deliverySchedule', + path: '/deliverySchedule', + builder: (context, params) => const DeliverySchedule(), + ), + FFRoute( + name: 'provisionalSchedule', + path: '/provisionalSchedule', + builder: (context, params) => const ProvisionalSchedule(), ), FFRoute( name: 'fastPassPage', diff --git a/lib/index.dart b/lib/index.dart index 0e675d5a..28c34aa1 100644 --- a/lib/index.dart +++ b/lib/index.dart @@ -1,27 +1,17 @@ -export '/pages/home_page/home_page_widget.dart' show HomePageWidget; - -export '/pages/register_visitor_page/register_visitor_page_widget.dart' - show RegisterVisitorPageWidget; - -export '/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart' - show ScheduleCompleteVisitPageWidget; - -export '/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart' - show ScheduleProvisionalVisitPageWidget; - -export '/pages/people_on_the_property_page/people_on_the_property_page_widget.dart' - show PeopleOnThePropertyPageWidget; - export '/pages/acess_history_page/acess_history_page_widget.dart' show AcessHistoryPageWidget; - +export '/pages/home_page/home_page_widget.dart' show HomePageWidget; export '/pages/liberation_history/liberation_history_widget.dart' show LiberationHistoryWidget; - -export '/pages/sign_in_page/sign_in_page_widget.dart' show SignInPageWidget; - -export '/pages/sign_up_page/sign_up_page_widget.dart' show SignUpPageWidget; - -export '/pages/welcome_page/welcome_page_widget.dart' show WelcomePageWidget; +export '/pages/people_on_the_property_page/people_on_the_property_page_widget.dart' + show PeopleOnThePropertyPageWidget; +export '/pages/preferences_settings_page/preferences_settings_widget.dart' + show PreferencesPageWidget; export '/pages/qr_code_page/qr_code_page_widget.dart' show QrCodePageWidget; -export '/pages/preferences_settings_page/preferences_settings_widget.dart' show PreferencesPageWidget; +export '/pages/register_visitor_page/register_visitor_page_widget.dart' + show RegisterVisitorPageWidget; +export '/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart' + show ScheduleCompleteVisitPageWidget; +export '/pages/sign_in_page/sign_in_page_widget.dart' show SignInPageWidget; +export '/pages/sign_up_page/sign_up_page_widget.dart' show SignUpPageWidget; +export '/pages/welcome_page/welcome_page_widget.dart' show WelcomePageWidget; diff --git a/lib/main.dart b/lib/main.dart index a0de4a05..bb3254ac 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -90,6 +90,7 @@ class _AppState extends State { @override Widget build(BuildContext context) { + log("haveLocals: ${AppState().haveLocal}"); return MultiProvider( providers: [ ChangeNotifierProvider(create: (_) => AppState()), diff --git a/lib/pages/acess_history_page/acess_history_page_model.dart b/lib/pages/acess_history_page/acess_history_page_model.dart index ea6e2115..67141afb 100644 --- a/lib/pages/acess_history_page/acess_history_page_model.dart +++ b/lib/pages/acess_history_page/acess_history_page_model.dart @@ -1,13 +1,9 @@ - - import 'package:flutter/material.dart'; import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/components/molecular_components/message_opt_modal/opt_modal_widget.dart'; -import 'package:hub/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/request_manager.dart'; import 'package:hub/pages/acess_history_page/acess_history_page_widget.dart'; -import 'package:hub/pages/liberation_history/liberation_history_model.dart'; class AcessHistoryPageModel extends FlutterFlowModel { final unfocusNode = FocusNode(); @@ -57,4 +53,4 @@ class AcessHistoryPageModel extends FlutterFlowModel { }, ); } -} \ No newline at end of file +} diff --git a/lib/pages/acess_history_page/acess_history_page_widget.dart b/lib/pages/acess_history_page/acess_history_page_widget.dart index 3e415874..d4a7f003 100644 --- a/lib/pages/acess_history_page/acess_history_page_widget.dart +++ b/lib/pages/acess_history_page/acess_history_page_widget.dart @@ -1,21 +1,14 @@ import 'dart:async'; -import 'dart:developer'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:hub/app_state.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; -import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/components/molecular_components/message_opt_modal/opt_modal_widget.dart'; import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; -import 'package:hub/flutter_flow/flutter_flow_model.dart'; - import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/pages/acess_history_page/acess_history_page_model.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/log_util.dart'; diff --git a/lib/pages/delivery_schedule_page/delivery_schedule_widget.dart b/lib/pages/delivery_schedule_page/delivery_schedule_widget.dart new file mode 100644 index 00000000..2d75026e --- /dev/null +++ b/lib/pages/delivery_schedule_page/delivery_schedule_widget.dart @@ -0,0 +1,80 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:hub/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart'; +import 'package:hub/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart'; +import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; +import 'package:hub/flutter_flow/flutter_flow_theme.dart'; +import 'package:provider/provider.dart'; + +import '/flutter_flow/flutter_flow_util.dart'; + +class DeliverySchedule extends StatefulWidget { + const DeliverySchedule({super.key}); + + @override + State createState() => _DeliveryScheduleState(); +} + +class _DeliveryScheduleState extends State { + late ScheduleProvisionalVisitPageModel _model; + + final scaffoldKey = GlobalKey(); + + @override + void initState() { + super.initState(); + _model = createModel(context, () => ScheduleProvisionalVisitPageModel()); + } + + @override + void dispose() { + _model.dispose(); + + super.dispose(); + } + + @override + Widget build(BuildContext context) { + context.watch(); + return Scaffold( + key: scaffoldKey, + backgroundColor: FlutterFlowTheme.of(context).primaryBackground, + appBar: AppBar( + automaticallyImplyLeading: false, + forceMaterialTransparency: true, + leading: FlutterFlowIconButton( + borderColor: Colors.transparent, + borderRadius: 30.0, + borderWidth: 1.0, + buttonSize: 60.0, + icon: Icon( + Icons.keyboard_arrow_left, + color: FlutterFlowTheme.of(context).primaryText, + size: 30.0, + ), + onPressed: () async { + Navigator.pop(context); + }, + ), + title: Text( + FFLocalizations.of(context).getVariableText( + enText: 'Delivery Schedule', + ptText: 'Agendar Entregas', + ), + style: FlutterFlowTheme.of(context).headlineMedium.override( + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 15.0, + fontWeight: FontWeight.bold, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), + ), + ), + actions: const [], + centerTitle: true, + elevation: 0.0, + ), + body: const SafeArea( + top: true, child: ScheduleProvisionalVisitPageWidget())); + } +} diff --git a/lib/pages/fast_pass_page/fast_pass_page_widget.dart b/lib/pages/fast_pass_page/fast_pass_page_widget.dart index 91130bc2..71780ff2 100644 --- a/lib/pages/fast_pass_page/fast_pass_page_widget.dart +++ b/lib/pages/fast_pass_page/fast_pass_page_widget.dart @@ -1,9 +1,10 @@ -import 'package:hub/app_state.dart'; +import 'dart:io' show Platform; + import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:hub/app_state.dart'; import 'package:url_launcher/url_launcher_string.dart'; import 'package:webview_flutter/webview_flutter.dart'; -import 'dart:io' show Platform; class FastPassPageWidget extends StatefulWidget { final String freToken = AppState().userUUID; @@ -54,9 +55,20 @@ class _FastPassPageWidgetState extends State { _controllerIOS = controller; }, onLoadStop: (controller, url) async { - await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-token', '\"${widget.freToken}\"')"); - await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-user-data', '${widget.freUserData}')"); - await controller.evaluateJavascript(source: "window.localStorage.setItem('enableBackButton', 'true')"); + await controller.evaluateJavascript( + source: + "window.localStorage.setItem('fre-token', '\"${widget.freToken}\"')"); + await controller.evaluateJavascript( + source: + "window.localStorage.setItem('fre-user-data', '${widget.freUserData}')"); + await controller.evaluateJavascript( + source: + "window.localStorage.setItem('enableBackButton', 'true')"); + }, + onUpdateVisitedHistory: (controller, uri, isVisited) { + if (uri.toString().contains('/hub/home')) { + Navigator.pop(context); + } }, ) : WebViewWidget( @@ -67,27 +79,34 @@ class _FastPassPageWidgetState extends State { ..setBackgroundColor(const Color(0x00000000)) ..setNavigationDelegate( NavigationDelegate( - onProgress: (int progress) {}, - onPageStarted: (String url) { - final String token = "localStorage.setItem('fre-token', '\"${widget.freToken}\"');"; - final String data = "localStorage.setItem('fre-user-data', '${widget.freUserData}');"; - const String backNavigation = "localStorage.setItem('enableBackButton', 'true');"; + onProgress: (int progress) {}, + onPageStarted: (String url) { + final String token = + "localStorage.setItem('fre-token', '\"${widget.freToken}\"');"; + final String data = + "localStorage.setItem('fre-user-data', '${widget.freUserData}');"; + const String backNavigation = + "localStorage.setItem('enableBackButton', 'true');"; - _controllerAll.runJavaScript(token); - _controllerAll.runJavaScript(data); - _controllerAll.runJavaScript(backNavigation); - }, - onNavigationRequest: (NavigationRequest request) { - if (request.url.startsWith('http') || - request.url - .startsWith('https://api.whatsapp.com/send') || - request.url.startsWith('https://wa.me')) { - launchUrlString(request.url); + _controllerAll.runJavaScript(token); + _controllerAll.runJavaScript(data); + _controllerAll.runJavaScript(backNavigation); + }, + onNavigationRequest: (NavigationRequest request) { + if (request.url.startsWith('http') || + request.url.startsWith( + 'https://api.whatsapp.com/send') || + request.url.startsWith('https://wa.me')) { + launchUrlString(request.url); + return NavigationDecision.prevent; + } return NavigationDecision.prevent; - } - return NavigationDecision.prevent; - }, - ), + }, + onUrlChange: (url) { + if (url.url.toString().contains('/hub/home')) { + Navigator.pop(context); + } + }), ) ..loadRequest(Uri.parse(url)), ), diff --git a/lib/pages/home_page/home_page_widget.dart b/lib/pages/home_page/home_page_widget.dart index fa31da21..dd5094ff 100644 --- a/lib/pages/home_page/home_page_widget.dart +++ b/lib/pages/home_page/home_page_widget.dart @@ -1,19 +1,20 @@ -import 'package:cached_network_image/cached_network_image.dart'; +import 'dart:developer'; + +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:hub/actions/actions.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/backend/notifications/firebase_messaging_service.dart'; import 'package:hub/backend/schema/enums/enums.dart'; import 'package:hub/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart'; import 'package:hub/components/organism_components/local_profile_component/local_profile_component_widget.dart'; import 'package:hub/components/organism_components/menu_component/menu_component_widget.dart'; -import 'package:hub/flutter_flow/custom_functions.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/pages/home_page/home_page_model.dart'; import 'package:hub/shared/utils/dialog_util.dart'; +import 'package:hub/shared/widgets/drawer_widget/drawer_widget.dart'; import 'package:provider/provider.dart'; class HomePageWidget extends StatefulWidget { @@ -25,78 +26,97 @@ class HomePageWidget extends StatefulWidget { class _HomePageWidgetState extends State { late HomePageModel _model; - bool localStatus = false; final scaffoldKey = GlobalKey(); + LocalProfileComponentWidget _localProfileComponentWidget = + const LocalProfileComponentWidget(); - Future checkLocalStatus() async { - localStatus = await checkLocals( + Future checkData() async { + try { + final response = await PhpGroup.getDadosCall.call( + devUUID: AppState().devUUID, + userUUID: AppState().userUUID, + cliUUID: AppState().cliUUID, + atividade: 'getDados', + ); + + if (response.statusCode == 200) { + if (response.jsonBody['error'] == false) { + AppState().whatsapp = response.jsonBody['whatsapp']; + AppState().provisional = response.jsonBody['provisional']; + AppState().name = response.jsonBody['visitado']['VDO_NOME']; + safeSetState(() {}); + } else { + final errorMsg = response.jsonBody['error_msg']; + if (errorMsg != + r'''Usuario nao possui vinculo ativo com esse condominio''') { + log(errorMsg); + await DialogUtil.warningDefault(context) + .whenComplete(() => checkData()); + safeSetState(() {}); + } + } + } else { + await DialogUtil.warningDefault(context) + .whenComplete(() => checkData()); + safeSetState(() {}); + } + } catch (e) { + log('Error in checkData: $e'); + await DialogUtil.warningDefault(context).whenComplete(() => checkData()); + } + } + + Future checkLocal() async { + try { + final response = await PhpGroup.getLocalsCall.call( + devUUID: AppState().devUUID, + userUUID: AppState().userUUID, + ); + + List locals = response.jsonBody['locais'] ?? []; + final activeLocals = + locals.where((local) => local['CLU_STATUS'] == 'A').toList(); + + if (activeLocals.isEmpty || AppState().cliUUID.isEmpty) { + await showBottomSheet().then((_) => checkData()); + } + if (AppState().cliUUID.isEmpty) { + await showBottomSheet().then((_) => checkData()); + } + } catch (e) { + log('Error in checkLocal: $e'); + await showBottomSheet().then((_) => checkData()); + } + } + + Future showBottomSheet() async { + await showModalBottomSheet( + isScrollControlled: true, + backgroundColor: Colors.transparent, + enableDrag: false, + isDismissible: false, context: context, - model: _model, - ); + builder: (context) => Padding( + padding: MediaQuery.viewInsetsOf(context), + child: const BottomArrowLinkedLocalsComponentWidget(), + ), + ).then((_) => safeSetState(() { + _localProfileComponentWidget = const LocalProfileComponentWidget(); + })); } @override void initState() { super.initState(); + _model = createModel(context, () => HomePageModel()); AppState().context = context; () async { + await checkLocal(); await FirebaseMessagingService().updateDeviceToken(); }(); - void fetchData() async { - bool success = false; - while (!success) { - final response = await PhpGroup.getDadosCall.call( - devUUID: AppState().devUUID, - userUUID: AppState().userUUID, - cliUUID: AppState().cliUUID, - atividade: 'getDados', - ); - - switch (response.statusCode) { - case 200: - if (response.jsonBody['error'] == false) { - success = true; - AppState().whatsapp = response.jsonBody['whatsapp']; - AppState().provisional = response.jsonBody['provisional']; - } - break; - default: - await DialogUtil.warningDefault(context); - safeSetState(() {}); - break; - } - } - } - - fetchData(); - - WidgetsBinding.instance.addPostFrameCallback((_) async { - localStatus = await checkLocals( - context: context, - model: _model, - ); - - if (AppState().cliUUID.isEmpty) { - showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - enableDrag: false, - isDismissible: false, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: const BottomArrowLinkedLocalsComponentWidget(), - ); - }, - ).then((value) => safeSetState(() {})); - } else { - return; - } - }); _model.textController ??= TextEditingController(); _model.textFieldFocusNode ??= FocusNode(); @@ -118,14 +138,63 @@ class _HomePageWidgetState extends State { : FocusScope.of(context).unfocus(), child: Scaffold( key: scaffoldKey, - backgroundColor: FlutterFlowTheme.of(context).secondaryBackground, - drawer: buildDrawer(context), - body: buildPage(context, localStatus), + backgroundColor: FlutterFlowTheme.of(context).primaryBackground, + // drawer: buildDrawer(context), + drawerEnableOpenDragGesture: true, + drawerDragStartBehavior: DragStartBehavior.start, + drawer: CustomDrawer(model: _model), + appBar: AppBar( + backgroundColor: FlutterFlowTheme.of(context).primary, + automaticallyImplyLeading: false, + leading: FlutterFlowIconButton( + borderRadius: 20.0, + borderWidth: 1.0, + buttonSize: 40.0, + fillColor: FlutterFlowTheme.of(context).primary, + icon: const Icon( + Icons.menu_rounded, + color: Colors.white, + size: 28.0, + ), + onPressed: () async { + scaffoldKey.currentState!.openDrawer(); + }, + ), + title: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: Image.asset( + 'assets/images/logo.png', + width: 15.0, + height: 15.0, + fit: BoxFit.cover, + ), + ), + Text( + 'FRE ACCESS', + 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(width: 8.0)), + ), + actions: const [], + centerTitle: true, + elevation: 0.0, + ), + body: buildPage(context), ), ); } - Container buildPage(BuildContext context, bool localStatus) { + Container buildPage(BuildContext context) { return Container( decoration: BoxDecoration( color: FlutterFlowTheme.of(context).primaryBackground, @@ -145,8 +214,7 @@ class _HomePageWidgetState extends State { verticalDirection: VerticalDirection.down, clipBehavior: Clip.none, children: [ - createHeader(context), - createLocal(localStatus), + createLocal(), createBody(), ], ), @@ -156,386 +224,26 @@ class _HomePageWidgetState extends State { ); } - Wrap createBody() { - return Wrap( - spacing: 0.0, - runSpacing: 0.0, - alignment: WrapAlignment.start, - crossAxisAlignment: WrapCrossAlignment.start, - direction: Axis.horizontal, - runAlignment: WrapAlignment.start, - verticalDirection: VerticalDirection.down, - clipBehavior: Clip.none, - children: [ - wrapWithModel( - model: _model.menuComponentModel, - updateCallback: () => setState(() {}), - child: const MenuComponentWidget( - expandable: true, - style: MenuView.list_grid, - item: MenuItem.button, - ), + Widget createBody() { + return Container( + color: FlutterFlowTheme.of(context).primaryBackground, + child: wrapWithModel( + model: _model.menuComponentModel, + updateCallback: () => setState(() {}), + child: const MenuComponentWidget( + expandable: true, + style: MenuView.list_grid, + item: MenuItem.button, ), - // Align( - // alignment: const AlignmentDirectional(0.0, 0.0), - // child: Provider( - // create: (_) => MessageWellNotifier(), - // child: wrapWithModel( - // model: _model.messageWellComponentModel, - // updateCallback: () => setState(() {}), - // child: const MessageWellComponentWidget(), - // ), - // ), - // ), - //footer - const SizedBox( - height: 100, - width: double.infinity, - ) - ], + ), ); } - Widget createLocal(bool localStatus) { + Widget createLocal() { return wrapWithModel( model: _model.localComponentModel, updateCallback: () => safeSetState(() {}), - child: LocalProfileComponentWidget( - localStatus: localStatus, - ), - ); - } - - Row createHeader(BuildContext context) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Container( - width: 100.0, - height: 100.0, - decoration: const BoxDecoration( - color: Color(0xFF1AAB5F), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Align( - alignment: const AlignmentDirectional(0.0, 1.0), - child: Container( - height: 50.0, - decoration: const BoxDecoration(), - child: Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 10.0, 0.0, 0.0, 0.0), - child: FlutterFlowIconButton( - borderRadius: 20.0, - borderWidth: 1.0, - buttonSize: 40.0, - fillColor: FlutterFlowTheme.of(context).primary, - icon: const Icon( - Icons.menu_rounded, - color: Colors.white, - size: 28.0, - ), - onPressed: () async { - scaffoldKey.currentState!.openDrawer(); - }, - ), - ), - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 60.0, 15.0, 0.0, 0.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: Image.asset( - 'assets/images/logo.png', - width: 50.0, - height: 200.0, - fit: BoxFit.none, - ), - ), - ), - ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 15.0, 0.0, 0.0), - child: Text( - 'FRE ACCESS', - 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), - ), - ), - ), - ), - ], - ), - ), - ), - ), - // Align( - // alignment: const AlignmentDirectional(0.0, 1.0), - // child: Container( - // width: 100.0, - // height: 50.0, - // decoration: const BoxDecoration(), - // child: Align( - // alignment: const AlignmentDirectional(1.0, 1.0), - // child: FlutterFlowIconButton( - // borderRadius: 20.0, - // borderWidth: 1.0, - // buttonSize: 40.0, - // icon: Icon( - // Icons.notifications_sharp, - // color: FlutterFlowTheme.of(context).info, - // size: 24.0, - // ), - // onPressed: () {}, - // ), - // ), - // ), - // ), - ], - ), - ), - ), - ], - ); - } - - SizedBox buildDrawer(BuildContext context) { - return SizedBox( - width: MediaQuery.of(context).size.width * 0.8, - child: Drawer( - elevation: 16.0, - child: Container( - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - shape: BoxShape.rectangle, - ), - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: double.infinity, - decoration: const BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(5.0), - bottomRight: Radius.circular(5.0), - topLeft: Radius.circular(0.0), - topRight: Radius.circular(0.0), - ), - shape: BoxShape.rectangle, - ), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(30, 30, 10, 0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Flexible( - child: Container( - width: double.infinity, - decoration: const BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: 50.0, - height: 50.0, - clipBehavior: Clip.antiAlias, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: CachedNetworkImage( - imageUrl: valueOrDefault( - 'https://freaccess.com.br/freaccess/Images/Clients/${AppState().cliUUID}.png', - 'assets/images/error_image.svg'), - width: 80.0, - height: 80.0, - fit: BoxFit.cover, - alignment: const Alignment(0.0, 0.0), - placeholder: (context, url) => - Image.asset( - 'assets/images/error_image.svg'), - errorListener: (_) => Image.asset( - 'assets/images/error_image.svg'), - errorWidget: (_, __, ___) => Image.asset( - 'assets/images/error_image.svg'), - ), - ), - Container( - width: 150.0, - child: Text( - valueOrDefault( - convertToUppercase(AppState().local), - 'NOME DO LOCAL', - ), - style: FlutterFlowTheme.of(context) - .bodyLarge - .override( - fontFamily: 'Nunito Sans', - color: FlutterFlowTheme.of(context) - .primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.normal, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Nunito Sans'), - ), - ), - ), - ].divide(const SizedBox(width: 20.0)), - ), - ), - ), - ] - .divide(const SizedBox(width: 0.0)) - .around(const SizedBox(width: 0.0)), - ), - ), - ].addToStart(const SizedBox(height: 30.0)), - ), - ), - Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Flexible( - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), - child: TextFormField( - controller: _model.textController, - focusNode: _model.textFieldFocusNode, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - isDense: true, - 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), - ), - alignLabelWithHint: false, - hintStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context).customColor1, - width: 0.5, - ), - borderRadius: BorderRadius.circular(2.0), - ), - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(2.0), - ), - errorBorder: UnderlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(2.0), - ), - focusedErrorBorder: UnderlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(2.0), - ), - prefixIcon: const Icon( - Icons.search_sharp, - ), - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - validator: _model.textControllerValidator - .asValidator(context), - ), - ), - ), - ] - .addToStart(const SizedBox(width: 30.0)) - .addToEnd(const SizedBox(width: 30.0)), - ), - ), - Expanded( - child: SingleChildScrollView( - child: wrapWithModel( - model: _model.menuComponentModel, - updateCallback: () => setState(() {}), - child: const MenuComponentWidget( - expandable: false, - style: MenuView.list, - item: MenuItem.tile, - ), - ), - ), - ), - ], - ), - ), - ), + child: _localProfileComponentWidget, ); } } diff --git a/lib/pages/liberation_history/liberation_history_widget.dart b/lib/pages/liberation_history/liberation_history_widget.dart index 875400ef..e75d5676 100644 --- a/lib/pages/liberation_history/liberation_history_widget.dart +++ b/lib/pages/liberation_history/liberation_history_widget.dart @@ -121,7 +121,8 @@ class _LiberationHistoryWidgetState extends State { style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, - fontSize: 17.0, + fontSize: 15.0, + fontWeight: FontWeight.bold, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), ), diff --git a/lib/pages/message_history_page/message_history_page_widget.dart b/lib/pages/message_history_page/message_history_page_widget.dart index 4cbda8f3..84749623 100644 --- a/lib/pages/message_history_page/message_history_page_widget.dart +++ b/lib/pages/message_history_page/message_history_page_widget.dart @@ -1,17 +1,11 @@ -import 'dart:developer'; - -import 'package:hub/app_state.dart'; +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; - import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/message_history_page/message_history_page_model.dart'; - -import 'package:flutter/material.dart'; -import 'package:flutter_spinkit/flutter_spinkit.dart'; -import 'package:google_fonts/google_fonts.dart'; import 'package:hub/shared/utils/dialog_util.dart'; import 'package:hub/shared/utils/log_util.dart'; import 'package:provider/provider.dart'; @@ -177,7 +171,8 @@ class _MessageHistoryPageWidgetState extends State style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, - fontSize: 17.0, + fontSize: 15.0, + fontWeight: FontWeight.bold, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), ), diff --git a/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart b/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart index 4ba4299a..e9ba900c 100644 --- a/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart +++ b/lib/pages/people_on_the_property_page/people_on_the_property_page_widget.dart @@ -1,21 +1,15 @@ -import 'dart:developer'; - -import 'package:hub/backend/api_requests/api_calls.dart'; - -import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; -import 'package:hub/flutter_flow/flutter_flow_theme.dart'; -import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/flutter_flow/internationalization.dart'; -import 'package:hub/flutter_flow/nav/nav.dart'; -import 'package:hub/pages/people_on_the_property_page/people_on_the_property_page_model.dart'; - import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:hub/backend/api_requests/api_calls.dart'; +import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; +import 'package:hub/flutter_flow/flutter_flow_theme.dart'; +import 'package:hub/flutter_flow/flutter_flow_util.dart'; +import 'package:hub/flutter_flow/nav/nav.dart'; +import 'package:hub/pages/people_on_the_property_page/people_on_the_property_page_model.dart'; import 'package:provider/provider.dart'; -import '../../shared/utils/dialog_util.dart'; import '../../shared/utils/log_util.dart'; class PeopleOnThePropertyPageWidget extends StatefulWidget { diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index 07912126..6cab1d32 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -313,8 +313,7 @@ class PreferencesPageModel with ChangeNotifier { AppState().deleteCliUUID(); AppState().deleteLocal(); AppState().deleteOwnerUUID(); - // Navigator.pop(context); - // Navigator.pop(context, true); + context.goNamed( 'homePage', extra: { diff --git a/lib/pages/preferences_settings_page/preferences_settings_widget.dart b/lib/pages/preferences_settings_page/preferences_settings_widget.dart index 180c1cc2..c2bbe6cc 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_widget.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_widget.dart @@ -48,7 +48,7 @@ class PreferencesPageWidget extends StatelessWidget { style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, - fontSize: 17.0, + fontSize: 15.0, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), ), diff --git a/lib/pages/provisional_schedule_page/provisional_schedule_widget.dart b/lib/pages/provisional_schedule_page/provisional_schedule_widget.dart new file mode 100644 index 00000000..a34d0397 --- /dev/null +++ b/lib/pages/provisional_schedule_page/provisional_schedule_widget.dart @@ -0,0 +1,80 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:hub/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart'; +import 'package:hub/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart'; +import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; +import 'package:hub/flutter_flow/flutter_flow_theme.dart'; +import 'package:provider/provider.dart'; + +import '/flutter_flow/flutter_flow_util.dart'; + +class ProvisionalSchedule extends StatefulWidget { + const ProvisionalSchedule({super.key}); + + @override + State createState() => _ProvisionalScheduleState(); +} + +class _ProvisionalScheduleState extends State { + late ScheduleProvisionalVisitPageModel _model; + + final scaffoldKey = GlobalKey(); + + @override + void initState() { + super.initState(); + _model = createModel(context, () => ScheduleProvisionalVisitPageModel()); + } + + @override + void dispose() { + _model.dispose(); + + super.dispose(); + } + + @override + Widget build(BuildContext context) { + context.watch(); + return Scaffold( + key: scaffoldKey, + backgroundColor: FlutterFlowTheme.of(context).primaryBackground, + appBar: AppBar( + automaticallyImplyLeading: false, + forceMaterialTransparency: true, + leading: FlutterFlowIconButton( + borderColor: Colors.transparent, + borderRadius: 30.0, + borderWidth: 1.0, + buttonSize: 60.0, + icon: Icon( + Icons.keyboard_arrow_left, + color: FlutterFlowTheme.of(context).primaryText, + size: 30.0, + ), + onPressed: () async { + Navigator.pop(context); + }, + ), + title: Text( + FFLocalizations.of(context).getVariableText( + enText: 'Provisional Schedule', + ptText: 'Agendar Prestadores', + ), + style: FlutterFlowTheme.of(context).headlineMedium.override( + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 15.0, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), + ), + ), + actions: const [], + centerTitle: true, + elevation: 0.0, + ), + body: const SafeArea( + top: true, child: ScheduleProvisionalVisitPageWidget())); + } +} diff --git a/lib/pages/qr_code_page/qr_code_page_widget.dart b/lib/pages/qr_code_page/qr_code_page_widget.dart index c6163fe8..36e99e85 100644 --- a/lib/pages/qr_code_page/qr_code_page_widget.dart +++ b/lib/pages/qr_code_page/qr_code_page_widget.dart @@ -1,8 +1,12 @@ -import 'dart:developer'; +import 'dart:async'; import 'package:barcode_widget/barcode_widget.dart'; +// import 'package:barcode_widget/barcode_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/scheduler.dart'; +import 'package:flutter_animate/flutter_animate.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:hub/actions/actions.dart'; - import 'package:hub/components/templates_components/qr_code_pass_key_template_component/qr_code_pass_key_template_component_widget.dart'; import 'package:hub/flutter_flow/custom_functions.dart'; import 'package:hub/flutter_flow/flutter_flow_animations.dart'; @@ -10,18 +14,9 @@ import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; -import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; - import 'package:hub/pages/qr_code_page/qr_code_page_model.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; - -import 'dart:async'; -// import 'package:barcode_widget/barcode_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/scheduler.dart'; -import 'package:flutter_animate/flutter_animate.dart'; -import 'package:google_fonts/google_fonts.dart'; // import 'package:percent_indicator/percent_indicator.dart'; import 'package:qr_flutter/qr_flutter.dart'; @@ -466,7 +461,8 @@ class _QrCodePageWidgetState extends State style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily, color: FlutterFlowTheme.of(context).primaryText, - fontSize: 16.0, + fontSize: 15.0, + fontWeight: FontWeight.bold, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context).headlineMediumFamily), diff --git a/lib/pages/register_visitor_page/register_visitor_page_widget.dart b/lib/pages/register_visitor_page/register_visitor_page_widget.dart index bf791b09..d0ed87d2 100644 --- a/lib/pages/register_visitor_page/register_visitor_page_widget.dart +++ b/lib/pages/register_visitor_page/register_visitor_page_widget.dart @@ -1,12 +1,14 @@ +import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; -import '/flutter_flow/flutter_flow_util.dart'; -import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; + +import '/flutter_flow/flutter_flow_util.dart'; import 'register_visitor_page_model.dart'; + export 'register_visitor_page_model.dart'; class RegisterVisitorPageWidget extends StatefulWidget { @@ -64,6 +66,7 @@ class _RegisterVisitorPageWidgetState extends State { fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily, color: FlutterFlowTheme.of(context).primaryText, fontSize: 15.0, + fontWeight: FontWeight.bold, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context).headlineMediumFamily), diff --git a/lib/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart b/lib/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart deleted file mode 100644 index 8b3dfbf9..00000000 --- a/lib/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart +++ /dev/null @@ -1,1086 +0,0 @@ -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:easy_debounce/easy_debounce.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:google_fonts/google_fonts.dart'; -import 'package:hub/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_model.dart'; -import 'package:hub/shared/utils/dialog_util.dart'; -import 'package:hub/shared/utils/log_util.dart'; -import 'package:provider/provider.dart'; - -import '/backend/api_requests/api_calls.dart'; -import '/flutter_flow/flutter_flow_icon_button.dart'; -import '/flutter_flow/flutter_flow_theme.dart'; -import '/flutter_flow/flutter_flow_util.dart'; -import '/flutter_flow/flutter_flow_widgets.dart'; - -class ScheduleProvisionalVisitPageWidget extends StatefulWidget { - const ScheduleProvisionalVisitPageWidget({super.key}); - - @override - State createState() => - _ScheduleProvisionalVisitPageWidgetState(); -} - -class _ScheduleProvisionalVisitPageWidgetState - extends State { - late ScheduleProvisionalVisitPageModel _model; - - final scaffoldKey = GlobalKey(); - - @override - void initState() { - super.initState(); - _model = createModel(context, () => ScheduleProvisionalVisitPageModel()); - - _model.personNameTextController ??= TextEditingController(); - _model.personNameFocusNode ??= FocusNode(); - - _model.dateTimeTextController ??= TextEditingController(); - _model.dateTimeFocusNode ??= FocusNode(); - - _model.notesTextController ??= TextEditingController(); - _model.notesFocusNode ??= FocusNode(); - } - - @override - void dispose() { - _model.dispose(); - - super.dispose(); - } - - bool _isFormValid() { - if (_model.personNameTextController.text == '' || - _model.personNameTextController.text.length > 80) { - return false; - } - - if (_model.dateTimeTextController.text == '') { - return false; - } - - return true; - } - - @override - Widget build(BuildContext context) { - context.watch(); - - return GestureDetector( - onTap: () => FocusScope.of(context).unfocus(), - child: Scaffold( - key: scaffoldKey, - backgroundColor: FlutterFlowTheme.of(context).primaryBackground, - appBar: AppBar( - automaticallyImplyLeading: false, - forceMaterialTransparency: true, - leading: FlutterFlowIconButton( - borderColor: Colors.transparent, - borderRadius: 30.0, - borderWidth: 1.0, - buttonSize: 60.0, - icon: Icon( - Icons.keyboard_arrow_left, - color: FlutterFlowTheme.of(context).primaryText, - size: 30.0, - ), - onPressed: () async { - Navigator.pop(context); - }, - ), - title: Text( - FFLocalizations.of(context).getText( - 'cifgwfxs' /* Agendamento Provisório */, - ), - style: FlutterFlowTheme.of(context).headlineMedium.override( - fontFamily: 'Nunito', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 16.0, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'), - ), - ), - actions: const [], - centerTitle: true, - elevation: 0.0, - ), - body: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Form( - key: _model.formKey, - autovalidateMode: AutovalidateMode.onUserInteraction, - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 24.0, 0.0, 24.0), - child: Text( - FFLocalizations.of(context).getText( - 'uj8acuab' /* Preencha os Campos Abaixo: */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - fontSize: 16.0, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - Container( - width: double.infinity, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context) - .secondaryBackground, - ), - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Align( - alignment: - const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context).getText( - '8d3679lf' /* Propriedade */, - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 10.0, 24.0, 10.0), - child: Container( - width: double.infinity, - height: 50.0, - decoration: BoxDecoration( - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(50.0), - bottomRight: Radius.circular(50.0), - topLeft: Radius.circular(50.0), - topRight: Radius.circular(50.0), - ), - border: Border.all( - color: FlutterFlowTheme.of(context) - .customColor5, - ), - ), - child: Padding( - padding: const EdgeInsets.all(5.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - ClipRRect( - borderRadius: - const BorderRadius.only( - bottomLeft: Radius.circular(50.0), - bottomRight: - Radius.circular(50.0), - topLeft: Radius.circular(50.0), - topRight: Radius.circular(50.0), - ), - child: CachedNetworkImage( - fadeInDuration: const Duration( - milliseconds: 200), - fadeOutDuration: const Duration( - milliseconds: 200), - imageUrl: - 'https://freaccess.com.br/freaccess/Images/Clients/${AppState().cliUUID}.png', - width: 35.0, - height: 35.0, - fit: BoxFit.contain, - memCacheWidth: 35, - memCacheHeight: 35, - ), - ), - Padding( - padding: const EdgeInsetsDirectional - .fromSTEB(15.0, 0.0, 0.0, 0.0), - child: Text( - AppState().local, - style: - FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of( - context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ), - Container( - decoration: const BoxDecoration(), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Align( - alignment: - const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB( - 24.0, 10.0, 0.0, 10.0), - child: Text( - FFLocalizations.of(context).getText( - 'z6aawgqa' /* Dados da Visita */, - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - ), - ), - ), - Column( - mainAxisSize: MainAxisSize.max, - children: [ - Container( - height: 80.0, - decoration: const BoxDecoration(), - alignment: const AlignmentDirectional( - 0.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional - .fromSTEB(24.0, 0.0, 24.0, 0.0), - child: SizedBox( - width: double.infinity, - child: TextFormField( - controller: _model - .personNameTextController, - focusNode: - _model.personNameFocusNode, - onChanged: (_) => - EasyDebounce.debounce( - '_model.personNameTextController', - const Duration( - milliseconds: 500), - () => setState(() {}), - ), - autofocus: false, - textInputAction: - TextInputAction.next, - obscureText: false, - decoration: InputDecoration( - isDense: false, - labelText: - FFLocalizations.of(context) - .getText( - 'wehvxbz4' /* Nome / Apelido do Visitante */, - ), - labelStyle: - 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), - ), - 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( - borderSide: BorderSide( - color: FlutterFlowTheme.of( - context) - .customColor5, - width: 0.5, - ), - borderRadius: - BorderRadius.circular( - 10.0), - ), - focusedBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of( - context) - .primary, - width: 0.5, - ), - borderRadius: - BorderRadius.circular( - 10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of( - context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular( - 10.0), - ), - focusedErrorBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of( - context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular( - 10.0), - ), - suffixIcon: Icon( - Icons.person, - color: FlutterFlowTheme.of( - context) - .accent1, - ), - ), - 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), - ), - textAlign: TextAlign.start, - maxLines: null, - validator: _model - .personNameTextControllerValidator - .asValidator(context), - ), - ), - ), - ), - ], - ), - Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 80.0, - child: Stack( - alignment: const AlignmentDirectional( - 0.0, 0.0), - children: [ - Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model - .dateTimeTextController, - focusNode: - _model.dateTimeFocusNode, - onChanged: (_) => - EasyDebounce.debounce( - '_model.dateTimeTextController', - const Duration( - milliseconds: 500), - () => setState(() {}), - ), - readOnly: true, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - isDense: false, - labelText: FFLocalizations.of( - context) - .getText( - '8zgsw5so' /* Data / Hora Limite da Visita */, - ), - labelStyle: - FlutterFlowTheme.of( - context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of( - context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - enabledBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of( - context) - .customColor5, - width: 0.5, - ), - borderRadius: - BorderRadius.circular( - 8.0), - ), - focusedBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of( - context) - .primary, - width: 0.5, - ), - borderRadius: - BorderRadius.circular( - 8.0), - ), - errorBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of( - context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular( - 8.0), - ), - focusedErrorBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of( - context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular( - 8.0), - ), - suffixIcon: Icon( - Icons.date_range, - color: FlutterFlowTheme.of( - context) - .accent1, - ), - ), - style: - FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of( - context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - textAlign: TextAlign.start, - validator: _model - .dateTimeTextControllerValidator - .asValidator(context), - ), - ), - Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: - Colors.transparent, - onTap: () async { - final datePickedDate = - await showDatePicker( - context: context, - initialDate: - getCurrentTimestamp, - firstDate: - (getCurrentTimestamp ?? - DateTime(1900)), - lastDate: DateTime(2050), - builder: (context, child) { - return wrapInMaterialDatePickerTheme( - context, - child!, - headerBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - headerForegroundColor: - FlutterFlowTheme.of( - context) - .info, - headerTextStyle: - FlutterFlowTheme.of( - context) - .headlineLarge - .override( - fontFamily: FlutterFlowTheme.of( - context) - .headlineLargeFamily, - fontSize: - 32.0, - letterSpacing: - 0.0, - fontWeight: - FontWeight - .w600, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of(context) - .headlineLargeFamily), - ), - pickerBackgroundColor: - FlutterFlowTheme.of( - context) - .secondaryBackground, - pickerForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - selectedDateTimeBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - selectedDateTimeForegroundColor: - FlutterFlowTheme.of( - context) - .info, - actionButtonForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - iconSize: 24.0, - ); - }, - ); - - TimeOfDay? datePickedTime; - if (datePickedDate != null) { - datePickedTime = - await showTimePicker( - context: context, - initialTime: TimeOfDay - .fromDateTime( - getCurrentTimestamp), - builder: - (context, child) { - return wrapInMaterialTimePickerTheme( - context, - child!, - headerBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - headerForegroundColor: - FlutterFlowTheme.of( - context) - .info, - headerTextStyle: - FlutterFlowTheme.of( - context) - .headlineLarge - .override( - fontFamily: - FlutterFlowTheme.of(context) - .headlineLargeFamily, - fontSize: - 32.0, - letterSpacing: - 0.0, - fontWeight: - FontWeight - .w600, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of(context).headlineLargeFamily), - ), - pickerBackgroundColor: - FlutterFlowTheme.of( - context) - .secondaryBackground, - pickerForegroundColor: - FlutterFlowTheme.of( - context) - .info, - selectedDateTimeBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - pickerDialForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - selectedDateTimeForegroundColor: - FlutterFlowTheme.of( - context) - .info, - actionButtonForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - iconSize: 24.0, - ); - }, - ); - } - - if (datePickedDate != null && - datePickedTime != null) { - safeSetState(() { - _model.datePicked = - DateTime( - datePickedDate.year, - datePickedDate.month, - datePickedDate.day, - datePickedTime!.hour, - datePickedTime.minute, - ); - }); - } - setState(() { - _model - .dateTimeTextController - ?.text = dateTimeFormat( - "dd/MM/yyyy HH:mm:ss", - _model.datePicked, - locale: - FFLocalizations.of( - context) - .languageCode, - ); - _model.dateTimeTextController - ?.selection = - TextSelection.collapsed( - offset: _model - .dateTimeTextController! - .text - .length); - }); - }, - child: Container( - width: double.infinity, - height: 50.0, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular( - 8.0), - ), - alignment: - const AlignmentDirectional( - 0.0, 0.0), - ), - ), - ), - ], - ), - ), - ], - ), - Padding( - padding: - const EdgeInsetsDirectional.fromSTEB( - 0.0, 10.0, 0.0, 10.0), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: const AlignmentDirectional( - 0.0, 0.0), - child: Container( - decoration: const BoxDecoration(), - alignment: - const AlignmentDirectional( - 0.0, 0.0), - child: Align( - alignment: - const AlignmentDirectional( - 0.0, 0.0), - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: SizedBox( - width: double.infinity, - child: TextFormField( - controller: _model - .notesTextController, - focusNode: - _model.notesFocusNode, - autofocus: false, - textInputAction: - TextInputAction.next, - obscureText: false, - decoration: InputDecoration( - isDense: false, - labelText: - FFLocalizations.of( - context) - .getText( - 'cw8b3tbb' /* Observação da Visita */, - ), - labelStyle: - 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), - ), - 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( - borderSide: BorderSide( - color: FlutterFlowTheme - .of(context) - .customColor5, - width: 0.5, - ), - borderRadius: - BorderRadius - .circular(10.0), - ), - focusedBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme - .of(context) - .primary, - width: 0.5, - ), - borderRadius: - BorderRadius - .circular(10.0), - ), - errorBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme - .of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius - .circular(10.0), - ), - focusedErrorBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme - .of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius - .circular(10.0), - ), - suffixIcon: Icon( - Icons.text_fields, - color: - FlutterFlowTheme.of( - context) - .accent1, - ), - ), - 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), - ), - textAlign: TextAlign.start, - maxLines: 3, - maxLength: 100, - maxLengthEnforcement: - MaxLengthEnforcement - .enforced, - validator: _model - .notesTextControllerValidator - .asValidator(context), - ), - ), - ), - ), - ), - ), - ], - ), - ), - ], - ), - ), - ), - FFButtonWidget( - onPressed: !_isFormValid() - ? null - : () async { - try { - _model.provVisitSchedule = await PhpGroup - .postProvVisitSchedulingCall - .call( - devUUID: AppState().devUUID, - userUUID: AppState().userUUID, - cliID: AppState().cliUUID, - atividade: 'putAgendamentoProv', - data: - _model.dateTimeTextController.text, - motivo: _model.notesTextController.text, - nome: _model - .personNameTextController.text, - proID: AppState().ownerUUID, - ); - - if (PhpGroup.postProvVisitSchedulingCall - .error((_model.provVisitSchedule - ?.jsonBody ?? - '')) == - false) { - DialogUtil.success( - context, - FFLocalizations.of(context).getVariableText( - ptText: - "Agendamento Provisório Realizado com Sucesso!", - enText: - "Provisional Scheduling Successfully Completed")); - setState(() { - _model.dateTimeTextController - ?.clear(); - _model.personNameTextController - ?.clear(); - _model.notesTextController?.clear(); - }); - } else { - var message = PhpGroup - .postProvVisitSchedulingCall - .msg((_model.provVisitSchedule - ?.jsonBody ?? - '')); - if (message != null) { - DialogUtil.error(context, message); - } else { - DialogUtil.errorDefault(context); - } - } - - setState(() {}); - } catch (e, s) { - DialogUtil.errorDefault(context); - LogUtil.requestAPIFailed( - "processRequest.php", - "", - "Cadastrar Visita Provisória", - e, - s); - } - }, - showLoadingIndicator: true, - text: FFLocalizations.of(context) - .getText('bv5fg9sv' /* Enviar */), - options: FFButtonOptions( - width: 150.0, - height: 50.0, - padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 24.0, 0.0), - iconPadding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 0.0), - color: FlutterFlowTheme.of(context).primary, - textStyle: FlutterFlowTheme.of(context) - .titleSmall - .override( - fontFamily: FlutterFlowTheme.of(context) - .titleSmallFamily, - color: Colors.white, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .titleSmallFamily), - ), - elevation: 3.0, - borderSide: const BorderSide( - color: Colors.transparent, - width: 1.0, - ), - borderRadius: BorderRadius.circular(8.0), - disabledColor: - FlutterFlowTheme.of(context).customColor5, - disabledTextColor: Colors.white, - ), - ), - ], - ), - ), - ), - ], - ), - ] - .addToStart(const SizedBox(height: 4.0)) - .addToEnd(const SizedBox(height: 40.0)), - ), - ), - ), - ); - } -} diff --git a/lib/shared/extensions/dialog_extensions.dart b/lib/shared/extensions/dialog_extensions.dart new file mode 100644 index 00000000..a2a571f0 --- /dev/null +++ b/lib/shared/extensions/dialog_extensions.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; +import 'package:hub/flutter_flow/internationalization.dart'; +import 'package:hub/shared/utils/dialog_util.dart'; + +export 'dialog_extensions.dart' show DialogUnavailable; + +extension DialogUnavailable on DialogUtil { + static Future unavailableFeature(BuildContext context) { + final message = FFLocalizations.of(context).getVariableText( + ptText: + "Essa funcionalidade não está disponível para este local. Por favor, selecione outro local ou entre em contato com os responsáveis para alterar o plano de contrato para sua localidade.", + enText: + "This functionality is not available for this location. Please select another location or contact the responsible parties to change the contract plan for your location."); + return DialogUtil.warning(context, message); + } +} diff --git a/lib/shared/utils/log_util.dart b/lib/shared/utils/log_util.dart index bcbb66cf..11aa8b27 100644 --- a/lib/shared/utils/log_util.dart +++ b/lib/shared/utils/log_util.dart @@ -1,14 +1,22 @@ +import 'dart:developer'; + import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; class LogUtil { - static void requestAPIFailed(String url, String body, String reason, - dynamic error, StackTrace stack) async { - FirebaseCrashlytics.instance - .setCustomKey('URL', "${PhpGroup.getBaseUrl()}/$url"); - FirebaseCrashlytics.instance.setCustomKey('Body', body); + static void requestAPIFailed(String url, String body, String reason, dynamic error, StackTrace stack) async { - await FirebaseCrashlytics.instance - .recordError(error, stack, reason: reason); + log("URL: ${PhpGroup.getBaseUrl()}/$url"); + log("Body: $body"); + log("Motivo: $reason"); + log("Error: ${error.toString()}"); + log("Stack: ${stack.toString()}"); + + // FirebaseCrashlytics.instance + // .setCustomKey('URL', "${PhpGroup.getBaseUrl()}/$url"); + // FirebaseCrashlytics.instance.setCustomKey('Body', body); + // + // await FirebaseCrashlytics.instance + // .recordError(error, stack, reason: reason); } } diff --git a/lib/shared/widgets/drawer_widget/drawer_widget.dart b/lib/shared/widgets/drawer_widget/drawer_widget.dart new file mode 100644 index 00000000..839e5c65 --- /dev/null +++ b/lib/shared/widgets/drawer_widget/drawer_widget.dart @@ -0,0 +1,178 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:hub/backend/schema/enums/enums.dart'; +import 'package:hub/components/organism_components/menu_component/menu_component_widget.dart'; +import 'package:hub/flutter_flow/custom_functions.dart'; +import 'package:hub/flutter_flow/flutter_flow_theme.dart'; +import 'package:hub/flutter_flow/flutter_flow_util.dart'; +import 'package:hub/pages/home_page/home_page_model.dart'; + +class CustomDrawer extends StatelessWidget { + const CustomDrawer({super.key, required this.model}); + final HomePageModel model; + + @override + Widget build(BuildContext context) { + return SafeArea( + child: SizedBox( + width: MediaQuery.of(context).size.width * 0.8, + child: Drawer( + elevation: 16.0, + child: Container( + color: FlutterFlowTheme.of(context).primaryBackground, + child: Column( + children: [ + _buildDrawerHeader(context), + // _buildSearchBar(context), + _buildDrawerBody(), + ].addToStart(const SizedBox(height: 20)), + ), + ), + ), + ), + ); + } + + Container _buildDrawerHeader(BuildContext context) { + return Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(5.0), + bottomRight: Radius.circular(5.0), + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + Flexible( + fit: FlexFit.loose, + flex: 1, + child: Container( + width: 50.0, + height: 50.0, + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + shape: BoxShape.circle, + ), + child: CachedNetworkImage( + imageUrl: valueOrDefault( + 'assets/images/person.jpg', + 'https://freaccess.com.br/freaccess/Images/Clients/${AppState().cliUUID}.png', + ), + width: 80.0, + height: 80.0, + fit: BoxFit.cover, + alignment: Alignment.center, + placeholder: (context, url) => + Image.asset('assets/images/person.jpg'), + errorListener: (_) => Image.asset('assets/images/person.jpg'), + errorWidget: (_, __, ___) => + Image.asset('assets/images/person.jpg'), + ), + ), + ), + SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + convertToUppercase(AppState().name) ?? '', + style: FlutterFlowTheme.of(context).bodyLarge.override( + fontFamily: 'Nunito Sans', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.normal, + ), + ), + SizedBox(height: 5), + Text( + AppState().email, + style: FlutterFlowTheme.of(context).bodySmall.override( + fontFamily: 'Nunito Sans', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 12.0, + letterSpacing: 0.0, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + ], + ), + ); + } + + Padding _buildSearchBar(BuildContext context) { + final theme = FlutterFlowTheme.of(context); + final errorColor = theme.error; + final primaryColor = theme.primary; + final customColor1 = theme.primaryText; + + return Padding( + padding: const EdgeInsets.symmetric(vertical: 10.0), + child: TextFormField( + controller: model.textController, + focusNode: model.textFieldFocusNode, + autofocus: false, + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelText: 'Search', + labelStyle: TextStyle(color: customColor1), + prefixIcon: const Icon(Icons.search_sharp), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: customColor1, + width: 0.5, + ), + borderRadius: BorderRadius.circular(2.0), + ), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: primaryColor, + width: 0.5, + ), + borderRadius: BorderRadius.circular(2.0), + ), + errorBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: errorColor, + width: 0.5, + ), + borderRadius: BorderRadius.circular(2.0), + ), + focusedErrorBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: errorColor, + width: 0.5, + ), + borderRadius: BorderRadius.circular(2.0), + ), + ), + style: theme.bodyMedium.override( + fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + letterSpacing: 0.0, + ), + validator: model.textControllerValidator.asValidator(context), + ), + ); + } + + Expanded _buildDrawerBody() { + return Expanded( + child: wrapWithModel( + model: model.menuComponentModel, + updateCallback: () {}, + child: const MenuComponentWidget( + expandable: false, + style: MenuView.list, + item: MenuItem.tile, + ), + ), + ); + } +}