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 315555bb..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 @@ -61,7 +61,7 @@ class _MenuButtonWidgetState extends State { child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ if (widget.icon != null) Container( @@ -74,20 +74,23 @@ class _MenuButtonWidgetState extends State { ), ), Flexible( - 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'), - ), + 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'), + ), + ), ), ), ], 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 8830bbf1..07a08f29 100644 --- a/lib/components/organism_components/menu_component/menu_component_model.dart +++ b/lib/components/organism_components/menu_component/menu_component_model.dart @@ -54,11 +54,29 @@ class MenuComponentModel extends FlutterFlowModel { ); } - Future scheduleProvisionalVisitAction(BuildContext context) async { + Future deliverySchedule(BuildContext context) async { final isProvisional = AppState().provisional; if (isProvisional) { context.pushNamed( - 'scheduleProvisionalVisitPage', + '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) { + context.pushNamed( + 'provisionalSchedule', extra: { kTransitionInfoKey: const TransitionInfo( hasTransition: true, 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 2d40ab8b..83b2d255 100644 --- a/lib/components/organism_components/menu_component/menu_component_widget.dart +++ b/lib/components/organism_components/menu_component/menu_component_widget.dart @@ -127,14 +127,25 @@ class _MenuComponentWidgetState extends State { else return [ MenuButtonWidget( - icon: Icons.pending_actions, + icon: Icons.engineering_outlined, action: () async { - await _model.scheduleProvisionalVisitAction(context); + await _model.provisionalSchedule(context); setState(() {}); }, title: FFLocalizations.of(context).getVariableText( enText: 'Provisional\nSchedule', - ptText: 'Agenda\nProvisória', + ptText: 'Agendar\nPrestadores', + ), + ), + 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( @@ -145,7 +156,7 @@ class _MenuComponentWidgetState extends State { }, title: FFLocalizations.of(context).getVariableText( enText: 'Fast\nVisit', - ptText: 'Agendar\nVisita', + ptText: 'Agenda\nRápida', ), ), MenuButtonWidget( @@ -166,8 +177,8 @@ class _MenuComponentWidgetState extends State { setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - enText: 'Order\nPickup', - ptText: 'Fazer\nEncomenda', + ptText: 'Minhas\nEncomendas', + enText: 'My\nOrders', ), ), MenuButtonWidget( @@ -177,8 +188,8 @@ class _MenuComponentWidgetState extends State { setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - ptText: 'Fazer\nReservas', - enText: 'Make\nReservations', + ptText: 'Reserva\nde Itens', + enText: 'Item\nReservation', ), ), MenuButtonWidget( @@ -215,14 +226,14 @@ class _MenuComponentWidgetState extends State { ), ), MenuButtonWidget( - icon: Icons.group_add_outlined, + icon: Icons.how_to_reg_outlined, action: () async { await _model.liberationHistoryAction(context); setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - enText: 'Liberation\nHistory', - ptText: 'Consultar\nLiberation', + enText: 'Liberations\nHistory', + ptText: 'Consultar\nLiberações', ), ), MenuButtonWidget( @@ -233,7 +244,7 @@ class _MenuComponentWidgetState extends State { }, title: FFLocalizations.of(context).getVariableText( enText: 'Access\nHistory', - ptText: 'Consultar\nAccessos', + ptText: 'Consultar\nAcessos', ), ), MenuButtonWidget( @@ -366,14 +377,25 @@ class _MenuComponentWidgetState extends State { // if (MenuItem.tile) return [ MenuCardItem( - icon: Icons.pending_actions, + icon: Icons.engineering_outlined, action: () async { - await _model.scheduleProvisionalVisitAction(context); + await _model.provisionalSchedule(context); setState(() {}); }, title: FFLocalizations.of(context).getVariableText( enText: 'Provisional Schedule', - ptText: 'Agenda Provisória', + 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( @@ -384,7 +406,7 @@ class _MenuComponentWidgetState extends State { }, title: FFLocalizations.of(context).getVariableText( enText: 'Fast Visit', - ptText: 'Agendar Visita', + ptText: 'Agenda Rápida', ), ), MenuCardItem( @@ -405,8 +427,8 @@ class _MenuComponentWidgetState extends State { setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - enText: 'Order Pickup', - ptText: 'Fazer Encomenda', + ptText: 'Minhas Encomendas', + enText: 'My Orders', ), ), MenuCardItem( @@ -416,8 +438,8 @@ class _MenuComponentWidgetState extends State { setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - ptText: 'Fazer Reservas', - enText: 'Make Reservations', + ptText: 'Reserva de Itens', + enText: 'Item Reservation', ), ), MenuCardItem( @@ -460,8 +482,8 @@ class _MenuComponentWidgetState extends State { setState(() {}); }, title: FFLocalizations.of(context).getVariableText( - enText: 'Liberation History', - ptText: 'Consultar Liberation', + enText: 'Liberations History', + ptText: 'Consultar Liberações', ), ), MenuCardItem( @@ -472,7 +494,7 @@ class _MenuComponentWidgetState extends State { }, title: FFLocalizations.of(context).getVariableText( enText: 'Access History', - ptText: 'Consultar Accessos', + ptText: 'Consultar Acessos', ), ), MenuCardItem( 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/flutter_flow/nav/nav.dart b/lib/flutter_flow/nav/nav.dart index 4b5ad183..88b5081a 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'; @@ -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/pages/delivery_schedule_page/delivery_schedule_widget.dart b/lib/pages/delivery_schedule_page/delivery_schedule_widget.dart new file mode 100644 index 00000000..11ee897d --- /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: 16.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/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_widget.dart b/lib/pages/preferences_settings_page/preferences_settings_widget.dart index 180c1cc2..221e2688 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_widget.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_widget.dart @@ -47,8 +47,9 @@ class PreferencesPageWidget extends StatelessWidget { ), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', + fontWeight: FontWeight.bold, 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)), - ), - ), - ), - ); - } -}