Refatoração do componente de menu; implementação do submenu de propriedades com páginas de veículos, animais de estimação, moradores e visitas abertas
This commit is contained in:
parent
4497df1b04
commit
3f7bb03fab
|
@ -28,8 +28,10 @@ linter:
|
||||||
# Additional information about this file can be found at
|
# Additional information about this file can be found at
|
||||||
# https://dart.dev/guides/language/analysis-options
|
# https://dart.dev/guides/language/analysis-options
|
||||||
|
|
||||||
|
|
||||||
analyzer:
|
analyzer:
|
||||||
|
errors:
|
||||||
|
curly_braces_in_flow_control_structures: ignore
|
||||||
|
use_build_context_synchronously: ignore
|
||||||
exclude:
|
exclude:
|
||||||
- lib/custom_code/**
|
- lib/custom_code/**
|
||||||
- lib/flutter_flow/custom_functions.dart
|
- lib/flutter_flow/custom_functions.dart
|
||||||
|
|
|
@ -24,20 +24,17 @@ class PhpGroup {
|
||||||
static ForgotPasswordCall forgotPasswordCall = ForgotPasswordCall();
|
static ForgotPasswordCall forgotPasswordCall = ForgotPasswordCall();
|
||||||
static ChangePasswordCall changePasswordCall = ChangePasswordCall();
|
static ChangePasswordCall changePasswordCall = ChangePasswordCall();
|
||||||
static GetLocalsCall getLocalsCall = GetLocalsCall();
|
static GetLocalsCall getLocalsCall = GetLocalsCall();
|
||||||
static PostScheduleVisitorCall postScheduleVisitorCall =
|
static PostScheduleVisitorCall postScheduleVisitorCall = PostScheduleVisitorCall();
|
||||||
PostScheduleVisitorCall();
|
|
||||||
static PostScheduleVisitCall postScheduleVisitCall = PostScheduleVisitCall();
|
static PostScheduleVisitCall postScheduleVisitCall = PostScheduleVisitCall();
|
||||||
static GetScheduleVisitCall getScheduleVisitCall = GetScheduleVisitCall();
|
static GetScheduleVisitCall getScheduleVisitCall = GetScheduleVisitCall();
|
||||||
static GetDadosCall getDadosCall = GetDadosCall();
|
static GetDadosCall getDadosCall = GetDadosCall();
|
||||||
static GetVisitorByDocCall getVisitorByDocCall = GetVisitorByDocCall();
|
static GetVisitorByDocCall getVisitorByDocCall = GetVisitorByDocCall();
|
||||||
static GetFotoVisitanteCall getFotoVisitanteCall = GetFotoVisitanteCall();
|
static GetFotoVisitanteCall getFotoVisitanteCall = GetFotoVisitanteCall();
|
||||||
static PostProvVisitSchedulingCall postProvVisitSchedulingCall =
|
static PostProvVisitSchedulingCall postProvVisitSchedulingCall = PostProvVisitSchedulingCall();
|
||||||
PostProvVisitSchedulingCall();
|
|
||||||
static GetVisitsCall getVisitsCall = GetVisitsCall();
|
static GetVisitsCall getVisitsCall = GetVisitsCall();
|
||||||
static DeleteVisitCall deleteVisitCall = DeleteVisitCall();
|
static DeleteVisitCall deleteVisitCall = DeleteVisitCall();
|
||||||
static GetPessoasLocalCall getPessoasLocalCall = GetPessoasLocalCall();
|
static GetPessoasLocalCall getPessoasLocalCall = GetPessoasLocalCall();
|
||||||
static RespondeSolicitacaoCall respondeSolicitacaoCall =
|
static RespondeSolicitacaoCall respondeSolicitacaoCall = RespondeSolicitacaoCall();
|
||||||
RespondeSolicitacaoCall();
|
|
||||||
static GetAccessCall getAccessCall = GetAccessCall();
|
static GetAccessCall getAccessCall = GetAccessCall();
|
||||||
static GetLiberationsCall getLiberationsCall = GetLiberationsCall();
|
static GetLiberationsCall getLiberationsCall = GetLiberationsCall();
|
||||||
static GetMessagesCall getMessagesCall = GetMessagesCall();
|
static GetMessagesCall getMessagesCall = GetMessagesCall();
|
||||||
|
@ -54,6 +51,103 @@ class PhpGroup {
|
||||||
static GetPets getPets = GetPets();
|
static GetPets getPets = GetPets();
|
||||||
static GetPetPhoto getPetPhoto = GetPetPhoto();
|
static GetPetPhoto getPetPhoto = GetPetPhoto();
|
||||||
static UnregisterDevice unregisterDevice = UnregisterDevice();
|
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 = StorageUtil().devUUID;
|
||||||
|
final String userUUID = StorageUtil().userUUID;
|
||||||
|
final String cliID = StorageUtil().cliUUID;
|
||||||
|
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 = StorageUtil().devUUID;
|
||||||
|
final String userUUID = StorageUtil().userUUID;
|
||||||
|
final String cliID = StorageUtil().cliUUID;
|
||||||
|
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 = StorageUtil().devUUID;
|
||||||
|
final String userUUID = StorageUtil().userUUID;
|
||||||
|
final String cliID = StorageUtil().cliUUID;
|
||||||
|
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 {
|
class UnregisterDevice {
|
||||||
|
@ -155,9 +249,7 @@ class UpdatePet {
|
||||||
'species': species,
|
'species': species,
|
||||||
'breed': breed,
|
'breed': breed,
|
||||||
if (color != '') 'color': color,
|
if (color != '') 'color': color,
|
||||||
if (birthdayDate != '')
|
if (birthdayDate != '') 'birthdayDate': ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
||||||
'birthdayDate':
|
|
||||||
ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
|
||||||
'gender': gender,
|
'gender': gender,
|
||||||
'size': size,
|
'size': size,
|
||||||
if (notes != '') 'notes': notes,
|
if (notes != '') 'notes': notes,
|
||||||
|
@ -174,7 +266,10 @@ class UpdatePet {
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetPets {
|
class GetPets {
|
||||||
Future<ApiCallResponse> call({final int? page, final int? pageSize,}) async {
|
Future<ApiCallResponse> call({
|
||||||
|
final int? page,
|
||||||
|
final int? pageSize,
|
||||||
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID = StorageUtil().devUUID;
|
final String devUUID = StorageUtil().devUUID;
|
||||||
|
@ -276,9 +371,7 @@ class RegisterPet {
|
||||||
'species': species,
|
'species': species,
|
||||||
'breed': breed,
|
'breed': breed,
|
||||||
if (color != '') 'color': color,
|
if (color != '') 'color': color,
|
||||||
if (birthdayDate != '')
|
if (birthdayDate != '') 'birthdayDate': ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
||||||
'birthdayDate':
|
|
||||||
ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
|
||||||
'gender': gender,
|
'gender': gender,
|
||||||
'size': size,
|
'size': size,
|
||||||
if (notes != '') 'notes': notes,
|
if (notes != '') 'notes': notes,
|
||||||
|
@ -652,7 +745,6 @@ class RegisterCall {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ChangePasswordCall {
|
class ChangePasswordCall {
|
||||||
Future<ApiCallResponse> call({
|
Future<ApiCallResponse> call({
|
||||||
required final String email,
|
required final String email,
|
||||||
|
@ -696,7 +788,6 @@ class ForgotPasswordCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
callName: 'forgotPassword',
|
callName: 'forgotPassword',
|
||||||
apiUrl: '$baseUrl/iforgot.php',
|
apiUrl: '$baseUrl/iforgot.php',
|
||||||
|
@ -1181,8 +1272,7 @@ class GetDadosCall {
|
||||||
response,
|
response,
|
||||||
r'''$.error_msg''',
|
r'''$.error_msg''',
|
||||||
));
|
));
|
||||||
String? visitedDesNomeStr(dynamic response) =>
|
String? visitedDesNomeStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.DES_NOME''',
|
r'''$.visitado.DES_NOME''',
|
||||||
));
|
));
|
||||||
|
@ -1190,33 +1280,27 @@ class GetDadosCall {
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_ID''',
|
r'''$.visitado.VDO_ID''',
|
||||||
));
|
));
|
||||||
String? visitedVDOTNomeStr(dynamic response) =>
|
String? visitedVDOTNomeStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_NOME''',
|
r'''$.visitado.VDO_NOME''',
|
||||||
));
|
));
|
||||||
String? visitedVDOTipoStr(dynamic response) =>
|
String? visitedVDOTipoStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_TIPO''',
|
r'''$.visitado.VDO_TIPO''',
|
||||||
));
|
));
|
||||||
String? visitedVDOImeiStr(dynamic response) =>
|
String? visitedVDOImeiStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_IMEI''',
|
r'''$.visitado.VDO_IMEI''',
|
||||||
));
|
));
|
||||||
String? visitedVDODocumentoStr(dynamic response) =>
|
String? visitedVDODocumentoStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_DOCUMENTO''',
|
r'''$.visitado.VDO_DOCUMENTO''',
|
||||||
));
|
));
|
||||||
String? visitedVDOEmailStr(dynamic response) =>
|
String? visitedVDOEmailStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_EMAIL''',
|
r'''$.visitado.VDO_EMAIL''',
|
||||||
));
|
));
|
||||||
String? visitedVDOStatusWebStr(dynamic response) =>
|
String? visitedVDOStatusWebStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_STATUSWEB''',
|
r'''$.visitado.VDO_STATUSWEB''',
|
||||||
));
|
));
|
||||||
|
@ -1264,8 +1348,7 @@ class GetDadosCall {
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.DES_ID''',
|
r'''$.visitado.DES_ID''',
|
||||||
));
|
));
|
||||||
String? visitedVDoNotTerceirosStr(dynamic response) =>
|
String? visitedVDoNotTerceirosStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_NOTTERCEIROS''',
|
r'''$.visitado.VDO_NOTTERCEIROS''',
|
||||||
));
|
));
|
||||||
|
@ -1334,8 +1417,7 @@ class GetDadosCall {
|
||||||
.map((x) => castToType<String>(x))
|
.map((x) => castToType<String>(x))
|
||||||
.withoutNulls
|
.withoutNulls
|
||||||
.toList();
|
.toList();
|
||||||
List<String>? levelNACIndPermiteReentradaStrList(dynamic response) =>
|
List<String>? levelNACIndPermiteReentradaStrList(dynamic response) => (getJsonField(
|
||||||
(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.niveis[:].NAC_INDPERMITEREENTRADA''',
|
r'''$.niveis[:].NAC_INDPERMITEREENTRADA''',
|
||||||
true,
|
true,
|
||||||
|
@ -1353,8 +1435,7 @@ class GetDadosCall {
|
||||||
.map((x) => castToType<String>(x))
|
.map((x) => castToType<String>(x))
|
||||||
.withoutNulls
|
.withoutNulls
|
||||||
.toList();
|
.toList();
|
||||||
List<String>? levelNACTempoAntiCaronaStrList(dynamic response) =>
|
List<String>? levelNACTempoAntiCaronaStrList(dynamic response) => (getJsonField(
|
||||||
(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.niveis[:].NAC_TEMPOANTICARONA''',
|
r'''$.niveis[:].NAC_TEMPOANTICARONA''',
|
||||||
true,
|
true,
|
||||||
|
@ -1944,7 +2025,6 @@ class RespondeSolicitacaoCall {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class GetAccessCall {
|
class GetAccessCall {
|
||||||
Future<ApiCallResponse> call({
|
Future<ApiCallResponse> call({
|
||||||
final String? pageSize,
|
final String? pageSize,
|
||||||
|
@ -2195,6 +2275,7 @@ class GetAccessCall {
|
||||||
.withoutNulls
|
.withoutNulls
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetLiberationsCall {
|
class GetLiberationsCall {
|
||||||
Stream<ApiCallResponse> call() {
|
Stream<ApiCallResponse> call() {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
@ -2384,6 +2465,7 @@ class GetLiberationsCall {
|
||||||
.withoutNulls
|
.withoutNulls
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetMessagesCall {
|
class GetMessagesCall {
|
||||||
Future<ApiCallResponse> call({
|
Future<ApiCallResponse> call({
|
||||||
final String? pageSize,
|
final String? pageSize,
|
||||||
|
@ -2438,8 +2520,7 @@ class ApiPagingParams {
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() =>
|
String toString() => 'PagingParams(nextPageNumber: $nextPageNumber, numItems: $numItems, lastResponse: $lastResponse,)';
|
||||||
'PagingParams(nextPageNumber: $nextPageNumber, numItems: $numItems, lastResponse: $lastResponse,)';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String _toEncodable(dynamic item) {
|
String _toEncodable(dynamic item) {
|
||||||
|
|
|
@ -22,8 +22,7 @@ extension FFEnumExtensions<T extends Enum> on T {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension FFEnumListExtensions<T extends Enum> on Iterable<T> {
|
extension FFEnumListExtensions<T extends Enum> on Iterable<T> {
|
||||||
T? deserialize(String? value) =>
|
T? deserialize(String? value) => firstWhereOrNull((e) => e.serialize() == value);
|
||||||
firstWhereOrNull((e) => e.serialize() == value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
T? deserializeEnum<T>(String? value) {
|
T? deserializeEnum<T>(String? value) {
|
||||||
|
|
|
@ -2,27 +2,24 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
|
import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/extensions/dialog_extensions.dart';
|
||||||
import 'package:hub/shared/utils/storage_util.dart';
|
import 'package:hub/shared/services/localization/localization_service.dart';
|
||||||
|
|
||||||
import '../../../shared/extensions/dialog_extensions.dart';
|
|
||||||
import '../../../shared/services/localization/localization_service.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class MenuButtonWidget extends MenuEntry {
|
class MenuButtonWidget extends MenuEntry {
|
||||||
const MenuButtonWidget({
|
const MenuButtonWidget({
|
||||||
super.key,
|
super.key,
|
||||||
this.action,
|
required this.action,
|
||||||
this.title,
|
required this.title,
|
||||||
this.icon,
|
required this.icon,
|
||||||
});
|
required super.safeSetState,
|
||||||
|
}) : super(action: action, title: title, icon: icon);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Function()? action;
|
final Function() action;
|
||||||
@override
|
@override
|
||||||
final String? title;
|
final String title;
|
||||||
@override
|
@override
|
||||||
final IconData? icon;
|
final IconData icon;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MenuButtonWidgetState createState() => _MenuButtonWidgetState();
|
_MenuButtonWidgetState createState() => _MenuButtonWidgetState();
|
||||||
|
@ -32,7 +29,6 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
|
||||||
get action => action;
|
get action => action;
|
||||||
bool _isProcessing = false;
|
bool _isProcessing = false;
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
|
@ -40,21 +36,23 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
|
||||||
focusColor: Colors.transparent,
|
focusColor: Colors.transparent,
|
||||||
hoverColor: Colors.transparent,
|
hoverColor: Colors.transparent,
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
onTap: _isProcessing ? null : () async {
|
onTap: _isProcessing
|
||||||
setState(() {
|
? null
|
||||||
_isProcessing = true;
|
: () async {
|
||||||
});
|
setState(() {
|
||||||
await LocalizationService.processLocals(context).then((value) async {
|
_isProcessing = true;
|
||||||
if (value) {
|
});
|
||||||
await widget.action?.call();
|
await LocalizationService.processLocals(context).then((value) async {
|
||||||
} else {
|
if (value) {
|
||||||
DialogUnavailable.unavailableCredentials(context);
|
await widget.action.call();
|
||||||
}
|
} else {
|
||||||
});
|
DialogUnavailable.unavailableCredentials(context);
|
||||||
setState(() {
|
}
|
||||||
_isProcessing = false;
|
});
|
||||||
});
|
setState(() {
|
||||||
},
|
_isProcessing = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
|
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -110,8 +108,7 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
useGoogleFonts:
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
|
||||||
GoogleFonts.asMap().containsKey('Nunito'),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -9,17 +9,18 @@ import '../../../shared/services/localization/localization_service.dart';
|
||||||
class MenuCardItem extends MenuEntry {
|
class MenuCardItem extends MenuEntry {
|
||||||
const MenuCardItem({
|
const MenuCardItem({
|
||||||
super.key,
|
super.key,
|
||||||
this.action,
|
required this.action,
|
||||||
this.title,
|
required this.title,
|
||||||
this.icon,
|
required this.icon,
|
||||||
});
|
required super.safeSetState,
|
||||||
|
}) : super(action: action, title: title, icon: icon);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Function()? action;
|
final Function() action;
|
||||||
@override
|
@override
|
||||||
final String? title;
|
final String title;
|
||||||
@override
|
@override
|
||||||
final IconData? icon;
|
final IconData icon;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MenuCardItemState createState() => _MenuCardItemState();
|
_MenuCardItemState createState() => _MenuCardItemState();
|
||||||
|
@ -36,21 +37,23 @@ class _MenuCardItemState extends State<MenuCardItem> {
|
||||||
focusColor: Colors.transparent,
|
focusColor: Colors.transparent,
|
||||||
hoverColor: Colors.transparent,
|
hoverColor: Colors.transparent,
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
onTap: _isProcessing ? null : () async {
|
onTap: _isProcessing
|
||||||
setState(() {
|
? null
|
||||||
_isProcessing = true;
|
: () async {
|
||||||
});
|
setState(() {
|
||||||
await LocalizationService.processLocals(context).then((value) async {
|
_isProcessing = true;
|
||||||
if (value) {
|
});
|
||||||
await widget.action?.call();
|
await LocalizationService.processLocals(context).then((value) async {
|
||||||
} else {
|
if (value) {
|
||||||
DialogUnavailable.unavailableCredentials(context);
|
await widget.action.call();
|
||||||
}
|
} else {
|
||||||
});
|
DialogUnavailable.unavailableCredentials(context);
|
||||||
setState(() {
|
}
|
||||||
_isProcessing = false;
|
});
|
||||||
});
|
setState(() {
|
||||||
},
|
_isProcessing = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
child: Card(
|
child: Card(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
@ -61,8 +64,7 @@ class _MenuCardItemState extends State<MenuCardItem> {
|
||||||
Align(
|
Align(
|
||||||
alignment: const AlignmentDirectional(-1.0, 0.0),
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding: const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 10.0, 0.0),
|
||||||
const EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 10.0, 0.0),
|
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 30.0,
|
width: 30.0,
|
||||||
height: 30.0,
|
height: 30.0,
|
||||||
|
|
|
@ -1,14 +1,38 @@
|
||||||
import 'package:flutter/material.dart';
|
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 {
|
abstract class MenuEntry extends StatefulWidget {
|
||||||
const MenuEntry({
|
const MenuEntry({
|
||||||
super.key,
|
super.key,
|
||||||
this.action,
|
required this.action,
|
||||||
this.title,
|
required this.title,
|
||||||
this.icon,
|
required this.icon,
|
||||||
|
required this.safeSetState,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Function()? action;
|
final Function() action;
|
||||||
final String? title;
|
final String title;
|
||||||
final IconData? icon;
|
final IconData icon;
|
||||||
|
final VoidCallback safeSetState;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,52 +1,195 @@
|
||||||
import 'package:flutter/material.dart';
|
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/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/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/extensions/dialog_extensions.dart';
|
import 'package:hub/shared/extensions/dialog_extensions.dart';
|
||||||
import 'package:hub/shared/services/authentication/authentication_service.dart';
|
import 'package:hub/shared/services/authentication/authentication_service.dart';
|
||||||
import 'package:hub/shared/utils/storage_util.dart';
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import '../../../shared/services/localization/localization_service.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> {
|
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;
|
bool isGrid = false;
|
||||||
|
|
||||||
late MenuListViewComponentModel menuListViewComponentModel;
|
late MenuListViewComponentModel menuListViewComponentModel;
|
||||||
late MenuStaggeredViewComponentModel menuStaggeredViewComponentModel;
|
late MenuStaggeredViewComponentModel menuStaggeredViewComponentModel;
|
||||||
|
late VoidCallback safeSetState;
|
||||||
|
late List<MenuEntry?> menuEntries;
|
||||||
|
|
||||||
@override void initState(BuildContext context) {
|
@override
|
||||||
menuListViewComponentModel =
|
void initState(BuildContext context) {
|
||||||
createModel(context, () => MenuListViewComponentModel());
|
menuListViewComponentModel = createModel(context, () => MenuListViewComponentModel());
|
||||||
menuStaggeredViewComponentModel =
|
menuStaggeredViewComponentModel = createModel(context, () => MenuStaggeredViewComponentModel());
|
||||||
createModel(context, () => MenuStaggeredViewComponentModel());
|
|
||||||
}
|
}
|
||||||
@override void dispose() {
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
menuListViewComponentModel.dispose();
|
menuListViewComponentModel.dispose();
|
||||||
menuStaggeredViewComponentModel.dispose();
|
menuStaggeredViewComponentModel.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future changeMenuStyle(BuildContext context) async {
|
List<MenuEntry?> generateMenuEntries(BuildContext context, MenuItem item, List<MenuOption> options) {
|
||||||
isGrid = !isGrid;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// ABOUT THE VISITORS
|
||||||
|
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.WorkersOnTheProperty))
|
||||||
|
addMenuEntry(Icons.engineering_outlined, 'Schedule Providers', 'Agendar Prestadores', () async {
|
||||||
|
if (StorageUtil().provisional)
|
||||||
|
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 (StorageUtil().provisional)
|
||||||
|
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 (StorageUtil().whatsapp)
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
|
||||||
|
/// ABOUT THE PROPERTY
|
||||||
|
if (options.contains(MenuOption.AboutProperty))
|
||||||
|
addMenuEntry(Icons.home, 'About Property', 'Sobre a Propriedade', () async {
|
||||||
|
if (StorageUtil().whatsapp)
|
||||||
|
await open(context, '/aboutProperty');
|
||||||
|
else
|
||||||
|
DialogUnavailable.unavailableFeature(context);
|
||||||
|
safeSetState;
|
||||||
|
});
|
||||||
|
if (options.contains(MenuOption.PetsOnTheProperty))
|
||||||
|
addMenuEntry(Icons.pets, 'My Pets', 'Meus Pets', () async {
|
||||||
|
if (StorageUtil().pets)
|
||||||
|
await open(context, '/petsOnThePropertyPage');
|
||||||
|
else
|
||||||
|
DialogUnavailable.unavailableFeature(context);
|
||||||
|
safeSetState;
|
||||||
|
});
|
||||||
|
if (options.contains(MenuOption.ResidentsOnTheProperty))
|
||||||
|
addMenuEntry(Icons.groups, 'Live With Me', 'Moram Comigo', () async {
|
||||||
|
await open(context, '/peopleOnThePropertyPage');
|
||||||
|
safeSetState;
|
||||||
|
});
|
||||||
|
if (options.contains(MenuOption.VehiclesOnTheProperty))
|
||||||
|
addMenuEntry(Symbols.directions_car, 'My Vehicles', 'Meus 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.PackagesOnTheProperty))
|
||||||
|
addMenuEntry(Icons.inventory_2_outlined, 'My Orders', 'Minhas Encomendas', () async {
|
||||||
|
if (StorageUtil().whatsapp)
|
||||||
|
await open(context, '/packageOrder');
|
||||||
|
else
|
||||||
|
DialogUnavailable.unavailableFeature(context);
|
||||||
|
safeSetState;
|
||||||
|
});
|
||||||
|
|
||||||
|
/// ABOUT THE RESIDENTS
|
||||||
|
if (options.contains(MenuOption.PetsRegister))
|
||||||
|
addMenuEntry(Icons.pets, 'Pets Register', 'Cadastrar Pet', () async {
|
||||||
|
if (StorageUtil().pets)
|
||||||
|
await open(context, '/petsPage');
|
||||||
|
else
|
||||||
|
DialogUnavailable.unavailableFeature(context);
|
||||||
|
safeSetState;
|
||||||
|
});
|
||||||
|
if (options.contains(MenuOption.ReservationsOnTheLocal))
|
||||||
|
addMenuEntry(Icons.event_available, 'Reservations', 'Reservas', () async {
|
||||||
|
if (StorageUtil().whatsapp)
|
||||||
|
await open(context, '/reservation');
|
||||||
|
else
|
||||||
|
DialogUnavailable.unavailableFeature(context);
|
||||||
|
|
||||||
|
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.AccessOnTheProperty))
|
||||||
|
addMenuEntry(Icons.transfer_within_a_station_outlined, 'Access History', 'Consultar Acessos', () async {
|
||||||
|
await open(context, '/acessHistoryPage');
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
|
||||||
|
/// ABOUT THE SYSTEM
|
||||||
|
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 openQRCodeScanner(BuildContext context) async {
|
|
||||||
context.push(
|
Future open(BuildContext context, String link) async {
|
||||||
'/qrCodePage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Future openCompleteSchedule(BuildContext context) async {
|
|
||||||
context.push(
|
context.push(
|
||||||
'/scheduleCompleteVisitPage',
|
link,
|
||||||
extra: <String, dynamic>{
|
extra: <String, dynamic>{
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
hasTransition: true,
|
hasTransition: true,
|
||||||
|
@ -56,57 +199,20 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Future openDeliverySchedule(BuildContext context) async {
|
|
||||||
final bool isProvisional = StorageUtil().provisional;
|
Future out(BuildContext context) async {
|
||||||
if (isProvisional == true) {
|
final String title = FFLocalizations.of(context).getVariableText(
|
||||||
context.push(
|
ptText: 'Sair',
|
||||||
'/deliverySchedule',
|
enText: 'Logout',
|
||||||
extra: <String, dynamic>{
|
);
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
final String content = FFLocalizations.of(context).getVariableText(
|
||||||
hasTransition: true,
|
ptText: 'Tem certeza que deseja sair?',
|
||||||
transitionType: PageTransitionType.scale,
|
enText: 'Are you sure you want to logout?',
|
||||||
alignment: Alignment.bottomCenter,
|
);
|
||||||
),
|
showAlertDialog(context, title, content, () async => await AuthenticationService.signOut(context));
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
DialogUnavailable.unavailableFeature(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Future openProvisionalSchedule(BuildContext context) async {
|
|
||||||
final isProvisional = StorageUtil().provisional;
|
|
||||||
if (isProvisional == true) {
|
|
||||||
context.push(
|
|
||||||
'/provisionalSchedule',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
DialogUnavailable.unavailableFeature(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Future openFastPassSchedule(BuildContext context) async {
|
|
||||||
final isWpp = StorageUtil().whatsapp;
|
/// LEGACY FEATURES
|
||||||
if (isWpp) {
|
|
||||||
context.push(
|
|
||||||
'/fastPassPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
DialogUnavailable.unavailableFeature(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Future showSchedules(BuildContext context) async {
|
Future showSchedules(BuildContext context) async {
|
||||||
final routesListStr = <String>[
|
final routesListStr = <String>[
|
||||||
'scheduleProvisionalVisitPage',
|
'scheduleProvisionalVisitPage',
|
||||||
|
@ -146,91 +252,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Future openVisitorsRegister(BuildContext context) async {
|
|
||||||
context.push(
|
|
||||||
'/registerVisitorPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Future openPoepleOnTheProperty(BuildContext context) async {
|
|
||||||
context.push(
|
|
||||||
'/peopleOnThePropertyPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Future<void> Logout(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 openPreferencesSettings(BuildContext context) async {
|
|
||||||
context.push(
|
|
||||||
'/preferencesSettings',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Future openMyOrders(BuildContext context) async {
|
|
||||||
final isWpp = StorageUtil().whatsapp;
|
|
||||||
if (isWpp) {
|
|
||||||
context.push(
|
|
||||||
'/packageOrder',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
DialogUnavailable.unavailableFeature(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Future openReservations(BuildContext context) async {
|
|
||||||
final isWpp = StorageUtil().whatsapp;
|
|
||||||
if (isWpp) {
|
|
||||||
context.push(
|
|
||||||
'/reservation',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
DialogUnavailable.unavailableFeature(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Future showHistories(BuildContext context) async {
|
Future showHistories(BuildContext context) async {
|
||||||
await showAdaptiveDialog(
|
await showAdaptiveDialog(
|
||||||
// isScrollControlled: true,
|
// isScrollControlled: true,
|
||||||
|
@ -241,12 +263,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
padding: MediaQuery.viewInsetsOf(context),
|
||||||
child: OptionSelectionModalWidget(
|
child: OptionSelectionModalWidget(
|
||||||
routesListStr: const <String>[
|
routesListStr: const <String>['liberationHistory', 'acessHistoryPage', 'scheduleCompleteVisitPage', 'messageHistoryPage'],
|
||||||
'liberationHistory',
|
|
||||||
'acessHistoryPage',
|
|
||||||
'scheduleCompleteVisitPage',
|
|
||||||
'messageHistoryPage'
|
|
||||||
],
|
|
||||||
iconsListIcon: const <IconData>[
|
iconsListIcon: const <IconData>[
|
||||||
Icons.history_rounded,
|
Icons.history_rounded,
|
||||||
Icons.history_rounded,
|
Icons.history_rounded,
|
||||||
|
@ -276,72 +293,4 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Future openLiberationsHistory(BuildContext context) async {
|
|
||||||
context.push(
|
|
||||||
'/liberationHistory',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Future openAccessHistory(BuildContext context) async {
|
|
||||||
context.push(
|
|
||||||
'/acessHistoryPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Future openVisitsHistory(BuildContext context) async {
|
|
||||||
context.push(
|
|
||||||
'/scheduleCompleteVisitPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Future openMessagesHistory(BuildContext context) async {
|
|
||||||
context.push(
|
|
||||||
'/messageHistoryPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Future openPetsRegister(BuildContext context) async {
|
|
||||||
bool isPet = StorageUtil().pets;
|
|
||||||
if (isPet) {
|
|
||||||
context.push(
|
|
||||||
'/petsPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
DialogUnavailable.unavailableFeature(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,617 +12,68 @@ import 'menu_component_model.dart';
|
||||||
export 'menu_component_model.dart';
|
export 'menu_component_model.dart';
|
||||||
|
|
||||||
class MenuComponentWidget extends StatefulWidget {
|
class MenuComponentWidget extends StatefulWidget {
|
||||||
const MenuComponentWidget({
|
final MenuComponentModel model;
|
||||||
Key? key,
|
const MenuComponentWidget({super.key, required this.model});
|
||||||
required this.style,
|
|
||||||
required this.item,
|
|
||||||
required this.expandable,
|
|
||||||
});
|
|
||||||
final MenuView style;
|
|
||||||
final MenuItem item;
|
|
||||||
final bool expandable;
|
|
||||||
@override
|
@override
|
||||||
State<MenuComponentWidget> createState() => _MenuComponentWidgetState();
|
State<MenuComponentWidget> createState() => _MenuComponentWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MenuComponentWidgetState extends State<MenuComponentWidget> {
|
class _MenuComponentWidgetState extends State<MenuComponentWidget> {
|
||||||
late MenuComponentModel _model;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void setState(VoidCallback callback) {
|
void setState(VoidCallback callback) {
|
||||||
super.setState(callback);
|
super.setState(callback);
|
||||||
_model.onUpdate();
|
widget.model.onUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.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
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_model.maybeDispose();
|
widget.model.maybeDispose();
|
||||||
|
|
||||||
super.dispose();
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
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',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
MenuCardItem(icon: null, action: () {}, title: ''),
|
|
||||||
];
|
|
||||||
}();
|
|
||||||
|
|
||||||
return Builder(
|
return Builder(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
if (widget.style == MenuView.list_grid &&
|
if (widget.model.style == MenuView.list_grid)
|
||||||
widget.expandable == true &&
|
|
||||||
widget.item == MenuItem.button) {
|
|
||||||
if (_model.isGrid == true) {
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
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(
|
return wrapWithModel(
|
||||||
model: _model.menuListViewComponentModel,
|
model: widget.model.menuStaggeredViewComponentModel,
|
||||||
|
updateCallback: () => setState(() {}),
|
||||||
|
updateOnChange: true,
|
||||||
|
child: MenuStaggeredViewComponentWidget(
|
||||||
|
options: widget.model.menuEntries,
|
||||||
|
expandable: widget.model.expandable,
|
||||||
|
item: widget.model.item,
|
||||||
|
changeMenuStyle: () async {},
|
||||||
|
isGrid: widget.model.isGrid,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (widget.model.style == MenuView.list)
|
||||||
|
return wrapWithModel(
|
||||||
|
model: widget.model.menuListViewComponentModel,
|
||||||
updateCallback: () => setState(() {}),
|
updateCallback: () => setState(() {}),
|
||||||
updateOnChange: true,
|
updateOnChange: true,
|
||||||
child: MenuListViewComponentWidget(
|
child: MenuListViewComponentWidget(
|
||||||
options: options,
|
options: widget.model.menuEntries,
|
||||||
expandable: widget.expandable,
|
expandable: widget.model.expandable,
|
||||||
item: widget.item,
|
item: widget.model.item,
|
||||||
changeMenuStyle: () async {
|
changeMenuStyle: () async {},
|
||||||
await _model.changeMenuStyle(context);
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,13 +2,10 @@ import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'menu_list_view_component_widget.dart' show MenuListViewComponentWidget;
|
import 'menu_list_view_component_widget.dart' show MenuListViewComponentWidget;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MenuListViewComponentModel extends FlutterFlowModel<MenuListViewComponentWidget> {
|
||||||
|
|
||||||
class MenuListViewComponentModel
|
|
||||||
extends FlutterFlowModel<MenuListViewComponentWidget> {
|
|
||||||
@override
|
@override
|
||||||
void initState(BuildContext context) {}
|
void initState(BuildContext context) {}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {}
|
void dispose() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,16 +23,14 @@ class MenuListViewComponentWidget extends StatefulWidget {
|
||||||
final bool expandable;
|
final bool expandable;
|
||||||
final MenuItem item;
|
final MenuItem item;
|
||||||
|
|
||||||
final List<MenuEntry> options;
|
final List<MenuEntry?> options;
|
||||||
final Future Function()? changeMenuStyle;
|
final Future Function()? changeMenuStyle;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MenuListViewComponentWidget> createState() =>
|
State<MenuListViewComponentWidget> createState() => _MenuListViewComponentWidgetState();
|
||||||
_MenuListViewComponentWidgetState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MenuListViewComponentWidgetState
|
class _MenuListViewComponentWidgetState extends State<MenuListViewComponentWidget> {
|
||||||
extends State<MenuListViewComponentWidget> {
|
|
||||||
late MenuListViewComponentModel _model;
|
late MenuListViewComponentModel _model;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -75,8 +73,7 @@ class _MenuListViewComponentWidgetState
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: SizedBox(
|
child: SizedBox(height: 115, width: 115, child: widget.options[index]),
|
||||||
height: 115, width: 115, child: widget.options[index]),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -95,8 +92,7 @@ class _MenuListViewComponentWidgetState
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: SizedBox(
|
child: SizedBox(height: 115, width: 115, child: widget.options[index]),
|
||||||
height: 115, width: 115, child: widget.options[index]),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -4,12 +4,10 @@ import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MenuStaggeredViewComponentModel extends FlutterFlowModel<MenuStaggeredViewComponentWidget> {
|
||||||
class MenuStaggeredViewComponentModel
|
|
||||||
extends FlutterFlowModel<MenuStaggeredViewComponentWidget> {
|
|
||||||
@override
|
@override
|
||||||
void initState(BuildContext context) {}
|
void initState(BuildContext context) {}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {}
|
void dispose() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,28 +7,20 @@ 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_util.dart';
|
||||||
|
|
||||||
class MenuStaggeredViewComponentWidget extends StatefulWidget {
|
class MenuStaggeredViewComponentWidget extends StatefulWidget {
|
||||||
const MenuStaggeredViewComponentWidget(
|
const MenuStaggeredViewComponentWidget({super.key, required this.changeMenuStyle, required this.expandable, required this.item, required this.options, required this.isGrid});
|
||||||
{super.key,
|
|
||||||
required this.changeMenuStyle,
|
|
||||||
required this.expandable,
|
|
||||||
required this.item,
|
|
||||||
required this.options,
|
|
||||||
required this.isGrid});
|
|
||||||
|
|
||||||
final bool expandable;
|
final bool expandable;
|
||||||
final MenuItem item;
|
final MenuItem item;
|
||||||
final bool isGrid;
|
final bool isGrid;
|
||||||
|
|
||||||
final List<MenuEntry> options;
|
final List<MenuEntry?> options;
|
||||||
final Future Function()? changeMenuStyle;
|
final Future Function()? changeMenuStyle;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MenuStaggeredViewComponentWidget> createState() =>
|
State<MenuStaggeredViewComponentWidget> createState() => _MenuStaggeredViewComponentWidgetState();
|
||||||
_MenuStaggeredViewComponentWidgetState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MenuStaggeredViewComponentWidgetState
|
class _MenuStaggeredViewComponentWidgetState extends State<MenuStaggeredViewComponentWidget> {
|
||||||
extends State<MenuStaggeredViewComponentWidget> {
|
|
||||||
late MenuStaggeredViewComponentModel _model;
|
late MenuStaggeredViewComponentModel _model;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -87,9 +79,7 @@ class _MenuStaggeredViewComponentWidgetState
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
].addToStart(const SizedBox(height: 30)).addToEnd(const SizedBox(height: 30)),
|
||||||
.addToStart(const SizedBox(height: 30))
|
|
||||||
.addToEnd(const SizedBox(height: 30)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,32 +2,43 @@ import 'dart:async';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
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/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/delivery_schedule_page/delivery_schedule_widget.dart';
|
||||||
import 'package:hub/pages/fast_pass_page/fast_pass_page_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/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/message_history_page/message_history_page_widget.dart';
|
||||||
import 'package:hub/pages/package_order_page/package_order_page.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/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/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/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/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/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/storage_util.dart';
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
import 'package:provider/provider.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 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
export 'serialization_util.dart';
|
export 'serialization_util.dart';
|
||||||
|
|
||||||
const kTransitionInfoKey = '__transition_info__';
|
const kTransitionInfoKey = '__transition_info__';
|
||||||
|
|
||||||
|
|
||||||
class AppStateNotifier extends ChangeNotifier {
|
class AppStateNotifier extends ChangeNotifier {
|
||||||
AppStateNotifier._();
|
AppStateNotifier._();
|
||||||
|
|
||||||
|
@ -47,40 +58,18 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
final bool? haveLocal = StorageUtil().haveLocal;
|
final bool? haveLocal = StorageUtil().haveLocal;
|
||||||
final bool haveUserUUID = StorageUtil().userUUID.isNotEmpty;
|
final bool haveUserUUID = StorageUtil().userUUID.isNotEmpty;
|
||||||
final bool haveDevUUID = StorageUtil().devUUID.isNotEmpty;
|
final bool haveDevUUID = StorageUtil().devUUID.isNotEmpty;
|
||||||
final bool isRecovered = StorageUtil().isRecovered;
|
// final bool isRecovered = StorageUtil().isRecovered;
|
||||||
|
|
||||||
log('() => isLogged: $isLogged');
|
|
||||||
log('() => haveLocal: $haveLocal');
|
|
||||||
|
|
||||||
return GoRouter(
|
return GoRouter(
|
||||||
initialLocation: '/',
|
initialLocation: '/',
|
||||||
debugLogDiagnostics: true,
|
debugLogDiagnostics: true,
|
||||||
refreshListenable: appStateNotifier,
|
refreshListenable: appStateNotifier,
|
||||||
// errorBuilder: (context, state) => appStateNotifier.showSplashImage
|
// errorBuilder: (context, state) => appStateNotifier.showSplashImage
|
||||||
// ? Builder(
|
// ? Builder( builder: (context) => Container(color: FlutterFlowTheme.of(context).primary, child: Image.asset( 'assets/images/logo.svg', fit: BoxFit.cover)))
|
||||||
// builder: (context) => Container(
|
|
||||||
// color: FlutterFlowTheme.of(context).primary,
|
|
||||||
// child: Image.asset(
|
|
||||||
// 'assets/images/logo.svg',
|
|
||||||
// fit: BoxFit.cover,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// : const PeopleOnThePropertyPageWidget(),
|
// : const PeopleOnThePropertyPageWidget(),
|
||||||
routes: [
|
routes: [
|
||||||
// FFRoute(
|
// FFRoute(name: '_initialize', path: '/',builder: (context, _) => appStateNotifier.showSplashImage
|
||||||
// name: '_initialize',
|
// ? Builder(builder: (context) => Container(color: FlutterFlowTheme.of(context).primary, child: Image.asset('assets/images/favicon.png', fit: BoxFit.cover)))
|
||||||
// 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(),
|
// : const OnBoardingPageWidget(),
|
||||||
// ),
|
// ),
|
||||||
FFRoute(
|
FFRoute(
|
||||||
|
@ -90,8 +79,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
try {
|
try {
|
||||||
return isLogged && haveDevUUID && haveUserUUID
|
return isLogged && haveDevUUID && haveUserUUID
|
||||||
? haveLocal == true
|
? haveLocal == true
|
||||||
? const HomePageWidget()
|
? const HomePageWidget()
|
||||||
: const ReceptionPageWidget()
|
: const ReceptionPageWidget()
|
||||||
: const WelcomePageWidget();
|
: const WelcomePageWidget();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
DialogUtil.error(context, e.toString());
|
DialogUtil.error(context, e.toString());
|
||||||
|
@ -99,237 +88,107 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
FFRoute(
|
FFRoute(name: 'forgotPassword', path: '/forgotPassword', builder: (context, params) => ForgotPasswordScreen(key: UniqueKey(), email: params.getParam('email', ParamType.String), token: params.getParam('token', ParamType.String))),
|
||||||
name: 'forgotPassword',
|
FFRoute(name: 'homePage', path: '/homePage', builder: (context, params) => HomePageWidget(key: UniqueKey())),
|
||||||
path: '/forgotPassword',
|
FFRoute(name: 'petsOnThePropertyPage', path: '/petsOnThePropertyPage', builder: (context, params) => Scaffold(body: const PetsHistoryScreen())),
|
||||||
builder: (context, params) {
|
FFRoute(name: 'vehiclesOnThePropertyPage', path: '/vehiclesOnThePropertyPage', builder: (context, params) => const VehicleOnTheProperty()),
|
||||||
late final String email = params.getParam('email', ParamType.String);
|
FFRoute(name: 'visitsOnThePropertyPage', path: '/visitsOnThePropertyPage', builder: (context, params) => const VisitsOnTheProperty()),
|
||||||
late final String token = params.getParam('token', ParamType.String);
|
FFRoute(name: 'receptionPage', path: '/receptionPage', builder: (context, params) => const ReceptionPageWidget()),
|
||||||
|
FFRoute(name: 'messageHistoryPage', path: '/messageHistoryPage', builder: (context, params) => const MessageHistoryPageWidget()),
|
||||||
return ForgotPasswordScreen(
|
FFRoute(name: 'registerVisitorPage', path: '/registerVisitorPage', builder: (context, params) => const RegisterVisitorPageWidget()),
|
||||||
key: UniqueKey(),
|
FFRoute(name: 'scheduleCompleteVisitPage', path: '/scheduleCompleteVisitPage', builder: (context, params) => const ScheduleCompleteVisitPageWidget()),
|
||||||
email: email,
|
FFRoute(name: 'deliverySchedule', path: '/deliverySchedule', builder: (context, params) => const DeliverySchedule()),
|
||||||
token: token,
|
FFRoute(name: 'provisionalSchedule', path: '/provisionalSchedule', builder: (context, params) => const ProvisionalSchedule()),
|
||||||
);
|
FFRoute(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(
|
FFRoute(name: 'peopleOnThePropertyPage', path: '/peopleOnThePropertyPage', builder: (context, params) => PeopleOnThePropertyPage()),
|
||||||
name: 'homePage',
|
FFRoute(name: 'acessHistoryPage', path: '/acessHistoryPage', builder: (context, params) => AccessHistoryScreen(opt: const {'personType': '.*', 'accessType': '.*', 'search': '.*'})),
|
||||||
path: '/homePage',
|
FFRoute(name: 'liberationHistory', path: '/liberationHistory', builder: (context, params) => const LiberationHistoryWidget()),
|
||||||
builder: (context, params) => HomePageWidget(key: UniqueKey()),
|
FFRoute(name: 'signInPage', path: '/signInPage', builder: (context, params) => const SignInPageWidget()),
|
||||||
),
|
FFRoute(name: 'signUpPage', path: '/signUpPage', builder: (context, params) => const SignUpPageWidget()),
|
||||||
FFRoute(
|
FFRoute(name: 'welcomePage', path: '/welcomePage', builder: (context, params) => const WelcomePageWidget()),
|
||||||
name: 'receptionPage',
|
FFRoute(name: 'qrCodePage', path: '/qrCodePage', builder: (context, params) => const QrCodePageWidget()),
|
||||||
path: '/receptionPage',
|
FFRoute(name: 'preferencesPage', path: '/preferencesPage', builder: (context, params) => PreferencesPageWidget()),
|
||||||
builder: (context, params) => const ReceptionPageWidget()),
|
FFRoute(name: 'packageOrder', path: '/packageOrder', builder: (context, params) => const PackageOrderPage()),
|
||||||
FFRoute(
|
FFRoute(name: 'reservation', path: '/reservation', builder: (context, params) => ReservationPageWidget()),
|
||||||
name: 'messageHistoryPage',
|
|
||||||
path: '/messageHistoryPage',
|
|
||||||
builder: (context, params) => const MessageHistoryPageWidget()),
|
|
||||||
FFRoute(
|
|
||||||
name: 'registerVisitorPage',
|
|
||||||
path: '/registerVisitorPage',
|
|
||||||
builder: (context, params) => const RegisterVisitorPageWidget(),
|
|
||||||
),
|
|
||||||
FFRoute(
|
|
||||||
name: 'scheduleCompleteVisitPage',
|
|
||||||
path: '/scheduleCompleteVisitPage',
|
|
||||||
builder: (context, params) {
|
|
||||||
return const ScheduleCompleteVisitPageWidget();
|
|
||||||
}),
|
|
||||||
FFRoute(
|
|
||||||
name: 'deliverySchedule',
|
|
||||||
path: '/deliverySchedule',
|
|
||||||
builder: (context, params) => const DeliverySchedule(),
|
|
||||||
),
|
|
||||||
FFRoute(
|
|
||||||
name: 'provisionalSchedule',
|
|
||||||
path: '/provisionalSchedule',
|
|
||||||
builder: (context, params) => const ProvisionalSchedule(),
|
|
||||||
),
|
|
||||||
FFRoute(
|
|
||||||
name: 'fastPassPage',
|
|
||||||
path: '/fastPassPage',
|
|
||||||
builder: (context, params) => /*const*/ FastPassPageWidget(),
|
|
||||||
),
|
|
||||||
FFRoute(
|
|
||||||
name: 'preferencesSettings',
|
|
||||||
path: '/preferencesSettings',
|
|
||||||
builder: (context, params) => PreferencesPageWidget()),
|
|
||||||
FFRoute(
|
|
||||||
name: 'peopleOnThePropertyPage',
|
|
||||||
path: '/peopleOnThePropertyPage',
|
|
||||||
builder: (context, params) => const PeopleOnThePropertyPageWidget(),
|
|
||||||
),
|
|
||||||
FFRoute(
|
|
||||||
name: 'acessHistoryPage',
|
|
||||||
path: '/acessHistoryPage',
|
|
||||||
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(),
|
|
||||||
),
|
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'petsPage',
|
name: 'petsPage',
|
||||||
path: '/petsPage',
|
path: '/petsPage',
|
||||||
builder: (context, params) {
|
builder: (context, params) {
|
||||||
final pet = params.getParam(
|
final pet = params.getParam('pet', ParamType.JSON);
|
||||||
'pet',
|
return PetsPageWidget(pet: pet);
|
||||||
ParamType.JSON,
|
|
||||||
);
|
|
||||||
|
|
||||||
return PetsPageWidget(
|
|
||||||
pet: pet,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// FFRoute(
|
// FFRoute(name: 'settingsPage', path: '/settingsPage', builder: (context, params) => params.isEmpty ? const NavBarPage(initialPage: 'settingsPage') : const SettingsPageWidget())
|
||||||
// name: 'settingsPage',
|
|
||||||
// path: '/settingsPage',
|
|
||||||
// builder: (context, params) => params.isEmpty
|
|
||||||
// ? const NavBarPage(initialPage: 'settingsPage')
|
|
||||||
// : const SettingsPageWidget(),
|
|
||||||
// )
|
|
||||||
].map((r) => r.toRoute(appStateNotifier)).toList(),
|
].map((r) => r.toRoute(appStateNotifier)).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NavParamExtensions on Map<String, String?> {
|
extension NavParamExtensions on Map<String, String?> {
|
||||||
Map<String, String> get withoutNulls => Map.fromEntries(
|
Map<String, String> get withoutNulls => Map.fromEntries(
|
||||||
entries
|
entries.where((e) => e.value != null).map((e) => MapEntry(e.key, e.value!)),
|
||||||
.where((e) => e.value != null)
|
|
||||||
.map((e) => MapEntry(e.key, e.value!)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NavigationExtensions on BuildContext {
|
extension NavigationExtensions on BuildContext {
|
||||||
void safePop() {
|
void safePop() {
|
||||||
// If there is only one route on the stack, navigate to the initial
|
if (canPop())
|
||||||
// page instead of popping.
|
|
||||||
if (canPop()) {
|
|
||||||
pop();
|
pop();
|
||||||
} else {
|
else
|
||||||
go('/');
|
go('/');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension _GoRouterStateExtensions on GoRouterState {
|
extension _GoRouterStateExtensions on GoRouterState {
|
||||||
Map<String, dynamic> get extraMap =>
|
Map<String, dynamic> get extraMap => extra != null ? extra as Map<String, dynamic> : {};
|
||||||
extra != null ? extra as Map<String, dynamic> : {};
|
|
||||||
Map<String, dynamic> get allParams => <String, dynamic>{}
|
Map<String, dynamic> get allParams => <String, dynamic>{}
|
||||||
..addAll(pathParameters)
|
..addAll(pathParameters)
|
||||||
..addAll(uri.queryParameters)
|
..addAll(uri.queryParameters)
|
||||||
..addAll(extraMap);
|
..addAll(extraMap);
|
||||||
TransitionInfo get transitionInfo => extraMap.containsKey(kTransitionInfoKey)
|
TransitionInfo get transitionInfo => extraMap.containsKey(kTransitionInfoKey) ? extraMap[kTransitionInfoKey] as TransitionInfo : TransitionInfo.appDefault();
|
||||||
? extraMap[kTransitionInfoKey] as TransitionInfo
|
|
||||||
: TransitionInfo.appDefault();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension GoRouterLocationExtension on GoRouter {
|
extension GoRouterLocationExtension on GoRouter {
|
||||||
String getCurrentLocation() {
|
String getCurrentLocation() {
|
||||||
final RouteMatch lastMatch = routerDelegate.currentConfiguration.last;
|
final RouteMatch lastMatch = routerDelegate.currentConfiguration.last;
|
||||||
final RouteMatchList matchList = lastMatch is ImperativeRouteMatch
|
final RouteMatchList matchList = lastMatch is ImperativeRouteMatch ? lastMatch.matches : routerDelegate.currentConfiguration;
|
||||||
? lastMatch.matches
|
|
||||||
: routerDelegate.currentConfiguration;
|
|
||||||
return matchList.uri.toString();
|
return matchList.uri.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class FFParameters {
|
class FFParameters {
|
||||||
FFParameters(this.state, [this.asyncParams = const {}]);
|
FFParameters(this.state, [this.asyncParams = const {}]);
|
||||||
|
|
||||||
final GoRouterState state;
|
final GoRouterState state;
|
||||||
final Map<String, Future<dynamic> Function(String)> asyncParams;
|
|
||||||
|
|
||||||
|
final Map<String, Future<dynamic> Function(String)> asyncParams;
|
||||||
Map<String, dynamic> futureParamValues = {};
|
Map<String, dynamic> futureParamValues = {};
|
||||||
|
|
||||||
// Parameters are empty if the params map is empty or if the only parameter
|
bool get isEmpty => state.allParams.isEmpty || (state.allParams.length == 1 && state.extraMap.containsKey(kTransitionInfoKey));
|
||||||
// present is the special extra parameter reserved for the transition info.
|
bool isAsyncParam(MapEntry<String, dynamic> param) => asyncParams.containsKey(param.key) && param.value is String;
|
||||||
bool get isEmpty =>
|
|
||||||
state.allParams.isEmpty ||
|
|
||||||
(state.allParams.length == 1 &&
|
|
||||||
state.extraMap.containsKey(kTransitionInfoKey));
|
|
||||||
bool isAsyncParam(MapEntry<String, dynamic> param) =>
|
|
||||||
asyncParams.containsKey(param.key) && param.value is String;
|
|
||||||
bool get hasFutures => state.allParams.entries.any(isAsyncParam);
|
bool get hasFutures => state.allParams.entries.any(isAsyncParam);
|
||||||
Future<bool> completeFutures() => Future.wait(
|
Future<bool> completeFutures() => Future.wait(
|
||||||
state.allParams.entries.where(isAsyncParam).map(
|
state.allParams.entries.where(isAsyncParam).map(
|
||||||
(param) async {
|
(param) async {
|
||||||
final doc = await asyncParams[param.key]!(param.value)
|
final doc = await asyncParams[param.key]!(param.value).onError((_, __) => null);
|
||||||
.onError((_, __) => null);
|
|
||||||
if (doc != null) {
|
if (doc != null) {
|
||||||
futureParamValues[param.key] = doc;
|
futureParamValues[param.key] = doc;
|
||||||
return true;
|
return true;
|
||||||
}
|
} else
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
).onError((_, __) => [false]).then((v) => v.every((e) => e));
|
).onError((_, __) => [false]).then((v) => v.every((e) => e));
|
||||||
|
|
||||||
dynamic getParam<T>(
|
dynamic getParam<T>(String paramName, ParamType type, {bool isList = false, StructBuilder<T>? structBuilder}) {
|
||||||
String paramName,
|
if (futureParamValues.containsKey(paramName)) return futureParamValues[paramName];
|
||||||
ParamType type, {
|
if (!state.allParams.containsKey(paramName)) return null;
|
||||||
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];
|
final param = state.allParams[paramName];
|
||||||
// Got parameter from `extras`, so just directly return it.
|
if (param is! String) return param;
|
||||||
if (param is! String) {
|
return deserializeParam<T>(param, type, isList, structBuilder: structBuilder);
|
||||||
return param;
|
|
||||||
}
|
|
||||||
// Return serialized value.
|
|
||||||
return deserializeParam<T>(
|
|
||||||
param,
|
|
||||||
type,
|
|
||||||
isList,
|
|
||||||
structBuilder: structBuilder,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class FFRoute {
|
class FFRoute {
|
||||||
const FFRoute({
|
const FFRoute({
|
||||||
required this.name,
|
required this.name,
|
||||||
|
@ -360,33 +219,26 @@ class FFRoute {
|
||||||
)
|
)
|
||||||
: builder(context, ffParams);
|
: builder(context, ffParams);
|
||||||
final child = page;
|
final child = page;
|
||||||
|
|
||||||
final transitionInfo = state.transitionInfo;
|
final transitionInfo = state.transitionInfo;
|
||||||
return transitionInfo.hasTransition
|
return transitionInfo.hasTransition
|
||||||
? CustomTransitionPage(
|
? CustomTransitionPage(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: child,
|
child: child,
|
||||||
transitionDuration: transitionInfo.duration,
|
transitionDuration: transitionInfo.duration,
|
||||||
transitionsBuilder:
|
transitionsBuilder: (context, animation, secondaryAnimation, child) => PageTransition(
|
||||||
(context, animation, secondaryAnimation, child) =>
|
|
||||||
PageTransition(
|
|
||||||
type: transitionInfo.transitionType,
|
type: transitionInfo.transitionType,
|
||||||
duration: transitionInfo.duration,
|
duration: transitionInfo.duration,
|
||||||
reverseDuration: transitionInfo.duration,
|
reverseDuration: transitionInfo.duration,
|
||||||
alignment: transitionInfo.alignment,
|
alignment: transitionInfo.alignment,
|
||||||
child: child,
|
child: child,
|
||||||
).buildTransitions(
|
).buildTransitions(context, animation, secondaryAnimation, child),
|
||||||
context,
|
|
||||||
animation,
|
|
||||||
secondaryAnimation,
|
|
||||||
child,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
: MaterialPage(key: state.pageKey, child: child);
|
: MaterialPage(key: state.pageKey, child: child);
|
||||||
},
|
},
|
||||||
routes: routes,
|
routes: routes,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransitionInfo {
|
class TransitionInfo {
|
||||||
const TransitionInfo({
|
const TransitionInfo({
|
||||||
required this.hasTransition,
|
required this.hasTransition,
|
||||||
|
@ -400,9 +252,9 @@ class TransitionInfo {
|
||||||
final Duration duration;
|
final Duration duration;
|
||||||
final Alignment? alignment;
|
final Alignment? alignment;
|
||||||
|
|
||||||
static TransitionInfo appDefault() =>
|
static TransitionInfo appDefault() => const TransitionInfo(hasTransition: false);
|
||||||
const TransitionInfo(hasTransition: false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class RootPageContext {
|
class RootPageContext {
|
||||||
const RootPageContext(this.isRootPage, [this.errorRoute]);
|
const RootPageContext(this.isRootPage, [this.errorRoute]);
|
||||||
final bool isRootPage;
|
final bool isRootPage;
|
||||||
|
@ -412,13 +264,8 @@ class RootPageContext {
|
||||||
final rootPageContext = context.read<RootPageContext?>();
|
final rootPageContext = context.read<RootPageContext?>();
|
||||||
final isRootPage = rootPageContext?.isRootPage ?? false;
|
final isRootPage = rootPageContext?.isRootPage ?? false;
|
||||||
final location = GoRouterState.of(context).uri.toString();
|
final location = GoRouterState.of(context).uri.toString();
|
||||||
return isRootPage &&
|
return isRootPage && location != '/' && location != rootPageContext?.errorRoute;
|
||||||
location != '/' &&
|
|
||||||
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);
|
||||||
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ Future<void> initializeApp() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await _initializeTracking();
|
await _initializeTracking();
|
||||||
await _initializeStorageHelpers();
|
await _initializeStorageHelpers();
|
||||||
|
|
||||||
await _initializeFirebase();
|
await _initializeFirebase();
|
||||||
await _initializeNotificationService();
|
await _initializeNotificationService();
|
||||||
_initializeUrlStrategy();
|
_initializeUrlStrategy();
|
||||||
|
@ -45,9 +44,6 @@ Future<void> initializeApp() async {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _initializeStorageHelpers() async {
|
Future<void> _initializeStorageHelpers() async {
|
||||||
log('Initializing SharedPreferencesStorageHelper');
|
|
||||||
await SharedPreferencesStorageHelper().initialize();
|
|
||||||
log('Initializing SharedPreferencesStorageHelper');
|
|
||||||
await StorageUtil().ensureInitialization();
|
await StorageUtil().ensureInitialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,10 +88,7 @@ Future<void> _foregroundHandlerMessage(RemoteMessage message) async {
|
||||||
StorageUtil().context?.go('/homePage');
|
StorageUtil().context?.go('/homePage');
|
||||||
}
|
}
|
||||||
if (!Platform.isIOS) {
|
if (!Platform.isIOS) {
|
||||||
NotificationService.show(
|
NotificationService.show(title: message.notification!.title!, body: message.notification!.body!, payload: Map<String, String>.from(message.data));
|
||||||
title: message.notification!.title!,
|
|
||||||
body: message.notification!.body!,
|
|
||||||
payload: Map<String, String>.from(message.data));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,11 +106,10 @@ class App extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
State<App> createState() => _AppState();
|
State<App> createState() => _AppState();
|
||||||
|
|
||||||
static _AppState of(BuildContext context) =>
|
static _AppState of(BuildContext context) => context.findAncestorStateOfType<_AppState>()!;
|
||||||
context.findAncestorStateOfType<_AppState>()!;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppState extends State<App> with WidgetsBindingObserver {
|
class _AppState extends State<App> with WidgetsBindingObserver {
|
||||||
Locale? _locale = FFLocalizations.getStoredLocale();
|
Locale? _locale = FFLocalizations.getStoredLocale();
|
||||||
ThemeMode _themeMode = FlutterFlowTheme.themeMode;
|
ThemeMode _themeMode = FlutterFlowTheme.themeMode;
|
||||||
late AppStateNotifier _appStateNotifier;
|
late AppStateNotifier _appStateNotifier;
|
||||||
|
@ -158,8 +150,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates =
|
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates = const [
|
||||||
const [
|
|
||||||
FFLocalizationsDelegate(),
|
FFLocalizationsDelegate(),
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
GlobalWidgetsLocalizations.delegate,
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
@ -211,8 +202,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||||
builder(context) => screen;
|
builder(context) => screen;
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => Padding(
|
builder: (context) => Padding(padding: MediaQuery.viewInsetsOf(context), child: builder(context)),
|
||||||
padding: MediaQuery.viewInsetsOf(context), child: builder(context)),
|
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
// barrierColor: theme.primaryBackground.withOpacity(0.2),
|
// barrierColor: theme.primaryBackground.withOpacity(0.2),
|
||||||
backgroundColor: theme.primaryBackground,
|
backgroundColor: theme.primaryBackground,
|
||||||
|
@ -238,8 +228,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||||
StorageUtil().haveLocal = true;
|
StorageUtil().haveLocal = true;
|
||||||
log('onMessageOpenedApp');
|
log('onMessageOpenedApp');
|
||||||
} else {
|
} else {
|
||||||
onMessageReceived(message.data, message.notification!.body,
|
onMessageReceived(message.data, message.notification!.body, message.data['click_action']);
|
||||||
message.data['click_action']);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FirebaseMessaging.instance.getInitialMessage().then((message) {
|
FirebaseMessaging.instance.getInitialMessage().then((message) {
|
||||||
|
@ -264,7 +253,8 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override void initState() {
|
@override
|
||||||
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
|
||||||
|
@ -273,25 +263,27 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||||
FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
|
FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
|
||||||
_appStateNotifier = AppStateNotifier.instance;
|
_appStateNotifier = AppStateNotifier.instance;
|
||||||
_router = createRouter(_appStateNotifier);
|
_router = createRouter(_appStateNotifier);
|
||||||
Future.delayed(const Duration(milliseconds: 1000),
|
Future.delayed(const Duration(milliseconds: 1000), () => setState(() => _appStateNotifier.stopShowingSplashImage()));
|
||||||
() => setState(() => _appStateNotifier.stopShowingSplashImage()));
|
|
||||||
|
|
||||||
_setupFirebaseMessaging();
|
_setupFirebaseMessaging();
|
||||||
WidgetsBinding.instance.addPersistentFrameCallback((_) => initDeepLinks());
|
WidgetsBinding.instance.addPersistentFrameCallback((_) => initDeepLinks());
|
||||||
}
|
}
|
||||||
|
|
||||||
@override void dispose() {
|
@override
|
||||||
|
void dispose() {
|
||||||
WidgetsBinding.instance.removeObserver(this);
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
_linkSubscription?.cancel();
|
_linkSubscription?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override void didChangeAppLifecycleState(AppLifecycleState state) async {
|
@override
|
||||||
|
void didChangeAppLifecycleState(AppLifecycleState state) async {
|
||||||
bool initialize = await StorageUtil().ensureInitialization();
|
bool initialize = await StorageUtil().ensureInitialization();
|
||||||
if(initialize) await LocalizationService.processLocals(context);
|
if (initialize) await LocalizationService.processLocals(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override Widget build(BuildContext context) {
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp.router(
|
return MaterialApp.router(
|
||||||
key: navigatorKey,
|
key: navigatorKey,
|
||||||
title: 'FRE ACCESS HUB',
|
title: 'FRE ACCESS HUB',
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
final GlobalKey<FormState> registerFormKey = GlobalKey<FormState>();
|
||||||
|
final GlobalKey<FormState> updateFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
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,70 @@
|
||||||
|
// 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 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,4 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
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/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/menu_component/menu_component_model.dart';
|
||||||
import 'package:hub/components/organism_components/message_well_component/message_well_component_model.dart';
|
import 'package:hub/components/organism_components/message_well_component/message_well_component_model.dart';
|
||||||
|
@ -19,7 +21,8 @@ class HomePageModel extends FlutterFlowModel<HomePageWidget> {
|
||||||
TextEditingController? textController;
|
TextEditingController? textController;
|
||||||
String? Function(BuildContext, String?)? textControllerValidator;
|
String? Function(BuildContext, String?)? textControllerValidator;
|
||||||
late LocalProfileComponentModel localComponentModel;
|
late LocalProfileComponentModel localComponentModel;
|
||||||
late MenuComponentModel menuComponentModel;
|
late MenuComponentModel homeMenuComponentModel;
|
||||||
|
late MenuComponentModel drawerMenuComponentModel;
|
||||||
late MessageWellComponentModel messageWellComponentModel;
|
late MessageWellComponentModel messageWellComponentModel;
|
||||||
|
|
||||||
Future<void> _initVariable() async {
|
Future<void> _initVariable() async {
|
||||||
|
@ -33,11 +36,45 @@ class HomePageModel extends FlutterFlowModel<HomePageWidget> {
|
||||||
@override
|
@override
|
||||||
void initState(BuildContext context) {
|
void initState(BuildContext context) {
|
||||||
_initVariable();
|
_initVariable();
|
||||||
localComponentModel =
|
localComponentModel = createModel(context, () => LocalProfileComponentModel());
|
||||||
createModel(context, () => LocalProfileComponentModel());
|
homeMenuComponentModel = createModel(
|
||||||
menuComponentModel = createModel(context, () => MenuComponentModel());
|
context,
|
||||||
messageWellComponentModel =
|
() => MenuComponentModel(expandable: true, style: MenuView.list_grid, item: MenuItem.button, menuOptions: [
|
||||||
createModel(context, () => MessageWellComponentModel());
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -47,7 +84,7 @@ class HomePageModel extends FlutterFlowModel<HomePageWidget> {
|
||||||
textController?.dispose();
|
textController?.dispose();
|
||||||
|
|
||||||
localComponentModel.dispose();
|
localComponentModel.dispose();
|
||||||
menuComponentModel.dispose();
|
homeMenuComponentModel.dispose();
|
||||||
messageWellComponentModel.dispose();
|
messageWellComponentModel.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
@ -20,7 +19,7 @@ class HomePageWidget extends StatefulWidget {
|
||||||
State<HomePageWidget> createState() => _HomePageWidgetState();
|
State<HomePageWidget> createState() => _HomePageWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _HomePageWidgetState extends State<HomePageWidget> {
|
class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
late HomePageModel _model;
|
late HomePageModel _model;
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
|
@ -30,13 +29,14 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
_localProfileComponentWidget = LocalProfileComponentWidget();
|
_localProfileComponentWidget = LocalProfileComponentWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override void dispose() {
|
@override
|
||||||
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
_model.dispose();
|
_model.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override void initState() {
|
@override
|
||||||
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
_model = createModel(context, () => HomePageModel());
|
_model = createModel(context, () => HomePageModel());
|
||||||
|
@ -48,9 +48,8 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
_model.textFieldFocusNode ??= FocusNode();
|
_model.textFieldFocusNode ??= FocusNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
@override Widget build(BuildContext context) {
|
|
||||||
StorageUtil().context = context;
|
StorageUtil().context = context;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
|
@ -95,8 +94,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
color: FlutterFlowTheme.of(context).info,
|
color: FlutterFlowTheme.of(context).info,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
].divide(const SizedBox(width: 8.0)),
|
].divide(const SizedBox(width: 8.0)),
|
||||||
|
@ -109,10 +107,6 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Container buildPage(BuildContext context) {
|
Container buildPage(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
@ -147,14 +141,13 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
return Container(
|
return Container(
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
child: wrapWithModel(
|
child: wrapWithModel(
|
||||||
model: _model.menuComponentModel,
|
model: _model.homeMenuComponentModel,
|
||||||
|
updateOnChange: true,
|
||||||
updateCallback: () => setState(() {}),
|
updateCallback: () => setState(() {}),
|
||||||
child: const Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(bottom: 40),
|
padding: const EdgeInsets.only(bottom: 40),
|
||||||
child: MenuComponentWidget(
|
child: MenuComponentWidget(
|
||||||
expandable: true,
|
model: _model.homeMenuComponentModel,
|
||||||
style: MenuView.list_grid,
|
|
||||||
item: MenuItem.button,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -2,10 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.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/pages/people_on_the_property_page/people_on_the_property_page_widget.dart';
|
||||||
|
|
||||||
class PeopleOnThePropertyPageModel
|
class PeopleOnThePropertyPageModel extends FlutterFlowModel<PeopleOnThePropertyPage> {
|
||||||
extends FlutterFlowModel<PeopleOnThePropertyPageWidget> {
|
|
||||||
/// State fields for stateful widgets in this page.
|
|
||||||
|
|
||||||
final unfocusNode = FocusNode();
|
final unfocusNode = FocusNode();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -1,70 +1,122 @@
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/backend/api_requests/api_calls.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_icon_button.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.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_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/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/log_util.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
import '../../shared/utils/log_util.dart';
|
class PeopleOnThePropertyPage extends StatefulWidget {
|
||||||
|
const PeopleOnThePropertyPage({super.key});
|
||||||
class PeopleOnThePropertyPageWidget extends StatefulWidget {
|
|
||||||
const PeopleOnThePropertyPageWidget({super.key});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PeopleOnThePropertyPageWidget> createState() =>
|
_PeopleOnThePropertyPageState createState() => _PeopleOnThePropertyPageState();
|
||||||
_PeopleOnThePropertyPageWidgetState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PeopleOnThePropertyPageWidgetState
|
class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> with TickerProviderStateMixin {
|
||||||
extends State<PeopleOnThePropertyPageWidget> {
|
late ScrollController _scrollController;
|
||||||
late PeopleOnThePropertyPageModel _model;
|
|
||||||
|
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
int _pageNumber = 1;
|
||||||
|
bool _hasData = false;
|
||||||
|
bool _loading = false;
|
||||||
|
int count = 0;
|
||||||
|
late final PeopleOnThePropertyPageModel model;
|
||||||
|
|
||||||
|
late Future<void> _petsFuture;
|
||||||
|
List<dynamic> _petsWrap = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_model = createModel(context, () => PeopleOnThePropertyPageModel());
|
model = createModel(context, () => PeopleOnThePropertyPageModel());
|
||||||
|
_petsFuture = _fetchVisits();
|
||||||
|
|
||||||
|
_scrollController = ScrollController()
|
||||||
|
..addListener(() {
|
||||||
|
if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) {
|
||||||
|
_loadMore();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_model.dispose();
|
_scrollController.dispose();
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) => Scaffold(
|
||||||
return Scaffold(
|
appBar: _appBar(context),
|
||||||
key: scaffoldKey,
|
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
appBar: AppBar(
|
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
automaticallyImplyLeading: false,
|
body: Column(
|
||||||
forceMaterialTransparency: true,
|
mainAxisSize: MainAxisSize.max,
|
||||||
leading: FlutterFlowIconButton(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
borderColor: Colors.transparent,
|
children: [
|
||||||
borderRadius: 30.0,
|
if (_hasData == false && _pageNumber <= 1 && _loading == false)
|
||||||
borderWidth: 1.0,
|
Expanded(
|
||||||
buttonSize: 60.0,
|
child: Column(
|
||||||
icon: Icon(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
Icons.keyboard_arrow_left,
|
mainAxisSize: MainAxisSize.max,
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
children: [
|
||||||
size: 30.0,
|
Center(
|
||||||
),
|
child: Text(FFLocalizations.of(context).getVariableText(ptText: "Nenhum veículo encontrado!", enText: "No vehicle found")),
|
||||||
onPressed: () async {
|
)
|
||||||
context.pop();
|
],
|
||||||
},
|
),
|
||||||
|
)
|
||||||
|
else if (_hasData == true || _pageNumber >= 1)
|
||||||
|
Expanded(
|
||||||
|
child: FutureBuilder<void>(
|
||||||
|
future: _petsFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
controller: _scrollController,
|
||||||
|
itemCount: _petsWrap.length + 1,
|
||||||
|
itemBuilder: (context, 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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
final item = _petsWrap[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)),
|
||||||
),
|
),
|
||||||
title: Text(
|
);
|
||||||
FFLocalizations.of(context).getText(
|
|
||||||
'nsu13r5d' /* Pessoas na Propriedade */,
|
PreferredSizeWidget _appBar(BuildContext context) {
|
||||||
),
|
return AppBar(
|
||||||
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
title: Text(FFLocalizations.of(context).getVariableText(ptText: 'Moram Comigo', enText: 'People on the property'),
|
||||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
||||||
fontFamily: 'Nunito',
|
fontFamily: 'Nunito',
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
@ -72,114 +124,103 @@ class _PeopleOnThePropertyPageWidgetState
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
|
||||||
),
|
)),
|
||||||
),
|
leading: _backButton(context, FlutterFlowTheme.of(context)),
|
||||||
actions: const [],
|
centerTitle: true,
|
||||||
centerTitle: true,
|
elevation: 0.0,
|
||||||
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(
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (snapshot.hasError || snapshot.data?.exception != null) {
|
Future<ApiCallResponse?> _fetchVisits() async {
|
||||||
if (snapshot.error != null && snapshot.stackTrace != null) {
|
try {
|
||||||
LogUtil.requestAPIFailed(
|
setState(() => _loading = true);
|
||||||
'getPessoasLocal.php',
|
|
||||||
"",
|
|
||||||
'Busca Pessoas no Local',
|
|
||||||
snapshot.error,
|
|
||||||
snapshot.stackTrace!);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Center(
|
var response = await PhpGroup.getResidentsByProperty.call(_pageNumber.toString());
|
||||||
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 List<dynamic> pets = response.jsonBody['residents'] ?? [];
|
||||||
final getPoepleProperty = PhpGroup.getPessoasLocalCall
|
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||||
.pessoas(
|
|
||||||
columnGetPessoasLocalResponse.jsonBody,
|
|
||||||
)
|
|
||||||
?.toList() ??
|
|
||||||
[];
|
|
||||||
|
|
||||||
return ListView.builder(
|
if (pets.isNotEmpty) {
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
setState(() {
|
||||||
shrinkWrap: true,
|
_petsWrap.addAll(pets);
|
||||||
itemCount: getPoepleProperty.length,
|
_hasData = true;
|
||||||
itemBuilder: (context, index) {
|
_loading = false;
|
||||||
final getPoeplePropertyItem = getPoepleProperty[index];
|
});
|
||||||
return Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
return response;
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
}
|
||||||
children: [
|
|
||||||
Padding(
|
_showNoMoreDataSnackBar(context);
|
||||||
padding: const EdgeInsets.all(4.0),
|
|
||||||
child: Container(
|
setState(() {
|
||||||
width: 50.0,
|
_hasData = false;
|
||||||
height: 50.0,
|
_loading = false;
|
||||||
clipBehavior: Clip.antiAlias,
|
});
|
||||||
decoration: const BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
return null;
|
||||||
),
|
} catch (e, s) {
|
||||||
child: CachedNetworkImage(
|
DialogUtil.errorDefault(context);
|
||||||
fadeInDuration: const Duration(milliseconds: 500),
|
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s);
|
||||||
fadeOutDuration: const Duration(milliseconds: 500),
|
setState(() {
|
||||||
imageUrl:
|
_hasData = false;
|
||||||
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
_loading = false;
|
||||||
fit: BoxFit.cover,
|
});
|
||||||
),
|
}
|
||||||
),
|
return null;
|
||||||
),
|
}
|
||||||
Text(
|
|
||||||
getJsonField(
|
void _loadMore() {
|
||||||
getPoeplePropertyItem,
|
if (_hasData == true) {
|
||||||
r'''$.USU_NOME''',
|
_pageNumber++;
|
||||||
).toString(),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
_petsFuture = _fetchVisits();
|
||||||
fontFamily:
|
}
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
}
|
||||||
fontSize: 14.0,
|
|
||||||
letterSpacing: 0.0,
|
void _showNoMoreDataSnackBar(BuildContext context) {
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
SnackBar(
|
||||||
),
|
content: Text(FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data.")),
|
||||||
),
|
duration: const Duration(seconds: 3),
|
||||||
]
|
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||||
.divide(const SizedBox(width: 20.0))
|
|
||||||
.addToStart(const SizedBox(width: 40.0)),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _item(BuildContext context, dynamic uItem) {
|
||||||
|
return CardItemTemplateComponentWidget(
|
||||||
|
imagePath: 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${StorageUtil().devUUID}&cliID=${StorageUtil().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: "Status", enText: "Status")}:': uItem['statusweb'] == "A"
|
||||||
|
? FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Ativo',
|
||||||
|
enText: 'Active',
|
||||||
|
)
|
||||||
|
: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Inativo',
|
||||||
|
enText: 'Inactive',
|
||||||
|
),
|
||||||
|
},
|
||||||
|
statusHashMap: [],
|
||||||
|
onTapCardItemAction: () async {},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,309 @@
|
||||||
|
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/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
|
class PetsHistoryScreen extends StatefulWidget {
|
||||||
|
const PetsHistoryScreen({super.key, this.model});
|
||||||
|
final PetsPageModel? model;
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PetsHistoryScreenState createState() => _PetsHistoryScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PetsHistoryScreenState extends State<PetsHistoryScreen> with TickerProviderStateMixin {
|
||||||
|
late ScrollController _scrollController;
|
||||||
|
|
||||||
|
int _pageNumber = 1;
|
||||||
|
final int _pageSize = 10;
|
||||||
|
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());
|
||||||
|
_petsFuture = _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) => 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 Pet encontrado!", enText: "No pets found")),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else if (_hasData == true || _pageNumber >= 1)
|
||||||
|
Expanded(
|
||||||
|
child: FutureBuilder<void>(
|
||||||
|
future: _petsFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
controller: _scrollController,
|
||||||
|
itemCount: _petsWrap.length + 1,
|
||||||
|
itemBuilder: (context, 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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
final item = _petsWrap[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: 'My Pets', ptText: 'Meus 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?> _fetchVisits() async {
|
||||||
|
try {
|
||||||
|
setState(() => _loading = true);
|
||||||
|
|
||||||
|
var response = await PhpGroup.getPets.call(
|
||||||
|
pageSize: _pageSize,
|
||||||
|
page: _pageNumber,
|
||||||
|
);
|
||||||
|
|
||||||
|
final List<dynamic> pets = response.jsonBody['pets']['list'] ?? [];
|
||||||
|
safeSetState(() => count = response.jsonBody['pets']['count'] ?? 0);
|
||||||
|
|
||||||
|
if (pets.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
_petsWrap.addAll(pets);
|
||||||
|
_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 Pets", e, s);
|
||||||
|
setState(() {
|
||||||
|
_hasData = false;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _loadMore() {
|
||||||
|
if (_hasData == true) {
|
||||||
|
_pageNumber++;
|
||||||
|
|
||||||
|
_petsFuture = _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.")),
|
||||||
|
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}&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'] ?? '',
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Raça", enText: "Breed")}:': uItem['breed'] ?? '',
|
||||||
|
},
|
||||||
|
statusHashMap: [
|
||||||
|
if (uItem['size'] == "MIN")
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Mini',
|
||||||
|
enText: 'Mini',
|
||||||
|
): FlutterFlowTheme.of(context).accent4,
|
||||||
|
},
|
||||||
|
if (uItem['size'] == "PEQ")
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Pequeno',
|
||||||
|
enText: 'Small',
|
||||||
|
): FlutterFlowTheme.of(context).accent4,
|
||||||
|
},
|
||||||
|
if (uItem['size'] == "MED")
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Medio',
|
||||||
|
enText: 'Medium',
|
||||||
|
): FlutterFlowTheme.of(context).accent4,
|
||||||
|
},
|
||||||
|
if (uItem['size'] == "GRA")
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Grande',
|
||||||
|
enText: 'Big',
|
||||||
|
): FlutterFlowTheme.of(context).accent4,
|
||||||
|
},
|
||||||
|
if (uItem['size'] == "GIG")
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Gigante',
|
||||||
|
enText: 'Giant',
|
||||||
|
): FlutterFlowTheme.of(context).accent4,
|
||||||
|
},
|
||||||
|
if (uItem['gender'] == "MAC")
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(ptText: 'Macho', enText: 'Male'): const Color(0xFF094CB0),
|
||||||
|
},
|
||||||
|
if (uItem['gender'] == "FEM")
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Femêa',
|
||||||
|
enText: 'Female',
|
||||||
|
): const Color(0xFFE463E7),
|
||||||
|
}
|
||||||
|
],
|
||||||
|
onTapCardItemAction: () async {
|
||||||
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
|
final cliName = StorageUtil().cliName;
|
||||||
|
final devUUID = StorageUtil().devUUID;
|
||||||
|
final userUUID = StorageUtil().userUUID;
|
||||||
|
await showDialog(
|
||||||
|
useSafeArea: true,
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return Dialog(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: model.buildPetDetails(
|
||||||
|
item: uItem,
|
||||||
|
context: context,
|
||||||
|
devUUID: devUUID,
|
||||||
|
userUUID: userUUID,
|
||||||
|
cliUUID: cliUUID,
|
||||||
|
cliName: cliName,
|
||||||
|
model: model,
|
||||||
|
isInteractive: false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
).whenComplete(() {
|
||||||
|
safeSetState(() {
|
||||||
|
_pageNumber = 1;
|
||||||
|
_petsWrap = [];
|
||||||
|
_petsFuture = _fetchVisits().then((value) => value!.jsonBody['pets'] ?? []);
|
||||||
|
});
|
||||||
|
}).catchError((e, s) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s);
|
||||||
|
safeSetState(() {
|
||||||
|
_hasData = false;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,284 +0,0 @@
|
||||||
import 'package:flutter/material.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_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/utils/dialog_util.dart';
|
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
|
||||||
import 'package:hub/shared/utils/storage_util.dart';
|
|
||||||
|
|
||||||
class PetsHistoryScreen extends StatefulWidget {
|
|
||||||
const PetsHistoryScreen({super.key, required this.model});
|
|
||||||
|
|
||||||
final PetsPageModel model;
|
|
||||||
|
|
||||||
@override
|
|
||||||
_PetsHistoryScreenState createState() => _PetsHistoryScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PetsHistoryScreenState extends State<PetsHistoryScreen>
|
|
||||||
with TickerProviderStateMixin {
|
|
||||||
late ScrollController _scrollController;
|
|
||||||
|
|
||||||
int _pageNumber = 1;
|
|
||||||
final int _pageSize = 10;
|
|
||||||
bool _hasData = false;
|
|
||||||
bool _loading = false;
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
late Future<void> _petsFuture;
|
|
||||||
List<dynamic> _petsWrap = [];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
_petsFuture = _fetchVisits();
|
|
||||||
|
|
||||||
_scrollController = ScrollController()
|
|
||||||
..addListener(() {
|
|
||||||
if (_scrollController.position.atEdge &&
|
|
||||||
_scrollController.position.pixels != 0) {
|
|
||||||
_loadMore();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_scrollController.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<ApiCallResponse?> _fetchVisits() async {
|
|
||||||
try {
|
|
||||||
setState(() => _loading = true);
|
|
||||||
|
|
||||||
var response = await PhpGroup.getPets.call(
|
|
||||||
pageSize: _pageSize,
|
|
||||||
page: _pageNumber,
|
|
||||||
);
|
|
||||||
|
|
||||||
final List<dynamic> pets = response.jsonBody['pets']['list'] ?? [];
|
|
||||||
safeSetState(() => count = response.jsonBody['pets']['count'] ?? 0);
|
|
||||||
|
|
||||||
if (pets.isNotEmpty) {
|
|
||||||
setState(() {
|
|
||||||
_petsWrap.addAll(pets);
|
|
||||||
_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 Pets", e, s);
|
|
||||||
setState(() {
|
|
||||||
_hasData = false;
|
|
||||||
_loading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _loadMore() {
|
|
||||||
if (_hasData == true) {
|
|
||||||
_pageNumber++;
|
|
||||||
|
|
||||||
_petsFuture = _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."),
|
|
||||||
),
|
|
||||||
duration: const Duration(seconds: 3),
|
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return 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 Pet encontrado!",
|
|
||||||
enText: "No pets found")),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else if (_hasData == true || _pageNumber >= 1)
|
|
||||||
Expanded(
|
|
||||||
child: FutureBuilder<void>(
|
|
||||||
future: _petsFuture,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
return ListView.builder(
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const BouncingScrollPhysics(),
|
|
||||||
controller: _scrollController,
|
|
||||||
itemCount: _petsWrap.length + 1,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == 0) {
|
|
||||||
// Add your item here
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 30, top: 10),
|
|
||||||
child: Text(
|
|
||||||
widget.model.petAmountRegister == '0'
|
|
||||||
? FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: "Ilimitado", enText: "Unlimited")
|
|
||||||
: "${FFLocalizations.of(context).getVariableText(ptText: "Quantidade de Pets: ", enText: "Amount of Pets: ")}$count/${widget.model.petAmountRegister}",
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
final item = _petsWrap[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)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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'] ?? ''}',
|
|
||||||
labelsHashMap: {
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:':
|
|
||||||
uItem['name'] ?? '',
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Espécie", enText: "Species")}:':
|
|
||||||
uItem['species'] ?? '',
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Raça", enText: "Breed")}:':
|
|
||||||
uItem['breed'] ?? '',
|
|
||||||
},
|
|
||||||
statusHashMap: [
|
|
||||||
if (uItem['size'] == "MIN")
|
|
||||||
{
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Mini',
|
|
||||||
enText: 'Mini',
|
|
||||||
): FlutterFlowTheme.of(context).accent4,
|
|
||||||
},
|
|
||||||
if (uItem['size'] == "PEQ")
|
|
||||||
{
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Pequeno',
|
|
||||||
enText: 'Small',
|
|
||||||
): FlutterFlowTheme.of(context).accent4,
|
|
||||||
},
|
|
||||||
if (uItem['size'] == "MED")
|
|
||||||
{
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Medio',
|
|
||||||
enText: 'Medium',
|
|
||||||
): FlutterFlowTheme.of(context).accent4,
|
|
||||||
},
|
|
||||||
if (uItem['size'] == "GRA")
|
|
||||||
{
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Grande',
|
|
||||||
enText: 'Big',
|
|
||||||
): FlutterFlowTheme.of(context).accent4,
|
|
||||||
},
|
|
||||||
if (uItem['size'] == "GIG")
|
|
||||||
{
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Gigante',
|
|
||||||
enText: 'Giant',
|
|
||||||
): FlutterFlowTheme.of(context).accent4,
|
|
||||||
},
|
|
||||||
if (uItem['gender'] == "MAC")
|
|
||||||
{
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Macho', enText: 'Male'): const Color(0xFF094CB0),
|
|
||||||
},
|
|
||||||
if (uItem['gender'] == "FEM")
|
|
||||||
{
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Femêa',
|
|
||||||
enText: 'Female',
|
|
||||||
): const Color(0xFFE463E7),
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onTapCardItemAction: () async {
|
|
||||||
final cliUUID = StorageUtil().cliUUID;
|
|
||||||
final cliName = StorageUtil().cliName;
|
|
||||||
final devUUID = StorageUtil().devUUID;
|
|
||||||
final userUUID = StorageUtil().userUUID;
|
|
||||||
await showDialog(
|
|
||||||
useSafeArea: true,
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return Dialog(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: widget.model.buildPetDetails(
|
|
||||||
item: uItem,
|
|
||||||
context: context,
|
|
||||||
devUUID: devUUID,
|
|
||||||
userUUID: userUUID,
|
|
||||||
cliUUID: cliUUID,
|
|
||||||
cliName: cliName,
|
|
||||||
model: widget.model,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
).whenComplete(() {
|
|
||||||
safeSetState(() {
|
|
||||||
_pageNumber = 1;
|
|
||||||
_petsWrap = [];
|
|
||||||
_petsFuture =
|
|
||||||
_fetchVisits().then((value) => value!.jsonBody['pets'] ?? []);
|
|
||||||
});
|
|
||||||
}).catchError((e, s) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
LogUtil.requestAPIFailed(
|
|
||||||
"proccessRequest.php", "", "Consulta de Pets", e, s);
|
|
||||||
safeSetState(() {
|
|
||||||
_hasData = false;
|
|
||||||
_loading = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,6 +18,11 @@ import 'package:hub/shared/utils/storage_util.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
|
|
||||||
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
|
static PetsPageModel? _instance = PetsPageModel._internal();
|
||||||
|
PetsPageModel._internal();
|
||||||
|
factory PetsPageModel() => _instance ?? PetsPageModel._internal();
|
||||||
|
static void resetInstance() => _instance = null;
|
||||||
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -100,17 +105,9 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
TextEditingController? textControllerObservation;
|
TextEditingController? textControllerObservation;
|
||||||
String? Function(BuildContext, String?)? textControllerObservationValidator;
|
String? Function(BuildContext, String?)? textControllerObservationValidator;
|
||||||
|
|
||||||
Future<void> initAsync() async {
|
|
||||||
devUUID = StorageUtil().devUUID;
|
|
||||||
userUUID = StorageUtil().userUUID;
|
|
||||||
cliUUID = StorageUtil().cliUUID;
|
|
||||||
petAmountRegister = StorageUtil().petAmountRegister.toString();
|
|
||||||
|
|
||||||
safeSetState?.call();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState(BuildContext context) {
|
void initState(BuildContext context) {
|
||||||
|
resetInstance();
|
||||||
tabBarController = TabController(
|
tabBarController = TabController(
|
||||||
vsync: Navigator.of(context),
|
vsync: Navigator.of(context),
|
||||||
length: 2,
|
length: 2,
|
||||||
|
@ -134,67 +131,13 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
textFieldFocusObservation = FocusNode();
|
textFieldFocusObservation = FocusNode();
|
||||||
textControllerObservation = TextEditingController();
|
textControllerObservation = TextEditingController();
|
||||||
|
|
||||||
dropDownValueController1 =
|
dropDownValueController1 = FormFieldController<String>(dropDownValue1 ??= 'Selecione uma opção');
|
||||||
FormFieldController<String>(dropDownValue1 ??= 'Selecione uma opção');
|
|
||||||
|
|
||||||
dropDownValueController2 =
|
dropDownValueController2 = FormFieldController<String>(dropDownValue2 ??= 'Selecione uma opção');
|
||||||
FormFieldController<String>(dropDownValue2 ??= 'Selecione uma opção');
|
|
||||||
|
|
||||||
initAsync();
|
initAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setEditForm() {
|
|
||||||
log('item: $item');
|
|
||||||
|
|
||||||
if (item != null) petId = item['id'];
|
|
||||||
|
|
||||||
// updateImage!();
|
|
||||||
(() async {
|
|
||||||
Response response = await get(Uri.parse(
|
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId'));
|
|
||||||
String base64 = base64Encode(response.bodyBytes);
|
|
||||||
uploadedTempFile = await ImageUtils.convertToUploadFile(base64);
|
|
||||||
updateImage?.call();
|
|
||||||
})();
|
|
||||||
|
|
||||||
textControllerName =
|
|
||||||
TextEditingController(text: item != null ? item['name'] ?? '' : '');
|
|
||||||
textFieldFocusName = FocusNode();
|
|
||||||
|
|
||||||
textControllerSpecies =
|
|
||||||
TextEditingController(text: item != null ? item['species'] ?? '' : '');
|
|
||||||
textFieldFocusSpecies = FocusNode();
|
|
||||||
|
|
||||||
textControllerRace =
|
|
||||||
TextEditingController(text: item != null ? item['breed'] ?? '' : '');
|
|
||||||
textFieldFocusRace = FocusNode();
|
|
||||||
|
|
||||||
textControllerColor =
|
|
||||||
TextEditingController(text: item != null ? item['color'] ?? '' : '');
|
|
||||||
textFieldFocusColor = FocusNode();
|
|
||||||
|
|
||||||
textControllerData = TextEditingController(
|
|
||||||
text: item != null
|
|
||||||
? item['birthdayDate'] != null
|
|
||||||
? ValidatorUtil.formatDateTimePicker(item['birthdayDate'])
|
|
||||||
: ''
|
|
||||||
: '');
|
|
||||||
|
|
||||||
textFieldFocusData = FocusNode();
|
|
||||||
|
|
||||||
textControllerObservation =
|
|
||||||
TextEditingController(text: item != null ? item['notes'] ?? '' : '');
|
|
||||||
textFieldFocusObservation = FocusNode();
|
|
||||||
|
|
||||||
item != null ? dropDownValue1 = item['gender'] ?? '' : dropDownValue1 = '';
|
|
||||||
|
|
||||||
item != null ? dropDownValue2 = item['size'] ?? '' : dropDownValue2 = '';
|
|
||||||
|
|
||||||
dropDownValueController1 = FormFieldController<String>(dropDownValue1);
|
|
||||||
|
|
||||||
dropDownValueController2 = FormFieldController<String>(dropDownValue2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
tabBarController.dispose();
|
tabBarController.dispose();
|
||||||
|
@ -221,31 +164,79 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
dropDownValueController2?.dispose();
|
dropDownValueController2?.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> initAsync() async {
|
||||||
|
devUUID = StorageUtil().devUUID;
|
||||||
|
userUUID = StorageUtil().userUUID;
|
||||||
|
cliUUID = StorageUtil().cliUUID;
|
||||||
|
petAmountRegister = StorageUtil().petAmountRegister.toString();
|
||||||
|
|
||||||
|
safeSetState?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setEditForm() {
|
||||||
|
log('item: $item');
|
||||||
|
|
||||||
|
if (item != null) petId = item['id'];
|
||||||
|
|
||||||
|
// updateImage!();
|
||||||
|
(() async {
|
||||||
|
Response response = await get(Uri.parse('https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId'));
|
||||||
|
String base64 = base64Encode(response.bodyBytes);
|
||||||
|
uploadedTempFile = await ImageUtils.convertToUploadFile(base64);
|
||||||
|
updateImage?.call();
|
||||||
|
})();
|
||||||
|
|
||||||
|
textControllerName = TextEditingController(text: item != null ? item['name'] ?? '' : '');
|
||||||
|
textFieldFocusName = FocusNode();
|
||||||
|
|
||||||
|
textControllerSpecies = TextEditingController(text: item != null ? item['species'] ?? '' : '');
|
||||||
|
textFieldFocusSpecies = FocusNode();
|
||||||
|
|
||||||
|
textControllerRace = TextEditingController(text: item != null ? item['breed'] ?? '' : '');
|
||||||
|
textFieldFocusRace = FocusNode();
|
||||||
|
|
||||||
|
textControllerColor = TextEditingController(text: item != null ? item['color'] ?? '' : '');
|
||||||
|
textFieldFocusColor = FocusNode();
|
||||||
|
|
||||||
|
textControllerData = TextEditingController(
|
||||||
|
text: item != null
|
||||||
|
? item['birthdayDate'] != null
|
||||||
|
? ValidatorUtil.formatDateTimePicker(item['birthdayDate'])
|
||||||
|
: ''
|
||||||
|
: '');
|
||||||
|
|
||||||
|
textFieldFocusData = FocusNode();
|
||||||
|
|
||||||
|
textControllerObservation = TextEditingController(text: item != null ? item['notes'] ?? '' : '');
|
||||||
|
textFieldFocusObservation = FocusNode();
|
||||||
|
|
||||||
|
item != null ? dropDownValue1 = item['gender'] ?? '' : dropDownValue1 = '';
|
||||||
|
|
||||||
|
item != null ? dropDownValue2 = item['size'] ?? '' : dropDownValue2 = '';
|
||||||
|
|
||||||
|
dropDownValueController1 = FormFieldController<String>(dropDownValue1);
|
||||||
|
|
||||||
|
dropDownValueController2 = FormFieldController<String>(dropDownValue2);
|
||||||
|
}
|
||||||
|
|
||||||
bool isFormValid(BuildContext context) {
|
bool isFormValid(BuildContext context) {
|
||||||
if (uploadedLocalFile == null || uploadedLocalFile!.bytes!.isEmpty) {
|
if (uploadedLocalFile == null || uploadedLocalFile!.bytes!.isEmpty) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (textControllerName.text.isEmpty ||
|
if (textControllerName!.text.isEmpty || textControllerName!.text.length > 80 || textControllerName!.text == '') {
|
||||||
textControllerName.text.length > 80 ||
|
|
||||||
textControllerName.text == '') {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (textControllerSpecies.text.isEmpty ||
|
if (textControllerSpecies!.text.isEmpty || textControllerSpecies!.text == '') {
|
||||||
textControllerSpecies.text == '') {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (textControllerRace.text.isEmpty || textControllerRace.text == '') {
|
if (textControllerRace!.text.isEmpty || textControllerRace!.text == '') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropDownValue1 == null ||
|
if (dropDownValue1 == null || dropDownValue1!.isEmpty || dropDownValue1 == '') {
|
||||||
dropDownValue1!.isEmpty ||
|
|
||||||
dropDownValue1 == '') {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (dropDownValue2 == null ||
|
if (dropDownValue2 == null || dropDownValue2!.isEmpty || dropDownValue2 == '') {
|
||||||
dropDownValue2!.isEmpty ||
|
|
||||||
dropDownValue2 == '') {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -254,8 +245,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
Future<void> updatePet() async {
|
Future<void> updatePet() async {
|
||||||
var img = await ImageUtils.convertImageFileToBase64(uploadedLocalFile!);
|
var img = await ImageUtils.convertImageFileToBase64(uploadedLocalFile!);
|
||||||
img = "base64;jpeg,$img";
|
img = "base64;jpeg,$img";
|
||||||
final url =
|
final url = 'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId';
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId';
|
|
||||||
final response = await PhpGroup.updatePet.call(
|
final response = await PhpGroup.updatePet.call(
|
||||||
petID: petId,
|
petID: petId,
|
||||||
image: img,
|
image: img,
|
||||||
|
@ -284,8 +274,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
} else {
|
} else {
|
||||||
String errorMessage;
|
String errorMessage;
|
||||||
try {
|
try {
|
||||||
errorMessage =
|
errorMessage = jsonDecode(response.jsonBody['error_msg'])[0]['message'].toString();
|
||||||
jsonDecode(response.jsonBody['error_msg'])[0]['message'].toString();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
errorMessage = FFLocalizations.of(buildContext!).getVariableText(
|
errorMessage = FFLocalizations.of(buildContext!).getVariableText(
|
||||||
enText: 'Failed to update pet',
|
enText: 'Failed to update pet',
|
||||||
|
@ -323,11 +312,9 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
} else {
|
} else {
|
||||||
String errorMessage;
|
String errorMessage;
|
||||||
try {
|
try {
|
||||||
errorMessage =
|
errorMessage = jsonDecode(response.jsonBody['error_msg'])[0]['message'].toString();
|
||||||
jsonDecode(response.jsonBody['error_msg'])[0]['message'].toString();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (response.jsonBody['error_msg'] ==
|
if (response.jsonBody['error_msg'] == "Limite de Cadastro de Pet Atingido.") {
|
||||||
"Limite de Cadastro de Pet Atingido.") {
|
|
||||||
errorMessage = FFLocalizations.of(buildContext!).getVariableText(
|
errorMessage = FFLocalizations.of(buildContext!).getVariableText(
|
||||||
enText: 'Pet registration limit reached',
|
enText: 'Pet registration limit reached',
|
||||||
ptText: 'Limite de cadastro de pets atingido',
|
ptText: 'Limite de cadastro de pets atingido',
|
||||||
|
@ -388,162 +375,142 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
required String cliUUID,
|
required String cliUUID,
|
||||||
required String cliName,
|
required String cliName,
|
||||||
required PetsPageModel model,
|
required PetsPageModel model,
|
||||||
|
bool isInteractive = true,
|
||||||
}) {
|
}) {
|
||||||
return DetailsComponentWidget(
|
return DetailsComponentWidget(
|
||||||
buttons: [
|
buttons: [
|
||||||
// EDIT ACTION
|
// EDIT ACTION
|
||||||
FFButtonWidget(
|
if (isInteractive)
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
FFButtonWidget(
|
||||||
ptText: 'Editar',
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Edit',
|
ptText: 'Editar',
|
||||||
),
|
enText: 'Edit',
|
||||||
icon: const Icon(Icons.edit),
|
),
|
||||||
onPressed: () async {
|
icon: const Icon(Icons.edit),
|
||||||
context.pop();
|
onPressed: () async {
|
||||||
|
context.pop();
|
||||||
|
|
||||||
model.isEditing = true;
|
model.isEditing = true;
|
||||||
model.item = item;
|
model.item = item;
|
||||||
model.switchTab(0);
|
model.switchTab(0);
|
||||||
model.setEditForm();
|
model.setEditForm();
|
||||||
// model.safeSetState!();
|
// model.safeSetState!();
|
||||||
},
|
},
|
||||||
options: FFButtonOptions(
|
options: FFButtonOptions(
|
||||||
width: 130,
|
width: 130,
|
||||||
height: 40,
|
height: 40,
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
elevation: 0,
|
|
||||||
textStyle: TextStyle(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
width: 1,
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
),
|
),
|
||||||
// borderRadius: 12,
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
// DELETE ACTION
|
// DELETE ACTION
|
||||||
FFButtonWidget(
|
if (isInteractive)
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
FFButtonWidget(
|
||||||
ptText: 'Excluir',
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Delete',
|
ptText: 'Excluir',
|
||||||
),
|
enText: 'Delete',
|
||||||
icon: const Icon(Icons.close),
|
),
|
||||||
onPressed: () async {
|
icon: const Icon(Icons.close),
|
||||||
showAlertDialog(
|
onPressed: () async {
|
||||||
context,
|
showAlertDialog(
|
||||||
FFLocalizations.of(context).getVariableText(
|
context,
|
||||||
ptText: 'Excluir Pet',
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Delete Pet',
|
ptText: 'Excluir Pet',
|
||||||
),
|
enText: 'Delete Pet',
|
||||||
FFLocalizations.of(context).getVariableText(
|
),
|
||||||
ptText: 'Você tem certeza que deseja excluir esse pet?',
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Are you sure you want to delete this pet?',
|
ptText: 'Você tem certeza que deseja excluir esse pet?',
|
||||||
), () async {
|
enText: 'Are you sure you want to delete this pet?',
|
||||||
int id = item['id'];
|
), () async {
|
||||||
await PhpGroup.deletePet
|
int id = item['id'];
|
||||||
.call(
|
await PhpGroup.deletePet
|
||||||
petID: id,
|
.call(
|
||||||
)
|
petID: id,
|
||||||
.then((value) {
|
)
|
||||||
// Navigator.pop(context, value);
|
.then((value) {
|
||||||
context.pop(value);
|
// Navigator.pop(context, value);
|
||||||
context.pop(value);
|
context.pop(value);
|
||||||
|
context.pop(value);
|
||||||
|
|
||||||
if (value == false) {
|
if (value == false) {
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Erro ao excluir pet',
|
||||||
|
enText: 'Error deleting pet',
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
} else if (value == true) {
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Success deleting pet',
|
||||||
|
ptText: 'Succeso ao excluir pet',
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}).catchError((err, stack) {
|
||||||
|
context.pop();
|
||||||
showSnackbar(
|
showSnackbar(
|
||||||
context,
|
context,
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Erro ao excluir pet',
|
|
||||||
enText: 'Error deleting pet',
|
enText: 'Error deleting pet',
|
||||||
|
ptText: 'Erro ao excluir pet',
|
||||||
),
|
),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
} else if (value == true) {
|
});
|
||||||
showSnackbar(
|
|
||||||
context,
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'Success deleting pet',
|
|
||||||
ptText: 'Succeso ao excluir pet',
|
|
||||||
),
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}).catchError((err, stack) {
|
|
||||||
context.pop();
|
|
||||||
showSnackbar(
|
|
||||||
context,
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
enText: 'Error deleting pet',
|
|
||||||
ptText: 'Erro ao excluir pet',
|
|
||||||
),
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
},
|
options: FFButtonOptions(
|
||||||
options: FFButtonOptions(
|
width: 130,
|
||||||
width: 130,
|
height: 40,
|
||||||
height: 40,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
||||||
elevation: 0,
|
|
||||||
textStyle: TextStyle(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
width: 1,
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
),
|
),
|
||||||
// borderRadius: 12,
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
// 'MIN', 'PEQ', 'MED', 'GRA', 'GIG'
|
// 'MIN', 'PEQ', 'MED', 'GRA', 'GIG'
|
||||||
labelsHashMap: Map<String, String>.from({
|
labelsHashMap: Map<String, String>.from({
|
||||||
if (item['species'] != null && item['species'] != '')
|
if (item['species'] != null && item['species'] != '') '${FFLocalizations.of(context).getVariableText(ptText: "Espécie", enText: "Species")}:': item['species'].toString().toUpperCase(),
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Espécie", enText: "Species")}:':
|
if (item['breed'] != null && item['breed'] != '') '${FFLocalizations.of(context).getVariableText(ptText: "Raça", enText: "Breed")}:': item['breed'].toString().toUpperCase(),
|
||||||
item['species'].toString().toUpperCase(),
|
if (item['color'] != null && item['color'] != '') '${FFLocalizations.of(context).getVariableText(ptText: "Cor", enText: "Color")}:': item['color'].toString().toUpperCase(),
|
||||||
if (item['breed'] != null && item['breed'] != '')
|
if (item['birthdayDate'] != null && item['birthdayDate'] != '') '${FFLocalizations.of(context).getVariableText(ptText: "Data de Nascimento", enText: "Date of Birth")}:': ValidatorUtil.formatDateTimePicker(item['birthdayDate']),
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Raça", enText: "Breed")}:':
|
if (item['gender'] != null && item['gender'] != '') '${FFLocalizations.of(context).getVariableText(ptText: "Gênero", enText: "Gender")}:': item['gender'] == 'MAC' ? FFLocalizations.of(context).getVariableText(ptText: 'MACHO', enText: 'MALE') : FFLocalizations.of(context).getVariableText(enText: 'FEMALE', ptText: 'FÊMEA'),
|
||||||
item['breed'].toString().toUpperCase(),
|
|
||||||
if (item['color'] != null && item['color'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Cor", enText: "Color")}:':
|
|
||||||
item['color'].toString().toUpperCase(),
|
|
||||||
if (item['birthdayDate'] != null && item['birthdayDate'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Data de Nascimento", enText: "Date of Birth")}:':
|
|
||||||
ValidatorUtil.formatDateTimePicker(item['birthdayDate']),
|
|
||||||
if (item['gender'] != null && item['gender'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Gênero", enText: "Gender")}:':
|
|
||||||
item['gender'] == 'MAC'
|
|
||||||
? FFLocalizations.of(context)
|
|
||||||
.getVariableText(ptText: 'MACHO', enText: 'MALE')
|
|
||||||
: FFLocalizations.of(context)
|
|
||||||
.getVariableText(enText: 'FEMALE', ptText: 'FÊMEA'),
|
|
||||||
if (item['size'] != null && item['size'] != '')
|
if (item['size'] != null && item['size'] != '')
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Porte", enText: "Size")}:':
|
'${FFLocalizations.of(context).getVariableText(ptText: "Porte", enText: "Size")}:': item['size'] == 'MIN'
|
||||||
item['size'] == 'MIN'
|
? FFLocalizations.of(context).getVariableText(ptText: 'MINI', enText: 'MINI')
|
||||||
? FFLocalizations.of(context)
|
: item['size'] == 'PEQ'
|
||||||
.getVariableText(ptText: 'MINI', enText: 'MINI')
|
? FFLocalizations.of(context).getVariableText(ptText: 'PEQUENO', enText: 'SMALL')
|
||||||
: item['size'] == 'PEQ'
|
: item['size'] == 'MED'
|
||||||
? FFLocalizations.of(context)
|
? FFLocalizations.of(context).getVariableText(ptText: 'MÉDIO', enText: 'MEDIUM')
|
||||||
.getVariableText(ptText: 'PEQUENO', enText: 'SMALL')
|
: item['size'] == 'GRD'
|
||||||
: item['size'] == 'MED'
|
? FFLocalizations.of(context).getVariableText(ptText: 'GRANDE', enText: 'LARGE')
|
||||||
? FFLocalizations.of(context).getVariableText(
|
: item['size'] == 'GIG'
|
||||||
ptText: 'MÉDIO', enText: 'MEDIUM')
|
? FFLocalizations.of(context).getVariableText(ptText: 'GIGANTE', enText: 'GIANT')
|
||||||
: item['size'] == 'GRD'
|
: '',
|
||||||
? FFLocalizations.of(context).getVariableText(
|
if (item['notes'] != null && item['notes'] != '') '${FFLocalizations.of(context).getVariableText(ptText: "Observação", enText: "Notes")}:': item['notes'] ?? '',
|
||||||
ptText: 'GRANDE', enText: 'LARGE')
|
|
||||||
: item['size'] == 'GIG'
|
|
||||||
? FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'GIGANTE', enText: 'GIANT')
|
|
||||||
: '',
|
|
||||||
if (item['notes'] != null && item['notes'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Observação", enText: "Notes")}:':
|
|
||||||
item['notes'] ?? '',
|
|
||||||
}),
|
}),
|
||||||
imagePath:
|
imagePath: 'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=${item['id'] ?? ''}',
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=${item['id'] ?? ''}',
|
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
if (item['gender'] == "MAC")
|
if (item['gender'] == "MAC")
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,7 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/reception_page/reception_page_model.dart';
|
import 'package:hub/pages/reception_page/reception_page_model.dart';
|
||||||
|
import 'package:hub/shared/services/authentication/authentication_service.dart';
|
||||||
import 'package:hub/shared/services/localization/localization_service.dart';
|
import 'package:hub/shared/services/localization/localization_service.dart';
|
||||||
import 'package:hub/shared/utils/storage_util.dart';
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
@ -23,7 +24,8 @@ class ReceptionPageWidget extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ReceptionPageWidgetState extends State<ReceptionPageWidget> with WidgetsBindingObserver {
|
class _ReceptionPageWidgetState extends State<ReceptionPageWidget> with WidgetsBindingObserver {
|
||||||
@override void initState() {
|
@override
|
||||||
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
() async {
|
() async {
|
||||||
|
@ -35,13 +37,14 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> with WidgetsB
|
||||||
LocalizationService.checkLocals(context);
|
LocalizationService.checkLocals(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override void dispose() {
|
@override
|
||||||
|
void dispose() {
|
||||||
WidgetsBinding.instance.removeObserver(this);
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
@override void didChangeAppLifecycleState(AppLifecycleState state) {
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
log('() => state: $state');
|
log('() => state: $state');
|
||||||
if (state == AppLifecycleState.resumed) {
|
if (state == AppLifecycleState.resumed) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -68,46 +71,31 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> with WidgetsB
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(45, 0, 45, 15.0),
|
padding: const EdgeInsets.fromLTRB(45, 0, 45, 15.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(ptText: 'Falta pouco para você utilizar o FRE Access Hub...', enText: 'You are close to using the FRE Access Hub...'),
|
||||||
ptText:
|
|
||||||
'Falta pouco para você utilizar o FRE Access Hub...',
|
|
||||||
enText:
|
|
||||||
'You are close to using the FRE Access Hub...'),
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context).displayLarge.override(
|
||||||
.displayLarge
|
|
||||||
.override(
|
|
||||||
fontFamily: 'Plus Jakarta Sans',
|
fontFamily: 'Plus Jakarta Sans',
|
||||||
color: FlutterFlowTheme.of(context).accent1,
|
color: FlutterFlowTheme.of(context).accent1,
|
||||||
fontSize: 20.0,
|
fontSize: 20.0,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
|
||||||
.containsKey('Plus Jakarta Sans'),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const AtomImageSvgTheme(
|
const AtomImageSvgTheme(filename: 'reception', width: 180, height: 180),
|
||||||
filename: 'reception', width: 180, height: 180),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(70, 30, 70.0, 60),
|
padding: const EdgeInsets.fromLTRB(70, 30, 70.0, 60),
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(ptText: 'Envie seu identificador para seu condomínio para vincularem sua conta aos nossos sistemas.', enText: 'Send your identifier to your condominium to link your account to our systems.'),
|
||||||
ptText:
|
|
||||||
'Envie seu identificador para seu condomínio para vincularem sua conta aos nossos sistemas.',
|
|
||||||
enText:
|
|
||||||
'Send your identifier to your condominium to link your account to our systems.'),
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: FlutterFlowTheme.of(context)
|
style: FlutterFlowTheme.of(context).displaySmall.override(
|
||||||
.displaySmall
|
|
||||||
.override(
|
|
||||||
fontFamily: 'Nunito Sans',
|
fontFamily: 'Nunito Sans',
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
|
||||||
.containsKey('Plus Jakarta Sans'),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -118,48 +106,31 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> with WidgetsB
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(60, 0, 60, 10),
|
padding: const EdgeInsets.fromLTRB(60, 0, 60, 10),
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: FFLocalizations.of(context).getVariableText(
|
message: FFLocalizations.of(context).getVariableText(ptText: 'Seu identificador é utilizado para efetuar\no vínculo do seu APP com o condominio.', enText: 'My Identifier'),
|
||||||
ptText:
|
textStyle: FlutterFlowTheme.of(context).labelSmall.override(
|
||||||
'Seu identificador é utilizado para efetuar\no vínculo do seu APP com o condominio.',
|
|
||||||
enText: 'My Identifier'),
|
|
||||||
textStyle: FlutterFlowTheme.of(context)
|
|
||||||
.labelSmall
|
|
||||||
.override(
|
|
||||||
fontFamily: 'Nunito Sans',
|
fontFamily: 'Nunito Sans',
|
||||||
color: FlutterFlowTheme.of(context)
|
color: FlutterFlowTheme.of(context).secondaryText,
|
||||||
.secondaryText,
|
|
||||||
fontSize: 10.0,
|
fontSize: 10.0,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
|
||||||
.containsKey('Plus Jakarta Sans'),
|
|
||||||
),
|
),
|
||||||
child: FFButtonWidget(
|
child: FFButtonWidget(
|
||||||
onPressed: () => model.getIdenfifier(context),
|
onPressed: () => model.getIdenfifier(context),
|
||||||
text: FFLocalizations.of(context)
|
text: FFLocalizations.of(context).getVariableText(ptText: 'Meu Identificador', enText: 'My Identifier'),
|
||||||
.getVariableText(
|
|
||||||
ptText: 'Meu Identificador',
|
|
||||||
enText: 'My Identifier'),
|
|
||||||
options: FFButtonOptions(
|
options: FFButtonOptions(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 44.0,
|
height: 44.0,
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||||
0.0, 0.0, 0.0, 0.0),
|
iconPadding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||||
iconPadding:
|
|
||||||
const EdgeInsetsDirectional.fromSTEB(
|
|
||||||
0.0, 0.0, 0.0, 0.0),
|
|
||||||
color: FlutterFlowTheme.of(context).primary,
|
color: FlutterFlowTheme.of(context).primary,
|
||||||
textStyle: FlutterFlowTheme.of(context)
|
textStyle: FlutterFlowTheme.of(context).titleSmall.override(
|
||||||
.titleSmall
|
|
||||||
.override(
|
|
||||||
fontFamily: 'Nunito Sans',
|
fontFamily: 'Nunito Sans',
|
||||||
color:
|
color: FlutterFlowTheme.of(context).info,
|
||||||
FlutterFlowTheme.of(context).info,
|
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
|
||||||
.containsKey('Plus Jakarta Sans'),
|
|
||||||
),
|
),
|
||||||
elevation: 3.0,
|
elevation: 3.0,
|
||||||
borderSide: const BorderSide(
|
borderSide: const BorderSide(
|
||||||
|
@ -177,44 +148,23 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> with WidgetsB
|
||||||
child: FFButtonWidget(
|
child: FFButtonWidget(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
PhpGroup.unregisterDevice();
|
PhpGroup.unregisterDevice();
|
||||||
|
AuthenticationService.signOut(context);
|
||||||
StorageUtil.purge();
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
context.go(
|
|
||||||
'/welcomePage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
text: FFLocalizations.of(context).getVariableText(ptText: 'Sair da Conta', enText: 'Logout'),
|
||||||
ptText: 'Sair da Conta', enText: 'Logout'),
|
|
||||||
options: FFButtonOptions(
|
options: FFButtonOptions(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 44.0,
|
height: 44.0,
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||||
0.0, 0.0, 0.0, 0.0),
|
iconPadding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||||
iconPadding:
|
color: FlutterFlowTheme.of(context).customColor1,
|
||||||
const EdgeInsetsDirectional.fromSTEB(
|
textStyle: FlutterFlowTheme.of(context).titleSmall.override(
|
||||||
0.0, 0.0, 0.0, 0.0),
|
|
||||||
color:
|
|
||||||
FlutterFlowTheme.of(context).customColor1,
|
|
||||||
textStyle: FlutterFlowTheme.of(context)
|
|
||||||
.titleSmall
|
|
||||||
.override(
|
|
||||||
fontFamily: 'Nunito Sans',
|
fontFamily: 'Nunito Sans',
|
||||||
color: FlutterFlowTheme.of(context)
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
.primaryBackground,
|
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
letterSpacing: 0.0,
|
letterSpacing: 0.0,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
|
||||||
.containsKey('Plus Jakarta Sans'),
|
|
||||||
),
|
),
|
||||||
elevation: 3.0,
|
elevation: 3.0,
|
||||||
borderSide: const BorderSide(
|
borderSide: const BorderSide(
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hub/backend/api_requests/api_manager.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/utils/storage_util.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;
|
||||||
|
|
||||||
|
final GlobalKey<FormState> registerFormKey = GlobalKey<FormState>();
|
||||||
|
final GlobalKey<FormState> updateFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
@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['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['model'] != null && item['model'] != '') '${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:': item['model'].toString().toUpperCase(),
|
||||||
|
if (item['tag'] != null && item['tag'] != '') '${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:': item['tag'].toString().toUpperCase(),
|
||||||
|
if (item['personName'] != null && item['personName'] != '') '${FFLocalizations.of(context).getVariableText(ptText: "Proprietário", enText: "Owner")}:': item['personName'].toString().toUpperCase(),
|
||||||
|
}),
|
||||||
|
imagePath: 'https://freaccess.com.br/freaccess/Images/Clients/${StorageUtil().cliUUID}.png',
|
||||||
|
statusHashMap: [
|
||||||
|
if (item['model'] != null) Map<String, Color>.from({item['model']: FlutterFlowTheme.of(context).primary}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,245 @@
|
||||||
|
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/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> _petsFuture;
|
||||||
|
List<dynamic> _petsWrap = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
model = createModel(context, () => VehicleModel());
|
||||||
|
_petsFuture = _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) => 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")),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else if (_hasData == true || _pageNumber >= 1)
|
||||||
|
Expanded(
|
||||||
|
child: FutureBuilder<void>(
|
||||||
|
future: _petsFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
controller: _scrollController,
|
||||||
|
itemCount: _petsWrap.length + 1,
|
||||||
|
itemBuilder: (context, 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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
final item = _petsWrap[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: 'My Vehicles', ptText: 'Meus 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> pets = response.jsonBody['vehicles'] ?? [];
|
||||||
|
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||||
|
|
||||||
|
if (pets.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
_petsWrap.addAll(pets);
|
||||||
|
_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 Pets", e, s);
|
||||||
|
setState(() {
|
||||||
|
_hasData = false;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _loadMore() {
|
||||||
|
if (_hasData == true) {
|
||||||
|
_pageNumber++;
|
||||||
|
|
||||||
|
_petsFuture = _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.")),
|
||||||
|
duration: const Duration(seconds: 3),
|
||||||
|
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _item(BuildContext context, dynamic uItem) {
|
||||||
|
return CardItemTemplateComponentWidget(
|
||||||
|
imagePath: '',
|
||||||
|
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;
|
||||||
|
_petsWrap = [];
|
||||||
|
_petsFuture = _fetchVisits().then((value) => value!.jsonBody['pets'] ?? []);
|
||||||
|
});
|
||||||
|
}).catchError((e, s) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s);
|
||||||
|
safeSetState(() {
|
||||||
|
_hasData = false;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,248 @@
|
||||||
|
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/log_util.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.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 VehicleModel model;
|
||||||
|
|
||||||
|
late Future<void> _visitsFuture;
|
||||||
|
List<dynamic> _visitsList = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
model = createModel(context, () => VehicleModel());
|
||||||
|
_visitsFuture = _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) => 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")),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else if (_hasData == true || _pageNumber >= 1)
|
||||||
|
Expanded(
|
||||||
|
child: FutureBuilder<void>(
|
||||||
|
future: _visitsFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
controller: _scrollController,
|
||||||
|
itemCount: _visitsList.length + 1,
|
||||||
|
itemBuilder: (context, 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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
final item = _visitsList[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: 'Visitas em aberto', ptText: '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> pets = response.jsonBody['visitas'] ?? [];
|
||||||
|
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||||
|
|
||||||
|
if (pets.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
_visitsList.addAll(pets);
|
||||||
|
_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 Pets", e, s);
|
||||||
|
setState(() {
|
||||||
|
_hasData = false;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _loadMore() {
|
||||||
|
if (_hasData == true) {
|
||||||
|
_pageNumber++;
|
||||||
|
|
||||||
|
_visitsFuture = _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.")),
|
||||||
|
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=${StorageUtil().devUUID}&cliID=${StorageUtil().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: "Entrada", enText: "Entrada")}:': uItem['VTA_DTINICIO'] ?? '',
|
||||||
|
if (uItem['VTA_DTFIM'] != '') '${FFLocalizations.of(context).getVariableText(ptText: "Saída", enText: "Exit")}:': uItem['VTA_DTFIM'] ?? '',
|
||||||
|
},
|
||||||
|
statusHashMap: [
|
||||||
|
if (uItem['VTA_UNICA'] == "N")
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Recorrente',
|
||||||
|
enText: 'Recurrent',
|
||||||
|
): FlutterFlowTheme.of(context).warning,
|
||||||
|
},
|
||||||
|
if (uItem['VTA_UNICA'] == "S")
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Única',
|
||||||
|
enText: 'Unique',
|
||||||
|
): FlutterFlowTheme.of(context).success,
|
||||||
|
},
|
||||||
|
if (uItem['VTA_DTFIM'] != '')
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Finalizada',
|
||||||
|
enText: 'Finished',
|
||||||
|
): FlutterFlowTheme.of(context).success,
|
||||||
|
},
|
||||||
|
if (uItem['VTA_DTFIM'] == '')
|
||||||
|
{
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Em aberto',
|
||||||
|
enText: 'Opened',
|
||||||
|
): FlutterFlowTheme.of(context).warning,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
onTapCardItemAction: () async {},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -143,27 +143,7 @@ class SQLiteStorageHelper implements Storage {
|
||||||
log('Setting up local variables');
|
log('Setting up local variables');
|
||||||
try {
|
try {
|
||||||
await _database?.transaction((txn) async {
|
await _database?.transaction((txn) async {
|
||||||
final keys = [
|
final keys = ['devUUID', 'userUUID', 'userDevUUID', 'status', 'userName', 'cliUUID', 'ownerUUID', 'cliName', 'petAmountRegister', 'whatsapp', 'provisional', 'pets', 'local', 'notify', 'fingerprint', 'access', 'panic', 'person', 'requestOSnotification'];
|
||||||
'devUUID',
|
|
||||||
'userUUID',
|
|
||||||
'userDevUUID',
|
|
||||||
'status',
|
|
||||||
'userName',
|
|
||||||
'cliUUID',
|
|
||||||
'ownerUUID',
|
|
||||||
'cliName',
|
|
||||||
'petAmountRegister',
|
|
||||||
'whatsapp',
|
|
||||||
'provisional',
|
|
||||||
'pets',
|
|
||||||
'local',
|
|
||||||
'notify',
|
|
||||||
'fingerprint',
|
|
||||||
'access',
|
|
||||||
'panic',
|
|
||||||
'person',
|
|
||||||
'requestOSnotification'
|
|
||||||
];
|
|
||||||
|
|
||||||
for (var key in keys) {
|
for (var key in keys) {
|
||||||
log('Fetching value for key: $key');
|
log('Fetching value for key: $key');
|
||||||
|
@ -220,8 +200,7 @@ class SQLiteStorageHelper implements Storage {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<int> set(
|
Future<int> set(String key, dynamic value, Function(dynamic) cacheSetter) async {
|
||||||
String key, dynamic value, Function(dynamic) cacheSetter) async {
|
|
||||||
log('Setting value for key: $key to $value');
|
log('Setting value for key: $key to $value');
|
||||||
CacheUtil().set(key, value);
|
CacheUtil().set(key, value);
|
||||||
final db = await database;
|
final db = await database;
|
||||||
|
@ -260,7 +239,6 @@ class SQLiteStorageHelper implements Storage {
|
||||||
Future<void> purge() async {
|
Future<void> purge() async {
|
||||||
log('Purging SQLite storage');
|
log('Purging SQLite storage');
|
||||||
await deleteDatabaseDB();
|
await deleteDatabaseDB();
|
||||||
await database;
|
|
||||||
log('Database purged');
|
log('Database purged');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/utils/snackbar_util.dart';
|
import 'package:hub/shared/utils/snackbar_util.dart';
|
||||||
|
@ -13,9 +11,6 @@ import '../../utils/log_util.dart';
|
||||||
import '../../utils/storage_util.dart';
|
import '../../utils/storage_util.dart';
|
||||||
|
|
||||||
class AuthenticationService {
|
class AuthenticationService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static Future<void> login(BuildContext context) async {
|
static Future<void> login(BuildContext context) async {
|
||||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||||
|
|
||||||
|
@ -35,10 +30,14 @@ class AuthenticationService {
|
||||||
context.go('/homePage');
|
context.go('/homePage');
|
||||||
}
|
}
|
||||||
StorageUtil().isLogged = true;
|
StorageUtil().isLogged = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future signIn(BuildContext context, FlutterFlowModel model, {String? emailAdress, String? password,}) async {
|
static Future signIn(
|
||||||
|
BuildContext context,
|
||||||
|
FlutterFlowModel model, {
|
||||||
|
String? emailAdress,
|
||||||
|
String? password,
|
||||||
|
}) async {
|
||||||
try {
|
try {
|
||||||
final ApiCallResponse? response;
|
final ApiCallResponse? response;
|
||||||
final LoginCall callback = PhpGroup.loginCall;
|
final LoginCall callback = PhpGroup.loginCall;
|
||||||
|
@ -84,8 +83,7 @@ class AuthenticationService {
|
||||||
if (response.jsonBody['error'] == null) {
|
if (response.jsonBody['error'] == null) {
|
||||||
DialogUtil.errorDefault(context);
|
DialogUtil.errorDefault(context);
|
||||||
} else {
|
} else {
|
||||||
DialogUtil.error(
|
DialogUtil.error(context, response.jsonBody['error_msg'].toString());
|
||||||
context, response.jsonBody['error_msg'].toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,12 +91,17 @@ class AuthenticationService {
|
||||||
return;
|
return;
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
DialogUtil.errorDefault(context);
|
DialogUtil.errorDefault(context);
|
||||||
LogUtil.requestAPIFailed(
|
LogUtil.requestAPIFailed('login.php', emailAdress.toString(), "Login", e, s);
|
||||||
'login.php', emailAdress.toString(), "Login", e, s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<bool> signUp(BuildContext context, {required String? name, String? passwd, required String? email, String? device,}) async {
|
static Future<bool> signUp(
|
||||||
|
BuildContext context, {
|
||||||
|
required String? name,
|
||||||
|
String? passwd,
|
||||||
|
required String? email,
|
||||||
|
String? device,
|
||||||
|
}) async {
|
||||||
try {
|
try {
|
||||||
ApiCallResponse? response;
|
ApiCallResponse? response;
|
||||||
if ((email != null && email != '') && (passwd != null && passwd != '' && passwd.length > 7) && (name != null && name != '')) {
|
if ((email != null && email != '') && (passwd != null && passwd != '' && passwd.length > 7) && (name != null && name != '')) {
|
||||||
|
@ -127,25 +130,24 @@ class AuthenticationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> signOut(BuildContext context) async {
|
static Future<void> signOut(BuildContext context) async {
|
||||||
await PhpGroup.unregisterDevice.call();
|
await PhpGroup.unregisterDevice.call();
|
||||||
final Map<String, dynamic> extra = <String, dynamic>{
|
await StorageUtil().purge();
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
await StorageUtil().ensureInitialization();
|
||||||
hasTransition: true,
|
final Map<String, dynamic> extra = <String, dynamic>{
|
||||||
transitionType: PageTransitionType.scale,
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
alignment: Alignment.bottomCenter,
|
hasTransition: true,
|
||||||
),
|
transitionType: PageTransitionType.scale,
|
||||||
};
|
alignment: Alignment.bottomCenter,
|
||||||
await StorageUtil.purge();
|
),
|
||||||
context.go( '/welcomePage', extra: extra);
|
};
|
||||||
}
|
context.go('/welcomePage', extra: extra);
|
||||||
|
}
|
||||||
|
|
||||||
static Future<void> forgotPassword(BuildContext context, String email) async {
|
static Future<void> forgotPassword(BuildContext context, String email) async {
|
||||||
try {
|
try {
|
||||||
final ApiCallResponse? response;
|
final ApiCallResponse? response;
|
||||||
final ForgotPasswordCall callback = PhpGroup.forgotPasswordCall;
|
final ForgotPasswordCall callback = PhpGroup.forgotPasswordCall;
|
||||||
final String message = FFLocalizations.of(context).getVariableText(
|
final String message = FFLocalizations.of(context).getVariableText(enText: "Send E-mail Successful!", ptText: "E-mail Enviado com Sucesso!");
|
||||||
enText: "Send E-mail Successful!",
|
|
||||||
ptText: "E-mail Enviado com Sucesso!");
|
|
||||||
|
|
||||||
response = await callback.call(email: email);
|
response = await callback.call(email: email);
|
||||||
|
|
||||||
|
@ -156,31 +158,28 @@ class AuthenticationService {
|
||||||
}
|
}
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
DialogUtil.errorDefault(context);
|
DialogUtil.errorDefault(context);
|
||||||
LogUtil.requestAPIFailed(
|
LogUtil.requestAPIFailed('forgotPassword.php', email, "Forgot Password", e, s);
|
||||||
'forgotPassword.php', email, "Forgot Password", e, s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> changePassword(BuildContext context, String email, String password, String token) async {
|
static Future<void> changePassword(BuildContext context, String email, String password, String token) async {
|
||||||
try {
|
try {
|
||||||
final ApiCallResponse response = await PhpGroup.changePasswordCall.call(email: email, psswd: password, token: token);
|
final ApiCallResponse response = await PhpGroup.changePasswordCall.call(email: email, psswd: password, token: token);
|
||||||
|
|
||||||
if (response.jsonBody['error'] == false) {
|
if (response.jsonBody['error'] == false) {
|
||||||
final String message = FFLocalizations.of(context).getVariableText(
|
final String message = FFLocalizations.of(context).getVariableText(
|
||||||
enText: "Password changed successfully!",
|
enText: "Password changed successfully!",
|
||||||
ptText: "Senha alterada com sucesso!",
|
ptText: "Senha alterada com sucesso!",
|
||||||
);
|
);
|
||||||
DialogUtil.success(context, message).then((_) => context.pop);
|
DialogUtil.success(context, message).then((_) => context.pop);
|
||||||
} else {
|
} else {
|
||||||
final String message = response.jsonBody['error_msg'];
|
final String message = response.jsonBody['error_msg'];
|
||||||
DialogUtil.error(context, message);
|
DialogUtil.error(context, message);
|
||||||
} } catch (e, s) {
|
}
|
||||||
|
} catch (e, s) {
|
||||||
DialogUtil.errorDefault(context);
|
DialogUtil.errorDefault(context);
|
||||||
LogUtil.requestAPIFailed(
|
LogUtil.requestAPIFailed('changePassword.php', email, "Change Password", e, s);
|
||||||
'changePassword.php', email, "Change Password", e, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> deleteAccount(BuildContext context) async {
|
static Future<void> deleteAccount(BuildContext context) async {
|
||||||
|
@ -199,7 +198,7 @@ class AuthenticationService {
|
||||||
enText: 'Account deleted successfully',
|
enText: 'Account deleted successfully',
|
||||||
ptText: 'Conta deletada com sucesso',
|
ptText: 'Conta deletada com sucesso',
|
||||||
);
|
);
|
||||||
StorageUtil.purge();
|
StorageUtil().purge();
|
||||||
context.pop();
|
context.pop();
|
||||||
context.go('/welcomePage', extra: extra);
|
context.go('/welcomePage', extra: extra);
|
||||||
}
|
}
|
||||||
|
@ -220,5 +219,4 @@ class AuthenticationService {
|
||||||
SnackBarUtil.showSnackBar(context, content, isError: true);
|
SnackBarUtil.showSnackBar(context, content, isError: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -13,8 +13,6 @@ import '../../utils/snackbar_util.dart';
|
||||||
import '../authentication/authentication_service.dart';
|
import '../authentication/authentication_service.dart';
|
||||||
|
|
||||||
class LocalizationService {
|
class LocalizationService {
|
||||||
|
|
||||||
|
|
||||||
static Future<void> checkLocals(BuildContext context) async {
|
static Future<void> checkLocals(BuildContext context) async {
|
||||||
try {
|
try {
|
||||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||||
|
@ -43,6 +41,7 @@ class LocalizationService {
|
||||||
log(e.toString(), stackTrace: s);
|
log(e.toString(), stackTrace: s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<bool> processLocals(BuildContext context) async {
|
static Future<bool> processLocals(BuildContext context) async {
|
||||||
try {
|
try {
|
||||||
await StorageUtil().ensureInitialization();
|
await StorageUtil().ensureInitialization();
|
||||||
|
@ -87,12 +86,12 @@ class LocalizationService {
|
||||||
} else if (isAvailable) {
|
} else if (isAvailable) {
|
||||||
log('() => isAvailable');
|
log('() => isAvailable');
|
||||||
return await processData(context);
|
return await processData(context);
|
||||||
} else {
|
} else {
|
||||||
if (!isUnique && !isActive) log('() => not unique and not active');
|
if (!isUnique && !isActive) log('() => not unique and not active');
|
||||||
if (!isUnique && isInactived) log('() => not unique and inactived');
|
if (!isUnique && isInactived) log('() => not unique and inactived');
|
||||||
if (!isUnique && isPending) log('() => not unique and pending');
|
if (!isUnique && isPending) log('() => not unique and pending');
|
||||||
if (!isUnique && isBlocked) log('() => not unique and blocked');
|
if (!isUnique && isBlocked) log('() => not unique and blocked');
|
||||||
log('() => else');
|
log('() => else');
|
||||||
return await selectLocal(context);
|
return await selectLocal(context);
|
||||||
}
|
}
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
|
@ -107,6 +106,7 @@ class LocalizationService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<bool> processData(BuildContext context) async {
|
static Future<bool> processData(BuildContext context) async {
|
||||||
try {
|
try {
|
||||||
await StorageUtil().ensureInitialization();
|
await StorageUtil().ensureInitialization();
|
||||||
|
@ -118,8 +118,7 @@ class LocalizationService {
|
||||||
final String errorMsg = response.jsonBody['error_msg'];
|
final String errorMsg = response.jsonBody['error_msg'];
|
||||||
DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context));
|
DialogUtil.error(context, errorMsg).whenComplete(() => selectLocal(context));
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
_updateStorageUtil(response.jsonBody);
|
_updateStorageUtil(response.jsonBody);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -134,6 +133,7 @@ class LocalizationService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<bool> selectLocal(BuildContext context) async {
|
static Future<bool> selectLocal(BuildContext context) async {
|
||||||
return await showModalBottomSheet(
|
return await showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
|
@ -152,6 +152,7 @@ class LocalizationService {
|
||||||
),
|
),
|
||||||
).then((_) async => await processData(context));
|
).then((_) async => await processData(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> unlinkLocal(BuildContext context) async {
|
static Future<void> unlinkLocal(BuildContext context) async {
|
||||||
String content;
|
String content;
|
||||||
try {
|
try {
|
||||||
|
@ -196,11 +197,16 @@ class LocalizationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _handleError(BuildContext context, String errorMsg) {
|
static void _handleError(BuildContext context, String errorMsg) async {
|
||||||
AuthenticationService.signOut(context);
|
await StorageUtil().ensureInitialization();
|
||||||
|
final bool isNotAuthenticated = StorageUtil().userUUID.isEmpty && StorageUtil().devUUID.isEmpty;
|
||||||
|
final bool isLinked = errorMsg.contains('Esse dispositivo nao pertence a esse usuario');
|
||||||
|
log('() => isLinked: $errorMsg');
|
||||||
|
if (isNotAuthenticated || isLinked) AuthenticationService.signOut(context);
|
||||||
DialogUtil.error(context, errorMsg);
|
DialogUtil.error(context, errorMsg);
|
||||||
LogUtil.requestAPIFailed('getLocals.php', '{devUUID: ${StorageUtil().devUUID}, cliUUID: ${StorageUtil().userUUID}}', 'Get Locals', errorMsg, StackTrace.current);
|
LogUtil.requestAPIFailed('getLocals.php', '{devUUID: ${StorageUtil().devUUID}, cliUUID: ${StorageUtil().userUUID}}', 'Get Locals', errorMsg, StackTrace.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<bool> _handleUnavailable(BuildContext context, List<dynamic> locals) async {
|
static Future<bool> _handleUnavailable(BuildContext context, List<dynamic> locals) async {
|
||||||
log('() => isUnavailable');
|
log('() => isUnavailable');
|
||||||
try {
|
try {
|
||||||
|
@ -222,6 +228,7 @@ class LocalizationService {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<bool> _handleEnabled(BuildContext context, dynamic local) async {
|
static Future<bool> _handleEnabled(BuildContext context, dynamic local) async {
|
||||||
log('() => isEnabled');
|
log('() => isEnabled');
|
||||||
StorageUtil().cliName = local['CLI_NOME'];
|
StorageUtil().cliName = local['CLI_NOME'];
|
||||||
|
@ -237,24 +244,31 @@ class LocalizationService {
|
||||||
log('() => CLU_STATUS: $status');
|
log('() => CLU_STATUS: $status');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _isActive(List<dynamic> locals) {
|
static bool _isActive(List<dynamic> locals) {
|
||||||
return locals.where((local) => local['CLU_STATUS'] == 'A').isNotEmpty;
|
return locals.where((local) => local['CLU_STATUS'] == 'A').isNotEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _isInactived(List<dynamic> locals) {
|
static bool _isInactived(List<dynamic> locals) {
|
||||||
return locals.where((local) => local['CLI_ID'] != StorageUtil().cliUUID && local['CLU_STATUS'] == 'A').isNotEmpty;
|
return locals.where((local) => local['CLI_ID'] != StorageUtil().cliUUID && local['CLU_STATUS'] == 'A').isNotEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _isPending(List<dynamic> locals) {
|
static bool _isPending(List<dynamic> locals) {
|
||||||
return locals.where((local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A').isNotEmpty;
|
return locals.where((local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A').isNotEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _isUnselected() {
|
static bool _isUnselected() {
|
||||||
return StorageUtil().cliUUID.isEmpty && StorageUtil().cliName.isEmpty && StorageUtil().ownerUUID.isEmpty;
|
return StorageUtil().cliUUID.isEmpty && StorageUtil().cliName.isEmpty && StorageUtil().ownerUUID.isEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _isSelected(bool isInactived) {
|
static bool _isSelected(bool isInactived) {
|
||||||
return StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty && isInactived;
|
return StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty && isInactived;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _isAvailable() {
|
static bool _isAvailable() {
|
||||||
return StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty;
|
return StorageUtil().cliUUID.isNotEmpty && StorageUtil().cliName.isNotEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _updateStorageUtil(Map<String, dynamic> jsonBody) {
|
static void _updateStorageUtil(Map<String, dynamic> jsonBody) {
|
||||||
StorageUtil().whatsapp = jsonBody['whatsapp'] ?? false;
|
StorageUtil().whatsapp = jsonBody['whatsapp'] ?? false;
|
||||||
StorageUtil().provisional = jsonBody['provisional'] ?? false;
|
StorageUtil().provisional = jsonBody['provisional'] ?? false;
|
||||||
|
@ -262,6 +276,4 @@ class LocalizationService {
|
||||||
StorageUtil().petAmountRegister = jsonBody['petAmountRegister'].toString().isEmpty ? '0' : jsonBody['petAmountRegister'].toString();
|
StorageUtil().petAmountRegister = jsonBody['petAmountRegister'].toString().isEmpty ? '0' : jsonBody['petAmountRegister'].toString();
|
||||||
StorageUtil().userName = jsonBody['visitado']['VDO_NOME'];
|
StorageUtil().userName = jsonBody['visitado']['VDO_NOME'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import 'dart:ffi';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/shared/helpers/secure_storage_helper.dart';
|
import 'package:hub/shared/helpers/secure_storage_helper.dart';
|
||||||
import 'package:hub/shared/helpers/shared_preferences_storage_helper.dart';
|
import 'package:hub/shared/helpers/shared_preferences_storage_helper.dart';
|
||||||
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:hub/shared/utils/cache_util.dart';
|
import 'package:hub/shared/utils/cache_util.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
@ -53,8 +51,7 @@ class StorageUtil {
|
||||||
await SecureStorageHelper().set(data.key, data.value, (v) {});
|
await SecureStorageHelper().set(data.key, data.value, (v) {});
|
||||||
break;
|
break;
|
||||||
case StorageType.sharedPreferences:
|
case StorageType.sharedPreferences:
|
||||||
await SharedPreferencesStorageHelper()
|
await SharedPreferencesStorageHelper().set(data.key, data.value, (v) {});
|
||||||
.set(data.key, data.value, (v) {});
|
|
||||||
break;
|
break;
|
||||||
case StorageType.dbSQLite3:
|
case StorageType.dbSQLite3:
|
||||||
await SQLiteStorageHelper().set(data.key, data.value, (v) {});
|
await SQLiteStorageHelper().set(data.key, data.value, (v) {});
|
||||||
|
@ -109,10 +106,11 @@ class StorageUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> purge() async {
|
Future<void> purge() async {
|
||||||
try {
|
try {
|
||||||
await SecureStorageHelper().purge();
|
await SecureStorageHelper().purge();
|
||||||
await SQLiteStorageHelper().purge();
|
await SQLiteStorageHelper().purge();
|
||||||
|
_initialized = true;
|
||||||
// await SharedPreferencesStorageHelper().purge();
|
// await SharedPreferencesStorageHelper().purge();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log('Error purging data: $e');
|
log('Error purging data: $e');
|
||||||
|
@ -122,12 +120,13 @@ class StorageUtil {
|
||||||
Future<bool> ensureInitialization() async {
|
Future<bool> ensureInitialization() async {
|
||||||
try {
|
try {
|
||||||
log('StorageUtil: Starting initialization');
|
log('StorageUtil: Starting initialization');
|
||||||
if(!_initialized) return true;
|
if (!_initialized) return true;
|
||||||
await initSharedPreferences();
|
if (_initialized) await SharedPreferencesStorageHelper().initialize();
|
||||||
await initSecureStorage();
|
await initSecureStorage();
|
||||||
|
await initSharedPreferences();
|
||||||
await initSQLiteStorage();
|
await initSQLiteStorage();
|
||||||
if(_initialized) _initialized = false;
|
if (_initialized) _initialized = false;
|
||||||
if(_initialized) return true;
|
if (_initialized) return true;
|
||||||
return false;
|
return false;
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
log('Error initializing storage: $e');
|
log('Error initializing storage: $e');
|
||||||
|
@ -138,10 +137,9 @@ class StorageUtil {
|
||||||
|
|
||||||
Future<void> initSharedPreferences() async {
|
Future<void> initSharedPreferences() async {
|
||||||
try {
|
try {
|
||||||
if(_initialized) _sharedPreferences = SharedPreferencesStorageHelper();
|
if (_initialized) _sharedPreferences = SharedPreferencesStorageHelper();
|
||||||
_sharedPreferences.prefs ??= await SharedPreferences.getInstance();
|
_sharedPreferences.prefs ??= await SharedPreferences.getInstance();
|
||||||
final bool milestone =
|
final bool milestone = _sharedPreferences.prefs?.getBool('fre_isFirstRun') ?? true;
|
||||||
_sharedPreferences.prefs?.getBool('fre_isFirstRun') ?? true;
|
|
||||||
if (milestone) {
|
if (milestone) {
|
||||||
isFirstRun = false;
|
isFirstRun = false;
|
||||||
await _sharedPreferences.prefs?.setBool('fre_isFirstRun', false);
|
await _sharedPreferences.prefs?.setBool('fre_isFirstRun', false);
|
||||||
|
@ -153,15 +151,14 @@ class StorageUtil {
|
||||||
}
|
}
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
log('SharedPreferencesStorageHelper: Error during initialization');
|
log('SharedPreferencesStorageHelper: Error during initialization');
|
||||||
LogUtil.requestAPIFailed(
|
LogUtil.requestAPIFailed('$UniqueKey', '$UniqueKey', 'SharedPreferencesStorageHelper', e, s);
|
||||||
'$UniqueKey', '$UniqueKey', 'SharedPreferencesStorageHelper', e, s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initSecureStorage() async {
|
Future<void> initSecureStorage() async {
|
||||||
log('SecureStorageHelper: Starting initialization');
|
log('SecureStorageHelper: Starting initialization');
|
||||||
try {
|
try {
|
||||||
if(_initialized) _secureStorage = SecureStorageHelper();
|
if (_initialized) _secureStorage = SecureStorageHelper();
|
||||||
_email = await _secureStorage.getString('fre_email');
|
_email = await _secureStorage.getString('fre_email');
|
||||||
_passwd = await _secureStorage.getString('fre_passwd');
|
_passwd = await _secureStorage.getString('fre_passwd');
|
||||||
_deviceType = await _secureStorage.getString('fre_deviceType');
|
_deviceType = await _secureStorage.getString('fre_deviceType');
|
||||||
|
@ -171,12 +168,10 @@ class StorageUtil {
|
||||||
_panicPass = await _secureStorage.getString('fre_panicPass');
|
_panicPass = await _secureStorage.getString('fre_panicPass');
|
||||||
_fingerprintPass = await _secureStorage.getString('fre_fingerprintPass');
|
_fingerprintPass = await _secureStorage.getString('fre_fingerprintPass');
|
||||||
_haveLocal = await _secureStorage.getBool('fre_have_local') ?? false;
|
_haveLocal = await _secureStorage.getBool('fre_have_local') ?? false;
|
||||||
_deviceDescription =
|
_deviceDescription = await _secureStorage.getString('fre_deviceDescription');
|
||||||
await _secureStorage.getString('fre_deviceDescription');
|
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
log('SecureStorageHelper: Error during initialization: $e');
|
log('SecureStorageHelper: Error during initialization: $e');
|
||||||
LogUtil.requestAPIFailed(
|
LogUtil.requestAPIFailed('$UniqueKey', '$UniqueKey', 'SecureStorageHelper', e, s);
|
||||||
'$UniqueKey', '$UniqueKey', 'SecureStorageHelper', e, s);
|
|
||||||
}
|
}
|
||||||
log('SecureStorageHelper: Initialization complete');
|
log('SecureStorageHelper: Initialization complete');
|
||||||
}
|
}
|
||||||
|
@ -184,7 +179,7 @@ class StorageUtil {
|
||||||
Future<void> initSQLiteStorage() async {
|
Future<void> initSQLiteStorage() async {
|
||||||
log('SQLiteStorageHelper: Starting initialization');
|
log('SQLiteStorageHelper: Starting initialization');
|
||||||
try {
|
try {
|
||||||
if(_initialized) _sqliteStorage = SQLiteStorageHelper();
|
if (_initialized) _sqliteStorage = SQLiteStorageHelper();
|
||||||
await _sqliteStorage.database;
|
await _sqliteStorage.database;
|
||||||
_devUUID = await _sqliteStorage.get('fre_devUUID') ?? '';
|
_devUUID = await _sqliteStorage.get('fre_devUUID') ?? '';
|
||||||
_userUUID = await _sqliteStorage.get('fre_userUUID') ?? '';
|
_userUUID = await _sqliteStorage.get('fre_userUUID') ?? '';
|
||||||
|
@ -204,12 +199,10 @@ class StorageUtil {
|
||||||
_access = await _sqliteStorage.getBoolean('fre_access');
|
_access = await _sqliteStorage.getBoolean('fre_access');
|
||||||
_panic = await _sqliteStorage.getBoolean('fre_panic');
|
_panic = await _sqliteStorage.getBoolean('fre_panic');
|
||||||
_person = await _sqliteStorage.getBoolean('fre_person');
|
_person = await _sqliteStorage.getBoolean('fre_person');
|
||||||
_requestOSnotification =
|
_requestOSnotification = await _sqliteStorage.getBoolean('fre_requestOSnotification');
|
||||||
await _sqliteStorage.getBoolean('fre_requestOSnotification');
|
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
log('SQLiteStorageHelper: Error during initialization: $e');
|
log('SQLiteStorageHelper: Error during initialization: $e');
|
||||||
LogUtil.requestAPIFailed(
|
LogUtil.requestAPIFailed('$UniqueKey', '$UniqueKey', 'SQLiteStorageHelper', e, s);
|
||||||
'$UniqueKey', '$UniqueKey', 'SQLiteStorageHelper', e, s);
|
|
||||||
}
|
}
|
||||||
log('SQLiteStorageHelper: Initialization complete');
|
log('SQLiteStorageHelper: Initialization complete');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.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/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/pages/home_page/home_page_model.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 {
|
class CustomDrawer extends StatelessWidget {
|
||||||
const CustomDrawer({super.key, required this.model});
|
const CustomDrawer({super.key, required this.model});
|
||||||
final HomePageModel model;
|
final HomePageModel model;
|
||||||
|
@ -64,11 +62,9 @@ class CustomDrawer extends StatelessWidget {
|
||||||
height: 80.0,
|
height: 80.0,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
placeholder: (context, url) =>
|
placeholder: (context, url) => Image.asset('assets/images/person.jpg'),
|
||||||
Image.asset('assets/images/person.jpg'),
|
|
||||||
errorListener: (_) => Image.asset('assets/images/person.jpg'),
|
errorListener: (_) => Image.asset('assets/images/person.jpg'),
|
||||||
errorWidget: (_, __, ___) =>
|
errorWidget: (_, __, ___) => Image.asset('assets/images/person.jpg'),
|
||||||
Image.asset('assets/images/person.jpg'),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -164,13 +160,9 @@ class CustomDrawer extends StatelessWidget {
|
||||||
|
|
||||||
Widget _buildDrawerBody() {
|
Widget _buildDrawerBody() {
|
||||||
return wrapWithModel(
|
return wrapWithModel(
|
||||||
model: model.menuComponentModel,
|
model: model.drawerMenuComponentModel,
|
||||||
updateCallback: () {},
|
updateCallback: () {},
|
||||||
child: const MenuComponentWidget(
|
child: MenuComponentWidget(model: model.drawerMenuComponentModel),
|
||||||
expandable: false,
|
|
||||||
style: MenuView.list,
|
|
||||||
item: MenuItem.tile,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue