Merge pull request #52 from FRE-Informatica/feature/fd-466
FEAT/FD-466: Sobre a Propriedade (APP)
This commit is contained in:
commit
369d1ccb47
|
@ -28,8 +28,10 @@ linter:
|
|||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
|
||||
|
||||
analyzer:
|
||||
errors:
|
||||
curly_braces_in_flow_control_structures: ignore
|
||||
use_build_context_synchronously: ignore
|
||||
exclude:
|
||||
- lib/custom_code/**
|
||||
- lib/flutter_flow/custom_functions.dart
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:hub/backend/notifications/firebase_messaging_service.dart';
|
||||
import 'package:hub/shared/helpers/base_storage.dart';
|
||||
import 'package:hub/shared/helpers/storage_helper.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';
|
||||
|
||||
|
@ -56,6 +55,103 @@ class PhpGroup {
|
|||
static GetPets getPets = GetPets();
|
||||
static GetPetPhoto getPetPhoto = GetPetPhoto();
|
||||
static UnregisterDevice unregisterDevice = UnregisterDevice();
|
||||
static GetVehiclesByProperty getVehiclesByProperty = GetVehiclesByProperty();
|
||||
static GetResidentsByProperty getResidentsByProperty = GetResidentsByProperty();
|
||||
static GetOpenedVisits getOpenedVisits = GetOpenedVisits();
|
||||
}
|
||||
|
||||
class GetOpenedVisits {
|
||||
Future<ApiCallResponse> call(final String page) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID = (await StorageHelper().get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
const String atividade = 'getOpenedVisits';
|
||||
const String pageSize = '10';
|
||||
return ApiManager.instance.makeApiCall(
|
||||
callName: 'getOpenedVisits',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||
params: {
|
||||
'devUUID': devUUID,
|
||||
'userUUID': userUUID,
|
||||
'cliID': cliID,
|
||||
'atividade': atividade,
|
||||
'page': page,
|
||||
'pageSize': pageSize,
|
||||
},
|
||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||
returnBody: true,
|
||||
encodeBodyUtf8: false,
|
||||
decodeUtf8: false,
|
||||
cache: false,
|
||||
isStreamingApi: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GetResidentsByProperty {
|
||||
Future<ApiCallResponse> call(final String page) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID = (await StorageHelper().get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
const String atividade = 'getResidentsByProperty';
|
||||
const String pageSize = '10';
|
||||
return ApiManager.instance.makeApiCall(
|
||||
callName: 'getResidentsByProperty',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||
params: {
|
||||
'devUUID': devUUID,
|
||||
'userUUID': userUUID,
|
||||
'cliID': cliID,
|
||||
'atividade': atividade,
|
||||
'page': page,
|
||||
'pageSize': pageSize,
|
||||
},
|
||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||
returnBody: true,
|
||||
encodeBodyUtf8: false,
|
||||
decodeUtf8: false,
|
||||
cache: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GetVehiclesByProperty {
|
||||
Future<ApiCallResponse> call(final String page) async {
|
||||
final String baseUrl = PhpGroup.getBaseUrl();
|
||||
final String devUUID = (await StorageHelper().get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
final String userUUID = (await StorageHelper().get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
final String cliID = (await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
const String atividade = 'getVehiclesByProperty';
|
||||
const String pageSize = '10';
|
||||
return ApiManager.instance.makeApiCall(
|
||||
callName: 'getVehiclesByProperty',
|
||||
apiUrl: '$baseUrl/processRequest.php',
|
||||
callType: ApiCallType.POST,
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||
params: {
|
||||
'devUUID': devUUID,
|
||||
'userUUID': userUUID,
|
||||
'cliID': cliID,
|
||||
'atividade': atividade,
|
||||
'page': page,
|
||||
'pageSize': pageSize,
|
||||
},
|
||||
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||
returnBody: true,
|
||||
encodeBodyUtf8: false,
|
||||
decodeUtf8: false,
|
||||
cache: false,
|
||||
alwaysAllowBody: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UnregisterDevice {
|
||||
|
@ -625,7 +721,7 @@ class LoginCall {
|
|||
late final String token;
|
||||
try {
|
||||
token = await FirebaseMessagingService.getToken();
|
||||
if (token == null || token.isEmpty) throw Exception('Token is empty');
|
||||
if (token == 'null' || token.isEmpty) throw Exception('Token is empty');
|
||||
} catch (e, s) {
|
||||
token = '';
|
||||
log('Error getting token', error: e, stackTrace: s);
|
||||
|
|
|
@ -3,15 +3,13 @@ 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 '../../../shared/extensions/dialog_extensions.dart';
|
||||
import '../../../shared/services/localization/localization_service.dart';
|
||||
|
||||
class MenuButtonWidget extends MenuEntry {
|
||||
const MenuButtonWidget({
|
||||
super.key,
|
||||
required this.action,
|
||||
required this.title,
|
||||
required this.icon,
|
||||
required super.safeSetState,
|
||||
}) : super(action: action, title: title, icon: icon);
|
||||
|
||||
@override
|
||||
|
|
|
@ -3,15 +3,13 @@ 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 '../../../shared/extensions/dialog_extensions.dart';
|
||||
import '../../../shared/services/localization/localization_service.dart';
|
||||
|
||||
class MenuCardItem extends MenuEntry {
|
||||
const MenuCardItem({
|
||||
super.key,
|
||||
required this.action,
|
||||
required this.title,
|
||||
required this.icon,
|
||||
required super.safeSetState,
|
||||
}) : super(action: action, title: title, icon: icon);
|
||||
|
||||
@override
|
||||
|
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:google_fonts/google_fonts.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/upload_data.dart';
|
||||
import 'package:hub/shared/utils/limited_text_size.dart';
|
||||
|
||||
|
|
|
@ -1,14 +1,38 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
enum MenuOption {
|
||||
CompleteSchedule,
|
||||
DeliverySchedule,
|
||||
WorkersOnTheProperty,
|
||||
FastPassSchedule,
|
||||
QRCodeAccessInProperty,
|
||||
AccessOnTheProperty,
|
||||
LiberationsOnTheProperty,
|
||||
MessagesOnTheProperty,
|
||||
ReservationsOnTheLocal,
|
||||
PackagesOnTheProperty,
|
||||
VehiclesOnTheProperty,
|
||||
PetsOnTheProperty,
|
||||
PetsRegister,
|
||||
VisitorsRegister,
|
||||
VisitsOnTheProperty,
|
||||
ResidentsOnTheProperty,
|
||||
SettingsOnTheApp,
|
||||
AboutProperty,
|
||||
LogoutOnTheApp,
|
||||
}
|
||||
|
||||
abstract class MenuEntry extends StatefulWidget {
|
||||
const MenuEntry({
|
||||
super.key,
|
||||
required this.action,
|
||||
required this.title,
|
||||
required this.icon,
|
||||
required this.safeSetState,
|
||||
});
|
||||
|
||||
final Function() action;
|
||||
final String title;
|
||||
final IconData icon;
|
||||
final VoidCallback safeSetState;
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ class LocalProfileComponentModel extends FlutterFlowModel<LocalProfileComponentW
|
|||
}
|
||||
|
||||
Future<void> getData() async {
|
||||
cliName = (await StorageHelper().get(SQLiteStorageKey.clientName.value, Storage.SQLiteStorage)) ?? '';
|
||||
cliUUID = (await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
cliName = await StorageHelper().get(SQLiteStorageKey.clientName.value, Storage.SQLiteStorage) ?? '';
|
||||
cliUUID = await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage) ?? '';
|
||||
setStateCallback?.call();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,14 +27,14 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
|
|||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
callback();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => LocalProfileComponentModel());
|
||||
_model.setOnUpdate(onUpdate: () => setState(() {}));
|
||||
_model.setOnUpdate(onUpdate: () => safeSetState(() {}));
|
||||
_model.setStateCallback = () => safeSetState(() {});
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
|
@ -54,11 +54,10 @@ class _LocalProfileComponentWidgetState extends State<LocalProfileComponentWidge
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
void onUpdate() {
|
||||
void onUpdate() async {
|
||||
log('() => onUpdate()');
|
||||
safeSetState(() {
|
||||
_model.getData();
|
||||
});
|
||||
await _model.getData();
|
||||
safeSetState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -1,21 +1,37 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/backend/schema/enums/enums.dart';
|
||||
import 'package:hub/components/atomic_components/menu_button_item/menu_button_item_widget.dart';
|
||||
import 'package:hub/components/atomic_components/menu_card_item/menu_card_item.dart';
|
||||
import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
|
||||
import 'package:hub/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart';
|
||||
import 'package:hub/components/organism_components/menu_component/menu_component_widget.dart';
|
||||
import 'package:hub/components/organism_components/menu_list_view_component/menu_list_view_component_model.dart';
|
||||
import 'package:hub/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_model.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||
import 'package:hub/shared/extensions/dialog_extensions.dart';
|
||||
import 'package:hub/shared/helpers/base_storage.dart';
|
||||
import 'package:hub/shared/helpers/storage_helper.dart';
|
||||
import 'package:hub/shared/services/authentication/authentication_service.dart';
|
||||
import 'package:material_symbols_icons/symbols.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';
|
||||
import '/flutter_flow/flutter_flow_util.dart';
|
||||
import 'menu_component_widget.dart' show MenuComponentWidget;
|
||||
|
||||
class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||
final MenuView style;
|
||||
final MenuItem item;
|
||||
final bool expandable;
|
||||
final List<MenuOption> menuOptions;
|
||||
|
||||
MenuComponentModel({required this.style, required this.item, required this.expandable, required this.menuOptions});
|
||||
|
||||
bool isGrid = false;
|
||||
|
||||
late MenuListViewComponentModel menuListViewComponentModel;
|
||||
late MenuStaggeredViewComponentModel menuStaggeredViewComponentModel;
|
||||
late VoidCallback safeSetState;
|
||||
late List<MenuEntry?> menuEntries;
|
||||
|
||||
@override
|
||||
void initState(BuildContext context) {
|
||||
|
@ -29,13 +45,160 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
|||
menuStaggeredViewComponentModel.dispose();
|
||||
}
|
||||
|
||||
Future changeMenuStyle(BuildContext context) async {
|
||||
isGrid = !isGrid;
|
||||
List<MenuEntry?> generateMenuEntries(BuildContext context, MenuItem item, List<MenuOption> options) {
|
||||
List<MenuEntry?> entries = [];
|
||||
MenuEntry? addMenuEntry(IconData icon, String enText, String ptText, Function() action) {
|
||||
entries.add(
|
||||
item == MenuItem.button
|
||||
? MenuButtonWidget(
|
||||
icon: icon,
|
||||
action: action,
|
||||
title: FFLocalizations.of(context).getVariableText(enText: enText, ptText: ptText),
|
||||
safeSetState: safeSetState)
|
||||
: item == MenuItem.card
|
||||
? MenuCardItem(
|
||||
icon: icon,
|
||||
action: action,
|
||||
title: FFLocalizations.of(context).getVariableText(enText: enText, ptText: ptText),
|
||||
safeSetState: safeSetState)
|
||||
: item == MenuItem.tile
|
||||
? MenuCardItem(
|
||||
icon: icon,
|
||||
action: action,
|
||||
title: FFLocalizations.of(context).getVariableText(enText: enText, ptText: ptText),
|
||||
safeSetState: safeSetState)
|
||||
: null,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
Future openQRCodeScanner(BuildContext context) async {
|
||||
if (options.contains(MenuOption.WorkersOnTheProperty))
|
||||
addMenuEntry(Icons.engineering_outlined, 'Schedule Providers', 'Agendar Prestadores', () async {
|
||||
if (await StorageHelper().get(SQLiteStorageKey.provisional.value, Storage.SQLiteStorage) == 'true')
|
||||
await open(context, '/provisionalSchedule');
|
||||
else
|
||||
DialogUnavailable.unavailableFeature(context);
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.DeliverySchedule))
|
||||
addMenuEntry(Icons.sports_motorsports_outlined, 'Schedule Deliveries', 'Agendar Entregas', () async {
|
||||
if (await StorageHelper().get(SQLiteStorageKey.provisional.value, Storage.SQLiteStorage) == 'true')
|
||||
await open(context, '/deliverySchedule');
|
||||
else
|
||||
DialogUnavailable.unavailableFeature(context);
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.FastPassSchedule))
|
||||
addMenuEntry(Icons.attach_email_outlined, 'Invite Visitor', 'Convidar Visitante', () async {
|
||||
if (await StorageHelper().get(SQLiteStorageKey.whatsapp.value, Storage.SQLiteStorage) == 'true')
|
||||
await open(context, '/fastPassPage');
|
||||
else
|
||||
DialogUnavailable.unavailableFeature(context);
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.CompleteSchedule))
|
||||
addMenuEntry(Icons.event, 'Complete Schedule', 'Agenda Completa', () async {
|
||||
await open(context, '/scheduleCompleteVisitPage');
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.PackagesOnTheProperty))
|
||||
addMenuEntry(Icons.inventory_2_outlined, 'Orders', 'Encomendas', () async {
|
||||
if (await StorageHelper().get(SQLiteStorageKey.whatsapp.value, Storage.SQLiteStorage) == 'true')
|
||||
await open(context, '/packageOrder');
|
||||
else
|
||||
DialogUnavailable.unavailableFeature(context);
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.ReservationsOnTheLocal))
|
||||
addMenuEntry(Icons.event_available, 'Reservations', 'Reservas', () async {
|
||||
if (await StorageHelper().get(SQLiteStorageKey.whatsapp.value, Storage.SQLiteStorage) == 'true')
|
||||
await open(context, '/reservation');
|
||||
else
|
||||
DialogUnavailable.unavailableFeature(context);
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.VisitorsRegister))
|
||||
addMenuEntry(Icons.person_add_alt_1_outlined, 'Register Visitor', 'Cadastrar Visitante', () async {
|
||||
await open(context, '/registerVisitorPage');
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.QRCodeAccessInProperty))
|
||||
addMenuEntry(Icons.qr_code, 'QRCode Access', 'QRCode de Acesso', () async {
|
||||
await open(context, '/qrCodePage');
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.PetsOnTheProperty))
|
||||
addMenuEntry(Icons.pets, 'Pets', 'Pets', () async {
|
||||
if (await StorageHelper().get(SQLiteStorageKey.pets.value, Storage.SQLiteStorage) == 'true')
|
||||
await open(context, '/petsOnThePropertyPage');
|
||||
else
|
||||
DialogUnavailable.unavailableFeature(context);
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.PetsRegister))
|
||||
addMenuEntry(Icons.pets, 'Pets Register', 'Cadastrar Pet', () async {
|
||||
if (await StorageHelper().get(SQLiteStorageKey.pets.value, Storage.SQLiteStorage) == 'true')
|
||||
await open(context, '/petsPage');
|
||||
else
|
||||
DialogUnavailable.unavailableFeature(context);
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.AccessOnTheProperty))
|
||||
addMenuEntry(Icons.transfer_within_a_station_outlined, 'Access History', 'Consultar Acessos', () async {
|
||||
await open(context, '/acessHistoryPage');
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.ResidentsOnTheProperty))
|
||||
addMenuEntry(Icons.groups, 'Residents', 'Moradores', () async {
|
||||
await open(context, '/peopleOnThePropertyPage');
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.LiberationsOnTheProperty))
|
||||
addMenuEntry(Icons.how_to_reg_outlined, 'Liberations History', 'Consultar Liberações', () async {
|
||||
await open(context, '/liberationHistory');
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.MessagesOnTheProperty))
|
||||
addMenuEntry(Icons.chat_outlined, 'Message History', 'Consultar Mensagens', () async {
|
||||
await open(context, '/messageHistoryPage');
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.VehiclesOnTheProperty))
|
||||
addMenuEntry(Symbols.directions_car, 'Vehicles', 'Veículos', () async {
|
||||
await open(context, '/vehiclesOnThePropertyPage');
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.VisitsOnTheProperty))
|
||||
addMenuEntry(Symbols.perm_contact_calendar, 'Opened Visits', 'Visitas em Aberto', () async {
|
||||
await open(context, '/visitsOnThePropertyPage');
|
||||
safeSetState;
|
||||
});
|
||||
|
||||
if (options.contains(MenuOption.AboutProperty))
|
||||
addMenuEntry(Icons.home, 'About Property', 'Sobre a Propriedade', () async {
|
||||
if (await StorageHelper().get(SQLiteStorageKey.whatsapp.value, Storage.SQLiteStorage) == 'true')
|
||||
await open(context, '/aboutProperty');
|
||||
else
|
||||
DialogUnavailable.unavailableFeature(context);
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.SettingsOnTheApp))
|
||||
addMenuEntry(Icons.settings, 'System Settings', 'Opções do Sistema', () async {
|
||||
await open(context, '/preferencesSettings');
|
||||
safeSetState;
|
||||
});
|
||||
if (options.contains(MenuOption.LogoutOnTheApp))
|
||||
addMenuEntry(Icons.logout, 'Logout', 'Sair', () async {
|
||||
await out(context);
|
||||
safeSetState;
|
||||
});
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
Future open(BuildContext context, String link) async {
|
||||
context.push(
|
||||
'/qrCodePage',
|
||||
link,
|
||||
extra: <String, dynamic>{
|
||||
kTransitionInfoKey: const TransitionInfo(
|
||||
hasTransition: false,
|
||||
|
@ -46,17 +209,16 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
|||
);
|
||||
}
|
||||
|
||||
Future openCompleteSchedule(BuildContext context) async {
|
||||
context.push(
|
||||
'/scheduleCompleteVisitPage',
|
||||
extra: <String, dynamic>{
|
||||
kTransitionInfoKey: const TransitionInfo(
|
||||
hasTransition: false,
|
||||
transitionType: PageTransitionType.scale,
|
||||
alignment: Alignment.bottomCenter,
|
||||
),
|
||||
},
|
||||
Future out(BuildContext context) async {
|
||||
final String title = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Sair',
|
||||
enText: 'Logout',
|
||||
);
|
||||
final String content = FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Tem certeza que deseja sair?',
|
||||
enText: 'Are you sure you want to logout?',
|
||||
);
|
||||
showAlertDialog(context, title, content, () async => await AuthenticationService.signOut(context));
|
||||
}
|
||||
|
||||
Future openDeliverySchedule(BuildContext context) async {
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/backend/schema/enums/enums.dart';
|
||||
import 'package:hub/components/atomic_components/menu_button_item/menu_button_item_widget.dart';
|
||||
import 'package:hub/components/atomic_components/menu_card_item/menu_card_item.dart';
|
||||
import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
|
||||
|
||||
import '/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart';
|
||||
import '/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_widget.dart';
|
||||
|
@ -12,612 +9,68 @@ import 'menu_component_model.dart';
|
|||
export 'menu_component_model.dart';
|
||||
|
||||
class MenuComponentWidget extends StatefulWidget {
|
||||
const MenuComponentWidget({
|
||||
Key? key,
|
||||
required this.style,
|
||||
required this.item,
|
||||
required this.expandable,
|
||||
});
|
||||
final MenuView style;
|
||||
final MenuItem item;
|
||||
final bool expandable;
|
||||
final MenuComponentModel model;
|
||||
const MenuComponentWidget({super.key, required this.model});
|
||||
|
||||
@override
|
||||
State<MenuComponentWidget> createState() => _MenuComponentWidgetState();
|
||||
}
|
||||
|
||||
class _MenuComponentWidgetState extends State<MenuComponentWidget> {
|
||||
late MenuComponentModel _model;
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
_model.onUpdate();
|
||||
widget.model.onUpdate();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => MenuComponentModel());
|
||||
widget.model.safeSetState = () => safeSetState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
widget.model.menuEntries = widget.model.generateMenuEntries(context, widget.model.item, widget.model.menuOptions);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.maybeDispose();
|
||||
|
||||
widget.model.maybeDispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// MenuButtonWidget(icon: FFIcons.kvector2, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Link\nCondominum' , ptText:'' ,),),
|
||||
// MenuButtonWidget(icon: FFIcons.kpets, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register\Pet' , ptText:'' ,),),
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final options = () {
|
||||
if (widget.item == MenuItem.button) {
|
||||
if (_model.isGrid == true)
|
||||
return <MenuEntry>[
|
||||
MenuButtonWidget(
|
||||
icon: FFIcons.kvector1,
|
||||
action: () async {
|
||||
await _model.showSchedules(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Schedule\nVisit',
|
||||
ptText: 'Agendar\nVisita',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: FFIcons.khome,
|
||||
action: () async {
|
||||
await _model.openVisitorsRegister(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Register\nVisitor',
|
||||
ptText: 'Cadastro\nde Visitante',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.qr_code,
|
||||
action: () async {
|
||||
await _model.openQRCodeScanner(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'QRCode\nAccess',
|
||||
ptText: 'QRCode\nde Acesso',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.pets,
|
||||
action: () async {
|
||||
await _model.openPetsRegister(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Pets\nRegister',
|
||||
ptText: 'Cadastro\nde Pet',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.people,
|
||||
action: () async {
|
||||
await _model.openPoepleOnTheProperty(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.showHistories(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Consult\nHistories',
|
||||
ptText: 'Consultar\nHistóricos',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.settings,
|
||||
action: () async {
|
||||
await _model.openPreferencesSettings(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Preferences\nSettings',
|
||||
ptText: 'Opções\ndo Sistema',
|
||||
),
|
||||
),
|
||||
];
|
||||
else
|
||||
return <MenuEntry>[
|
||||
MenuButtonWidget(
|
||||
icon: Icons.engineering_outlined,
|
||||
action: () async {
|
||||
await _model.openProvisionalSchedule(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Schedule\nProviders',
|
||||
ptText: 'Agendar\nPrestadores',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.sports_motorsports_outlined,
|
||||
action: () async {
|
||||
await _model.openDeliverySchedule(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Schedule\nDeliveries',
|
||||
ptText: 'Agendar\nEntregas',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.attach_email_outlined,
|
||||
action: () async {
|
||||
await _model.openFastPassSchedule(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Convidar\nVisitante',
|
||||
enText: 'Invite\nVisitor',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.event,
|
||||
action: () async {
|
||||
await _model.openCompleteSchedule(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Complete\nSchedule',
|
||||
ptText: 'Agenda\nCompleta',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.inventory_2_outlined,
|
||||
action: () async {
|
||||
await _model.openMyOrders(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Minhas\nEncomendas',
|
||||
enText: 'My\nOrders',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.event_available,
|
||||
action: () async {
|
||||
await _model.openReservations(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Reservas',
|
||||
enText: 'Reservations',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.person_add_alt_1_outlined,
|
||||
action: () async {
|
||||
await _model.openVisitorsRegister(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Register\nVisitor',
|
||||
ptText: 'Cadastrar\nVisitante',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.qr_code,
|
||||
action: () async {
|
||||
await _model.openQRCodeScanner(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'QRCode\nAccess',
|
||||
ptText: 'QRCode\nde Acesso',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.pets,
|
||||
action: () async {
|
||||
await _model.openPetsRegister(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Pets\nRegister',
|
||||
ptText: 'Cadastrar\nPet',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.transfer_within_a_station_outlined,
|
||||
action: () async {
|
||||
await _model.openAccessHistory(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Access\nHistory',
|
||||
ptText: 'Consultar\nAcessos',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.how_to_reg_outlined,
|
||||
action: () async {
|
||||
await _model.openLiberationsHistory(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Liberations\nHistory',
|
||||
ptText: 'Consultar\nLiberações',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.chat_outlined,
|
||||
action: () async {
|
||||
await _model.openMessagesHistory(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Message\nHistory',
|
||||
ptText: 'Consultar\nMensagens',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.groups,
|
||||
action: () async {
|
||||
await _model.openPoepleOnTheProperty(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'People on\nthe Property',
|
||||
ptText: 'Pessoas na\nPropriedade',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.settings,
|
||||
action: () async {
|
||||
await _model.openPreferencesSettings(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'System\n Settings',
|
||||
ptText: 'Opções\ndo Sistema',
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
if (widget.item == MenuItem.card) {
|
||||
return <MenuEntry>[
|
||||
MenuCardItem(
|
||||
icon: FFIcons.kvector1,
|
||||
action: () async {
|
||||
await _model.showSchedules(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Schedule\nVisit',
|
||||
ptText: 'Agendar\nVisita',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: FFIcons.khome,
|
||||
action: () async {
|
||||
await _model.openVisitorsRegister(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Register\nVisitor',
|
||||
ptText: 'Cadastro\nde Visitante',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.qr_code,
|
||||
action: () async {
|
||||
await _model.openQRCodeScanner(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'QRCode\nAccess',
|
||||
ptText: 'QRCode\nde Acesso',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.people,
|
||||
action: () async {
|
||||
await _model.openPoepleOnTheProperty(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'People on\nthe Property',
|
||||
ptText: 'Pessoas\nna Propriedade',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.history_sharp,
|
||||
action: () async {
|
||||
await _model.showHistories(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Consult\nHistories',
|
||||
ptText: 'Consultar\nHistoricos',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.inventory_2_rounded,
|
||||
action: () async {
|
||||
await _model.openMyOrders(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Orders',
|
||||
ptText: 'Encomendas',
|
||||
),
|
||||
),
|
||||
MenuButtonWidget(
|
||||
icon: Icons.pets,
|
||||
action: () async {
|
||||
await _model.openPetsRegister(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Pets\nRegister',
|
||||
ptText: 'Cadastrar\nPet',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.event_available,
|
||||
action: () async {
|
||||
await _model.openReservations(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Reservations',
|
||||
ptText: 'Reservas',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.settings,
|
||||
action: () async {
|
||||
await _model.openPreferencesSettings(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Preferences\nSettings',
|
||||
ptText: 'Preferências\nde Configuração',
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
// if (MenuItem.tile)
|
||||
return <MenuEntry>[
|
||||
MenuCardItem(
|
||||
icon: Icons.engineering_outlined,
|
||||
action: () async {
|
||||
await _model.openProvisionalSchedule(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Schedule Providers',
|
||||
ptText: 'Agendar Prestadores',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.sports_motorsports_outlined,
|
||||
action: () async {
|
||||
await _model.openDeliverySchedule(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Schedule Deliveries',
|
||||
ptText: 'Agendar Entregas',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.attach_email_outlined,
|
||||
action: () async {
|
||||
await _model.openFastPassSchedule(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Convidar Visitante',
|
||||
enText: 'Invite Visitor',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.event,
|
||||
action: () async {
|
||||
await _model.openCompleteSchedule(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Complete Schedule',
|
||||
ptText: 'Agenda Completa',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.inventory_2_outlined,
|
||||
action: () async {
|
||||
await _model.openMyOrders(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Minhas Encomendas',
|
||||
enText: 'My Orders',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.event_available,
|
||||
action: () async {
|
||||
await _model.openReservations(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Reservas',
|
||||
enText: 'Reservations',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.person_add_alt_1_outlined,
|
||||
action: () async {
|
||||
await _model.openVisitorsRegister(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Register Visitor',
|
||||
ptText: 'Cadastrar Visitante',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.qr_code,
|
||||
action: () async {
|
||||
await _model.openQRCodeScanner(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'QRCode Access',
|
||||
ptText: 'QRCode de Acesso',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.pets,
|
||||
action: () async {
|
||||
await _model.openPetsRegister(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Pets Register',
|
||||
ptText: 'Cadastro de Pet',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.transfer_within_a_station_outlined,
|
||||
action: () async {
|
||||
await _model.openAccessHistory(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Access History',
|
||||
ptText: 'Consultar Acessos',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.how_to_reg_outlined,
|
||||
action: () async {
|
||||
await _model.openLiberationsHistory(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Liberations History',
|
||||
ptText: 'Consultar Liberações',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.chat_outlined,
|
||||
action: () async {
|
||||
await _model.openMessagesHistory(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Message History',
|
||||
ptText: 'Consultar Mensagens',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.groups,
|
||||
action: () async {
|
||||
await _model.openPoepleOnTheProperty(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'People on the Property',
|
||||
ptText: 'Pessoas na Propriedade',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.settings,
|
||||
action: () async {
|
||||
await _model.openPreferencesSettings(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'System Settings',
|
||||
ptText: 'Opções do Sistema',
|
||||
),
|
||||
),
|
||||
MenuCardItem(
|
||||
icon: Icons.logout,
|
||||
action: () async {
|
||||
await _model.Logout(context);
|
||||
setState(() {});
|
||||
},
|
||||
title: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Logout Account',
|
||||
ptText: 'Sair da Conta',
|
||||
),
|
||||
),
|
||||
];
|
||||
}();
|
||||
|
||||
return Builder(
|
||||
builder: (context) {
|
||||
if (widget.style == MenuView.list_grid && widget.expandable == true && widget.item == MenuItem.button) {
|
||||
if (_model.isGrid == true) {
|
||||
if (widget.model.style == MenuView.list_grid)
|
||||
return wrapWithModel(
|
||||
model: _model.menuStaggeredViewComponentModel,
|
||||
model: widget.model.menuStaggeredViewComponentModel,
|
||||
updateCallback: () => setState(() {}),
|
||||
updateOnChange: true,
|
||||
child: MenuStaggeredViewComponentWidget(
|
||||
options: options,
|
||||
expandable: widget.expandable,
|
||||
item: widget.item,
|
||||
changeMenuStyle: () async {
|
||||
await _model.changeMenuStyle(context);
|
||||
setState(() {});
|
||||
},
|
||||
isGrid: _model.isGrid,
|
||||
options: widget.model.menuEntries,
|
||||
expandable: widget.model.expandable,
|
||||
item: widget.model.item,
|
||||
changeMenuStyle: () async {},
|
||||
isGrid: widget.model.isGrid,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
if (widget.model.style == MenuView.list)
|
||||
return wrapWithModel(
|
||||
model: _model.menuStaggeredViewComponentModel,
|
||||
updateCallback: () => setState(() {}),
|
||||
updateOnChange: true,
|
||||
child: MenuStaggeredViewComponentWidget(
|
||||
options: options,
|
||||
expandable: widget.expandable,
|
||||
item: widget.item,
|
||||
changeMenuStyle: () async {
|
||||
await _model.changeMenuStyle(context);
|
||||
setState(() {});
|
||||
},
|
||||
isGrid: _model.isGrid,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (widget.style == MenuView.list && widget.expandable == false && widget.item == MenuItem.tile) {
|
||||
return wrapWithModel(
|
||||
model: _model.menuListViewComponentModel,
|
||||
model: widget.model.menuListViewComponentModel,
|
||||
updateCallback: () => setState(() {}),
|
||||
updateOnChange: true,
|
||||
child: MenuListViewComponentWidget(
|
||||
options: options,
|
||||
expandable: widget.expandable,
|
||||
item: widget.item,
|
||||
changeMenuStyle: () async {
|
||||
await _model.changeMenuStyle(context);
|
||||
setState(() {});
|
||||
},
|
||||
options: widget.model.menuEntries,
|
||||
expandable: widget.model.expandable,
|
||||
item: widget.model.item,
|
||||
changeMenuStyle: () async {},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return const SizedBox();
|
||||
},
|
||||
);
|
||||
|
|
|
@ -23,7 +23,7 @@ class MenuListViewComponentWidget extends StatefulWidget {
|
|||
final bool expandable;
|
||||
final MenuItem item;
|
||||
|
||||
final List<MenuEntry> options;
|
||||
final List<MenuEntry?> options;
|
||||
final Future Function()? changeMenuStyle;
|
||||
|
||||
@override
|
||||
|
|
|
@ -19,7 +19,7 @@ class MenuStaggeredViewComponentWidget extends StatefulWidget {
|
|||
final MenuItem item;
|
||||
final bool isGrid;
|
||||
|
||||
final List<MenuEntry> options;
|
||||
final List<MenuEntry?> options;
|
||||
final Future Function()? changeMenuStyle;
|
||||
|
||||
@override
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:cached_network_image/cached_network_image.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/shared/utils/limited_text_size.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
import '/flutter_flow/flutter_flow_theme.dart';
|
||||
import '/flutter_flow/flutter_flow_util.dart';
|
||||
|
@ -175,14 +176,14 @@ class _CardItemTemplateComponentWidgetState extends State<CardItemTemplateCompon
|
|||
.addToStart(const SizedBox(height: 5)),
|
||||
),
|
||||
),
|
||||
_generateImage(),
|
||||
if (widget.imagePath != null) _generateImage(),
|
||||
].addToEnd(const SizedBox(width: 10)).addToStart(const SizedBox(width: 10)),
|
||||
);
|
||||
} else {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_generateImage(),
|
||||
if (widget.imagePath != null) _generateImage(),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
|
|
|
@ -13,7 +13,7 @@ class DetailsComponentWidget extends StatefulWidget {
|
|||
Key? key,
|
||||
required this.labelsHashMap,
|
||||
required this.statusHashMap,
|
||||
required this.imagePath,
|
||||
this.imagePath,
|
||||
this.onTapCardItemAction,
|
||||
required this.buttons,
|
||||
});
|
||||
|
@ -22,7 +22,7 @@ class DetailsComponentWidget extends StatefulWidget {
|
|||
final List<Map<String, Color>?> statusHashMap;
|
||||
final String? imagePath;
|
||||
final Future Function()? onTapCardItemAction;
|
||||
final List<Widget> buttons;
|
||||
final List<Widget>? buttons;
|
||||
|
||||
@override
|
||||
State<DetailsComponentWidget> createState() => _DetailsComponentWidgetState();
|
||||
|
@ -75,6 +75,7 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
|
|||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
if (widget.imagePath != null && widget.imagePath != '')
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.3,
|
||||
height: MediaQuery.of(context).size.width * 0.3,
|
||||
|
@ -85,7 +86,7 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
|
|||
child: CachedNetworkImage(
|
||||
fadeInDuration: const Duration(milliseconds: 100),
|
||||
fadeOutDuration: const Duration(milliseconds: 100),
|
||||
imageUrl: widget.imagePath ?? '',
|
||||
imageUrl: widget.imagePath!,
|
||||
fit: BoxFit.cover,
|
||||
useOldImageOnUrlChange: true,
|
||||
),
|
||||
|
@ -100,8 +101,6 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
|
|||
horizontal: MediaQuery.of(context).size.width * 0.05,
|
||||
),
|
||||
child: TextFormField(
|
||||
// controller: _model.textControllerStatus,
|
||||
// focusNode: _model.textFieldFocusNodeStatus,
|
||||
autofocus: false,
|
||||
canRequestFocus: false,
|
||||
readOnly: true,
|
||||
|
@ -153,7 +152,7 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
|
|||
),
|
||||
fontSize: limitedBodyFontSize,
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: null,
|
||||
keyboardType: TextInputType.name,
|
||||
validator: _model.textController1Validator.asValidator(context),
|
||||
|
@ -239,14 +238,14 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
|
|||
},
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
if (widget.buttons.isNotEmpty) // Adicione este SizedBox com a altura desejada
|
||||
if (widget.buttons!.isNotEmpty || widget.buttons != null)
|
||||
OverflowBar(
|
||||
overflowAlignment: OverflowBarAlignment.center,
|
||||
alignment: MainAxisAlignment.center,
|
||||
overflowSpacing: 2,
|
||||
spacing: 2,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: widget.buttons,
|
||||
children: widget.buttons!,
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
],
|
||||
|
|
|
@ -95,7 +95,9 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 0.0, 0.0),
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getText('8d3679lf'),
|
||||
FFLocalizations.of(context).getText(
|
||||
'8d3679lf' /* Propriedade */,
|
||||
),
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
letterSpacing: 0.0,
|
||||
|
@ -184,7 +186,9 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 10.0, 0.0, 10.0),
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getText('z6aawgqa'),
|
||||
FFLocalizations.of(context).getText(
|
||||
'z6aawgqa' /* Dados da Visita */,
|
||||
),
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
letterSpacing: 0.0,
|
||||
|
@ -210,14 +214,19 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
controller: model.personNameTextController,
|
||||
focusNode: model.personNameFocusNode,
|
||||
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||
onChanged: (_) => EasyDebounce.debounce('model.personNameTextController',
|
||||
const Duration(milliseconds: 500), () => setState(() {})),
|
||||
onChanged: (_) => EasyDebounce.debounce(
|
||||
'model.personNameTextController',
|
||||
const Duration(milliseconds: 500),
|
||||
() => setState(() {}),
|
||||
),
|
||||
autofocus: false,
|
||||
textInputAction: TextInputAction.next,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
labelText: FFLocalizations.of(context).getText('wehvxbz4'),
|
||||
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,
|
||||
|
@ -299,8 +308,11 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
controller: model.dateTimeTextController,
|
||||
focusNode: model.dateTimeFocusNode,
|
||||
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||
onChanged: (_) => EasyDebounce.debounce('model.dateTimeTextController',
|
||||
const Duration(milliseconds: 500), () => setState(() {})),
|
||||
onChanged: (_) => EasyDebounce.debounce(
|
||||
'model.dateTimeTextController',
|
||||
const Duration(milliseconds: 500),
|
||||
() => setState(() {}),
|
||||
),
|
||||
readOnly: true,
|
||||
autofocus: false,
|
||||
obscureText: false,
|
||||
|
@ -460,6 +472,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
model.datePicked,
|
||||
locale: FFLocalizations.of(context).languageCode,
|
||||
);
|
||||
|
||||
model.dateTimeTextController?.selection = TextSelection.collapsed(
|
||||
offset: model.dateTimeTextController!.text.length);
|
||||
});
|
||||
|
@ -608,8 +621,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Agendamento Provisório Realizado com Sucesso!",
|
||||
enText: "Provisional Scheduling Successfully Completed",
|
||||
));
|
||||
enText: "Provisional Scheduling Successfully Completed"));
|
||||
safeSetState(() {
|
||||
model.dateTimeTextController?.clear();
|
||||
model.personNameTextController?.clear();
|
||||
|
@ -632,7 +644,7 @@ class _ScheduleProvisionalVisitPageWidgetState extends State<ScheduleProvisional
|
|||
}
|
||||
},
|
||||
showLoadingIndicator: true,
|
||||
text: FFLocalizations.of(context).getText('bv5fg9sv'),
|
||||
text: FFLocalizations.of(context).getText('bv5fg9sv' /* Enviar */),
|
||||
options: FFButtonOptions(
|
||||
height: 30.0 * MediaQuery.textScalerOf(context).scale(1),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
||||
|
|
|
@ -3,26 +3,37 @@ import 'dart:developer';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/backend/schema/util/schema_util.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||
import 'package:hub/pages/about_property_page/about_property_screen.dart';
|
||||
import 'package:hub/pages/acess_history_page/acess_history_page_widget.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/forgot_password_page/forgot_password_screen.dart';
|
||||
import 'package:hub/pages/home_page/home_page_widget.dart';
|
||||
import 'package:hub/pages/liberation_history/liberation_history_widget.dart';
|
||||
import 'package:hub/pages/message_history_page/message_history_page_widget.dart';
|
||||
import 'package:hub/pages/package_order_page/package_order_page.dart';
|
||||
import 'package:hub/pages/people_on_the_property_page/people_on_the_property_page_widget.dart';
|
||||
import 'package:hub/pages/pets_on_the_property_page/pets_history_screen.dart';
|
||||
import 'package:hub/pages/pets_page/pets_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/qr_code_page/qr_code_page_widget.dart';
|
||||
import 'package:hub/pages/reception_page/reception_page_widget.dart';
|
||||
import 'package:hub/pages/register_visitor_page/register_visitor_page_widget.dart';
|
||||
import 'package:hub/pages/reservation_page/reservation_page_widget.dart';
|
||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart';
|
||||
import 'package:hub/pages/sign_in_page/sign_in_page_widget.dart';
|
||||
import 'package:hub/pages/sign_up_page/sign_up_page_widget.dart';
|
||||
import 'package:hub/pages/vehicles_on_the_property/vehicles_on_the_property.dart';
|
||||
import 'package:hub/pages/visits_on_the_property/visits_on_the_property_screen.dart';
|
||||
import 'package:hub/pages/welcome_page/welcome_page_widget.dart';
|
||||
import 'package:hub/shared/helpers/base_storage.dart';
|
||||
import 'package:hub/shared/helpers/storage_helper.dart';
|
||||
|
||||
import 'package:hub/shared/utils/dialog_util.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../shared/utils/dialog_util.dart';
|
||||
import '/backend/schema/structs/index.dart';
|
||||
import '/flutter_flow/flutter_flow_util.dart';
|
||||
import '/index.dart';
|
||||
|
||||
export 'package:go_router/go_router.dart';
|
||||
|
||||
export 'serialization_util.dart';
|
||||
|
@ -60,30 +71,11 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
},
|
||||
refreshListenable: appStateNotifier,
|
||||
// errorBuilder: (context, state) => appStateNotifier.showSplashImage
|
||||
// ? Builder(
|
||||
// builder: (context) => Container(
|
||||
// color: FlutterFlowTheme.of(context).primary,
|
||||
// child: Image.asset(
|
||||
// 'assets/images/logo.svg',
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ? Builder( builder: (context) => Container(color: FlutterFlowTheme.of(context).primary, child: Image.asset( 'assets/images/logo.svg', fit: BoxFit.cover)))
|
||||
// : const PeopleOnThePropertyPageWidget(),
|
||||
routes: [
|
||||
// FFRoute(
|
||||
// name: '_initialize',
|
||||
// path: '/',
|
||||
// builder: (context, _) => appStateNotifier.showSplashImage
|
||||
// ? Builder(
|
||||
// builder: (context) => Container(
|
||||
// color: FlutterFlowTheme.of(context).primary,
|
||||
// child: Image.asset(
|
||||
// 'assets/images/favicon.png',
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// FFRoute(name: '_initialize', path: '/',builder: (context, _) => appStateNotifier.showSplashImage
|
||||
// ? Builder(builder: (context) => Container(color: FlutterFlowTheme.of(context).primary, child: Image.asset('assets/images/favicon.png', fit: BoxFit.cover)))
|
||||
// : const OnBoardingPageWidget(),
|
||||
// ),
|
||||
FFRoute(
|
||||
|
@ -134,27 +126,24 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
FFRoute(
|
||||
name: 'forgotPassword',
|
||||
path: '/forgotPassword',
|
||||
builder: (context, params) {
|
||||
late final String email =
|
||||
params.getParam('email', ParamType.String);
|
||||
late final String token =
|
||||
params.getParam('token', ParamType.String);
|
||||
|
||||
return ForgotPasswordScreen(
|
||||
builder: (context, params) => ForgotPasswordScreen(
|
||||
key: UniqueKey(),
|
||||
email: email,
|
||||
token: token,
|
||||
);
|
||||
}),
|
||||
email: params.getParam('email', ParamType.String),
|
||||
token: params.getParam('token', ParamType.String))),
|
||||
FFRoute(name: 'homePage', path: '/homePage', builder: (context, params) => HomePageWidget(key: UniqueKey())),
|
||||
FFRoute(
|
||||
name: 'homePage',
|
||||
path: '/homePage',
|
||||
builder: (context, params) => HomePageWidget(key: UniqueKey()),
|
||||
),
|
||||
name: 'petsOnThePropertyPage',
|
||||
path: '/petsOnThePropertyPage',
|
||||
builder: (context, params) => Scaffold(body: const PetsHistoryScreen(isApp: true))),
|
||||
FFRoute(
|
||||
name: 'receptionPage',
|
||||
path: '/receptionPage',
|
||||
builder: (context, params) => const ReceptionPageWidget()),
|
||||
name: 'vehiclesOnThePropertyPage',
|
||||
path: '/vehiclesOnThePropertyPage',
|
||||
builder: (context, params) => const VehicleOnTheProperty()),
|
||||
FFRoute(
|
||||
name: 'visitsOnThePropertyPage',
|
||||
path: '/visitsOnThePropertyPage',
|
||||
builder: (context, params) => const VisitsOnTheProperty()),
|
||||
FFRoute(name: 'receptionPage', path: '/receptionPage', builder: (context, params) => const ReceptionPageWidget()),
|
||||
FFRoute(
|
||||
name: 'messageHistoryPage',
|
||||
path: '/messageHistoryPage',
|
||||
|
@ -162,107 +151,53 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
|||
FFRoute(
|
||||
name: 'registerVisitorPage',
|
||||
path: '/registerVisitorPage',
|
||||
builder: (context, params) => const RegisterVisitorPageWidget(),
|
||||
),
|
||||
builder: (context, params) => const RegisterVisitorPageWidget()),
|
||||
FFRoute(
|
||||
name: 'scheduleCompleteVisitPage',
|
||||
path: '/scheduleCompleteVisitPage',
|
||||
builder: (context, params) {
|
||||
return const ScheduleCompleteVisitPageWidget();
|
||||
}),
|
||||
builder: (context, params) => const ScheduleCompleteVisitPageWidget()),
|
||||
FFRoute(
|
||||
name: 'deliverySchedule',
|
||||
path: '/deliverySchedule',
|
||||
builder: (context, params) => const DeliverySchedule(),
|
||||
),
|
||||
name: 'deliverySchedule', path: '/deliverySchedule', builder: (context, params) => const DeliverySchedule()),
|
||||
FFRoute(
|
||||
name: 'provisionalSchedule',
|
||||
path: '/provisionalSchedule',
|
||||
builder: (context, params) => const ProvisionalSchedule(),
|
||||
),
|
||||
builder: (context, params) => const ProvisionalSchedule()),
|
||||
FFRoute(
|
||||
name: 'fastPassPage',
|
||||
path: '/fastPassPage',
|
||||
builder: (context, params) => /*const*/ FastPassPageWidget(),
|
||||
),
|
||||
name: 'fastPassPage', path: '/fastPassPage', builder: (context, params) => /*const*/ FastPassPageWidget()),
|
||||
FFRoute(
|
||||
name: 'preferencesSettings',
|
||||
path: '/preferencesSettings',
|
||||
builder: (context, params) => PreferencesPageWidget()),
|
||||
FFRoute(name: 'aboutProperty', path: '/aboutProperty', builder: (context, params) => AboutPropertyPage()),
|
||||
FFRoute(
|
||||
name: 'peopleOnThePropertyPage',
|
||||
path: '/peopleOnThePropertyPage',
|
||||
builder: (context, params) => const PeopleOnThePropertyPageWidget(),
|
||||
),
|
||||
builder: (context, params) => PeopleOnThePropertyPage()),
|
||||
FFRoute(
|
||||
name: 'acessHistoryPage',
|
||||
path: '/acessHistoryPage',
|
||||
builder: (context, params) => AccessHistoryScreen(opt: const {
|
||||
'personType': '.*',
|
||||
'accessType': '.*',
|
||||
'search': '.*',
|
||||
})),
|
||||
builder: (context, params) =>
|
||||
AccessHistoryScreen(opt: const {'personType': '.*', 'accessType': '.*', 'search': '.*'})),
|
||||
FFRoute(
|
||||
name: 'liberationHistory',
|
||||
path: '/liberationHistory',
|
||||
builder: (context, params) => const LiberationHistoryWidget(),
|
||||
),
|
||||
FFRoute(
|
||||
name: 'signInPage',
|
||||
path: '/signInPage',
|
||||
builder: (context, params) => const SignInPageWidget(),
|
||||
),
|
||||
FFRoute(
|
||||
name: 'signUpPage',
|
||||
path: '/signUpPage',
|
||||
builder: (context, params) => const SignUpPageWidget(),
|
||||
),
|
||||
FFRoute(
|
||||
name: 'welcomePage',
|
||||
path: '/welcomePage',
|
||||
builder: (context, params) => const WelcomePageWidget(),
|
||||
),
|
||||
FFRoute(
|
||||
name: 'qrCodePage',
|
||||
path: '/qrCodePage',
|
||||
builder: (context, params) => const QrCodePageWidget(),
|
||||
),
|
||||
FFRoute(
|
||||
name: 'preferencesPage',
|
||||
path: '/preferencesPage',
|
||||
builder: (context, params) => PreferencesPageWidget(),
|
||||
),
|
||||
FFRoute(
|
||||
name: 'packageOrder',
|
||||
path: '/packageOrder',
|
||||
builder: (context, params) => const PackageOrderPage(),
|
||||
),
|
||||
FFRoute(
|
||||
name: 'reservation',
|
||||
path: '/reservation',
|
||||
builder: (context, params) => ReservationPageWidget(),
|
||||
),
|
||||
builder: (context, params) => const LiberationHistoryWidget()),
|
||||
FFRoute(name: 'signInPage', path: '/signInPage', builder: (context, params) => const SignInPageWidget()),
|
||||
FFRoute(name: 'signUpPage', path: '/signUpPage', builder: (context, params) => const SignUpPageWidget()),
|
||||
FFRoute(name: 'welcomePage', path: '/welcomePage', builder: (context, params) => const WelcomePageWidget()),
|
||||
FFRoute(name: 'qrCodePage', path: '/qrCodePage', builder: (context, params) => const QrCodePageWidget()),
|
||||
FFRoute(name: 'preferencesPage', path: '/preferencesPage', builder: (context, params) => PreferencesPageWidget()),
|
||||
FFRoute(name: 'packageOrder', path: '/packageOrder', builder: (context, params) => const PackageOrderPage()),
|
||||
FFRoute(name: 'reservation', path: '/reservation', builder: (context, params) => ReservationPageWidget()),
|
||||
FFRoute(
|
||||
name: 'petsPage',
|
||||
path: '/petsPage',
|
||||
builder: (context, params) {
|
||||
final pet = params.getParam(
|
||||
'pet',
|
||||
ParamType.JSON,
|
||||
);
|
||||
|
||||
return PetsPageWidget(
|
||||
pet: pet,
|
||||
);
|
||||
final pet = params.getParam('pet', ParamType.JSON);
|
||||
return PetsPageWidget(pet: pet);
|
||||
},
|
||||
),
|
||||
// FFRoute(
|
||||
// name: 'settingsPage',
|
||||
// path: '/settingsPage',
|
||||
// builder: (context, params) => params.isEmpty
|
||||
// ? const NavBarPage(initialPage: 'settingsPage')
|
||||
// : const SettingsPageWidget(),
|
||||
// )
|
||||
// FFRoute(name: 'settingsPage', path: '/settingsPage', builder: (context, params) => params.isEmpty ? const NavBarPage(initialPage: 'settingsPage') : const SettingsPageWidget())
|
||||
].map((r) => r.toRoute(appStateNotifier)).toList(),
|
||||
);
|
||||
}
|
||||
|
@ -277,14 +212,11 @@ extension NavParamExtensions on Map<String, String?> {
|
|||
|
||||
extension NavigationExtensions on BuildContext {
|
||||
void safePop() {
|
||||
// If there is only one route on the stack, navigate to the initial
|
||||
// page instead of popping.
|
||||
if (canPop()) {
|
||||
if (canPop())
|
||||
pop();
|
||||
} else {
|
||||
else
|
||||
go('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension _GoRouterStateExtensions on GoRouterState {
|
||||
|
@ -311,14 +243,11 @@ extension GoRouterLocationExtension on GoRouter {
|
|||
|
||||
class FFParameters {
|
||||
FFParameters(this.state, [this.asyncParams = const {}]);
|
||||
|
||||
final GoRouterState state;
|
||||
final Map<String, Future<dynamic> Function(String)> asyncParams;
|
||||
|
||||
final Map<String, Future<dynamic> Function(String)> asyncParams;
|
||||
Map<String, dynamic> futureParamValues = {};
|
||||
|
||||
// Parameters are empty if the params map is empty or if the only parameter
|
||||
// present is the special extra parameter reserved for the transition info.
|
||||
bool get isEmpty =>
|
||||
state.allParams.isEmpty ||
|
||||
(state.allParams.length == 1 &&
|
||||
|
@ -334,36 +263,18 @@ class FFParameters {
|
|||
if (doc != null) {
|
||||
futureParamValues[param.key] = doc;
|
||||
return true;
|
||||
}
|
||||
} else
|
||||
return false;
|
||||
},
|
||||
),
|
||||
).onError((_, __) => [false]).then((v) => v.every((e) => e));
|
||||
|
||||
dynamic getParam<T>(
|
||||
String paramName,
|
||||
ParamType type, {
|
||||
bool isList = false,
|
||||
StructBuilder<T>? structBuilder,
|
||||
}) {
|
||||
if (futureParamValues.containsKey(paramName)) {
|
||||
return futureParamValues[paramName];
|
||||
}
|
||||
if (!state.allParams.containsKey(paramName)) {
|
||||
return null;
|
||||
}
|
||||
dynamic getParam<T>(String paramName, ParamType type, {bool isList = false, StructBuilder<T>? structBuilder}) {
|
||||
if (futureParamValues.containsKey(paramName)) return futureParamValues[paramName];
|
||||
if (!state.allParams.containsKey(paramName)) return null;
|
||||
final param = state.allParams[paramName];
|
||||
// Got parameter from `extras`, so just directly return it.
|
||||
if (param is! String) {
|
||||
return param;
|
||||
}
|
||||
// Return serialized value.
|
||||
return deserializeParam<T>(
|
||||
param,
|
||||
type,
|
||||
isList,
|
||||
structBuilder: structBuilder,
|
||||
);
|
||||
if (param is! String) return param;
|
||||
return deserializeParam<T>(param, type, isList, structBuilder: structBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,7 +308,6 @@ class FFRoute {
|
|||
)
|
||||
: builder(context, ffParams);
|
||||
final child = page;
|
||||
|
||||
final transitionInfo = state.transitionInfo;
|
||||
return transitionInfo.hasTransition
|
||||
? CustomTransitionPage(
|
||||
|
@ -412,12 +322,7 @@ class FFRoute {
|
|||
reverseDuration: transitionInfo.duration,
|
||||
alignment: transitionInfo.alignment,
|
||||
child: child,
|
||||
).buildTransitions(
|
||||
context,
|
||||
animation,
|
||||
secondaryAnimation,
|
||||
child,
|
||||
),
|
||||
).buildTransitions(context, animation, secondaryAnimation, child),
|
||||
)
|
||||
: MaterialPage(key: state.pageKey, child: child);
|
||||
},
|
||||
|
@ -456,8 +361,6 @@ class RootPageContext {
|
|||
location != rootPageContext?.errorRoute;
|
||||
}
|
||||
|
||||
static Widget wrap(Widget child, {String? errorRoute}) => Provider.value(
|
||||
value: RootPageContext(true, errorRoute),
|
||||
child: child,
|
||||
);
|
||||
static Widget wrap(Widget child, {String? errorRoute}) =>
|
||||
Provider.value(value: RootPageContext(true, errorRoute), child: child);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
import 'package:flutter/material.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_component/menu_component_model.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||
|
||||
import 'package:hub/pages/about_property_page/about_property_screen.dart';
|
||||
|
||||
class AboutPropertyModel extends FlutterFlowModel<AboutPropertyPage> {
|
||||
dynamic item;
|
||||
|
||||
VoidCallback? safeSetState;
|
||||
|
||||
late MenuComponentModel menuComponentModel;
|
||||
|
||||
Future<void> initAsync() async {
|
||||
safeSetState?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState(BuildContext context) {
|
||||
menuComponentModel = createModel(
|
||||
context,
|
||||
() => MenuComponentModel(expandable: true, style: MenuView.list_grid, item: MenuItem.button, menuOptions: [
|
||||
MenuOption.PetsOnTheProperty,
|
||||
MenuOption.ResidentsOnTheProperty,
|
||||
MenuOption.VisitsOnTheProperty,
|
||||
MenuOption.VehiclesOnTheProperty,
|
||||
MenuOption.PackagesOnTheProperty,
|
||||
]));
|
||||
|
||||
initAsync();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
// ignore: must_be_immutable
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/components/atomic_components/shared_components_atoms/appbar.dart';
|
||||
import 'package:hub/components/organism_components/menu_component/menu_component_widget.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/nav/nav.dart';
|
||||
import 'package:hub/pages/about_property_page/about_property_model.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class AboutPropertyPage extends StatefulWidget {
|
||||
dynamic pet;
|
||||
|
||||
AboutPropertyPage({
|
||||
super.key,
|
||||
this.pet,
|
||||
});
|
||||
|
||||
@override
|
||||
State<AboutPropertyPage> createState() => _AboutPropertyPageState();
|
||||
}
|
||||
|
||||
class _AboutPropertyPageState extends State<AboutPropertyPage> with SingleTickerProviderStateMixin {
|
||||
late AboutPropertyModel _model;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => AboutPropertyModel());
|
||||
_model.updateOnChange = true;
|
||||
|
||||
_model.safeSetState = () {
|
||||
safeSetState(() {});
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_model.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: _buildAppBar(context),
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
body: _buildBody(context));
|
||||
}
|
||||
|
||||
PreferredSizeWidget _buildAppBar(BuildContext context) {
|
||||
final String title =
|
||||
FFLocalizations.of(context).getVariableText(ptText: "Sobre a Propriedade", enText: "About the Property");
|
||||
return AppBarUtil(
|
||||
title: title,
|
||||
onBackButtonPressed: () => context.pop(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Container(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
child: wrapWithModel(
|
||||
model: _model.menuComponentModel,
|
||||
updateCallback: () => setState(() {}),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: 40),
|
||||
child: MenuComponentWidget(model: _model.menuComponentModel),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
// ignore_for_file: unused_field
|
||||
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -23,16 +25,15 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
|
|||
late InAppWebViewController _controllerIOS;
|
||||
|
||||
Future<Map<String, String>> initVariables() async {
|
||||
final email = (await StorageHelper().get(hub.SecureStorageKey.email.value, hub.Storage.SecureStorage)) ?? '';
|
||||
final name = (await StorageHelper().get(hub.SQLiteStorageKey.userName.value, hub.Storage.SQLiteStorage)) ?? '';
|
||||
final devUUID = (await StorageHelper().get(hub.SQLiteStorageKey.devUUID.value, hub.Storage.SQLiteStorage)) ?? '';
|
||||
final userUUID = (await StorageHelper().get(hub.SQLiteStorageKey.userUUID.value, hub.Storage.SQLiteStorage)) ?? '';
|
||||
final cliUUID = (await StorageHelper().get(hub.SQLiteStorageKey.clientUUID.value, hub.Storage.SQLiteStorage)) ?? '';
|
||||
final email = await StorageHelper().get(hub.SecureStorageKey.email.value, hub.Storage.SecureStorage) ?? '';
|
||||
final name = await StorageHelper().get(hub.SQLiteStorageKey.userName.value, hub.Storage.SQLiteStorage) ?? '';
|
||||
final devUUID = await StorageHelper().get(hub.SQLiteStorageKey.devUUID.value, hub.Storage.SQLiteStorage) ?? '';
|
||||
final userUUID = await StorageHelper().get(hub.SQLiteStorageKey.userUUID.value, hub.Storage.SQLiteStorage) ?? '';
|
||||
final cliUUID = await StorageHelper().get(hub.SQLiteStorageKey.clientUUID.value, hub.Storage.SQLiteStorage) ?? '';
|
||||
const createdAt = '0000-00-00 00:00:00';
|
||||
final url = 'https://hub.freaccess.com.br/hub/fast-pass/$cliUUID';
|
||||
final freUserData =
|
||||
"{\"name\": \"$name\", \"email\": \"$email\",\"dev_id\": \"$devUUID\",\"created_at\":\"$createdAt\",\"updated_at\": \"0000-00-00 00:00:00\",\"status\": \"A\" }";
|
||||
|
||||
return {
|
||||
'url': url,
|
||||
'name': name,
|
||||
|
@ -53,38 +54,48 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
|
|||
future: initVariables(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError || snapshot.hasData == false || snapshot.data!.isEmpty) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError || !snapshot.hasData || snapshot.data!.isEmpty) {
|
||||
return Center(
|
||||
child: Text(FFLocalizations.of(context)
|
||||
.getVariableText(enText: 'Unexpected error', ptText: 'Erro inesperado')));
|
||||
} else if (snapshot.hasData) {
|
||||
} else {
|
||||
final data = snapshot.data!;
|
||||
final url = data['url']!;
|
||||
final userUUID = data['userUUID']!;
|
||||
final freUserData = data['freUserData']!;
|
||||
|
||||
return Platform.isIOS
|
||||
? InAppWebView(
|
||||
? _buildIOSWebView(url, userUUID, freUserData)
|
||||
: _buildAndroidWebView(url, userUUID, freUserData);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildIOSWebView(String url, String userUUID, String freUserData) {
|
||||
return InAppWebView(
|
||||
initialUrlRequest: URLRequest(url: WebUri(url)),
|
||||
onLoadStart: (controller, url) {},
|
||||
initialSettings: InAppWebViewSettings(
|
||||
allowsBackForwardNavigationGestures: true,
|
||||
javaScriptEnabled: true,
|
||||
),
|
||||
onWebViewCreated: (controller) async => _controllerIOS = controller,
|
||||
onLoadStop: (controller, url) async {
|
||||
await controller.evaluateJavascript(
|
||||
source: "window.localStorage.setItem('fre-token', '\"$userUUID\"')");
|
||||
await controller.evaluateJavascript(
|
||||
source: "window.localStorage.setItem('fre-user-data', '$freUserData')");
|
||||
await controller.evaluateJavascript(
|
||||
source: "window.localStorage.setItem('enableBackButton', 'true')");
|
||||
await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-token', '\"$userUUID\"')");
|
||||
await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-user-data', '$freUserData')");
|
||||
await controller.evaluateJavascript(source: "window.localStorage.setItem('enableBackButton', 'true')");
|
||||
},
|
||||
onUpdateVisitedHistory: (controller, uri, isVisited) {
|
||||
if (uri.toString().contains('/hub/home')) context.pop();
|
||||
},
|
||||
)
|
||||
: WebViewWidget(
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAndroidWebView(String url, String userUUID, String freUserData) {
|
||||
return WebViewWidget(
|
||||
controller: _controllerAndroid = WebViewController()
|
||||
..clearCache()
|
||||
..clearLocalStorage()
|
||||
|
@ -92,7 +103,6 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
|
|||
..setBackgroundColor(const Color(0x00000000))
|
||||
..setNavigationDelegate(
|
||||
NavigationDelegate(
|
||||
onProgress: (int progress) {},
|
||||
onPageStarted: (String url) {
|
||||
final String token = "localStorage.setItem('fre-token', '\"$userUUID\"');";
|
||||
final String data = "localStorage.setItem('fre-user-data', '$freUserData');";
|
||||
|
@ -103,8 +113,7 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
|
|||
_controllerAndroid.runJavaScript(backNavigation);
|
||||
},
|
||||
onPageFinished: (String url) {
|
||||
bool isDarkMode =
|
||||
SchedulerBinding.instance.platformDispatcher.platformBrightness == Brightness.dark;
|
||||
bool isDarkMode = SchedulerBinding.instance.platformDispatcher.platformBrightness == Brightness.dark;
|
||||
|
||||
if (isDarkMode) {
|
||||
_controllerAndroid.runJavaScript(WebviewUtil.jsEnableDarkMode);
|
||||
|
@ -121,16 +130,10 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
|
|||
},
|
||||
onUrlChange: (url) {
|
||||
if (url.url.toString().contains('/hub/home')) context.pop();
|
||||
}),
|
||||
},
|
||||
),
|
||||
)
|
||||
..loadRequest(Uri.parse(url)),
|
||||
);
|
||||
} else {
|
||||
return const Center(child: Text('Unexpected error'));
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import 'package:flutter/material.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/local_profile_component/local_profile_component_model.dart';
|
||||
import 'package:hub/components/organism_components/menu_component/menu_component_model.dart';
|
||||
import 'package:hub/components/organism_components/message_well_component/message_well_component_model.dart';
|
||||
|
@ -8,6 +10,9 @@ import 'package:hub/shared/helpers/base_storage.dart';
|
|||
import 'package:hub/shared/helpers/storage_helper.dart';
|
||||
|
||||
class HomePageModel extends FlutterFlowModel<HomePageWidget> {
|
||||
HomePageModel({required this.safeSetState});
|
||||
late final VoidCallback safeSetState;
|
||||
|
||||
bool isGrid = false;
|
||||
late final String devUUID;
|
||||
late final String cliUUID;
|
||||
|
@ -20,7 +25,8 @@ class HomePageModel extends FlutterFlowModel<HomePageWidget> {
|
|||
TextEditingController? textController;
|
||||
String? Function(BuildContext, String?)? textControllerValidator;
|
||||
late LocalProfileComponentModel localComponentModel;
|
||||
late MenuComponentModel menuComponentModel;
|
||||
late MenuComponentModel homeMenuComponentModel;
|
||||
late MenuComponentModel drawerMenuComponentModel;
|
||||
late MessageWellComponentModel messageWellComponentModel;
|
||||
|
||||
Future<void> _initVariable() async {
|
||||
|
@ -29,13 +35,50 @@ class HomePageModel extends FlutterFlowModel<HomePageWidget> {
|
|||
cliUUID = (await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
userName = (await StorageHelper().get(SQLiteStorageKey.userName.value, Storage.SQLiteStorage)) ?? '';
|
||||
userEmail = (await StorageHelper().get(SecureStorageKey.email.value, Storage.SecureStorage)) ?? '';
|
||||
safeSetState.call();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState(BuildContext context) {
|
||||
_initVariable();
|
||||
localComponentModel = createModel(context, () => LocalProfileComponentModel());
|
||||
menuComponentModel = createModel(context, () => MenuComponentModel());
|
||||
homeMenuComponentModel = createModel(
|
||||
context,
|
||||
() => MenuComponentModel(expandable: true, style: MenuView.list_grid, item: MenuItem.button, menuOptions: [
|
||||
MenuOption.SettingsOnTheApp,
|
||||
MenuOption.MessagesOnTheProperty,
|
||||
MenuOption.AccessOnTheProperty,
|
||||
MenuOption.PetsRegister,
|
||||
MenuOption.VisitorsRegister,
|
||||
MenuOption.ReservationsOnTheLocal,
|
||||
MenuOption.PackagesOnTheProperty,
|
||||
MenuOption.DeliverySchedule,
|
||||
MenuOption.WorkersOnTheProperty,
|
||||
MenuOption.AboutProperty,
|
||||
MenuOption.CompleteSchedule,
|
||||
MenuOption.FastPassSchedule,
|
||||
MenuOption.LiberationsOnTheProperty,
|
||||
MenuOption.QRCodeAccessInProperty,
|
||||
]));
|
||||
drawerMenuComponentModel = createModel(
|
||||
context,
|
||||
() => MenuComponentModel(expandable: false, style: MenuView.list, item: MenuItem.tile, menuOptions: [
|
||||
MenuOption.SettingsOnTheApp,
|
||||
MenuOption.MessagesOnTheProperty,
|
||||
MenuOption.AccessOnTheProperty,
|
||||
MenuOption.PetsRegister,
|
||||
MenuOption.VisitorsRegister,
|
||||
MenuOption.ReservationsOnTheLocal,
|
||||
MenuOption.PackagesOnTheProperty,
|
||||
MenuOption.DeliverySchedule,
|
||||
MenuOption.WorkersOnTheProperty,
|
||||
MenuOption.AboutProperty,
|
||||
MenuOption.CompleteSchedule,
|
||||
MenuOption.FastPassSchedule,
|
||||
MenuOption.LiberationsOnTheProperty,
|
||||
MenuOption.QRCodeAccessInProperty,
|
||||
MenuOption.LogoutOnTheApp,
|
||||
]));
|
||||
messageWellComponentModel = createModel(context, () => MessageWellComponentModel());
|
||||
}
|
||||
|
||||
|
@ -46,7 +89,7 @@ class HomePageModel extends FlutterFlowModel<HomePageWidget> {
|
|||
textController?.dispose();
|
||||
|
||||
localComponentModel.dispose();
|
||||
menuComponentModel.dispose();
|
||||
homeMenuComponentModel.dispose();
|
||||
messageWellComponentModel.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/backend/notifications/firebase_messaging_service.dart';
|
||||
import 'package:hub/backend/schema/enums/enums.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/flutter_flow_icon_button.dart';
|
||||
|
@ -39,8 +37,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_model = createModel(context, () => HomePageModel());
|
||||
_model.updateOnChange = true;
|
||||
_model = createModel(context, () => HomePageModel(safeSetState: () => safeSetState(() {})));
|
||||
|
||||
_model.textController ??= TextEditingController();
|
||||
_model.textFieldFocusNode ??= FocusNode();
|
||||
|
@ -56,7 +53,13 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
drawerEnableOpenDragGesture: true,
|
||||
drawerDragStartBehavior: DragStartBehavior.start,
|
||||
drawer: CustomDrawer(model: _model),
|
||||
appBar: AppBar(
|
||||
appBar: buildAppBar(context),
|
||||
body: buildPage(context),
|
||||
);
|
||||
}
|
||||
|
||||
AppBar buildAppBar(BuildContext context) {
|
||||
return AppBar(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||
automaticallyImplyLeading: false,
|
||||
leading: FlutterFlowIconButton(
|
||||
|
@ -100,8 +103,6 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
actions: const [],
|
||||
centerTitle: true,
|
||||
elevation: 0.0,
|
||||
),
|
||||
body: buildPage(context),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -139,14 +140,13 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
|||
return Container(
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
child: wrapWithModel(
|
||||
model: _model.menuComponentModel,
|
||||
model: _model.homeMenuComponentModel,
|
||||
updateOnChange: true,
|
||||
updateCallback: () => setState(() {}),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(bottom: 40),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 40),
|
||||
child: MenuComponentWidget(
|
||||
expandable: true,
|
||||
style: MenuView.list_grid,
|
||||
item: MenuItem.button,
|
||||
model: _model.homeMenuComponentModel,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -36,11 +36,11 @@ class _PackageOrderPage extends State<PackageOrderPage> {
|
|||
List<dynamic> _orderList = [];
|
||||
|
||||
final Map<String, String> filter = {
|
||||
'adresseeType': '.*',
|
||||
'adresseeType': 'PRO',
|
||||
'status': 'notPickedUp',
|
||||
};
|
||||
|
||||
String _adresseeType = '.*';
|
||||
String _adresseeType = 'PRO';
|
||||
String _status = 'notPickedUp';
|
||||
|
||||
late BehaviorSubject<Map<String, String>> _selectedTypeSubject;
|
||||
|
@ -224,7 +224,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
|
|||
return AppBar(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(FFLocalizations.of(context).getVariableText(enText: 'My Orders', ptText: 'Minhas Encomendas'),
|
||||
title: Text(FFLocalizations.of(context).getVariableText(enText: 'Orders', ptText: 'Encomendas'),
|
||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
||||
fontFamily: 'Nunito',
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
|
@ -412,6 +412,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
appBar: _appBar(context),
|
||||
body: _appBody(context),
|
||||
);
|
||||
|
|
|
@ -1,14 +1,27 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||
import 'package:hub/pages/people_on_the_property_page/people_on_the_property_page_widget.dart';
|
||||
import 'package:hub/shared/helpers/base_storage.dart';
|
||||
import 'package:hub/shared/helpers/storage_helper.dart';
|
||||
|
||||
class PeopleOnThePropertyPageModel extends FlutterFlowModel<PeopleOnThePropertyPageWidget> {
|
||||
/// State fields for stateful widgets in this page.
|
||||
class PeopleOnThePropertyPageModel extends FlutterFlowModel<PeopleOnThePropertyPage> {
|
||||
PeopleOnThePropertyPageModel({this.onRefresh});
|
||||
late final VoidCallback? onRefresh;
|
||||
|
||||
final unfocusNode = FocusNode();
|
||||
late final String devUUID;
|
||||
late final String cliUUID;
|
||||
|
||||
@override
|
||||
void initState(BuildContext context) {}
|
||||
void initState(BuildContext context) {
|
||||
initVariables();
|
||||
}
|
||||
|
||||
void initVariables() async {
|
||||
devUUID = (await StorageHelper().get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
cliUUID = (await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
onRefresh?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
|
|
@ -1,68 +1,135 @@
|
|||
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/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_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:hub/shared/utils/dialog_util.dart';
|
||||
import 'package:hub/shared/utils/limited_text_size.dart';
|
||||
import 'package:hub/shared/utils/log_util.dart';
|
||||
|
||||
import '../../shared/utils/log_util.dart';
|
||||
|
||||
class PeopleOnThePropertyPageWidget extends StatefulWidget {
|
||||
const PeopleOnThePropertyPageWidget({super.key});
|
||||
class PeopleOnThePropertyPage extends StatefulWidget {
|
||||
const PeopleOnThePropertyPage({super.key});
|
||||
|
||||
@override
|
||||
State<PeopleOnThePropertyPageWidget> createState() => _PeopleOnThePropertyPageWidgetState();
|
||||
_PeopleOnThePropertyPageState createState() => _PeopleOnThePropertyPageState();
|
||||
}
|
||||
|
||||
class _PeopleOnThePropertyPageWidgetState extends State<PeopleOnThePropertyPageWidget> {
|
||||
late PeopleOnThePropertyPageModel _model;
|
||||
class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> with TickerProviderStateMixin {
|
||||
late ScrollController _scrollController;
|
||||
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
int _pageNumber = 1;
|
||||
bool _hasData = false;
|
||||
bool _loading = false;
|
||||
int count = 0;
|
||||
|
||||
late final PeopleOnThePropertyPageModel model;
|
||||
|
||||
late Future<void> _future;
|
||||
List<dynamic> _wrap = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => PeopleOnThePropertyPageModel());
|
||||
model = createModel(context, () => PeopleOnThePropertyPageModel(onRefresh: () => safeSetState(() {})));
|
||||
_future = _fetchVisits();
|
||||
|
||||
_scrollController = ScrollController()
|
||||
..addListener(() {
|
||||
if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) {
|
||||
_loadMore();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_model.dispose();
|
||||
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
late final limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||
|
||||
return Scaffold(
|
||||
key: scaffoldKey,
|
||||
appBar: _appBar(context),
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
appBar: AppBar(
|
||||
body: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (_hasData == false && _pageNumber <= 1 && _loading == false)
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Nenhum morador encontrado!",
|
||||
enText: "No residents found!",
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: limitedHeaderTextSize,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
else if (_hasData == true || _pageNumber >= 1)
|
||||
Expanded(
|
||||
child: FutureBuilder<void>(
|
||||
future: _future,
|
||||
builder: (context, snapshot) {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
controller: _scrollController,
|
||||
itemCount: _wrap.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
// Add your item here
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 30, top: 10),
|
||||
child: Text(
|
||||
'',
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final item = _wrap[index - 1];
|
||||
return _item(context, item);
|
||||
}
|
||||
});
|
||||
},
|
||||
)),
|
||||
if (_hasData == true && _loading == true)
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 15, bottom: 15),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
].addToStart(const SizedBox(height: 0)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
PreferredSizeWidget _appBar(BuildContext context) {
|
||||
return AppBar(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
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 {
|
||||
context.pop();
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'nsu13r5d' /* Pessoas na Propriedade */,
|
||||
),
|
||||
title: Text(FFLocalizations.of(context).getVariableText(ptText: 'Moradores', enText: 'Residents'),
|
||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
||||
fontFamily: 'Nunito',
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
|
@ -70,106 +137,114 @@ class _PeopleOnThePropertyPageWidgetState extends State<PeopleOnThePropertyPageW
|
|||
letterSpacing: 0.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
|
||||
),
|
||||
),
|
||||
actions: const [],
|
||||
)),
|
||||
leading: _backButton(context, FlutterFlowTheme.of(context)),
|
||||
centerTitle: true,
|
||||
elevation: 0.0,
|
||||
actions: [],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _backButton(BuildContext context, FlutterFlowTheme theme) {
|
||||
return FlutterFlowIconButton(
|
||||
borderColor: Colors.transparent,
|
||||
borderRadius: 30.0,
|
||||
borderWidth: 1.0,
|
||||
buttonSize: 60.0,
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: theme.primaryText,
|
||||
size: 30.0,
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: FutureBuilder<ApiCallResponse>(
|
||||
future: PhpGroup.getPessoasLocalCall.call(),
|
||||
builder: (context, snapshot) {
|
||||
// Customize what your widget looks like when it's loading.
|
||||
if (!snapshot.hasData) {
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
child: SpinKitCircle(
|
||||
color: FlutterFlowTheme.of(context).primary,
|
||||
size: 50.0,
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
);
|
||||
}
|
||||
|
||||
Future<ApiCallResponse?> _fetchVisits() async {
|
||||
try {
|
||||
setState(() => _loading = true);
|
||||
|
||||
var response = await PhpGroup.getResidentsByProperty.call(_pageNumber.toString());
|
||||
|
||||
final List<dynamic> residents = response.jsonBody['residents'] ?? [];
|
||||
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||
|
||||
if (residents.isNotEmpty) {
|
||||
setState(() {
|
||||
_wrap.addAll(residents);
|
||||
_hasData = true;
|
||||
_loading = false;
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
_showNoMoreDataSnackBar(context);
|
||||
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
|
||||
return null;
|
||||
} catch (e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de moradores", e, s);
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void _loadMore() {
|
||||
if (_hasData == true) {
|
||||
_pageNumber++;
|
||||
|
||||
_future = _fetchVisits();
|
||||
}
|
||||
}
|
||||
|
||||
void _showNoMoreDataSnackBar(BuildContext context) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Não há mais dados.",
|
||||
enText: "No more data.",
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: LimitedFontSizeUtil.getBodyFontSize(context),
|
||||
),
|
||||
),
|
||||
duration: const Duration(seconds: 3),
|
||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (snapshot.hasError || snapshot.data?.exception != null) {
|
||||
if (snapshot.error != null && snapshot.stackTrace != null) {
|
||||
LogUtil.requestAPIFailed(
|
||||
'getPessoasLocal.php', "", 'Busca Pessoas no Local', snapshot.error, snapshot.stackTrace!);
|
||||
}
|
||||
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 100,
|
||||
child: Text(
|
||||
FFLocalizations.of(context)
|
||||
.getVariableText(ptText: "Pessoas não encontradas", enText: "Persons not found"),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final columnGetPessoasLocalResponse = snapshot.data!;
|
||||
final getPoepleProperty = PhpGroup.getPessoasLocalCall
|
||||
.pessoas(
|
||||
columnGetPessoasLocalResponse.jsonBody,
|
||||
Widget _item(BuildContext context, dynamic uItem) {
|
||||
return CardItemTemplateComponentWidget(
|
||||
imagePath:
|
||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${model.devUUID}&cliID=${model.cliUUID}&atividade=getFoto&Documento=${uItem['documento']}&tipo=Z',
|
||||
labelsHashMap: {
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': uItem['nome'] ?? '',
|
||||
//statusweb
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Possui App", enText: "Has App")}:':
|
||||
uItem['statusweb'] == "A"
|
||||
? FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Sim',
|
||||
enText: 'Yes',
|
||||
)
|
||||
?.toList() ??
|
||||
[];
|
||||
|
||||
return ListView.builder(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemCount: getPoepleProperty.length,
|
||||
itemBuilder: (context, index) {
|
||||
final getPoeplePropertyItem = getPoepleProperty[index];
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Container(
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Não',
|
||||
enText: 'No',
|
||||
),
|
||||
child: CachedNetworkImage(
|
||||
fadeInDuration: const Duration(milliseconds: 500),
|
||||
fadeOutDuration: const Duration(milliseconds: 500),
|
||||
imageUrl:
|
||||
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
getJsonField(
|
||||
getPoeplePropertyItem,
|
||||
r'''$.USU_NOME''',
|
||||
).toString(),
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||
fontSize: 14.0,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts:
|
||||
GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||
),
|
||||
),
|
||||
].divide(const SizedBox(width: 20.0)).addToStart(const SizedBox(width: 40.0)),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
statusHashMap: [],
|
||||
onTapCardItemAction: () async {},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||
import 'package:hub/backend/api_requests/api_manager.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_theme.dart';
|
||||
|
||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
||||
import 'package:hub/shared/helpers/base_storage.dart';
|
||||
|
@ -11,8 +15,9 @@ import 'package:hub/shared/utils/limited_text_size.dart';
|
|||
import 'package:hub/shared/utils/log_util.dart';
|
||||
|
||||
class PetsHistoryScreen extends StatefulWidget {
|
||||
const PetsHistoryScreen({super.key, required this.model});
|
||||
final PetsPageModel model;
|
||||
const PetsHistoryScreen({super.key, this.model, required this.isApp});
|
||||
final bool isApp;
|
||||
final PetsPageModel? model;
|
||||
|
||||
@override
|
||||
_PetsHistoryScreenState createState() => _PetsHistoryScreenState();
|
||||
|
@ -26,13 +31,14 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
|
|||
bool _hasData = false;
|
||||
bool _loading = false;
|
||||
int count = 0;
|
||||
|
||||
late final PetsPageModel model;
|
||||
late Future<void> _petsFuture;
|
||||
List<dynamic> _petsWrap = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
model = widget.model ?? createModel(context, () => PetsPageModel(isInteractive: false));
|
||||
_petsFuture = _fetch();
|
||||
_scrollController = ScrollController()
|
||||
..addListener(() {
|
||||
|
@ -48,6 +54,41 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
PreferredSizeWidget _appBar(BuildContext context) {
|
||||
return AppBar(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(FFLocalizations.of(context).getVariableText(enText: 'Pets', ptText: 'Pets'),
|
||||
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'),
|
||||
)),
|
||||
leading: _backButton(context, FlutterFlowTheme.of(context)),
|
||||
centerTitle: true,
|
||||
elevation: 0.0,
|
||||
actions: [],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _backButton(BuildContext context, FlutterFlowTheme theme) {
|
||||
return FlutterFlowIconButton(
|
||||
borderColor: Colors.transparent,
|
||||
borderRadius: 30.0,
|
||||
borderWidth: 1.0,
|
||||
buttonSize: 60.0,
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: theme.primaryText,
|
||||
size: 30.0,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
);
|
||||
}
|
||||
|
||||
Future<ApiCallResponse?> _fetch() async {
|
||||
try {
|
||||
setState(() => _loading = true);
|
||||
|
@ -115,10 +156,13 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double limitedBodyTextSize = LimitedFontSizeUtil.getBodyFontSize(context);
|
||||
double limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||
late final double limitedBodyTextSize = LimitedFontSizeUtil.getBodyFontSize(context);
|
||||
late final double limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||
|
||||
return Column(
|
||||
return Scaffold(
|
||||
appBar: widget.isApp ? _appBar(context) : null,
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
body: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
@ -149,10 +193,27 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
|
|||
shrinkWrap: true,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
controller: _scrollController,
|
||||
itemCount: _petsWrap.length,
|
||||
itemCount: _petsWrap.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
final item = _petsWrap[index];
|
||||
if (index == 0) {
|
||||
// Add your item here
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 30, top: 10),
|
||||
child: Text(
|
||||
model.petAmountRegister == '0'
|
||||
? FFLocalizations.of(context).getVariableText(ptText: "Ilimitado", enText: "Unlimited")
|
||||
: "${FFLocalizations.of(context).getVariableText(ptText: "Quantidade de Pets: ", enText: "Amount of Pets: ")}$count/${model.petAmountRegister}",
|
||||
textAlign: TextAlign.right,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: limitedBodyTextSize,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final item = _petsWrap[index - 1];
|
||||
return _item(context, item);
|
||||
}
|
||||
});
|
||||
},
|
||||
)),
|
||||
|
@ -168,13 +229,14 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
|
|||
),
|
||||
)
|
||||
].addToStart(const SizedBox(height: 0)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _item(BuildContext context, dynamic uItem) {
|
||||
return CardItemTemplateComponentWidget(
|
||||
imagePath:
|
||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${widget.model.devUUID}&userUUID=${widget.model.userUUID}&cliID=${widget.model.cliUUID}&atividade=consultaFotoPet&petId=${uItem['id'] ?? ''}',
|
||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${model.devUUID}&userUUID=${model.userUUID}&cliID=${model.cliUUID}&atividade=consultaFotoPet&petId=${uItem['id'] ?? ''}',
|
||||
labelsHashMap: {
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': uItem['name'] ?? '',
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Espécie", enText: "Species")}:': uItem['species'] ?? '',
|
||||
|
@ -239,14 +301,14 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProvid
|
|||
builder: (context) {
|
||||
return Dialog(
|
||||
alignment: Alignment.center,
|
||||
child: widget.model.buildPetDetails(
|
||||
child: model.buildPetDetails(
|
||||
item: uItem,
|
||||
context: context,
|
||||
devUUID: devUUID,
|
||||
userUUID: userUUID,
|
||||
cliUUID: cliUUID,
|
||||
cliName: cliName,
|
||||
model: widget.model,
|
||||
model: model,
|
||||
),
|
||||
);
|
||||
},
|
|
@ -20,6 +20,11 @@ import 'package:hub/shared/utils/limited_text_size.dart';
|
|||
import 'package:hub/shared/utils/validator_util.dart';
|
||||
|
||||
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||
PetsPageModel({
|
||||
required this.isInteractive,
|
||||
});
|
||||
late final bool isInteractive;
|
||||
|
||||
late String devUUID = '';
|
||||
late String userUUID = '';
|
||||
late String cliUUID = '';
|
||||
|
@ -393,8 +398,8 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
|||
required PetsPageModel model,
|
||||
}) {
|
||||
return DetailsComponentWidget(
|
||||
buttons: [
|
||||
// EDIT ACTION
|
||||
buttons: isInteractive
|
||||
? [
|
||||
FFButtonWidget(
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Editar',
|
||||
|
@ -426,8 +431,6 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
|||
// borderRadius: 12,
|
||||
),
|
||||
),
|
||||
|
||||
// DELETE ACTION
|
||||
FFButtonWidget(
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Excluir',
|
||||
|
@ -503,8 +506,8 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
|||
// borderRadius: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
// 'MIN', 'PEQ', 'MED', 'GRA', 'GIG'
|
||||
]
|
||||
: [],
|
||||
labelsHashMap: Map<String, String>.from({
|
||||
if (item['species'] != null && item['species'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Espécie", enText: "Species")}:':
|
||||
|
|
|
@ -10,7 +10,7 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
|||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
import 'package:hub/flutter_flow/form_field_controller.dart';
|
||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||
import 'package:hub/pages/pets_page/pets_history_screen.dart';
|
||||
import 'package:hub/pages/pets_on_the_property_page/pets_history_screen.dart';
|
||||
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
||||
import 'package:hub/shared/utils/limited_text_size.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
@ -34,7 +34,7 @@ class _PetsPageWidgetState extends State<PetsPageWidget> with SingleTickerProvid
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => PetsPageModel());
|
||||
_model = createModel(context, () => PetsPageModel(isInteractive: true));
|
||||
|
||||
_model.updateOnChange = true;
|
||||
|
||||
|
@ -96,7 +96,7 @@ class _PetsPageWidgetState extends State<PetsPageWidget> with SingleTickerProvid
|
|||
labelTab2: FFLocalizations.of(context).getVariableText(ptText: 'Consultar', enText: 'History'),
|
||||
controller: _model.tabBarController,
|
||||
widget1: _model.isEditing ? _buildEditForm(context) : _buildRegisterForm(context),
|
||||
widget2: PetsHistoryScreen(model: _model),
|
||||
widget2: PetsHistoryScreen(model: _model, isApp: false),
|
||||
onEditingChanged: onEditingChanged,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,10 +9,9 @@ import 'package:hub/components/atomic_components/shared_components_atoms/atom_im
|
|||
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/nav/nav.dart';
|
||||
import 'package:hub/pages/reception_page/reception_page_model.dart';
|
||||
import 'package:hub/shared/helpers/base_storage.dart';
|
||||
import 'package:hub/shared/helpers/storage_helper.dart';
|
||||
import 'package:hub/shared/services/authentication/authentication_service.dart';
|
||||
import 'package:hub/shared/services/localization/localization_service.dart';
|
||||
import 'package:hub/shared/utils/limited_text_size.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
@ -162,21 +161,8 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> with WidgetsB
|
|||
child: FFButtonWidget(
|
||||
onPressed: () async {
|
||||
PhpGroup.unregisterDevice();
|
||||
|
||||
StorageHelper().clearAll(Storage.SecureStorage);
|
||||
|
||||
AuthenticationService.signOut(context);
|
||||
setState(() {});
|
||||
|
||||
context.go(
|
||||
'/welcomePage',
|
||||
extra: <String, dynamic>{
|
||||
kTransitionInfoKey: const TransitionInfo(
|
||||
hasTransition: true,
|
||||
transitionType: PageTransitionType.scale,
|
||||
alignment: Alignment.bottomCenter,
|
||||
),
|
||||
},
|
||||
);
|
||||
},
|
||||
text: FFLocalizations.of(context)
|
||||
.getVariableText(ptText: 'Sair da Conta', enText: 'Logout'),
|
||||
|
|
|
@ -22,19 +22,15 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
|
|||
late WebViewController _controllerAll;
|
||||
|
||||
Future<Map<String, String>> initVariables() async {
|
||||
final email = (await StorageHelper().get(hub.SecureStorageKey.email.value, hub.Storage.SecureStorage)) ?? '';
|
||||
final name = (await StorageHelper().get(hub.SQLiteStorageKey.userName.value, hub.Storage.SQLiteStorage)) ?? '';
|
||||
final devUUID = (await StorageHelper().get(hub.SQLiteStorageKey.devUUID.value, hub.Storage.SQLiteStorage)) ?? '';
|
||||
final userUUID = (await StorageHelper().get(hub.SQLiteStorageKey.userUUID.value, hub.Storage.SQLiteStorage)) ?? '';
|
||||
final clientId =
|
||||
(await StorageHelper().get(hub.SQLiteStorageKey.clientUUID.value, hub.Storage.SQLiteStorage)) ?? '';
|
||||
final email = await StorageHelper().get(hub.SecureStorageKey.email.value, hub.Storage.SecureStorage) ?? '';
|
||||
final name = await StorageHelper().get(hub.SQLiteStorageKey.userName.value, hub.Storage.SQLiteStorage) ?? '';
|
||||
final devUUID = await StorageHelper().get(hub.SQLiteStorageKey.devUUID.value, hub.Storage.SQLiteStorage) ?? '';
|
||||
final userUUID = await StorageHelper().get(hub.SQLiteStorageKey.userUUID.value, hub.Storage.SQLiteStorage) ?? '';
|
||||
final clientId = await StorageHelper().get(hub.SQLiteStorageKey.clientUUID.value, hub.Storage.SQLiteStorage) ?? '';
|
||||
const createdAt = '0000-00-00 00:00:00';
|
||||
|
||||
final url = 'https://hub.freaccess.com.br/hub/reservation/$clientId';
|
||||
|
||||
final freUserData =
|
||||
"{\"name\": \"$name\", \"email\": \"$email\",\"dev_id\": \"$devUUID\",\"created_at\": \"0000-00-00 00:00:00\",\"updated_at\": \"0000-00-00 00:00:00\",\"status\": \"A\" }";
|
||||
|
||||
"{\"name\": \"$name\", \"email\": \"$email\",\"dev_id\": \"$devUUID\",\"created_at\": \"$createdAt\",\"updated_at\": \"0000-00-00 00:00:00\",\"status\": \"A\" }";
|
||||
return {
|
||||
'url': url,
|
||||
'name': name,
|
||||
|
@ -56,18 +52,27 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
|
|||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (snapshot.hasError || snapshot.hasData == false || snapshot.data!.isEmpty) {
|
||||
} else if (snapshot.hasError || !snapshot.hasData || snapshot.data!.isEmpty) {
|
||||
return Center(
|
||||
child: Text(FFLocalizations.of(context)
|
||||
.getVariableText(enText: 'Unexpected error', ptText: 'Erro inesperado')));
|
||||
} else if (snapshot.hasData) {
|
||||
} else {
|
||||
final data = snapshot.data!;
|
||||
final url = data['url']!;
|
||||
final userUUID = data['userUUID']!;
|
||||
final freUserData = data['freUserData']!;
|
||||
|
||||
return Platform.isIOS
|
||||
? InAppWebView(
|
||||
? _buildIOSWebView(url, userUUID, freUserData)
|
||||
: _buildAndroidWebView(url, userUUID, freUserData);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildIOSWebView(String url, String userUUID, String freUserData) {
|
||||
return InAppWebView(
|
||||
initialUrlRequest: URLRequest(url: WebUri(url)),
|
||||
initialSettings: InAppWebViewSettings(
|
||||
allowsBackForwardNavigationGestures: true,
|
||||
|
@ -75,20 +80,18 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
|
|||
),
|
||||
onWebViewCreated: (controller) async {},
|
||||
onLoadStop: (controller, url) async {
|
||||
await controller.evaluateJavascript(
|
||||
source: "window.localStorage.setItem('fre-token', '\"$userUUID\"')");
|
||||
await controller.evaluateJavascript(
|
||||
source: "window.localStorage.setItem('fre-user-data', '$freUserData')");
|
||||
await controller.evaluateJavascript(
|
||||
source: "window.localStorage.setItem('enableBackButton', 'true')");
|
||||
await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-token', '\"$userUUID\"')");
|
||||
await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-user-data', '$freUserData')");
|
||||
await controller.evaluateJavascript(source: "window.localStorage.setItem('enableBackButton', 'true')");
|
||||
},
|
||||
onUpdateVisitedHistory: (controller, uri, isVisited) {
|
||||
if (uri.toString().contains('/hub/home')) {
|
||||
context.pop();
|
||||
}
|
||||
if (uri.toString().contains('/hub/home')) context.pop();
|
||||
},
|
||||
)
|
||||
: WebViewWidget(
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAndroidWebView(String url, String userUUID, String freUserData) {
|
||||
return WebViewWidget(
|
||||
controller: _controllerAll = WebViewController()
|
||||
..clearCache()
|
||||
..clearLocalStorage()
|
||||
|
@ -96,7 +99,6 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
|
|||
..setBackgroundColor(const Color(0x00000000))
|
||||
..setNavigationDelegate(
|
||||
NavigationDelegate(
|
||||
onProgress: (int progress) {},
|
||||
onPageStarted: (String url) {
|
||||
final String token = "localStorage.setItem('fre-token', '\"$userUUID\"');";
|
||||
final String data = "localStorage.setItem('fre-user-data', '$freUserData');";
|
||||
|
@ -107,8 +109,7 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
|
|||
_controllerAll.runJavaScript(backNavigation);
|
||||
},
|
||||
onPageFinished: (String url) {
|
||||
bool isDarkMode =
|
||||
SchedulerBinding.instance.platformDispatcher.platformBrightness == Brightness.dark;
|
||||
bool isDarkMode = SchedulerBinding.instance.platformDispatcher.platformBrightness == Brightness.dark;
|
||||
|
||||
if (isDarkMode) {
|
||||
_controllerAll.runJavaScript(WebviewUtil.jsEnableDarkMode);
|
||||
|
@ -124,19 +125,11 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
|
|||
return NavigationDecision.prevent;
|
||||
},
|
||||
onUrlChange: (url) {
|
||||
if (url.url.toString().contains('/hub/home')) {
|
||||
context.pop();
|
||||
}
|
||||
}),
|
||||
if (url.url.toString().contains('/hub/home')) context.pop();
|
||||
},
|
||||
),
|
||||
)
|
||||
..loadRequest(Uri.parse(url)),
|
||||
);
|
||||
} else {
|
||||
return const Center(child: Text('Unexpected error'));
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@ import 'package:share_plus/share_plus.dart';
|
|||
import '../../shared/utils/validator_util.dart';
|
||||
|
||||
class ScheduleCompleteVisitPageModel extends FlutterFlowModel<ScheduleComplete> {
|
||||
late VoidCallback safeSetState;
|
||||
ScheduleCompleteVisitPageModel({this.safeSetState});
|
||||
|
||||
late VoidCallback? safeSetState;
|
||||
late Function(Function) updateState;
|
||||
final _visitHistoryManager = FutureRequestManager<ApiCallResponse>();
|
||||
late final String devUUID;
|
||||
|
@ -371,7 +373,7 @@ class ScheduleCompleteVisitPageModel extends FlutterFlowModel<ScheduleComplete>
|
|||
void switchTab(int index) {
|
||||
tabBarController?.animateTo(index);
|
||||
|
||||
safeSetState.call();
|
||||
safeSetState?.call();
|
||||
}
|
||||
|
||||
void setFormField() {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
|
@ -26,9 +25,7 @@ class ScheduleComplete extends StatefulWidget {
|
|||
const ScheduleComplete({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
State<StatefulWidget> createState() => throw UnimplementedError();
|
||||
}
|
||||
|
||||
class ScheduleCompleteVisitPageWidget extends ScheduleComplete {
|
||||
|
@ -52,8 +49,7 @@ class _ScheduleCompleteVisitPageWidgetState extends State<ScheduleCompleteVisitP
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => ScheduleCompleteVisitPageModel());
|
||||
_model.safeSetState = () => safeSetState(() {});
|
||||
_model = createModel(context, () => ScheduleCompleteVisitPageModel(safeSetState: () => safeSetState(() {})));
|
||||
_model.updateState = (Function fn) => safeSetState(fn());
|
||||
|
||||
_model.tabBarController = TabController(
|
||||
|
@ -758,12 +754,10 @@ class _ScheduleCompleteVisitPageWidgetState extends State<ScheduleCompleteVisitP
|
|||
padding: MediaQuery.viewInsetsOf(context),
|
||||
child: VisitorSearchModalTemplateComponentWidget(
|
||||
getVisitors: (visitorsParam) async {
|
||||
model.visitorJsonList = visitorsParam!.toList().cast<dynamic>();
|
||||
model.visitorJsonList = visitorsParam!.toList().cast<dynamic>();
|
||||
safeSetState(() {});
|
||||
},
|
||||
getDocs: (docsParam) async {
|
||||
model.visitorStrList = strListToStr(docsParam!.toList());
|
||||
model.visitorStrList = strListToStr(docsParam!.toList());
|
||||
safeSetState(() {});
|
||||
},
|
||||
|
|
|
@ -38,13 +38,14 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProv
|
|||
devUUID = (await StorageHelper().get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
userUUID = (await StorageHelper().get(SQLiteStorageKey.userUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
cliUUID = (await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
safeSetState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_model = createModel(context, () => ScheduleCompleteVisitPageModel());
|
||||
_model = createModel(context, () => ScheduleCompleteVisitPageModel(safeSetState: () => safeSetState(() {})));
|
||||
_initVariables();
|
||||
_visitFuture = _fetchVisits();
|
||||
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
// import 'dart:developer';
|
||||
|
||||
// import 'package:f_r_e_hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||
// import 'package:f_r_e_hub/flutter_flow/flutter_flow_theme.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
|
||||
// class TestPage extends StatelessWidget {
|
||||
// const TestPage({Key? key}) : super(key: key);
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// // Exemplo de dados para os HashMaps
|
||||
// final Map<String, String> labelsHashMap = {
|
||||
// 'Nome:': 'Gabriel da Silva',
|
||||
// 'Entrada:': '08:00 AM 01/01/2022',
|
||||
// 'Saída:': '17:00 PM 01/01/2022',
|
||||
// };
|
||||
|
||||
// // Ajuste para o novo tipo esperado pelo componente
|
||||
// final Map<String, Color> statusHashMap = {
|
||||
// 'Ativo': FlutterFlowTheme.of(context).success,
|
||||
// };
|
||||
|
||||
// // função set statusHashMap que recebe um String status faz um switch case e retorna um Map<String, Color>
|
||||
// Map<String, Color> getStatusHashMap(String status) {
|
||||
// switch (status) {
|
||||
// case 'Ativo':
|
||||
// return {'Ativo': FlutterFlowTheme.of(context).success};
|
||||
// case 'Inativo':
|
||||
// return {'Inativo': FlutterFlowTheme.of(context).error};
|
||||
// default:
|
||||
// return {'Desconhecido': FlutterFlowTheme.of(context).primaryColor};
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Ajuste para passar os valores corretos para a URL da imagem
|
||||
// final Map<String, String> imageKeyValue = {
|
||||
// 'key': 'docID',
|
||||
// 'value': 'imageType',
|
||||
// };
|
||||
|
||||
// return Scaffold(
|
||||
// appBar: AppBar(
|
||||
// title: const Text('Test Page'),
|
||||
// ),
|
||||
// body: Center(
|
||||
// child: ListView.builder(
|
||||
// itemCount: 10,
|
||||
// itemBuilder: (context, index) {
|
||||
// return CardItemTemplateComponentWidget(
|
||||
// labelsHashMap: labelsHashMap,
|
||||
// statusHashMap: statusHashMap,
|
||||
// imageHashMap: imageKeyValue,
|
||||
// onTapCardItemAction: () async {
|
||||
// // Ação ao tocar no card
|
||||
// },
|
||||
// );
|
||||
// }),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
|
@ -0,0 +1,54 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||
import 'package:hub/flutter_flow/internationalization.dart';
|
||||
import 'package:hub/pages/vehicles_on_the_property/vehicles_on_the_property.dart';
|
||||
|
||||
class VehicleModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
||||
static VehicleModel? _instance = VehicleModel._internal();
|
||||
VehicleModel._internal();
|
||||
factory VehicleModel() => _instance ?? VehicleModel._internal();
|
||||
static void resetInstance() => _instance = null;
|
||||
|
||||
dynamic item;
|
||||
|
||||
@override
|
||||
void initState(BuildContext context) {
|
||||
resetInstance();
|
||||
|
||||
initAsync();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {}
|
||||
|
||||
Future<void> initAsync() async {}
|
||||
|
||||
Widget buildVehicleDetails({
|
||||
required dynamic item,
|
||||
required BuildContext context,
|
||||
required VehicleModel model,
|
||||
}) {
|
||||
return DetailsComponentWidget(
|
||||
buttons: [],
|
||||
labelsHashMap: Map<String, String>.from({
|
||||
if (item['model'] != null && item['model'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:':
|
||||
item['model'].toString().toUpperCase(),
|
||||
if (item['licensePlate'] != null && item['licensePlate'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:':
|
||||
item['licensePlate'].toString().toUpperCase(),
|
||||
if (item['color'] != null && item['color'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Cor", enText: "Color")}:':
|
||||
item['color'].toString().toUpperCase(),
|
||||
if (item['personName'] != null && item['personName'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Proprietário", enText: "Owner")}:':
|
||||
item['personName'].toString().toUpperCase(),
|
||||
if (item['tag'] != null && item['tag'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:':
|
||||
item['tag'].toString().toUpperCase(),
|
||||
}),
|
||||
statusHashMap: [],
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,267 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/backend/api_requests/api_calls.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_theme.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
import 'package:hub/pages/vehicles_on_the_property/vehicle_model.dart';
|
||||
import 'package:hub/shared/utils/dialog_util.dart';
|
||||
import 'package:hub/shared/utils/limited_text_size.dart';
|
||||
import 'package:hub/shared/utils/log_util.dart';
|
||||
|
||||
class VehicleOnTheProperty extends StatefulWidget {
|
||||
const VehicleOnTheProperty({super.key});
|
||||
|
||||
@override
|
||||
_VehicleOnThePropertyState createState() => _VehicleOnThePropertyState();
|
||||
}
|
||||
|
||||
class _VehicleOnThePropertyState extends State<VehicleOnTheProperty> with TickerProviderStateMixin {
|
||||
late ScrollController _scrollController;
|
||||
|
||||
int _pageNumber = 1;
|
||||
bool _hasData = false;
|
||||
bool _loading = false;
|
||||
int count = 0;
|
||||
late final VehicleModel model;
|
||||
|
||||
late Future<void> _future;
|
||||
List<dynamic> _wrap = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
model = createModel(context, () => VehicleModel());
|
||||
_future = _fetchVisits();
|
||||
_scrollController = ScrollController()
|
||||
..addListener(() {
|
||||
if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) {
|
||||
_loadMore();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
late final limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
appBar: _appBar(context),
|
||||
body: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (_hasData == false && _pageNumber <= 1 && _loading == false)
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Nenhum veículo encontrado!",
|
||||
enText: "No vehicle found",
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: limitedHeaderTextSize,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
else if (_hasData == true || _pageNumber >= 1)
|
||||
Expanded(
|
||||
child: FutureBuilder<void>(
|
||||
future: _future,
|
||||
builder: (context, snapshot) {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
controller: _scrollController,
|
||||
itemCount: _wrap.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
// Add your item here
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 30, top: 10),
|
||||
child: Text(
|
||||
'',
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final item = _wrap[index - 1];
|
||||
return _item(context, item);
|
||||
}
|
||||
});
|
||||
},
|
||||
)),
|
||||
if (_hasData == true && _loading == true)
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 15, bottom: 15),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
].addToStart(const SizedBox(height: 0)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
PreferredSizeWidget _appBar(BuildContext context) {
|
||||
return AppBar(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(FFLocalizations.of(context).getVariableText(enText: 'Vehicles', ptText: 'Veículos'),
|
||||
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'),
|
||||
)),
|
||||
leading: _backButton(context, FlutterFlowTheme.of(context)),
|
||||
centerTitle: true,
|
||||
elevation: 0.0,
|
||||
actions: [],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _backButton(BuildContext context, FlutterFlowTheme theme) {
|
||||
return FlutterFlowIconButton(
|
||||
borderColor: Colors.transparent,
|
||||
borderRadius: 30.0,
|
||||
borderWidth: 1.0,
|
||||
buttonSize: 60.0,
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: theme.primaryText,
|
||||
size: 30.0,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
);
|
||||
}
|
||||
|
||||
Future<ApiCallResponse?> _fetchVisits() async {
|
||||
try {
|
||||
setState(() => _loading = true);
|
||||
|
||||
var response = await PhpGroup.getVehiclesByProperty.call(_pageNumber.toString());
|
||||
|
||||
final List<dynamic> vehicles = response.jsonBody['vehicles'] ?? [];
|
||||
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||
|
||||
if (vehicles.isNotEmpty) {
|
||||
setState(() {
|
||||
_wrap.addAll(vehicles);
|
||||
_hasData = true;
|
||||
_loading = false;
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
_showNoMoreDataSnackBar(context);
|
||||
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
|
||||
return null;
|
||||
} catch (e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Veículo", e, s);
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void _loadMore() {
|
||||
if (_hasData == true) {
|
||||
_pageNumber++;
|
||||
|
||||
_future = _fetchVisits();
|
||||
}
|
||||
}
|
||||
|
||||
void _showNoMoreDataSnackBar(BuildContext context) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Não há mais dados.",
|
||||
enText: "No more data.",
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: LimitedFontSizeUtil.getBodyFontSize(context),
|
||||
),
|
||||
),
|
||||
duration: const Duration(seconds: 3),
|
||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _item(BuildContext context, dynamic uItem) {
|
||||
return CardItemTemplateComponentWidget(
|
||||
imagePath: null,
|
||||
labelsHashMap: {
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:':
|
||||
uItem['licensePlate'] ?? '',
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:': uItem['model'] ?? '',
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:': uItem['tag'] ?? '',
|
||||
},
|
||||
statusHashMap: [],
|
||||
onTapCardItemAction: () async {
|
||||
await showDialog(
|
||||
useSafeArea: true,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Dialog(
|
||||
alignment: Alignment.center,
|
||||
child: model.buildVehicleDetails(
|
||||
item: uItem,
|
||||
context: context,
|
||||
model: model,
|
||||
),
|
||||
);
|
||||
},
|
||||
).whenComplete(() {
|
||||
safeSetState(() {
|
||||
_pageNumber = 1;
|
||||
_wrap = [];
|
||||
_future = _fetchVisits().then((value) => value!.jsonBody['vehicles'] ?? []);
|
||||
});
|
||||
}).catchError((e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Veículos", e, s);
|
||||
safeSetState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||
import 'package:hub/flutter_flow/internationalization.dart';
|
||||
import 'package:hub/pages/vehicles_on_the_property/vehicles_on_the_property.dart';
|
||||
import 'package:hub/shared/helpers/base_storage.dart';
|
||||
import 'package:hub/shared/helpers/storage_helper.dart';
|
||||
|
||||
class VisitsModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
||||
static VisitsModel? _instance;
|
||||
VisitsModel._internal({this.onRefresh});
|
||||
factory VisitsModel({VoidCallback? onRefresh}) => _instance ??= VisitsModel._internal(onRefresh: onRefresh);
|
||||
static void resetInstance() => _instance = null;
|
||||
late final VoidCallback? onRefresh;
|
||||
|
||||
late final String devUUID;
|
||||
late final String cliUUID;
|
||||
|
||||
dynamic item;
|
||||
|
||||
@override
|
||||
void initState(BuildContext context) {
|
||||
resetInstance();
|
||||
|
||||
initAsync();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {}
|
||||
|
||||
Future<void> initAsync() async {
|
||||
devUUID = (await StorageHelper().get(SQLiteStorageKey.devUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
cliUUID = (await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage)) ?? '';
|
||||
onRefresh?.call();
|
||||
}
|
||||
|
||||
Widget buildVisitDetails({
|
||||
required dynamic item,
|
||||
required BuildContext context,
|
||||
required VisitsModel model,
|
||||
}) {
|
||||
return DetailsComponentWidget(
|
||||
buttons: [],
|
||||
labelsHashMap: Map<String, String>.from({
|
||||
if (item['MOT_DESCRICAO'] != null && item['MOT_DESCRICAO'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Motivo",
|
||||
enText: "Reason",
|
||||
)}:': item['MOT_DESCRICAO'].toString().toUpperCase(),
|
||||
if (item['VTA_DTINICIO'] != null && item['VTA_DTINICIO'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Data de Início",
|
||||
enText: "Start Date",
|
||||
)}:': item['VTA_DTINICIO'].toString().toUpperCase(),
|
||||
if (item['VTA_VALIDADE'] != null && item['VTA_VALIDADE'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Validade",
|
||||
enText: "Validity",
|
||||
)}:': item['VTA_VALIDADE'].toString().toUpperCase(),
|
||||
if (item['VTA_FIXA'] != null && item['VTA_FIXA'] != '')
|
||||
'${FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Entrada Única",
|
||||
enText: "Single Entry",
|
||||
)}:': item['VTA_FIXA'] == true
|
||||
? FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Sim",
|
||||
enText: "Yes",
|
||||
)
|
||||
: FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Não",
|
||||
enText: "No",
|
||||
),
|
||||
}),
|
||||
imagePath:
|
||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${devUUID}&cliID=${cliUUID}&atividade=getFoto&Documento=${item['VDO_DOCUMENTO']}&tipo=E',
|
||||
statusHashMap: [
|
||||
if (item['VTA_FIXA'] != null)
|
||||
Map<String, Color>.from({
|
||||
item['VTA_FIXA']
|
||||
? FFLocalizations.of(context).getVariableText(ptText: "Entrada Única", enText: "Single Entry")
|
||||
: FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Entrada Recorrente", enText: "Recurrent Entry"): FlutterFlowTheme.of(context).warning
|
||||
}),
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,281 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hub/backend/api_requests/api_calls.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_theme.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
import 'package:hub/pages/visits_on_the_property/model.dart';
|
||||
import 'package:hub/shared/utils/dialog_util.dart';
|
||||
import 'package:hub/shared/utils/log_util.dart';
|
||||
import 'package:hub/shared/utils/limited_text_size.dart';
|
||||
|
||||
class VisitsOnTheProperty extends StatefulWidget {
|
||||
const VisitsOnTheProperty({super.key});
|
||||
|
||||
@override
|
||||
_VisitsOnThePropertyState createState() => _VisitsOnThePropertyState();
|
||||
}
|
||||
|
||||
class _VisitsOnThePropertyState extends State<VisitsOnTheProperty> with TickerProviderStateMixin {
|
||||
late ScrollController _scrollController;
|
||||
|
||||
int _pageNumber = 1;
|
||||
bool _hasData = false;
|
||||
bool _loading = false;
|
||||
int count = 0;
|
||||
late final VisitsModel model;
|
||||
|
||||
late Future<void> _future;
|
||||
List<dynamic> _list = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
model = createModel(context, () => VisitsModel(onRefresh: () => safeSetState(() {})));
|
||||
_future = _fetchVisits();
|
||||
|
||||
_scrollController = ScrollController()
|
||||
..addListener(() {
|
||||
if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) {
|
||||
_loadMore();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
late final limitedBodyTextSize = LimitedFontSizeUtil.getBodyFontSize(context);
|
||||
late final limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: _appBar(context),
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
body: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (_hasData == false && _pageNumber <= 1 && _loading == false)
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: "Nenhuma visita em aberto encontrada!", enText: "No opened visits found"),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: limitedHeaderTextSize,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
else if (_hasData == true || _pageNumber >= 1)
|
||||
Expanded(
|
||||
child: FutureBuilder<void>(
|
||||
future: _future,
|
||||
builder: (context, snapshot) {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
controller: _scrollController,
|
||||
itemCount: _list.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
// Add your item here
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 30, top: 10),
|
||||
child: Text(
|
||||
'',
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final item = _list[index - 1];
|
||||
return _item(context, item);
|
||||
}
|
||||
});
|
||||
},
|
||||
)),
|
||||
if (_hasData == true && _loading == true)
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 15, bottom: 15),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
].addToStart(const SizedBox(height: 0)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
PreferredSizeWidget _appBar(BuildContext context) {
|
||||
return AppBar(
|
||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(FFLocalizations.of(context).getVariableText(ptText: 'Visitas em aberto', enText: 'Opened visits'),
|
||||
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'),
|
||||
)),
|
||||
leading: _backButton(context, FlutterFlowTheme.of(context)),
|
||||
centerTitle: true,
|
||||
elevation: 0.0,
|
||||
actions: [],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _backButton(BuildContext context, FlutterFlowTheme theme) {
|
||||
return FlutterFlowIconButton(
|
||||
borderColor: Colors.transparent,
|
||||
borderRadius: 30.0,
|
||||
borderWidth: 1.0,
|
||||
buttonSize: 60.0,
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: theme.primaryText,
|
||||
size: 30.0,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
);
|
||||
}
|
||||
|
||||
Future<ApiCallResponse?> _fetchVisits() async {
|
||||
try {
|
||||
setState(() => _loading = true);
|
||||
|
||||
var response = await PhpGroup.getOpenedVisits.call(_pageNumber.toString());
|
||||
|
||||
final List<dynamic> visits = response.jsonBody['visitas'] ?? [];
|
||||
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||
|
||||
if (visits.isNotEmpty) {
|
||||
setState(() {
|
||||
_list.addAll(visits);
|
||||
_hasData = true;
|
||||
_loading = false;
|
||||
});
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
_showNoMoreDataSnackBar(context);
|
||||
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
|
||||
return null;
|
||||
} catch (e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s);
|
||||
setState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void _loadMore() {
|
||||
if (_hasData == true) {
|
||||
_pageNumber++;
|
||||
|
||||
_future = _fetchVisits();
|
||||
}
|
||||
}
|
||||
|
||||
void _showNoMoreDataSnackBar(BuildContext context) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: LimitedFontSizeUtil.getBodyFontSize(context),
|
||||
),
|
||||
),
|
||||
duration: const Duration(seconds: 3),
|
||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _item(BuildContext context, dynamic uItem) {
|
||||
return CardItemTemplateComponentWidget(
|
||||
imagePath:
|
||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${model.devUUID}&cliID=${model.cliUUID}&atividade=getFoto&Documento=${uItem['VDO_DOCUMENTO']}&tipo=E',
|
||||
labelsHashMap: {
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': uItem['VTA_NOME'] ?? '',
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Validade", enText: "Valids")}:':
|
||||
uItem['VTA_VALIDADE'] ?? '',
|
||||
'${FFLocalizations.of(context).getVariableText(ptText: "Motivo", enText: "Reason")}:':
|
||||
uItem['MOT_DESCRICAO'][0].toUpperCase() + uItem['MOT_DESCRICAO'].substring(1).toLowerCase(),
|
||||
},
|
||||
statusHashMap: [
|
||||
if (uItem['VTA_FIXA'] == true)
|
||||
{
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Recorrente',
|
||||
enText: 'Recurrent',
|
||||
): FlutterFlowTheme.of(context).warning,
|
||||
},
|
||||
if (uItem['VTA_FIXA'] == false)
|
||||
{
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText: 'Única',
|
||||
enText: 'Single',
|
||||
): FlutterFlowTheme.of(context).success,
|
||||
},
|
||||
],
|
||||
onTapCardItemAction: () async {
|
||||
await showDialog(
|
||||
useSafeArea: true,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Dialog(
|
||||
alignment: Alignment.center,
|
||||
child: model.buildVisitDetails(
|
||||
item: uItem,
|
||||
context: context,
|
||||
model: model,
|
||||
),
|
||||
);
|
||||
},
|
||||
).whenComplete(() {
|
||||
safeSetState(() {
|
||||
_pageNumber = 1;
|
||||
_list = [];
|
||||
_future = _fetchVisits().then((value) => value!.jsonBody['visitas'] ?? []);
|
||||
});
|
||||
}).catchError((e, s) {
|
||||
DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s);
|
||||
safeSetState(() {
|
||||
_hasData = false;
|
||||
_loading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:hub/shared/helpers/base_storage.dart';
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hub/shared/helpers/base_storage.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
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/flutter_flow_theme.dart';
|
||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||
import 'package:hub/pages/home_page/home_page_model.dart';
|
||||
|
||||
import '../../../components/organism_components/menu_component/menu_component_widget.dart';
|
||||
import '../../../flutter_flow/flutter_flow_theme.dart';
|
||||
|
||||
class CustomDrawer extends StatelessWidget {
|
||||
const CustomDrawer({super.key, required this.model});
|
||||
final HomePageModel model;
|
||||
|
@ -162,13 +160,9 @@ class CustomDrawer extends StatelessWidget {
|
|||
|
||||
Widget _buildDrawerBody() {
|
||||
return wrapWithModel(
|
||||
model: model.menuComponentModel,
|
||||
model: model.drawerMenuComponentModel,
|
||||
updateCallback: () {},
|
||||
child: const MenuComponentWidget(
|
||||
expandable: false,
|
||||
style: MenuView.list,
|
||||
item: MenuItem.tile,
|
||||
),
|
||||
child: MenuComponentWidget(model: model.drawerMenuComponentModel),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue