Merge pull request #23 from FRE-Informatica/fix/fd-685

Fix/fd 685
This commit is contained in:
Jônatas Antunes Messias 2024-08-21 15:23:02 -03:00 committed by GitHub
commit fc06f41a25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
55 changed files with 1436 additions and 15777 deletions

View File

@ -30,6 +30,7 @@ if (keystorePropertiesFile.exists()) {
android {
compileSdkVersion 34
compileSdk 34
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@ -46,8 +47,19 @@ android {
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
@ -57,6 +69,10 @@ android {
}
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
}
buildTypes {
release {
signingConfig signingConfigs.debug
@ -71,9 +87,12 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10"
// id "org.jetbrains.kotlin.android" version "1.8.10" apply false
implementation 'com.android.support:multidex:1.0.3' // Se necessário, adicione suporte ao multidex
// Adicione outras dependências do seu aplicativo aqui
implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0'
}
apply plugin: 'com.google.gms.google-services'

View File

@ -1,13 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.freaccess.hub"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application
android:label="FREHub"
@ -22,36 +23,41 @@
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustResize"
android:showWhenLocked="true"
android:turnScreenOn="true">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Deep linking -->
<meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_fre_black" />
android:name="com.google.firebase.messaging.ic_fre_black"
android:resource="@drawable/ic_fre_black" />
<intent-filter android:autoVerify="true">
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
@ -67,6 +73,17 @@
android:value="2" />
<receiver android:exported="false"
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<receiver android:exported="false"
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
</application>
</manifest>
</manifest>

View File

@ -5,13 +5,13 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2' // Use a versão do Gradle que corresponde à sua configuração
classpath 'com.android.tools.build:gradle:7.3.1' // Use a versão do Gradle que corresponde à sua configuração
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10' // Kotlin Gradle plugin
classpath 'com.google.gms:google-services:4.4.2' // Google Services plugin
// Certifique-se de adicionar outras dependências do classpath aqui, se necessário.
}
}
allprojects {
repositories {
google()

View File

@ -1,6 +1,6 @@
#Sat Jun 15 18:23:23 BRT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -42,4 +42,12 @@ post_install do |installer|
end
end
awesome_pod_file = File.expand_path(File.join('plugins', 'awesome_notifications', 'ios', 'Scripts', 'AwesomePodFile'), '.symlinks')
require awesome_pod_file
update_awesome_pod_build_settings(installer)
end
awesome_pod_file = File.expand_path(File.join('plugins', 'awesome_notifications', 'ios', 'Scripts', 'AwesomePodFile'), '.symlinks')
require awesome_pod_file
update_awesome_main_target_settings('Runner', File.dirname(File.realpath(__FILE__)), flutter_root)

View File

@ -1,4 +1,7 @@
PODS:
- awesome_notifications (0.9.3):
- Flutter
- IosAwnCore (~> 0.9.3)
- connectivity_plus (0.0.1):
- Flutter
- FlutterMacOS
@ -133,8 +136,6 @@ PODS:
- flutter_inappwebview_ios/Core (0.0.1):
- Flutter
- OrderedSet (~> 5.0)
- flutter_local_notifications (0.0.1):
- Flutter
- flutter_secure_storage (6.0.0):
- Flutter
- fluttertoast (0.0.2):
@ -194,8 +195,10 @@ PODS:
- GoogleUtilities/Privacy
- image_picker_ios (0.0.1):
- Flutter
- IosAwnCore (0.9.3)
- local_auth_darwin (0.0.1):
- Flutter
- FlutterMacOS
- nanopb (2.30910.0):
- nanopb/decode (= 2.30910.0)
- nanopb/encode (= 2.30910.0)
@ -232,6 +235,7 @@ PODS:
- Flutter
DEPENDENCIES:
- awesome_notifications (from `.symlinks/plugins/awesome_notifications/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
@ -241,7 +245,6 @@ DEPENDENCIES:
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`)
- flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
@ -272,6 +275,7 @@ SPEC REPOS:
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleUtilities
- IosAwnCore
- nanopb
- OrderedSet
- PromisesObjC
@ -281,6 +285,8 @@ SPEC REPOS:
- Toast
EXTERNAL SOURCES:
awesome_notifications:
:path: ".symlinks/plugins/awesome_notifications/ios"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/darwin"
device_info_plus:
@ -299,8 +305,6 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_inappwebview_ios:
:path: ".symlinks/plugins/flutter_inappwebview_ios/ios"
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
fluttertoast:
@ -327,6 +331,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
SPEC CHECKSUMS:
awesome_notifications: 66d28ab7174ca2823b04d275cb043e0a4a3eb9cf
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
@ -348,14 +353,14 @@ SPEC CHECKSUMS:
FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_inappwebview_ios: 97215cf7d4677db55df76782dbd2930c5e1c1ea0
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c
GoogleAppMeasurement: f65fc137531af9ad647f1c0a42f3b6a4d3a98049
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
local_auth_darwin: 4d56c90c2683319835a61274b57620df9c4520ab
IosAwnCore: b8601fbb37f7b3560f31b84ebf55a72f65812e05
local_auth_darwin: 66e40372f1c29f383a314c738c7446e2f7fdadc3
nanopb: 438bc412db1928dac798aa6fd75726007be04262
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
@ -370,8 +375,8 @@ SPEC CHECKSUMS:
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36
webview_flutter_wkwebview: 2a23822e9039b7b1bc52e5add778e5d89ad488d1
PODFILE CHECKSUM: d7f4d1b71f8c708247c1078c4aec33a28c763405
PODFILE CHECKSUM: 3bb356a4513d56583f2f2461d3d8eefb4cd4c3a4
COCOAPODS: 1.14.3

View File

@ -41,8 +41,8 @@
4C588A6A63D12FBFE8C3D586 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
4C7A2C30DCF835BA60FAD235 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
50BE974D08F66282C0031620 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
6436409127A31CDB00820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6436409227A31CD800820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6436409227A31CDD00820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6436409B27A31CD600820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
@ -53,8 +53,6 @@
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
6436409227A31CDD00820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6436409B27A31CD600820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C1B4A503715BC7B0F8826983 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -382,8 +380,10 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@ -528,8 +528,10 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@ -568,8 +570,10 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";

View File

@ -1,7 +1,6 @@
import UIKit
import Flutter
import flutter_local_notifications
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
@ -9,15 +8,6 @@ import flutter_local_notifications
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
GeneratedPluginRegistrant.register(with: registry)
}
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

View File

@ -1,22 +1,16 @@
import 'dart:developer';
import 'package:flutter/material.dart';
// import 'package:hub/components/organisms/bottom_arrow_linked_locals/bottom_arrow_linked_locals_component_widget.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart';
import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart';
import 'package:hub/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart';
import 'package:hub/custom_code/actions/get_dev_u_u_i_d.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/random_data_util.dart';
import 'package:hub/pages/home_page/home_page_model.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
import '../shared/utils/log_util.dart';
@ -112,23 +106,23 @@ Future singInLoginAction(
await Future.wait([
Future(() async {
FFAppState().email = emailAdress!;
AppState().email = emailAdress!;
}),
Future(() async {
FFAppState().passwd = password!;
AppState().passwd = password!;
}),
]);
if ((FFAppState().email != '') && (FFAppState().passwd != '')) {
if ((AppState().email != '') && (AppState().passwd != '')) {
devUUID = await getDevUUID();
FFAppState().devUUID = devUUID!;
AppState().devUUID = devUUID!;
loginCall = await PhpGroup.loginCall.call(
email: FFAppState().email,
password: FFAppState().passwd,
uuid: FFAppState().devUUID,
type: FFAppState().device,
email: AppState().email,
password: AppState().passwd,
uuid: AppState().devUUID,
type: AppState().device,
description: randomString(
10,
10,
@ -139,30 +133,30 @@ Future singInLoginAction(
);
if (PhpGroup.loginCall.error((loginCall.jsonBody ?? '')) == false) {
FFAppState().userUUID = PhpGroup.loginCall.userUUID(
AppState().userUUID = PhpGroup.loginCall.userUUID(
(loginCall.jsonBody ?? ''),
)!;
FFAppState().createdAt = dateTimeFormat(
AppState().createdAt = dateTimeFormat(
'd/M/y H:mm:ss',
getCurrentTimestamp,
locale: FFLocalizations.of(context).languageCode,
);
FFAppState().updatedAt = '00/00/0000 00:00:00';
AppState().updatedAt = '00/00/0000 00:00:00';
FFAppState().status =
AppState().status =
PhpGroup.loginCall.userStatus((loginCall.jsonBody ?? ''))!;
FFAppState().userDevUUID =
AppState().userDevUUID =
PhpGroup.loginCall.userDeviceId((loginCall.jsonBody ?? ''))!;
FFAppState().name =
AppState().name =
PhpGroup.loginCall.userName((loginCall.jsonBody ?? ''))!;
FFAppState().serialNumber = await getSerialNumber() ?? '';
AppState().serialNumber = await getSerialNumber() ?? '';
FFAppState().isLogged = true;
AppState().isLogged = true;
await toggleHomePage(context);
} else {
@ -173,13 +167,13 @@ Future singInLoginAction(
PhpGroup.loginCall.msg((loginCall?.jsonBody ?? '')).toString());
}
FFAppState().deleteEmail();
FFAppState().email = '';
AppState().deleteEmail();
AppState().email = '';
FFAppState().deletePasswd();
FFAppState().passwd = '';
AppState().deletePasswd();
AppState().passwd = '';
FFAppState().update(() {});
AppState().update(() {});
}
}
@ -271,15 +265,15 @@ Future forgotPasswdAction(
}
Future cachingLoginActionApp(BuildContext context) async {
if (FFAppState().isLogged == true) {
if (AppState().isLogged == true) {
context.pushNamed('homePage');
} else {
if (isAndroid == true) {
FFAppState().device = 'Android';
AppState().device = 'Android';
} else if (isiOS == true) {
FFAppState().device = 'iOS';
AppState().device = 'iOS';
} else {
FFAppState().device = 'Web';
AppState().device = 'Web';
}
}
}
@ -328,9 +322,9 @@ Future<bool> visitCancelAction(BuildContext context,
ApiCallResponse? apiCallResponse;
apiCallResponse = await PhpGroup.cancelaVisita.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliID: FFAppState().cliUUID,
userUUID: AppState().userUUID,
devUUID: AppState().devUUID,
cliID: AppState().cliUUID,
atividade: 'cancelaVisita',
idDestino: idDestino,
idVisita: idVisita,
@ -381,8 +375,8 @@ Future<bool> checkLocals({
}) async {
// A chamada para a API permanece a mesma, assumindo que é necessária sempre.
final response = await PhpGroup.getLocalsCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
);
// Verificação rápida de erro para evitar processamento desnecessário.
@ -391,7 +385,7 @@ Future<bool> checkLocals({
}
// Uso eficiente de coleções para verificar a condição desejada.
final String uuid = cliUUID ?? FFAppState().cliUUID;
final String uuid = cliUUID ?? AppState().cliUUID;
final bool itemFound = response.jsonBody['locais'].any(
(local) => local['CLI_ID'] == uuid && local['CLU_STATUS'] == "A",
);
@ -422,33 +416,25 @@ Future<bool> checkLocals({
}
}
Future<String> answersRequest(BuildContext context, String? ref, String? task, String? response, String? id) async {
try {
ApiCallResponse? respondeSolicitacaoCall;
Future answersRequest(BuildContext context, String? ref, String? task,
String? response, String? id) async {
ApiCallResponse? respondeSolicitacaoCall;
respondeSolicitacaoCall = await PhpGroup.respondeSolicitacaoCall.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliUUID: FFAppState().cliUUID,
atividade: 'respondeSolicitacao',
referencia: ref,
tarefa: task,
resposta: response,
idVisitante: id,
);
respondeSolicitacaoCall = await PhpGroup.respondeSolicitacaoCall.call(
userUUID: AppState().userUUID,
devUUID: AppState().devUUID,
cliUUID: AppState().cliUUID,
atividade: 'respondeSolicitacao',
referencia: ref,
tarefa: task,
resposta: response,
idVisitante: id,
);
if (respondeSolicitacaoCall.statusCode == 200) {
if (!respondeSolicitacaoCall.jsonBody['error']) {
return '';
} else {
return respondeSolicitacaoCall.jsonBody['error_msg'].toString();
}
} else {
return FFLocalizations.of(context).getVariableText(ptText: 'Falha ao Responder Solicitação', enText: 'Failed to Response Request');
}
} catch (e, s) {
return FFLocalizations.of(context).getVariableText(ptText: 'Falha ao Responder Solicitação', enText: 'Failed to Response Request');
if (respondeSolicitacaoCall.statusCode == 200) {
return !respondeSolicitacaoCall.jsonBody['error'];
} else {
return false;
}
}

View File

@ -1,12 +1,12 @@
// import 'dart:ffi';
import 'package:csv/csv.dart';
import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:csv/csv.dart';
import 'package:local_auth/local_auth.dart';
import 'package:synchronized/synchronized.dart';
class FFAppState extends ChangeNotifier {
class AppState extends ChangeNotifier {
// Adiciona a variável para controle de autenticação biométrica
bool _isBiometricAuthenticated = false;
bool get isBiometricAuthenticated => _isBiometricAuthenticated;
@ -57,16 +57,16 @@ class FFAppState extends ChangeNotifier {
// Limpar a informação salva, se necessário
}
static FFAppState _instance = FFAppState._internal();
static AppState _instance = AppState._internal();
factory FFAppState() {
factory AppState() {
return _instance;
}
FFAppState._internal();
AppState._internal();
static void reset() {
_instance = FFAppState._internal();
_instance = AppState._internal();
}
Future initializePersistedState() async {
@ -150,6 +150,9 @@ class FFAppState extends ChangeNotifier {
_fingerprintPass =
await secureStorage.getString('fingerprintPass') ?? _fingerprintPass;
});
await _safeInitAsync(() async {
_context = await secureStorage.getObject('ff_context') ?? _context;
});
}
void update(VoidCallback callback) {
@ -159,6 +162,17 @@ class FFAppState extends ChangeNotifier {
late FlutterSecureStorage secureStorage;
BuildContext? _context;
BuildContext? get context => _context;
set context(BuildContext? value) {
_context = value;
secureStorage.setString('ff_context', value.toString());
}
void deleteContext() {
secureStorage.delete(key: 'ff_context');
}
bool _panicOPT = false;
bool get panic => _panicOPT;
set panic(bool value) {
@ -481,6 +495,14 @@ extension FlutterSecureStorageExtensions on FlutterSecureStorage {
Future<void> setDouble(String key, double value) async =>
await writeSync(key: key, value: value.toString());
Future<BuildContext?> getObject(String key) async {
final value = await read(key: key);
if (value == null || value.isEmpty) {
return null;
}
return value as BuildContext;
}
Future<List<String>?> getStringList(String key) async =>
await read(key: key).then((result) {
if (result == null || result.isEmpty) {

View File

@ -7,13 +7,12 @@ import 'dart:io';
import 'dart:typed_data';
import 'package:collection/collection.dart';
import 'package:http/http.dart' as http;
import 'package:equatable/equatable.dart';
import 'package:http/http.dart' as http;
import 'package:http_parser/http_parser.dart';
import 'package:mime_type/mime_type.dart';
import '/flutter_flow/uploaded_file.dart';
import 'get_streamed_response.dart';
enum ApiCallType {
@ -411,7 +410,6 @@ class ApiManager {
ApiCallOptions? options,
http.Client? client,
}) async {
final callOptions = options ??
ApiCallOptions(
callName: callName,
@ -512,6 +510,8 @@ class ApiManager {
result = ApiCallResponse(null, {}, -1, exception: e);
}
log('Params: $params');
log('JsonBody: ${result.jsonBody}');
return result;
}
}

View File

@ -0,0 +1,73 @@
import 'dart:developer';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:hub/app_state.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'notification_service.dart';
Future<void> handleMessage(RemoteMessage message) async {
NotificationService.show(
title: message.notification!.title!,
body: message.notification!.body!,
payload: Map<String, String>.from(message.data));
}
class FirebaseMessagingService {
// Singleton instance
static final FirebaseMessagingService _instance =
FirebaseMessagingService._internal();
// Factory constructor
factory FirebaseMessagingService() => _instance;
// Private constructor
FirebaseMessagingService._internal();
final _firebaseMessaging = FirebaseMessaging.instance;
Future<void> initNotifications() async {
await _firebaseMessaging.requestPermission();
_refreshToken();
_firebaseMessaging.setAutoInitEnabled(false);
_firebaseMessaging.pluginConstants;
FirebaseMessaging.onBackgroundMessage(handleMessage);
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
handleMessage(message);
});
}
Future<void> updateDeviceToken() async {
try {
final String? deviceToken = await _firebaseMessaging.getToken();
if (deviceToken != null) {
AppState().token = deviceToken;
final ApiCallResponse? response = await PhpGroup.updToken.call(
token: AppState().token,
devid: AppState().devUUID,
useruuid: AppState().userUUID);
if (PhpGroup.updToken.error((response?.jsonBody ?? '')) == false) {
log('Token Atualizado com Sucesso!');
} else {
log('Falha ao Atualizar Token: ${response?.jsonBody}');
}
} else {
log('Falha ao Pegar Token do Firebase');
}
} catch (e, s) {
LogUtil.requestAPIFailed("updToken.php", "", "Atualizar Token", e, s);
}
}
void _refreshToken() {
_firebaseMessaging.onTokenRefresh.listen((token) => updateDeviceToken);
}
}

View File

@ -0,0 +1,352 @@
import 'dart:developer';
import 'package:awesome_notifications/awesome_notifications.dart';
import 'package:flutter/material.dart';
import 'package:hub/actions/actions.dart';
import 'package:hub/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart';
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/shared/utils/dialog_util.dart';
class NotificationService {
static Future<void> initialize() async {
await AwesomeNotifications().initialize(
null,
[
NotificationChannel(
channelKey: 'basic_channel',
channelGroupKey: 'basic_channel',
channelName: 'Basic notifications',
channelDescription: 'Notification channel for tests',
importance: NotificationImportance.Max,
channelShowBadge: true,
playSound: true,
criticalAlerts: true,
onlyAlertOnce: true,
defaultColor: const Color(0xFF9D58D0),
ledColor: Colors.white)
],
channelGroups: [
NotificationChannelGroup(
channelGroupKey: 'basic_channel_group',
channelGroupName: 'group_1')
],
debug: true);
await AwesomeNotifications()
.isNotificationAllowed()
.then((isAllowed) async {
if (!isAllowed) {
await AwesomeNotifications().requestPermissionToSendNotifications();
}
});
await AwesomeNotifications().setListeners(
onActionReceivedMethod: onActionReceivedMethod,
onNotificationCreatedMethod: onNotificationCreatedMethod,
onNotificationDisplayedMethod: onNotificationDisplayedMethod,
onDismissActionReceivedMethod: onDismissActionReceivedMethod);
}
static Future<void> onActionReceivedMethod(
ReceivedAction receivedAction) async {
final payload = receivedAction.payload ?? {};
final extra = receivedAction.body;
final handleClick = payload['click_action'];
final localId = jsonDecode(payload['local']!)['CLI_ID'];
log('payload: $payload');
log('extra: $extra');
switch (handleClick) {
case 'visit_request':
showDialog(
context: AppState().context!,
barrierColor: Colors.transparent,
barrierDismissible: true,
builder: (BuildContext context) {
return Dialog(
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.height * 0.6,
child: DetailsComponentWidget(
buttons: [
FlutterFlowIconButton(
icon: const Icon(Icons.done),
onPressed: () async {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Aprovar Visita',
enText: 'Approve Visit',
),
),
content: Text(
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja aprovar essa visita?',
enText:
'Are you sure you want to approve this visit?',
),
),
backgroundColor: FlutterFlowTheme.of(context)
.primaryBackground,
actions: [
FFButtonWidget(
text: FFLocalizations.of(context)
.getVariableText(
enText: 'No',
ptText: 'Não',
),
onPressed: () {
Navigator.pop(context);
},
options: FFButtonOptions(
width: 100,
height: 40,
color: FlutterFlowTheme.of(context)
.primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context)
.primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius:
BorderRadius.circular(10)),
),
FFButtonWidget(
text: FFLocalizations.of(context)
.getVariableText(
enText: 'Yes',
ptText: 'Sim',
),
onPressed: () async {
log("payload: $payload");
await answersRequest
.call(
context,
payload['referencia'].toString(),
'L',
'Mensagem',
payload['idVisitante'].toString(),
)
.then((value) {
if (value) {
Navigator.pop(context);
Navigator.pop(context);
} else {
Navigator.pop(context);
Navigator.pop(context);
DialogUtil.errorDefault(context);
}
}).catchError((e) {
Navigator.pop(context);
Navigator.pop(context);
DialogUtil.errorDefault(context);
});
},
options: FFButtonOptions(
width: 100,
height: 40,
color: FlutterFlowTheme.of(context)
.primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context)
.primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
),
],
);
});
},
),
FlutterFlowIconButton(
icon: const Icon(Icons.close),
onPressed: () async {
showAlertDialog(
context,
FFLocalizations.of(context).getVariableText(
ptText: 'Bloquear Visita',
enText: 'Block Visit',
),
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja bloquear essa visita?',
enText:
'Are you sure you want to block this visit?',
), () async {
await answersRequest
.call(
context,
payload['referencia'].toString(),
'B',
'Mensagem',
payload['idVisitante'].toString(),
)
.then((value) {
if (value) {
Navigator.pop(context);
Navigator.pop(context);
} else {
Navigator.pop(context);
Navigator.pop(context);
DialogUtil.errorDefault(context);
}
}).catchError((e) {
Navigator.pop(context);
Navigator.pop(context);
DialogUtil.errorDefault(context);
});
});
},
),
],
labelsHashMap: Map<String, String>.from({
FFLocalizations.of(context).getVariableText(
enText: 'Visitor',
ptText: 'Visitante',
): payload['nomevisita'],
FFLocalizations.of(context).getVariableText(
enText: 'Reason',
ptText: 'Motivo',
): payload['motivo'],
FFLocalizations.of(context).getVariableText(
enText: 'Message',
ptText: 'Mensagem',
): payload['mensagem'],
}),
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${payload['documento'] ?? ''}&tipo=E',
statusHashMap: [
{
FFLocalizations.of(context).getVariableText(
enText: 'Active',
ptText: 'Ativo',
): FlutterFlowTheme.of(context).warning,
},
],
),
),
);
});
break;
case 'access':
showDialog(
context: AppState().context!,
barrierColor: Colors.transparent,
barrierDismissible: true,
builder: (BuildContext context) {
return Dialog(
backgroundColor: Colors.transparent,
child: AccessNotificationModalTemplateComponentWidget(
datetime: payload['ACE_DATAHORA'].toString(),
drive: payload['ACI_DESCRICAO'].toString(),
id: payload['USR_TIPO'].toString() == 'O'
? payload['USR_ID'].toString() == ''
? '0'
: payload['USR_ID'].toString()
: payload['USR_DOCUMENTO'].toString() == ''
? '0'
: payload['USR_DOCUMENTO'].toString(),
name: payload['PES_NOME'].toString(),
type: payload['USR_TIPO'],
),
);
});
break;
case 'mensagem':
showDialog(
context: AppState().context!,
barrierColor: Colors.transparent,
barrierDismissible: true,
builder: (BuildContext context) {
return Dialog(
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.3,
child: MessageNotificationModalTemplateComponentWidget(
id: localId,
from: payload['remetente'].toString(),
to: payload['destinatario'].toString() == 'O'
? 'Morador'
: 'Visitante',
message:
extra.toString().isEmpty ? 'Unknown' : extra.toString(),
),
),
);
});
break;
default:
log('default');
break;
}
// showAlertDialog(AppState().context!, 'Test', 'Test', () async {});
}
static Future<void> onNotificationCreatedMethod(
ReceivedNotification receivedNotification) async {}
static Future<void> onNotificationDisplayedMethod(
ReceivedNotification receivedNotification) async {}
static Future<void> onDismissActionReceivedMethod(
ReceivedAction receivedAction) async {}
static Future<void> show({
required final String title,
required final String body,
final String? summary,
final Map<String, String>? payload,
final ActionType actionType = ActionType.Default,
final NotificationLayout notificationLayout = NotificationLayout.Default,
final NotificationCategory? category,
final String? bigPicture,
final List<NotificationActionButton>? actionButtons,
final bool scheduled = false,
final int? interval,
}) async {
assert(!scheduled || (scheduled && interval != null));
await AwesomeNotifications().createNotification(
content: NotificationContent(
id: 0,
channelKey: 'basic_channel',
title: title,
body: body,
actionType: actionType,
notificationLayout: notificationLayout,
summary: summary,
category: category,
payload: payload,
bigPicture: bigPicture,
),
actionButtons: actionButtons,
schedule: scheduled
? NotificationInterval(
interval: interval,
timeZone:
await AwesomeNotifications().getLocalTimeZoneIdentifier(),
preciseAlarm: true)
: null);
}
}

View File

@ -1,571 +0,0 @@
import 'dart:async';
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'dart:math' as math;
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:hub/actions/actions.dart';
import 'package:hub/app_state.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart';
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart';
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:rxdart/rxdart.dart';
//
class PushNotificationService {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance;
final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
final Subject<RemoteMessage> _onMessage = BehaviorSubject<RemoteMessage>();
final BehaviorSubject<BuildContext> _context =
BehaviorSubject<BuildContext>();
final BehaviorSubject<Map<String, dynamic>> _notificationDetails =
BehaviorSubject<Map<String, dynamic>>();
PushNotificationService() {
_initializeLocalNotifications(_context);
_createNotificationChannels();
}
Subject<RemoteMessage> getOnMessage() {
return _onMessage;
}
Future<void> initialize(BuildContext context) async {
_context.add(context);
await _requestPermissions();
_listenToForegroundMessages(context);
_listenToBackgroundMessages();
_listenToNotificationClicks(context);
await updateDeviceToken();
}
Future<void> _requestPermissions() async {
NotificationSettings settings = await _firebaseMessaging.requestPermission(
alert: true,
badge: true,
sound: true,
);
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
} else {}
}
Map<String, dynamic> validJsonFromString(String? jsonString) {
if (jsonString == null || jsonString.isEmpty) {
return {};
}
// Passo 1 e 2: Adiciona aspas duplas em torno das chaves e valores que não estão corretamente delimitados
String correctedJson = jsonString.replaceAllMapped(
RegExp(r'([a-zA-Z0-9_]+)\s*:\s*([^",\}\]]+)'), (match) {
var key = '"${match[1]!}"'; // Chaves sempre recebem aspas
var value = match[2]!.trim();
// Verifica se o valor é uma string (não numérica, booleana, nula ou objeto JSON)
bool isStringValue = !RegExp(r'^-?\d+(\.\d+)?$').hasMatch(value) &&
value != 'true' &&
value != 'false' &&
value != 'null' &&
!value.startsWith('{') &&
!value.endsWith('}');
// Adiciona aspas duplas em torno do valor se for uma string
String quotedValue = isStringValue ? '"$value"' : value;
return '$key: $quotedValue';
});
// Passo 3: Tratar corretamente strings JSON aninhadas
correctedJson =
correctedJson.replaceAllMapped(RegExp(r'"{([^"]+)}"'), (match) {
// Remove as aspas duplas extras em torno de objetos JSON aninhados
return '{${match[1]!}}';
});
try {
// Passo 4: Decodificar o JSON corrigido
return jsonDecode(correctedJson);
} catch (e) {
return {};
}
}
void _initializeLocalNotifications(
BehaviorSubject<BuildContext> context) async {
while (context.valueOrNull == null) {
await Future.delayed(Duration(milliseconds: 100));
}
var initializationSettingsAndroid =
AndroidInitializationSettings('mipmap/ic_fre_black');
var initializationSettingsIOS = DarwinInitializationSettings(
requestAlertPermission: true,
requestBadgePermission: true,
requestSoundPermission: true,
);
var initializationSettings = InitializationSettings(
android: initializationSettingsAndroid,
iOS: initializationSettingsIOS,
);
_flutterLocalNotificationsPlugin.initialize(
initializationSettings,
onDidReceiveNotificationResponse: (NotificationResponse response) async {
if (response.payload != null) {
try {
Map<String, dynamic> message = validJsonFromString(response.payload!);
var data = _notificationDetails; // Assuming getOnMessage() now returns the latest RemoteMessage
_handleNotificationClick(message, extra: data.value);
} catch (e) {}
}
},
);
}
void _createNotificationChannels() {
List<String> actions = [
'visit_request',
'visit_response',
'access',
'mensagem',
'enroll_cond',
'miscellaneous'
];
for (String action in actions) {
_createNotificationChannel(action, "Channel for $action");
}
}
void _createNotificationChannel(String channelId, String channelName) {
_flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.createNotificationChannel(
AndroidNotificationChannel(
channelId, // Use o click_action como ID do canal
channelName, // Nome descritivo baseado no click_action
description: 'Channel for $channelName notifications',
importance: Importance.max,
),
);
}
void _listenToForegroundMessages(BuildContext context) {
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
log("Message Foregroud: ${message.data}");
_onMessage.add(message);
_notificationDetails.add(message.toMap()['notification']);
_showNotification(message);
});
}
void _listenToBackgroundMessages() {
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
}
void _listenToNotificationClicks(BuildContext context) {
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
_onMessage.add(message);
NotificationHandler().handleMessage(message.data, context);
});
}
void configureTokenRefresh() {
_firebaseMessaging.onTokenRefresh
.listen(_handleTokenUpdate)
.onError((err) {});
}
Future<void> _updateToken(String token) async {
FFAppState().token = token;
final ApiCallResponse? response = await _updateTokenOnServer(token);
if (_isTokenUpdateSuccessful(response)) {
} else {}
}
Future<void> _handleTokenUpdate(String newToken) async {
await _updateToken(newToken);
}
Future<void> updateDeviceToken() async {
configureTokenRefresh();
final NotificationSettings settings =
await _requestNotificationPermission();
if (Platform.isIOS) await _fetchAndLogApnsToken(settings);
final String? deviceToken = await _firebaseMessaging.getToken();
if (deviceToken != null) {
await _updateToken(deviceToken);
} else {}
}
Future<NotificationSettings> _requestNotificationPermission() async {
final NotificationSettings settings =
await _firebaseMessaging.requestPermission();
log(settings.authorizationStatus == AuthorizationStatus.authorized
? 'User granted permission'
: 'User declined or has not accepted permission');
return settings;
}
Future<void> _fetchAndLogApnsToken(NotificationSettings settings) async {
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
final String? apnsToken = await _firebaseMessaging.getAPNSToken();
log(apnsToken != null
? 'APNS Token: $apnsToken'
: 'Failed to get APNS token');
}
}
Future<ApiCallResponse?> _updateTokenOnServer(String deviceToken) async {
return await PhpGroup.updToken.call(
token: deviceToken,
devid: FFAppState().devUUID,
useruuid: FFAppState().userUUID,
);
}
bool _isTokenUpdateSuccessful(ApiCallResponse? response) {
return PhpGroup.updToken.error((response?.jsonBody ?? '')) == false;
}
String _getChannelIdBasedOnClickAction(String clickAction) {
final baseId = clickAction.hashCode;
return 'channel_$baseId';
}
void _showNotification(RemoteMessage message) async {
String channelId =
_getChannelIdBasedOnClickAction(message.data['click_action']);
var androidDetails = AndroidNotificationDetails(
channelId,
'Channel Name for $channelId',
channelDescription: 'Channel Description for $channelId',
importance: Importance.max,
priority: Priority.high,
);
var iOSDetails = DarwinNotificationDetails();
var generalNotificationDetails = NotificationDetails(android: androidDetails, iOS: iOSDetails);
await _flutterLocalNotificationsPlugin.show(
// DateTime.now().millisecondsSinceEpoch % (1 << 31),
math.Random().nextInt(1 << 30),
message.notification?.title,
message.notification?.body,
generalNotificationDetails,
payload: message.data.toString(),
);
}
_handleNotificationClick(Map<String, dynamic> payload,
{Map<String, dynamic> extra = const {}}) {
switch (payload.isNotEmpty) {
case true:
// Print the 'data' property
// Handle the message data as needed
NotificationHandler().handleMessage(payload, _context.value, extra: extra.isEmpty ? {} : extra);
// Access the 'data' property of 'RemoteMessage'
case false:
// Handle the message notification as needed
break;
}
}
static Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
log("Mensagem firebase: $message");
}
}
class NotificationHandler {
void handleMessage(Map<String, dynamic> message, BuildContext context, {Map<String, dynamic> extra = const {}}) {
message.forEach((key, value) {});
switch (message['click_action']) {
case 'visit_request':
_showVisitRequestDialog(message, context);
break;
case '':
break;
case 'access':
_showAcessNotificationModal(message, context);
break;
case 'mensagem':
log("Extra Handle Message: $extra");
_showMessageNotificationDialog(message, context, extra);
break;
case 'enroll_cond':
break;
default:
}
}
String _getIdBasedOnUserType(Map<String, dynamic> message) {
if (message['USR_TIPO'].toString() == 'O') {
// Retorna USR_ID se não estiver vazio/nulo, caso contrário retorna '0'
return message['USR_ID'].toString().isEmpty
? '0'
: message['USR_ID'].toString();
} else {
// Retorna USR_DOCUMENTO se não estiver vazio/nulo, caso contrário retorna '0'
return message['USR_DOCUMENTO'].toString().isEmpty
? '0'
: message['USR_DOCUMENTO'].toString();
}
}
void _showAcessNotificationModal(
Map<String, dynamic> message, BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
_getIdBasedOnUserType(message);
return Dialog(
backgroundColor: Colors.transparent,
child: AccessNotificationModalTemplateComponentWidget(
datetime: message['ACE_DATAHORA'].toString(),
drive: message['ACI_DESCRICAO'].toString(),
id: message['USR_TIPO'].toString() == 'O'
? message['USR_ID'].toString() == ''
? '0'
: message['USR_ID'].toString()
: message['USR_DOCUMENTO'].toString() == ''
? '0'
: message['USR_DOCUMENTO'].toString(),
name: message['PES_NOME'].toString(),
type: message['USR_TIPO'],
));
},
);
}
void _showMessageNotificationDialog(Map<String, dynamic> message, BuildContext context, Map<String, dynamic> extra) {
showDialog(
useSafeArea: true,
barrierDismissible: true,
context: context,
builder: (BuildContext context) {
String localId = '';
try {
localId = jsonDecode(message['local'])['CLI_ID'];
} catch(e, s) {
localId = message['local']['CLI_ID'].toString();
}
log("Mensagem: $message");
log("Extra: $extra");
return GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Dialog(
backgroundColor: Colors.transparent,
child: GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: MessageNotificationModalTemplateComponentWidget(
id: localId,
from: message['remetente'].toString(),
to: message['destinatario'].toString() == 'O'
? 'Morador'
: 'Visitante',
message: extra['body'].toString().isEmpty
? 'Unknown'
: extra['body'].toString(),
),
),
),
),
),
);
},
);
}
void _showVisitRequestDialog(
Map<String, dynamic> message, BuildContext context) {
showDialog(
context: context,
barrierDismissible: true,
// barrierColor: Colors.green,
builder: (BuildContext context) {
_getIdBasedOnUserType(message);
return Dialog(
backgroundColor: Colors.transparent,
child: DetailsComponentWidget(
buttons: [
FlutterFlowIconButton(
icon: const Icon(Icons.done),
onPressed: () async {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Aprovar Visita',
enText: 'Approve Visit',
),
),
content: Text(
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja aprovar essa visita?',
enText:
'Are you sure you want to approve this visit?',
),
),
backgroundColor:
FlutterFlowTheme.of(context).primaryBackground,
actions: [
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'No',
ptText: 'Não',
),
onPressed: () {
Navigator.pop(context);
},
options: FFButtonOptions(
width: 100,
height: 40,
color: FlutterFlowTheme.of(context)
.primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context)
.primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
),
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'Yes',
ptText: 'Sim',
),
onPressed: () async {
await answersRequest.call(
context,
message['referencia'].toString(),
'L',
'Mensagem',
message['idVisitante'].toString(),
);
},
options: FFButtonOptions(
width: 100,
height: 40,
color: FlutterFlowTheme.of(context)
.primaryBackground,
textStyle: TextStyle(
color:
FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
),
],
);
});
},
),
FlutterFlowIconButton(
icon: const Icon(Icons.close),
onPressed: () async {
showAlertDialog(
context,
FFLocalizations.of(context).getVariableText(
ptText: 'Bloquear Visita',
enText: 'Block Visit',
),
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja bloquear essa visita?',
enText: 'Are you sure you want to block this visit?',
), () async {
await answersRequest.call(
context,
message['referencia'].toString(),
'B',
'Mensagem',
message['idVisitante'].toString(),
);
});
},
),
],
labelsHashMap: Map<String, String>.from({
FFLocalizations.of(context).getVariableText(
enText: 'Visitor',
ptText: 'Visitante',
): message['nomevisita'],
FFLocalizations.of(context).getVariableText(
enText: 'Reason',
ptText: 'Motivo',
): message['motivo'],
FFLocalizations.of(context).getVariableText(
enText: 'Message',
ptText: 'Mensagem',
): message['mensagem'],
}),
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${message['documento'] ?? ''}&tipo=E',
statusHashMap: [
{
FFLocalizations.of(context).getVariableText(
enText: 'Active',
ptText: 'Ativo',
): FlutterFlowTheme.of(context).warning,
},
],
// changeStatusAction: answersRequest,
),
);
},
);
}
}
class PushNotificationManager {
final StreamController<RemoteMessage> _onMessageReceivedController =
StreamController<RemoteMessage>.broadcast();
Stream<RemoteMessage> get onMessageReceived =>
_onMessageReceivedController.stream;
PushNotificationManager() {
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
_onMessageReceivedController.add(message);
});
}
void dispose() {
_onMessageReceivedController.close();
}
}

View File

@ -1,14 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_model.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:provider/provider.dart';
import '/backend/api_requests/api_calls.dart';
import '/flutter_flow/flutter_flow_icon_button.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:provider/provider.dart';
class BottomArrowLinkedLocalsComponentWidget extends StatefulWidget {
const BottomArrowLinkedLocalsComponentWidget({super.key});
@ -44,7 +43,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Align(
alignment: const AlignmentDirectional(0.0, 1.0),
@ -105,8 +104,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState
Expanded(
child: FutureBuilder<ApiCallResponse>(
future: PhpGroup.getLocalsCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
),
builder: (context, snapshot) {
// Customize what your widget looks like when it's loading.
@ -156,17 +155,17 @@ class _BottomArrowLinkedLocalsComponentWidgetState
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () async {
FFAppState().cliUUID = getJsonField(
AppState().cliUUID = getJsonField(
eachLocalsItem,
r'''$.CLI_ID''',
).toString();
setState(() {});
FFAppState().local = getJsonField(
AppState().local = getJsonField(
eachLocalsItem,
r'''$.CLI_NOME''',
).toString();
setState(() {});
FFAppState().ownerUUID = getJsonField(
AppState().ownerUUID = getJsonField(
eachLocalsItem,
r'''$.CLU_OWNER_ID''',
).toString();

View File

@ -43,7 +43,7 @@ class _LocalProfileComponentWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Container(
decoration: const BoxDecoration(),
@ -92,7 +92,7 @@ class _LocalProfileComponentWidgetState
child: ClipRRect(
borderRadius: BorderRadius.circular(200.0),
child: Image.network(
'https://freaccess.com.br/freaccess/Images/Clients/${FFAppState().cliUUID}.png',
'https://freaccess.com.br/freaccess/Images/Clients/${AppState().cliUUID}.png',
width: 80.0,
height: 80.0,
fit: BoxFit.cover,
@ -117,7 +117,7 @@ class _LocalProfileComponentWidgetState
children: [
Text(
valueOrDefault<String>(
functions.convertToUppercase(FFAppState().local),
functions.convertToUppercase(AppState().local),
'NOME DO LOCAL',
),
style: FlutterFlowTheme.of(context).labelMedium.override(

View File

@ -355,9 +355,9 @@ class MessageWellNotifier extends StateNotifier<MessageWellState> {
if (state.pageNumber <= totalPageNumber) {
var apiCall = GetMessagesCall();
var response = await apiCall.call(
devUUID: FFAppState().devUUID.toString(),
userUUID: FFAppState().userUUID.toString(),
cliID: FFAppState().cliUUID.toString(),
devUUID: AppState().devUUID.toString(),
userUUID: AppState().userUUID.toString(),
cliID: AppState().cliUUID.toString(),
atividade: 'getMensagens',
pageSize: '100',
pageNumber: state.pageNumber.toString(),

View File

@ -99,7 +99,7 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
final visitorsData = widget.visitorJsonList!.toList().take(2).toList();
final visitorsDataItem = visitorsData[0];
@ -178,7 +178,7 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
fadeInDuration: const Duration(milliseconds: 500),
fadeOutDuration: const Duration(milliseconds: 500),
imageUrl: valueOrDefault<String>(
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${AppState().devUUID}&userUUID=${AppState().userUUID}&cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
visitorsDataItem,
r'''$.VTE_DOCUMENTO''',
).toString()}&tipo=E",
@ -789,8 +789,8 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
onPressed: () async {
_model.postScheduleVisit =
await PhpGroup.postScheduleVisitCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
atividade: 'putVisita',
devDesc: widget.visitObsStr,
idVisitante: widget.visitorStrList,
@ -801,7 +801,7 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
idMotivo: extractIdToStr(widget.visitResonStr!),
idNAC: extractIdToStr(widget.visitLevelStr!),
obs: widget.visitObsStr,
cliID: FFAppState().cliUUID,
cliID: AppState().cliUUID,
);
if (PhpGroup.postScheduleVisitCall.error(

View File

@ -5,13 +5,11 @@ import 'package:hub/components/organism_components/up_arrow_linked_locals_compon
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
class UpArrowLinkedLocalsComponentWidget extends StatefulWidget {
const UpArrowLinkedLocalsComponentWidget({super.key});
@ -45,7 +43,7 @@ class _UpArrowLinkedLocalsComponentWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Align(
alignment: const AlignmentDirectional(0.0, -1.0),
@ -82,8 +80,8 @@ class _UpArrowLinkedLocalsComponentWidgetState
),
child: FutureBuilder<ApiCallResponse>(
future: PhpGroup.getLocalsCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
),
builder: (context, snapshot) {
// Customize what your widget looks like when it's loading.
@ -134,12 +132,12 @@ class _UpArrowLinkedLocalsComponentWidgetState
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () async {
FFAppState().cliUUID = getJsonField(
AppState().cliUUID = getJsonField(
eachLocalsItem,
r'''$.CLI_ID''',
).toString();
setState(() {});
FFAppState().local = getJsonField(
AppState().local = getJsonField(
eachLocalsItem,
r'''$.CLI_NOME''',
).toString();
@ -150,7 +148,8 @@ class _UpArrowLinkedLocalsComponentWidgetState
width: 50.0,
height: double.infinity,
decoration: const BoxDecoration(),
alignment: const AlignmentDirectional(0.0, 0.0),
alignment:
const AlignmentDirectional(0.0, 0.0),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
@ -162,7 +161,8 @@ class _UpArrowLinkedLocalsComponentWidgetState
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.primaryText,
borderRadius: const BorderRadius.only(
borderRadius:
const BorderRadius.only(
bottomLeft: Radius.circular(25.0),
bottomRight:
Radius.circular(25.0),
@ -177,7 +177,8 @@ class _UpArrowLinkedLocalsComponentWidgetState
),
),
child: ClipRRect(
borderRadius: const BorderRadius.only(
borderRadius:
const BorderRadius.only(
bottomLeft: Radius.circular(25.0),
bottomRight:
Radius.circular(25.0),
@ -192,14 +193,14 @@ class _UpArrowLinkedLocalsComponentWidgetState
width: double.infinity,
height: double.infinity,
fit: BoxFit.fill,
alignment: const Alignment(0.0, 0.0),
alignment:
const Alignment(0.0, 0.0),
),
),
),
Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(
0.0, 10.0, 0.0, 0.0),
padding: const EdgeInsetsDirectional
.fromSTEB(0.0, 10.0, 0.0, 0.0),
child: Text(
getJsonField(
eachLocalsItem,
@ -244,4 +245,4 @@ class _UpArrowLinkedLocalsComponentWidgetState
),
);
}
}
}

View File

@ -4,7 +4,6 @@ import 'access_notification_modal_template_component_widget.dart'
show AccessNotificationModalTemplateComponentWidget;
import 'package:flutter/material.dart';
class AccessNotificationModalTemplateComponentModel
extends FlutterFlowModel<AccessNotificationModalTemplateComponentWidget> {
/// State fields for stateful widgets in this component.
@ -55,9 +54,9 @@ class AccessNotificationModalTemplateComponentModel
ApiCallResponse? visitRequest;
visitRequest = await PhpGroup.respondeSolicitacaoCall.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliUUID: FFAppState().cliUUID,
userUUID: AppState().userUUID,
devUUID: AppState().devUUID,
cliUUID: AppState().cliUUID,
atividade: 'respondeSolicitacao',
referencia: refUUID,
tarefa: actionValue,

View File

@ -7,9 +7,6 @@ import 'package:provider/provider.dart';
import 'access_notification_modal_template_component_model.dart';
export 'access_notification_modal_template_component_model.dart';
class AccessNotificationModalTemplateComponentWidget extends StatefulWidget {
const AccessNotificationModalTemplateComponentWidget({
super.key,
@ -70,17 +67,13 @@ class _AccessNotificationModalTemplateComponentWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
String labelTypeResident = FFLocalizations.of(context).getVariableText(
enText: 'Resident',
ptText: 'Morador'
);
String labelTypeResident = FFLocalizations.of(context)
.getVariableText(enText: 'Resident', ptText: 'Morador');
String labelTypeVisitor = FFLocalizations.of(context).getVariableText(
enText: 'Visitor',
ptText: 'Visitante'
);
String labelTypeVisitor = FFLocalizations.of(context)
.getVariableText(enText: 'Visitor', ptText: 'Visitante');
return Align(
alignment: const AlignmentDirectional(0.0, 0.0),
@ -118,9 +111,9 @@ class _AccessNotificationModalTemplateComponentWidgetState
fadeOutDuration: const Duration(milliseconds: 100),
imageUrl: valueOrDefault<String>(
// widget.type == 'O'
// ? 'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=O'
// : 'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=E',
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=${widget.type}',
// ? 'https://freaccess.com.br/freaccess/getImage.php?cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=O'
// : 'https://freaccess.com.br/freaccess/getImage.php?cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=E',
'https://freaccess.com.br/freaccess/getImage.php?cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=${widget.type}',
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
),
fit: BoxFit.cover,
@ -194,7 +187,10 @@ class _AccessNotificationModalTemplateComponentWidgetState
children: [
Expanded(
child: TextFormField(
controller: TextEditingController(text: widget.type == 'O' ? labelTypeResident : labelTypeVisitor),
controller: TextEditingController(
text: widget.type == 'O'
? labelTypeResident
: labelTypeVisitor),
focusNode: _model.textFieldFocusNode2,
autofocus: false,
textInputAction: TextInputAction.next,
@ -329,7 +325,7 @@ class _AccessNotificationModalTemplateComponentWidgetState
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getVariableText(
enText: 'Access Sector',
enText: 'Access Sector',
ptText: 'Setor de Acesso',
),
labelStyle: FlutterFlowTheme.of(context)
@ -383,4 +379,4 @@ class _AccessNotificationModalTemplateComponentWidgetState
),
);
}
}
}

View File

@ -83,7 +83,7 @@ class _CardItemTemplateComponentWidgetState
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height;
context.watch<FFAppState>();
context.watch<AppState>();
return InkWell(
splashColor: Colors.transparent,
focusColor: Colors.transparent,

View File

@ -10,7 +10,6 @@ import 'package:google_fonts/google_fonts.dart';
import 'change_pass_model.dart';
export 'change_pass_model.dart';
class PassKeyTemplateWidget extends StatefulWidget {
const PassKeyTemplateWidget({
super.key,
@ -20,12 +19,10 @@ class PassKeyTemplateWidget extends StatefulWidget {
final Future Function(String key)? toggleActionStatus;
@override
State<PassKeyTemplateWidget> createState() =>
_PassKeyTemplateWidgetState();
State<PassKeyTemplateWidget> createState() => _PassKeyTemplateWidgetState();
}
class _PassKeyTemplateWidgetState
extends State<PassKeyTemplateWidget> {
class _PassKeyTemplateWidgetState extends State<PassKeyTemplateWidget> {
late PassKeyTemplateComponentModel _model;
@override
@ -82,7 +79,8 @@ class _PassKeyTemplateWidgetState
tablet: false,
))
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0),
padding:
const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0),
child: InkWell(
splashColor: Colors.transparent,
focusColor: Colors.transparent,
@ -104,8 +102,8 @@ class _PassKeyTemplateWidgetState
),
),
Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0),
padding: const EdgeInsetsDirectional.fromSTEB(
12.0, 0.0, 0.0, 0.0),
child: Text(
'',
style:
@ -125,11 +123,14 @@ class _PassKeyTemplateWidgetState
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0),
padding:
const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0),
child: Text(
FFLocalizations.of(context).getVariableText(
enText: 'INSERT PASSWORD',
ptText: FFAppState().accessPass != '' ? 'ALTERAR SENHA' : 'ADICIONAR SENHA',
ptText: AppState().accessPass != ''
? 'ALTERAR SENHA'
: 'ADICIONAR SENHA',
),
style: FlutterFlowTheme.of(context).headlineMedium.override(
fontFamily: 'Outfit',
@ -142,12 +143,12 @@ class _PassKeyTemplateWidgetState
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0),
padding:
const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0),
child: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Enter your password to continue',
ptText: 'Digite sua senha para continuar'
),
enText: 'Enter your password to continue',
ptText: 'Digite sua senha para continuar'),
style: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
@ -165,7 +166,8 @@ class _PassKeyTemplateWidgetState
child: Column(
children: [
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0),
padding: const EdgeInsetsDirectional.fromSTEB(
16.0, 12.0, 16.0, 0.0),
child: SizedBox(
width: double.infinity,
child: TextFormField(
@ -175,7 +177,7 @@ class _PassKeyTemplateWidgetState
'_model.keyTextFieldTextController',
const Duration(milliseconds: 2000),
() {
if (mounted) setState(() {});
if (mounted) setState(() {});
},
),
autofillHints: const [AutofillHints.password],
@ -184,120 +186,120 @@ class _PassKeyTemplateWidgetState
obscureText: !_model.keyTextFieldVisibility1,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getVariableText(
ptText: 'Senha',
enText: 'Password',
labelText:
FFLocalizations.of(context).getVariableText(
ptText: 'Senha',
enText: 'Password',
),
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
.labelMedium
.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
hintText: FFLocalizations.of(context).getVariableText(
ptText: 'Digite a sua senha.....',
enText: 'Enter your password.....',
ptText: 'Digite a sua senha.....',
enText: 'Enter your password.....',
),
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
.labelMedium
.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primary,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primary,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primary,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primary,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 2.0,
),
borderRadius: BorderRadius.circular(12.0),
),
filled: true,
fillColor:
FlutterFlowTheme.of(context).primaryBackground,
contentPadding:
const EdgeInsetsDirectional.fromSTEB(
FlutterFlowTheme.of(context).primaryBackground,
contentPadding: const EdgeInsetsDirectional.fromSTEB(
24.0, 24.0, 20.0, 24.0),
suffixIcon: InkWell(
onTap: () => setState(
() => _model.keyTextFieldVisibility1 =
!_model.keyTextFieldVisibility1,
),
focusNode: FocusNode(skipTraversal: true),
child: Icon(
_model.keyTextFieldVisibility1
? Icons.visibility_outlined
: Icons.visibility_off_outlined,
color: FlutterFlowTheme.of(context).accent1,
size: 22.0,
),
onTap: () => setState(
() => _model.keyTextFieldVisibility1 =
!_model.keyTextFieldVisibility1,
),
focusNode: FocusNode(skipTraversal: true),
child: Icon(
_model.keyTextFieldVisibility1
? Icons.visibility_outlined
: Icons.visibility_off_outlined,
color: FlutterFlowTheme.of(context).accent1,
size: 22.0,
),
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
maxLength: 4,
maxLengthEnforcement: MaxLengthEnforcement.enforced,
buildCounter: (context,
{required currentLength,
required isFocused,
maxLength}) =>
null,
{required currentLength,
required isFocused,
maxLength}) =>
null,
keyboardType: TextInputType.number,
cursorColor: FlutterFlowTheme.of(context).primary,
validator: _model.keyTextFieldTextControllerValidator1
.asValidator(context),
.asValidator(context),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
LengthLimitingTextInputFormatter(4),
],
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
LengthLimitingTextInputFormatter(4),
],
),
),
),
),
],
),
),
Align(
alignment: const AlignmentDirectional(0.0, 0.0),
child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0),
padding:
const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0),
child: FFButtonWidget(
onPressed: () async {
if (_model.formKey.currentState == null ||
@ -305,20 +307,24 @@ class _PassKeyTemplateWidgetState
return;
}
await widget.toggleActionStatus?.call(
_model.keyTextFieldTextController1.text.isEmpty ? _model.keyTextFieldTextController2.text : _model.keyTextFieldTextController1.text,
_model.keyTextFieldTextController1.text.isEmpty
? _model.keyTextFieldTextController2.text
: _model.keyTextFieldTextController1.text,
);
Navigator.pop(context, true);
},
text: FFLocalizations.of(context).getVariableText(
ptText: FFAppState().accessPass != '' ? 'Alterar' : 'Adicionar',
enText: FFAppState().accessPass != '' ? 'Change' : 'Add',
ptText:
AppState().accessPass != '' ? 'Alterar' : 'Adicionar',
enText: AppState().accessPass != '' ? 'Change' : 'Add',
),
options: FFButtonOptions(
width: 270.0,
height: 50.0,
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
iconPadding:
const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
padding: const EdgeInsetsDirectional.fromSTEB(
0.0, 0.0, 0.0, 0.0),
iconPadding: const EdgeInsetsDirectional.fromSTEB(
0.0, 0.0, 0.0, 0.0),
color: const Color(0xFF1AAB5F),
textStyle: FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Plus Jakarta Sans',
@ -344,4 +350,4 @@ class _PassKeyTemplateWidgetState
),
);
}
}
}

View File

@ -109,12 +109,11 @@ Widget buildDetails(dynamic visitaWrapItem, BuildContext context, Future<dynamic
context,
MaterialPageRoute(
builder: (context) => ScheduleCompleteVisitPageWidget(
dropdownValue1: visitaWrapItem['MOT_DESCRICAO'],
dropdownValue1: visitaWrapItem['MOT_DESCRICAO'],
dropdownValue2: visitaWrapItem['NAC_DESCRICAO'],
visitorJsonList: [visitaWrapItem],
visitorStrList: visitaWrapItem['VTE_DOCUMENTO'],
)
),
)),
);
},
options: FFButtonOptions(
@ -173,7 +172,7 @@ URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${vi
'${FFLocalizations.of(context).getVariableText(ptText: "Fim", enText: "End")}:': visitaWrapItem['VAW_DTFIM'] != '' && visitaWrapItem['VAW_DTFIM'] != null ? ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', visitaWrapItem['VAW_DTFIM']) : '',
}),
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${visitaWrapItem['VTE_DOCUMENTO'] ?? ''}&tipo=E',
'https://freaccess.com.br/freaccess/getImage.php?cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${visitaWrapItem['VTE_DOCUMENTO'] ?? ''}&tipo=E',
statusHashMap: [
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
Map<String, Color>.from({

View File

@ -28,12 +28,10 @@ class DetailsComponentWidget extends StatefulWidget {
final List<Widget> buttons;
@override
State<DetailsComponentWidget> createState() =>
_DetailsComponentWidgetState();
State<DetailsComponentWidget> createState() => _DetailsComponentWidgetState();
}
class _DetailsComponentWidgetState
extends State<DetailsComponentWidget> {
class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
late DetailsComponentModel _model;
LinkedHashMap<String, String> get labelsLinkedHashMap =>
@ -66,7 +64,7 @@ class _DetailsComponentWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Container(
constraints: BoxConstraints(

View File

@ -58,9 +58,9 @@ class LiberationHistoryItemDetailsTemplateComponentModel
ApiCallResponse? visitRequest;
visitRequest = await PhpGroup.respondeSolicitacaoCall.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliUUID: FFAppState().cliUUID,
userUUID: AppState().userUUID,
devUUID: AppState().devUUID,
cliUUID: AppState().cliUUID,
atividade: 'respondeSolicitacao',
referencia: refUUID,
tarefa: actionValue,
@ -78,4 +78,4 @@ class LiberationHistoryItemDetailsTemplateComponentModel
return false;
}
}
}
}

View File

@ -1,4 +1,3 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
@ -69,7 +68,7 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Align(
alignment: const AlignmentDirectional(0.0, 0.0),
@ -106,7 +105,7 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState
fadeInDuration: const Duration(milliseconds: 100),
fadeOutDuration: const Duration(milliseconds: 100),
imageUrl: valueOrDefault<String>(
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=E',
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${AppState().devUUID}&userUUID=${AppState().userUUID}&cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${widget.id}&tipo=E',
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
),
fit: BoxFit.cover,
@ -117,7 +116,8 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState
.addToEnd(const SizedBox(width: 10.0)),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController1,
focusNode: _model.textFieldFocusNode1,
@ -242,7 +242,8 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState
.addToEnd(const SizedBox(width: 24.0)),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController3,
focusNode: _model.textFieldFocusNode3,
@ -300,7 +301,8 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController4,
focusNode: _model.textFieldFocusNode4,
@ -365,4 +367,4 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState
),
);
}
}
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:hub/app_state.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
@ -56,9 +55,9 @@ class MessageNotificationModalTemplateComponentModel
ApiCallResponse? visitRequest;
visitRequest = await PhpGroup.respondeSolicitacaoCall.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliUUID: FFAppState().cliUUID,
userUUID: AppState().userUUID,
devUUID: AppState().devUUID,
cliUUID: AppState().cliUUID,
atividade: 'respondeSolicitacao',
referencia: refUUID,
tarefa: actionValue,
@ -76,4 +75,4 @@ class MessageNotificationModalTemplateComponentModel
return false;
}
}
}
}

View File

@ -1,13 +1,8 @@
import 'package:hub/app_state.dart';
import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_model.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_model.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:provider/provider.dart';
class MessageNotificationModalTemplateComponentWidget extends StatefulWidget {
@ -64,163 +59,86 @@ class _MessageNotificationModalTemplateComponentWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Align(
alignment: const AlignmentDirectional(0.0, 0.0),
child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0),
child: Container(
width: MediaQuery.sizeOf(context).width,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(25.0),
bottomRight: Radius.circular(25.0),
topLeft: Radius.circular(25.0),
topRight: Radius.circular(25.0),
),
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController1,
focusNode: _model.textFieldFocusNode1,
autofocus: false,
textInputAction: TextInputAction.next,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getVariableText(
ptText: 'Mensagem',
enText: 'Message',
return Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(25.0),
bottomRight: Radius.circular(25.0),
topLeft: Radius.circular(25.0),
topRight: Radius.circular(25.0),
),
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController1,
focusNode: _model.textFieldFocusNode1,
autofocus: false,
textInputAction: TextInputAction.next,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getVariableText(
ptText: 'Mensagem',
enText: 'Message',
),
labelStyle: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.message,
color: FlutterFlowTheme.of(context).accent1,
hintStyle: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator:
_model.textController1Validator.asValidator(context),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.message,
color: FlutterFlowTheme.of(context).accent1,
),
),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: TextFormField(
controller: _model.textController2,
focusNode: _model.textFieldFocusNode2,
autofocus: false,
textInputAction: TextInputAction.next,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText:
FFLocalizations.of(context).getVariableText(
ptText: 'De',
enText: 'From',
),
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.labelMediumFamily),
),
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.labelMediumFamily),
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.person,
color: FlutterFlowTheme.of(context).accent1,
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator: _model.textController2Validator
.asValidator(context),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
]
.addToStart(const SizedBox(width: 24.0))
.addToEnd(const SizedBox(width: 24.0)),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator: _model.textController1Validator.asValidator(context),
),
),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: TextFormField(
controller: _model.textController3,
focusNode: _model.textFieldFocusNode3,
controller: _model.textController2,
focusNode: _model.textFieldFocusNode2,
autofocus: false,
textInputAction: TextInputAction.next,
readOnly: true,
@ -228,8 +146,8 @@ class _MessageNotificationModalTemplateComponentWidgetState
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getVariableText(
ptText: 'Para',
enText: 'To',
ptText: 'De',
enText: 'From',
),
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
@ -272,15 +190,71 @@ class _MessageNotificationModalTemplateComponentWidgetState
maxLines: null,
keyboardType: TextInputType.name,
validator:
_model.textController3Validator.asValidator(context),
_model.textController2Validator.asValidator(context),
),
),
]
.divide(const SizedBox(height: 10.0))
.addToStart(const SizedBox(height: 20.0))
.addToEnd(const SizedBox(height: 20.0)),
.addToStart(const SizedBox(width: 24.0))
.addToEnd(const SizedBox(width: 24.0)),
),
),
Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController3,
focusNode: _model.textFieldFocusNode3,
autofocus: false,
textInputAction: TextInputAction.next,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getVariableText(
ptText: 'Para',
enText: 'To',
),
labelStyle: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
hintStyle: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.person,
color: FlutterFlowTheme.of(context).accent1,
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator: _model.textController3Validator.asValidator(context),
),
),
]
.divide(const SizedBox(height: 10.0))
.addToStart(const SizedBox(height: 20.0))
.addToEnd(const SizedBox(height: 20.0)),
),
),
);

View File

@ -46,9 +46,9 @@ class RegisiterVistorTemplateComponentModel extends FlutterFlowModel<RegisiterVi
Future<bool> getVisitanteByDocument(
String document, BuildContext context) async {
final response = await PhpGroup.getVisitorByDocCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
cliID: AppState().cliUUID,
atividade: 'getVisitante',
documento: document,
);

View File

@ -112,7 +112,7 @@ class _RegisiterVistorTemplateComponentWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Align(
alignment: const AlignmentDirectional(0.0, 1.0),
child: Container(
@ -820,9 +820,9 @@ class _RegisiterVistorTemplateComponentWidgetState
_model.scheduleVisitor =
await PhpGroup.postScheduleVisitorCall
.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
cliID: AppState().cliUUID,
atividade: 'putVisitante',
documento: _model.textController2.text,
nome: _model.textController1.text,

View File

@ -123,7 +123,7 @@ class _SignUpTemplateComponentWidgetState
return false;
}
context.watch<FFAppState>();
context.watch<AppState>();
return Row(
mainAxisSize: MainAxisSize.max,
@ -701,7 +701,7 @@ class _SignUpTemplateComponentWidgetState
email: _model
.emailRegisterFormTextController
.text,
device: FFAppState().device,
device: AppState().device,
);
shouldSetState = true;
if (_model.signUp == true) {

View File

@ -128,7 +128,7 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
var filteredVisitorJsonList =
findVisitorById(widget.visitorJsonList, widget.visitIdStr) ?? 'null';
context.watch<FFAppState>();
context.watch<AppState>();
return Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 200.0, 0.0, 0.0),
@ -829,9 +829,9 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
onPressed: () async {
_model.deleteVisit =
await PhpGroup.deleteVisitCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
cliID: AppState().cliUUID,
atividade: 'cancelaVisita',
idVisita: widget.visitIdStr,
);

View File

@ -63,7 +63,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0),
@ -272,7 +272,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
fadeOutDuration: const Duration(
milliseconds: 500),
imageUrl:
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${AppState().devUUID}&userUUID=${AppState().userUUID}&cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
visitorItem,
r'''$.VTE_DOCUMENTO''',
).toString()}&tipo=E",
@ -444,9 +444,9 @@ class _VisitorSearchModalTemplateComponentWidgetState
TextSelection.collapsed(offset: _model.textController!.text.length);
});
_model.getVisitorByDoc = await PhpGroup.getVisitorByDocCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
cliID: AppState().cliUUID,
atividade: 'getVisitante',
documento: _model.textController.text,
);

View File

@ -1,14 +1,14 @@
import 'dart:io';
import 'dart:math' show pow, pi, sin;
import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:collection/collection.dart';
import 'package:from_css_color/from_css_color.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'dart:math' show pow, pi, sin;
import 'package:intl/intl.dart';
import 'package:json_path/json_path.dart';
import 'package:timeago/timeago.dart' as timeago;
@ -16,19 +16,21 @@ import 'package:url_launcher/url_launcher.dart';
import '../main.dart';
export 'dart:convert' show jsonEncode, jsonDecode;
export 'dart:math' show min, max;
export 'dart:typed_data' show Uint8List;
export 'package:intl/intl.dart';
export 'package:page_transition/page_transition.dart';
export '/app_state.dart';
export 'custom_icons.dart' show FFIcons;
export 'flutter_flow_model.dart';
export 'internationalization.dart' show FFLocalizations;
export 'keep_alive_wrapper.dart';
export 'lat_lng.dart';
export 'place.dart';
export 'uploaded_file.dart';
export '/app_state.dart';
export 'flutter_flow_model.dart';
export 'dart:math' show min, max;
export 'dart:typed_data' show Uint8List;
export 'dart:convert' show jsonEncode, jsonDecode;
export 'package:intl/intl.dart';
export 'package:page_transition/page_transition.dart';
export 'custom_icons.dart' show FFIcons;
export 'internationalization.dart' show FFLocalizations;
T valueOrDefault<T>(T? value, T defaultValue) =>
(value is String && value.isEmpty) || value == null ? defaultValue : value;
@ -502,10 +504,10 @@ extension IterableExt<T> on Iterable<T> {
}
void setAppLanguage(BuildContext context, String language) =>
MyApp.of(context).setLocale(language);
App.of(context).setLocale(language);
void setDarkModeSetting(BuildContext context, ThemeMode themeMode) =>
MyApp.of(context).setThemeMode(themeMode);
App.of(context).setThemeMode(themeMode);
void showSnackbar(
BuildContext context,

View File

@ -69,7 +69,7 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
FFRoute(
name: '_initialize',
path: '/',
builder: (context, _) => FFAppState().isLogged
builder: (context, _) => AppState().isLogged
? const HomePageWidget()
: const WelcomePageWidget(),
),

View File

@ -1,54 +1,64 @@
import 'dart:developer';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:hub/app_state.dart';
import 'package:hub/backend/notifications/firebase_messaging_service.dart';
import 'package:hub/backend/notifications/notification_service.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:provider/provider.dart';
import 'package:flutter/material.dart';
import 'package:responsive_framework/responsive_framework.dart';
import 'firebase_options.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:flutter/services.dart';
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
void main() async {
Future<void> initializeApp() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
await init();
runApp(ChangeNotifierProvider(
create: (context) => FFAppState(),
child: const MyApp(),
));
}
Future<void> init() async {
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
await Firebase.initializeApp();
await FirebaseMessagingService().initNotifications();
await NotificationService.initialize();
setUrlStrategy(const PathUrlStrategy());
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
if (kDebugMode) {
log("Aplicativo em Debug Mode, crashlytics desabilitado!");
} else {
final crashlyticsInstance = FirebaseCrashlytics.instance;
if (crashlyticsInstance.isCrashlyticsCollectionEnabled) {
FlutterError.onError = crashlyticsInstance.recordFlutterError;
}
}
await FlutterFlowTheme.initialize();
await FFLocalizations.initialize();
final appState = FFAppState();
final appState = AppState();
await appState.initializePersistedState();
GoRouter.optionURLReflectsImperativeAPIs = true;
usePathUrlStrategy();
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
static _MyAppState of(BuildContext context) =>
context.findAncestorStateOfType<_MyAppState>()!;
void main() async {
await initializeApp();
runApp(const App());
}
class _MyAppState extends State<MyApp> {
class App extends StatefulWidget {
const App({super.key});
@override
State<App> createState() => _AppState();
static _AppState of(BuildContext context) =>
context.findAncestorStateOfType<_AppState>()!;
}
class _AppState extends State<App> {
Locale? _locale = FFLocalizations.getStoredLocale();
ThemeMode _themeMode = FlutterFlowTheme.themeMode;
late AppStateNotifier _appStateNotifier;
@ -81,62 +91,67 @@ class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: 'FREHub',
builder: (context, widget) => ResponsiveBreakpoints.builder(
child: BouncingScrollWrapper.builder(context, widget!),
breakpoints: [
const Breakpoint(start: 0, end: 450, name: MOBILE),
const Breakpoint(start: 451, end: 800, name: TABLET),
const Breakpoint(start: 801, end: 1920, name: DESKTOP),
const Breakpoint(start: 1921, end: double.infinity, name: '4K'),
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => AppState()),
],
child: MaterialApp.router(
title: 'FREHub',
builder: (context, widget) => ResponsiveBreakpoints.builder(
child: BouncingScrollWrapper.builder(context, widget!),
breakpoints: [
const Breakpoint(start: 0, end: 450, name: MOBILE),
const Breakpoint(start: 451, end: 800, name: TABLET),
const Breakpoint(start: 801, end: 1920, name: DESKTOP),
const Breakpoint(start: 1921, end: double.infinity, name: '4K'),
],
),
localizationsDelegates: const [
FFLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
),
localizationsDelegates: const [
FFLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
locale: _locale,
supportedLocales: const [
Locale('pt'),
Locale('en'),
],
theme: ThemeData(
brightness: Brightness.light,
scrollbarTheme: ScrollbarThemeData(
thumbVisibility: WidgetStateProperty.all(false),
interactive: false,
thumbColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.dragged)) {
locale: _locale,
supportedLocales: const [
Locale('pt'),
Locale('en'),
],
theme: ThemeData(
brightness: Brightness.light,
scrollbarTheme: ScrollbarThemeData(
thumbVisibility: WidgetStateProperty.all(false),
interactive: false,
thumbColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.dragged)) {
return const Color(0xff1aab5f);
}
if (states.contains(WidgetState.hovered)) {
return const Color(0xff1aab5f);
}
return const Color(0xff1aab5f);
}
if (states.contains(WidgetState.hovered)) {
return const Color(0xff1aab5f);
}
return const Color(0xff1aab5f);
}),
}),
),
),
),
darkTheme: ThemeData(
brightness: Brightness.dark,
scrollbarTheme: ScrollbarThemeData(
thumbVisibility: WidgetStateProperty.all(false),
interactive: false,
thumbColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.dragged)) {
darkTheme: ThemeData(
brightness: Brightness.dark,
scrollbarTheme: ScrollbarThemeData(
thumbVisibility: WidgetStateProperty.all(false),
interactive: false,
thumbColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.dragged)) {
return const Color(0xff1aab5f);
}
if (states.contains(WidgetState.hovered)) {
return const Color(0xff1aab5f);
}
return const Color(0xff1aab5f);
}
if (states.contains(WidgetState.hovered)) {
return const Color(0xff1aab5f);
}
return const Color(0xff1aab5f);
}),
}),
),
),
themeMode: _themeMode,
routerConfig: _router,
),
themeMode: _themeMode,
routerConfig: _router,
);
}
}

View File

@ -209,9 +209,9 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
try {
setState(() => _loading = true);
var response = await PhpGroup.getAccessCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
cliID: AppState().cliUUID,
atividade: 'getAcessos',
pageSize: _pageSize.toString(),
pageNumber: _pageNumber.toString(),
@ -355,7 +355,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
BuildContext context, dynamic accessHistoryItem) {
return CardItemTemplateComponentWidget(
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${accessHistoryItem['PES_ID'] ?? ''}&tipo=${accessHistoryItem['PES_TIPO'] ?? ''}',
'https://freaccess.com.br/freaccess/getImage.php?cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${accessHistoryItem['PES_ID'] ?? ''}&tipo=${accessHistoryItem['PES_TIPO'] ?? ''}',
labelsHashMap: Map<String, String>.from({
'Nome:': accessHistoryItem['PES_NOME'] ?? '',
'Acesso:': accessHistoryItem['ACE_DATAHORA'] ?? '',
@ -409,7 +409,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
String imageUrlAtomWidget(String document, String type) {
return valueOrDefault<String>(
"https://freaccess.com.br/freaccess/getImage.php?&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=$document&tipo=$type",
"https://freaccess.com.br/freaccess/getImage.php?&cliID=${AppState().cliUUID}&atividade=getFoto&Documento=$document&tipo=$type",
"https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg",
);
}

View File

@ -9,15 +9,15 @@ import 'package:webview_flutter/webview_flutter.dart';
import 'dart:io' show Platform;
class FastPassPageWidget extends StatefulWidget {
final String freToken = FFAppState().userUUID;
final String freUserData = "{\"name\": \"${FFAppState().name}\", " +
"\"email\": \"${FFAppState().email}\"," +
"\"dev_id\": \"${FFAppState().devUUID}\"," +
"\"created_at\": \"${FFAppState().createdAt}\"," +
final String freToken = AppState().userUUID;
final String freUserData = "{\"name\": \"${AppState().name}\", " +
"\"email\": \"${AppState().email}\"," +
"\"dev_id\": \"${AppState().devUUID}\"," +
"\"created_at\": \"${AppState().createdAt}\"," +
"\"updated_at\": \"0000-00-00 00:00:00\"," +
"\"status\": \"A\" }";
final String clientId = FFAppState().cliUUID;
final String clientId = AppState().cliUUID;
@override
_FastPassPageWidgetState createState() => _FastPassPageWidgetState();
@ -35,63 +35,69 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
@override
void initState() {
super.initState();
name = FFAppState().name;
email = FFAppState().email;
userUUID = FFAppState().userUUID;
created_at = FFAppState().createdAt;
name = AppState().name;
email = AppState().email;
userUUID = AppState().userUUID;
created_at = AppState().createdAt;
url = 'https://hub.freaccess.com.br/hub/fast-pass/${widget.clientId}';
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Platform.isIOS ? InAppWebView(
initialUrlRequest: URLRequest(url: WebUri(url)),
initialSettings: InAppWebViewSettings(
allowsBackForwardNavigationGestures: true,
javaScriptEnabled: true,
),
onWebViewCreated: (controller) async {
_controllerIOS = controller;
},
onLoadStop: (controller, url) async {
await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-token', '\"${widget.freToken}\"')");
await controller.evaluateJavascript(source: "window.localStorage.setItem('fre-user-data', '${widget.freUserData}')");
},
) : WebViewWidget(
controller: _controllerAll = WebViewController()
..clearCache()
..clearLocalStorage()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {},
onPageStarted: (String url) {
final String token = "localStorage.setItem('fre-token', '\"${widget.freToken}\"');";
final String data = "localStorage.setItem('fre-user-data', '${widget.freUserData}');";
body: Platform.isIOS
? InAppWebView(
initialUrlRequest: URLRequest(url: WebUri(url)),
initialSettings: InAppWebViewSettings(
allowsBackForwardNavigationGestures: true,
javaScriptEnabled: true,
),
onWebViewCreated: (controller) async {
_controllerIOS = controller;
},
onLoadStop: (controller, url) async {
await controller.evaluateJavascript(
source:
"window.localStorage.setItem('fre-token', '\"${widget.freToken}\"')");
await controller.evaluateJavascript(
source:
"window.localStorage.setItem('fre-user-data', '${widget.freUserData}')");
},
)
: WebViewWidget(
controller: _controllerAll = WebViewController()
..clearCache()
..clearLocalStorage()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {},
onPageStarted: (String url) {
final String token =
"localStorage.setItem('fre-token', '\"${widget.freToken}\"');";
final String data =
"localStorage.setItem('fre-user-data', '${widget.freUserData}');";
_controllerAll.runJavaScript(token);
_controllerAll.runJavaScript(data);
},
onNavigationRequest: (NavigationRequest request) {
if (request.url.startsWith('http') ||
request.url.startsWith('https://api.whatsapp.com/send') ||
request.url.startsWith('https://wa.me')) {
launchUrlString(request.url);
return NavigationDecision.prevent;
}
return NavigationDecision.prevent;
},
_controllerAll.runJavaScript(token);
_controllerAll.runJavaScript(data);
},
onNavigationRequest: (NavigationRequest request) {
if (request.url.startsWith('http') ||
request.url
.startsWith('https://api.whatsapp.com/send') ||
request.url.startsWith('https://wa.me')) {
launchUrlString(request.url);
return NavigationDecision.prevent;
}
return NavigationDecision.prevent;
},
),
)
..loadRequest(Uri.parse(url)),
),
)
..loadRequest(Uri.parse(url)),
),
),
);
}
}
}

View File

@ -1,27 +1,20 @@
// import 'package:hub/backend/push_notification/pushNotification.dart';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/actions/actions.dart';
import 'package:hub/backend/push_notification/pushNotificationService.dart';
import 'package:hub/backend/notifications/firebase_messaging_service.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/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart';
import 'package:hub/components/organism_components/local_profile_component/local_profile_component_widget.dart';
import 'package:hub/components/organism_components/menu_component/menu_component_widget.dart';
import 'package:hub/components/organism_components/message_well_component/message_well_component_widget.dart';
import 'package:hub/flutter_flow/custom_functions.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/home_page/home_page_model.dart';
import 'package:provider/provider.dart';
class HomePageWidget extends StatefulWidget {
@ -36,6 +29,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
bool localStatus = false;
final scaffoldKey = GlobalKey<ScaffoldState>();
Future<void> checkLocalStatus() async {
localStatus = await checkLocals(
context: context,
@ -48,9 +42,14 @@ class _HomePageWidgetState extends State<HomePageWidget> {
void initState() {
super.initState();
_model = createModel(context, () => HomePageModel());
SchedulerBinding.instance.addPostFrameCallback((_) async {
await PushNotificationService().initialize(context);
AppState().context = context;
() async {
await FirebaseMessagingService().updateDeviceToken();
}();
WidgetsBinding.instance.addPostFrameCallback((_) async {
@override
void initState() {
super.initState();
@ -58,7 +57,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
}
// Rest of your code...
if (FFAppState().cliUUID == null || FFAppState().cliUUID.isEmpty) {
if (AppState().cliUUID == null || AppState().cliUUID.isEmpty) {
showModalBottomSheet(
isScrollControlled: false,
backgroundColor: Colors.transparent,
@ -95,7 +94,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus
? FocusScope.of(context).requestFocus(_model.unfocusNode)
@ -160,17 +159,17 @@ class _HomePageWidgetState extends State<HomePageWidget> {
item: MenuItem.button,
),
),
Align(
alignment: const AlignmentDirectional(0.0, 0.0),
child: Provider<MessageWellNotifier>(
create: (_) => MessageWellNotifier(),
child: wrapWithModel(
model: _model.messageWellComponentModel,
updateCallback: () => setState(() {}),
child: const MessageWellComponentWidget(),
),
),
),
// Align(
// alignment: const AlignmentDirectional(0.0, 0.0),
// child: Provider<MessageWellNotifier>(
// create: (_) => MessageWellNotifier(),
// child: wrapWithModel(
// model: _model.messageWellComponentModel,
// updateCallback: () => setState(() {}),
// child: const MessageWellComponentWidget(),
// ),
// ),
// ),
//footer
const SizedBox(
height: 100,
@ -363,7 +362,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
),
child: Image.network(
valueOrDefault<String>(
'https://freaccess.com.br/freaccess/Images/Clients/${FFAppState().cliUUID}.png',
'https://freaccess.com.br/freaccess/Images/Clients/${AppState().cliUUID}.png',
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
),
fit: BoxFit.cover,
@ -373,7 +372,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
width: 150.0,
child: Text(
valueOrDefault<String>(
convertToUppercase(FFAppState().local),
convertToUppercase(AppState().local),
'NOME DO LOCAL',
),
style: FlutterFlowTheme.of(context)
@ -543,7 +542,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
),
FFButtonWidget(
onPressed: () async {
FFAppState().deleteAll();
AppState().deleteAll();
setState(() {});
context.goNamed(
@ -588,202 +587,5 @@ class _HomePageWidgetState extends State<HomePageWidget> {
),
),
);
// body: Container(
// decoration: BoxDecoration(
// color: FlutterFlowTheme.of(context).primaryBackground,
// ),
// child: SingleChildScrollView(
// child: Column(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Wrap(
// spacing: 0.0,
// runSpacing: 0.0,
// alignment: WrapAlignment.start,
// crossAxisAlignment: WrapCrossAlignment.start,
// direction: Axis.horizontal,
// runAlignment: WrapAlignment.start,
// verticalDirection: VerticalDirection.down,
// clipBehavior: Clip.none,
// children: [
// Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// Expanded(
// child: Container(
// width: 100.0,
// height: 100.0,
// decoration: const BoxDecoration(
// color: Color(0xFF1AAB5F),
// ),
// child: Row(
// mainAxisSize: MainAxisSize.min,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Align(
// alignment: const AlignmentDirectional(0.0, 1.0),
// child: Container(
// height: 50.0,
// decoration: const BoxDecoration(),
// child: Align(
// alignment: const AlignmentDirectional(0.0, 0.0),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// Align(
// alignment:
// const AlignmentDirectional(-1.0, 0.0),
// child: Padding(
// padding: const EdgeInsetsDirectional
// .fromSTEB(
// 10.0, 0.0, 0.0, 0.0),
// child: FlutterFlowIconButton(
// borderRadius: 20.0,
// borderWidth: 1.0,
// buttonSize: 40.0,
// fillColor:
// FlutterFlowTheme.of(context)
// .primary,
// icon: const Icon(
// Icons.menu_rounded,
// color: Colors.white,
// size: 28.0,
// ),
// onPressed: () async {
// scaffoldKey.currentState!
// .openDrawer();
// },
// ),
// ),
// ),
// Align(
// alignment:
// const AlignmentDirectional(-1.0, 0.0),
// child: Padding(
// padding: const EdgeInsetsDirectional
// .fromSTEB(
// 60.0, 15.0, 0.0, 0.0),
// child: ClipRRect(
// borderRadius:
// BorderRadius.circular(8.0),
// child: Image.network(
// 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/8r2vsbd9i03k/logo.png',
// width: 50.0,
// height: 200.0,
// fit: BoxFit.none,
// ),
// ),
// ),
// ),
// Align(
// alignment:
// const AlignmentDirectional(0.0, 0.0),
// child: Padding(
// padding: const EdgeInsetsDirectional
// .fromSTEB(
// 0.0, 15.0, 0.0, 0.0),
// child: Text(
// FFLocalizations.of(context)
// .getText(
// 'rg9pzkpz' /* FRE ACCESS */,
// ),
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily:
// FlutterFlowTheme.of(
// context)
// .bodyMediumFamily,
// color: FlutterFlowTheme
// .of(context)
// .info,
// letterSpacing: 0.0,
// useGoogleFonts: GoogleFonts
// .asMap()
// .containsKey(
// FlutterFlowTheme.of(
// context)
// .bodyMediumFamily),
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// ),
// ),
// Align(
// alignment: const AlignmentDirectional(0.0, 1.0),
// child: Container(
// width: 100.0,
// height: 50.0,
// decoration: const BoxDecoration(),
// child: Align(
// alignment: const AlignmentDirectional(1.0, 1.0),
// child: FlutterFlowIconButton(
// borderRadius: 20.0,
// borderWidth: 1.0,
// buttonSize: 40.0,
// icon: Icon(
// Icons.notifications_sharp,
// color:
// FlutterFlowTheme.of(context).info,
// size: 24.0,
// ),
// onPressed: () {
// print('IconButton pressed ...');
// },
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// ),
// ],
// ),
// wrapWithModel(
// model: _model.localComponentModel,
// updateCallback: () => setState(() {}),
// child: const LocalProfileComponentWidget(),
// ),
// Wrap(
// spacing: 0.0,
// runSpacing: 0.0,
// alignment: WrapAlignment.start,
// crossAxisAlignment: WrapCrossAlignment.start,
// direction: Axis.horizontal,
// runAlignment: WrapAlignment.start,
// verticalDirection: VerticalDirection.down,
// clipBehavior: Clip.none,
// children: [
// wrapWithModel(
// model: _model.menuComponentModel,
// updateCallback: () => setState(() {}),
// child: const MenuComponentWidget(),
// ),
// Align(
// alignment: const AlignmentDirectional(0.0, 0.0),
// child: wrapWithModel(
// model: _model.messageWellComponentModel,
// updateCallback: () => setState(() {}),
// child: const MessageWellComponentWidget(),
// ),
// ),
// ],
// ),
// ],
// ),
// ],
// ),
// ),
// ),
// ),
// );
}
}

View File

@ -1,9 +1,7 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/actions/actions.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/backend/push_notification/pushNotificationService.dart';
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
@ -11,11 +9,6 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/pages/liberation_history/liberation_history_model.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
@ -25,7 +18,8 @@ class LiberationHistoryWidget extends StatefulWidget {
const LiberationHistoryWidget({super.key});
@override
State<LiberationHistoryWidget> createState() => _LiberationHistoryWidgetState();
State<LiberationHistoryWidget> createState() =>
_LiberationHistoryWidgetState();
}
class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
@ -53,33 +47,46 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
}
String _imagePath(dynamic request) {
return 'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${request['VTE_ID'] ?? ''}&tipo=E';
return 'https://freaccess.com.br/freaccess/getImage.php?cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${request['VTE_ID'] ?? ''}&tipo=E';
}
Map<String, String> _labelsHashMap(dynamic request, bool details) {
return Map<String, String>.from({
'${FFLocalizations.of(context).getVariableText(ptText: 'Nome', enText: 'Name')}:': request['VTE_NOME'],
'${FFLocalizations.of(context).getVariableText(ptText: 'Dt. Envio', enText: 'Date Send')}:': request['NOT_DTENVIO'] != null ? ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', request['NOT_DTENVIO']) : '',
'${FFLocalizations.of(context).getVariableText(ptText: 'Motivo', enText: 'Reason')}:': request['NOT_MOTIVO'],
return Map<String, String>.from({
'${FFLocalizations.of(context).getVariableText(ptText: 'Nome', enText: 'Name')}:':
request['VTE_NOME'],
'${FFLocalizations.of(context).getVariableText(ptText: 'Dt. Envio', enText: 'Date Send')}:':
request['NOT_DTENVIO'] != null
? ValidatorUtil.toLocalDateTime(
'yyyy-MM-dd HH:mm:ss', request['NOT_DTENVIO'])
: '',
'${FFLocalizations.of(context).getVariableText(ptText: 'Motivo', enText: 'Reason')}:':
request['NOT_MOTIVO'],
if (details == true)
'${FFLocalizations.of(context).getVariableText(ptText: 'Mensagem', enText: 'Message')}:': request['NOT_MSGENVIO'],
'${FFLocalizations.of(context).getVariableText(ptText: 'Mensagem', enText: 'Message')}:':
request['NOT_MSGENVIO'],
});
}
Map<String, Color> _statusHashMap(dynamic request) {
return Map<String, Color>.from({
if (request['NOT_STATUS'] == 'L')
FFLocalizations.of(context).getVariableText(ptText: 'Finalizado', enText: 'Finished'): FlutterFlowTheme.of(context).success
FFLocalizations.of(context).getVariableText(
ptText: 'Finalizado',
enText: 'Finished'): FlutterFlowTheme.of(context).success
else if (request['NOT_STATUS'] == 'B')
FFLocalizations.of(context).getVariableText(ptText: 'Bloqueado', enText: 'Blocked'): FlutterFlowTheme.of(context).error
FFLocalizations.of(context).getVariableText(
ptText: 'Bloqueado',
enText: 'Blocked'): FlutterFlowTheme.of(context).error
else
FFLocalizations.of(context).getVariableText(ptText: 'Ativo', enText: 'Active'): FlutterFlowTheme.of(context).warning
FFLocalizations.of(context).getVariableText(
ptText: 'Ativo',
enText: 'Active'): FlutterFlowTheme.of(context).warning
});
}
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Scaffold(
key: scaffoldKey,
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
@ -112,12 +119,12 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
'784f83pc' /* Histórico de Liberação */,
),
style: FlutterFlowTheme.of(context).headlineMedium.override(
fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 17.0,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
),
fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 17.0,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
),
),
actions: const [],
centerTitle: true,
@ -146,9 +153,11 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
],
),
)
else if (_hasData == true && _loading == false && _requestWrap.isNotEmpty)
else if (_hasData == true &&
_loading == false &&
_requestWrap.isNotEmpty)
Expanded(child: _listItems(context)),
if ( _loading == true)
if (_loading == true)
Container(
padding: const EdgeInsets.only(top: 15, bottom: 15),
child: Center(
@ -203,7 +212,8 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
buttons: [
if (liberationHistoryItem['NOT_STATUS'] == 'S')
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(ptText: "Aceitar", enText: "Accept"),
text: FFLocalizations.of(context)
.getVariableText(ptText: "Aceitar", enText: "Accept"),
options: FFButtonOptions(
width: 130,
height: 40,
@ -218,17 +228,22 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
),
icon: const Icon(Icons.done),
onPressed: () async {
return answersRequest.call(
return answersRequest
.call(
context,
liberationHistoryItem['NOT_ID'].toString(),
'L',
'',
liberationHistoryItem['VTE_ID'].toString(),
).then((message) {
)
.then((message) {
if (message.isEmpty) {
showSnackbar(
context,
FFLocalizations.of(context).getVariableText(enText: 'Successfully resolved visit', ptText: 'Visita resolvida com sucesso'), false);
FFLocalizations.of(context).getVariableText(
enText: 'Successfully resolved visit',
ptText: 'Visita resolvida com sucesso'),
false);
} else {
showSnackbar(context, message, true);
}
@ -244,7 +259,8 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
),
if (liberationHistoryItem['NOT_STATUS'] == 'S')
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(ptText: "Bloquear", enText: "Block"),
text: FFLocalizations.of(context)
.getVariableText(ptText: "Bloquear", enText: "Block"),
options: FFButtonOptions(
width: 130,
height: 40,
@ -259,17 +275,22 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
),
icon: const Icon(Icons.close),
onPressed: () async {
return answersRequest.call(
return answersRequest
.call(
context,
liberationHistoryItem['NOT_ID'].toString(),
'B',
'',
liberationHistoryItem['VTE_ID'].toString(),
).then((message) {
)
.then((message) {
if (message.isEmpty) {
showSnackbar(
context,
FFLocalizations.of(context).getVariableText(enText: 'Successfully resolved visit', ptText: 'Visita resolvida com sucesso'), false);
FFLocalizations.of(context).getVariableText(
enText: 'Successfully resolved visit',
ptText: 'Visita resolvida com sucesso'),
false);
} else {
showSnackbar(context, message, true);
}
@ -290,43 +311,44 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
);
},
).then((_) {
() {}();
// PushNotificationManager _pushNotificationService =
// PushNotificationManager();
PushNotificationManager _pushNotificationService = PushNotificationManager();
_pushNotificationService.onMessageReceived.listen((received) {
if (received.data['click_action'] == 'cancel_request') {
_pushNotificationService.dispose();
showSnackbar(
context,
FFLocalizations.of(context).getVariableText(
enText: 'Successfully resolved visit',
ptText: 'Visita resolvida com sucesso'),
false);
context.pushReplacementNamed(
'liberationHistory',
extra: <String, dynamic>{
kTransitionInfoKey: const TransitionInfo(
hasTransition: true,
transitionType: PageTransitionType.scale,
alignment: Alignment.bottomCenter,
),
},
);
}
});
}).whenComplete(() {
safeSetState(() {
_requestWrap = [];
_requestFuture = _fetchRequests();
});
}).catchError((e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Solitiações", e, s);
safeSetState(() {
_hasData = false;
_loading = false;
});
// _pushNotificationService.onMessageReceived.listen((received) {
// if (received.data['click_action'] == 'cancel_request') {
// _pushNotificationService.dispose();
// showSnackbar(
// context,
// FFLocalizations.of(context).getVariableText(
// enText: 'Successfully resolved visit',
// ptText: 'Visita resolvida com sucesso'),
// false);
// context.pushReplacementNamed(
// 'liberationHistory',
// extra: <String, dynamic>{
// kTransitionInfoKey: const TransitionInfo(
// hasTransition: true,
// transitionType: PageTransitionType.scale,
// alignment: Alignment.bottomCenter,
// ),
// },
// );
// }
// });
// }).whenComplete(() {
// safeSetState(() {
// _requestWrap = [];
// _requestFuture = _fetchRequests();
// });
// }).catchError((e, s) {
// DialogUtil.errorDefault(context);
// LogUtil.requestAPIFailed(
// "proccessRequest.php", "", "Consulta de Solitiações", e, s);
// safeSetState(() {
// _hasData = false;
// _loading = false;
// });
});
},
);
@ -335,12 +357,14 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
Future<ApiCallResponse?> _fetchRequests() async {
try {
setState(() => _loading = true);
var response = await PhpGroup.getLiberationsCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID,
atividade: 'getSolicitacoes',
).first;
var response = await PhpGroup.getLiberationsCall
.call(
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
cliID: AppState().cliUUID,
atividade: 'getSolicitacoes',
)
.first;
final List<dynamic> requests = response.jsonBody['solicitacoes'] ?? [];
@ -364,7 +388,8 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
return null;
} catch (e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Solicitações", e, s);
LogUtil.requestAPIFailed(
"proccessRequest.php", "", "Consulta de Solicitações", e, s);
setState(() {
_hasData = false;
_loading = false;

View File

@ -91,7 +91,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Scaffold(
key: scaffoldKey,
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
@ -105,9 +105,9 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
setState(() => _loading = true);
var response = await PhpGroup.getMessagesCall.call(
devUUID: FFAppState().devUUID.toString(),
userUUID: FFAppState().userUUID.toString(),
cliID: FFAppState().cliUUID.toString(),
devUUID: AppState().devUUID.toString(),
userUUID: AppState().userUUID.toString(),
cliID: AppState().cliUUID.toString(),
atividade: 'getMensagens',
pageSize: _pageSize.toString(),
pageNumber: _pageNumber.toString(),

View File

@ -9,7 +9,6 @@ import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/people_on_the_property_page/people_on_the_property_page_model.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
@ -19,7 +18,6 @@ import 'package:provider/provider.dart';
import '../../shared/utils/dialog_util.dart';
import '../../shared/utils/log_util.dart';
class PeopleOnThePropertyPageWidget extends StatefulWidget {
const PeopleOnThePropertyPageWidget({super.key});
@ -49,7 +47,7 @@ class _PeopleOnThePropertyPageWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Scaffold(
key: scaffoldKey,
@ -93,10 +91,10 @@ class _PeopleOnThePropertyPageWidgetState
top: true,
child: FutureBuilder<ApiCallResponse>(
future: PhpGroup.getPessoasLocalCall.call(
cliID: FFAppState().cliUUID,
ownID: FFAppState().ownerUUID,
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: AppState().cliUUID,
ownID: AppState().ownerUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
),
builder: (context, snapshot) {
// Customize what your widget looks like when it's loading.
@ -115,7 +113,12 @@ class _PeopleOnThePropertyPageWidgetState
if (snapshot.hasError || snapshot.data?.exception != null) {
if (snapshot.error != null && snapshot.stackTrace != null) {
LogUtil.requestAPIFailed('getPessoasLocal.php', "", 'Busca Pessoas no Local', snapshot.error, snapshot.stackTrace!);
LogUtil.requestAPIFailed(
'getPessoasLocal.php',
"",
'Busca Pessoas no Local',
snapshot.error,
snapshot.stackTrace!);
}
return Center(
@ -124,9 +127,8 @@ class _PeopleOnThePropertyPageWidgetState
height: 100,
child: Text(
FFLocalizations.of(context).getVariableText(
ptText: "Pessoas não encontradas",
enText: "Persons not found"
),
ptText: "Pessoas não encontradas",
enText: "Persons not found"),
textAlign: TextAlign.center,
),
),
@ -134,7 +136,12 @@ class _PeopleOnThePropertyPageWidgetState
}
final columnGetPessoasLocalResponse = snapshot.data!;
final getPoepleProperty = PhpGroup.getPessoasLocalCall.pessoas(columnGetPessoasLocalResponse.jsonBody,)?.toList() ?? [];
final getPoepleProperty = PhpGroup.getPessoasLocalCall
.pessoas(
columnGetPessoasLocalResponse.jsonBody,
)
?.toList() ??
[];
return ListView.builder(
physics: const AlwaysScrollableScrollPhysics(),
@ -170,7 +177,8 @@ class _PeopleOnThePropertyPageWidgetState
r'''$.USU_NOME''',
).toString(),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
fontSize: 14.0,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
@ -188,4 +196,4 @@ class _PeopleOnThePropertyPageWidgetState
),
);
}
}
}

View File

@ -16,17 +16,17 @@ class PreferencesPageModel with ChangeNotifier {
final unfocusNode = FocusNode();
Future<void> toggleFingerprint(BuildContext context) async {
// FFAppState().checkBiometrics()
// .then((value) => FFAppState().authenticateBiometric()
// AppState().checkBiometrics()
// .then((value) => AppState().authenticateBiometric()
// .then( (value) {
// FFAppState().fingerprint = !FFAppState().fingerprint;
// AppState().fingerprint = !AppState().fingerprint;
// })
// .whenComplete(() => notifyListeners()));
if (FFAppState().fingerprint) {
FFAppState().fingerprint = false;
FFAppState().deleteFingerprintPass();
if (AppState().fingerprint) {
AppState().fingerprint = false;
AppState().deleteFingerprintPass();
notifyListeners();
} else {
await showModalBottomSheet(
@ -39,8 +39,8 @@ class PreferencesPageModel with ChangeNotifier {
padding: MediaQuery.viewInsetsOf(context),
child: PassKeyTemplateWidget(
toggleActionStatus: (key) async {
FFAppState().fingerprintPass = key;
FFAppState().fingerprint = true;
AppState().fingerprintPass = key;
AppState().fingerprint = true;
},
),
);
@ -88,8 +88,8 @@ class PreferencesPageModel with ChangeNotifier {
Share.share(
FFLocalizations.of(context).getVariableText(
ptText:
'Este é o meu identificador de acesso: ${FFAppState().userDevUUID}',
enText: 'This is my access identifier: ${FFAppState().userDevUUID}',
'Este é o meu identificador de acesso: ${AppState().userDevUUID}',
enText: 'This is my access identifier: ${AppState().userDevUUID}',
),
);
}
@ -102,19 +102,19 @@ class PreferencesPageModel with ChangeNotifier {
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
title: Text(
FFLocalizations.of(context).getVariableText(
enText: FFAppState().notify
enText: AppState().notify
? 'Disable Access Notification'
: 'Access Notification',
ptText: FFAppState().notify
ptText: AppState().notify
? 'Desativar notificação de acesso'
: 'Notificação de acesso'),
),
content: Text(
FFLocalizations.of(context).getVariableText(
ptText: FFAppState().notify
ptText: AppState().notify
? 'Tem certeza que deseja desativar as suas notificações de acesso?'
: 'Tem certeza que deseja receber as suas notificações de acesso?',
enText: FFAppState().notify
enText: AppState().notify
? 'Are you sure you want to disable your access notifications?'
: 'Are you sure you want to receive your access notifications?'),
),
@ -150,17 +150,17 @@ class PreferencesPageModel with ChangeNotifier {
try {
PhpGroup.changeNotifica
.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliID: FFAppState().cliUUID,
userUUID: AppState().userUUID,
devUUID: AppState().devUUID,
cliID: AppState().cliUUID,
atividade: 'updVisitado',
notifica: FFAppState().notify ? 'S' : 'N',
notifica: AppState().notify ? 'S' : 'N',
)
.then((value) {
if (value.jsonBody['error'] == false) {
Navigator.pop(context);
FFAppState().notify = !FFAppState().notify;
AppState().notify = !AppState().notify;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
@ -306,16 +306,16 @@ class PreferencesPageModel with ChangeNotifier {
try {
await PhpGroup.resopndeVinculo
.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliID: FFAppState().cliUUID,
userUUID: AppState().userUUID,
devUUID: AppState().devUUID,
cliID: AppState().cliUUID,
tarefa: 'I',
)
.then((value) {
if (value.jsonBody['error'] == false) {
FFAppState().deleteCliUUID();
FFAppState().deleteLocal();
FFAppState().deleteOwnerUUID();
AppState().deleteCliUUID();
AppState().deleteLocal();
AppState().deleteOwnerUUID();
Navigator.pop(context);
Navigator.pop(context);
@ -460,13 +460,13 @@ class PreferencesPageModel with ChangeNotifier {
try {
await PhpGroup.deleteAccount
.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
)
.then((value) {
if (value.jsonBody['error'] == false) {
FFAppState().deleteAll();
FFAppState().isLogged = false;
AppState().deleteAll();
AppState().isLogged = false;
context.goNamed(
'welcomePage',
extra: <String, dynamic>{
@ -550,9 +550,9 @@ class PreferencesPageModel with ChangeNotifier {
}
Future<void> togglePass(BuildContext context) async {
// if (FFAppState().pass) {
// FFAppState().pass = false;
// FFAppState().deleteAccessPass();
// if (AppState().pass) {
// AppState().pass = false;
// AppState().deleteAccessPass();
// notifyListeners();
// } else {
await showModalBottomSheet(
@ -565,20 +565,20 @@ class PreferencesPageModel with ChangeNotifier {
padding: MediaQuery.viewInsetsOf(context),
child: PassKeyTemplateWidget(
toggleActionStatus: (key) async {
FFAppState().accessPass = key;
AppState().accessPass = key;
notifyListeners();
await PhpGroup.changePass
.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliID: FFAppState().cliUUID,
userUUID: AppState().userUUID,
devUUID: AppState().devUUID,
cliID: AppState().cliUUID,
atividade: 'updVisitado',
newSenha: FFAppState().accessPass,
newSenha: AppState().accessPass,
)
.then((value) {
// var error = jsonDecode(value.jsonBody['error'].toString());
if (jsonDecode(value.jsonBody['error'].toString()) == false) {
FFAppState().pass = true;
AppState().pass = true;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
@ -614,10 +614,10 @@ class PreferencesPageModel with ChangeNotifier {
),
),
);
// FFAppState().pass = false;
// AppState().pass = false;
}
}).catchError((error, StackTrace) {
// FFAppState().pass = false;
// AppState().pass = false;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
@ -655,20 +655,20 @@ class PreferencesPageModel with ChangeNotifier {
padding: MediaQuery.viewInsetsOf(context),
child: PassKeyTemplateWidget(
toggleActionStatus: (key) async {
FFAppState().panicPass = key;
AppState().panicPass = key;
notifyListeners();
await PhpGroup.changePanic
.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliID: FFAppState().cliUUID,
userUUID: AppState().userUUID,
devUUID: AppState().devUUID,
cliID: AppState().cliUUID,
atividade: 'updVisitado',
newSenhaPanico: FFAppState().panicPass,
newSenhaPanico: AppState().panicPass,
)
.then((value) {
FFAppState().panic = true;
AppState().panic = true;
if (jsonDecode(value.jsonBody['error'].toString()) == false) {
FFAppState().panic = true;
AppState().panic = true;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
@ -704,10 +704,10 @@ class PreferencesPageModel with ChangeNotifier {
),
),
);
// FFAppState().panic = false;
// AppState().panic = false;
}
}).catchError((e, s) {
// FFAppState().panic = false;
// AppState().panic = false;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(

View File

@ -101,7 +101,7 @@ class PreferencesPageWidget extends StatelessWidget {
icon = Icons.fingerprint;
onPressed = () =>
model.toggleFingerprint(context); // Disable if fingerprint is false
isEnabled = FFAppState().fingerprint;
isEnabled = AppState().fingerprint;
content = FFLocalizations.of(context).getVariableText(
ptText:
'Ative a autenticação por impressão digital para login seguro.',
@ -111,7 +111,7 @@ class PreferencesPageWidget extends StatelessWidget {
case 1:
icon = Icons.person;
onPressed = () => model.enablePerson(context);
isEnabled = FFAppState().person;
isEnabled = AppState().person;
content = FFLocalizations.of(context).getVariableText(
ptText: 'Compartilhe o código de identificação remota',
enText: 'Share the remote identification code',
@ -120,7 +120,7 @@ class PreferencesPageWidget extends StatelessWidget {
case 2:
icon = Icons.notifications;
onPressed = () => model.toggleNotify(context);
isEnabled = FFAppState().notify;
isEnabled = AppState().notify;
content = FFLocalizations.of(context).getVariableText(
ptText: 'Ative para receber sua notificação de acesso',
enText: 'Enable to receive your access notification',
@ -129,7 +129,7 @@ class PreferencesPageWidget extends StatelessWidget {
case 3:
icon = Icons.lock;
// onLongPress = model.togglePass(context, model);
isEnabled = FFAppState().pass;
isEnabled = AppState().pass;
content = FFLocalizations.of(context).getVariableText(
ptText: 'Ative para inserir uma credencial de acesso para o QRCode',
enText: 'Enable to enter an access credential for the QRCode',
@ -138,7 +138,7 @@ class PreferencesPageWidget extends StatelessWidget {
case 4:
icon = Icons.lock_clock_sharp;
// onLongPress = model.togglePass(context, model);
isEnabled = FFAppState().panic;
isEnabled = AppState().panic;
content = FFLocalizations.of(context).getVariableText(
ptText: 'Ative para inserir uma credencial de pânico para o QRCode',
enText: 'Enable to enter an panic credential for the QRCode',

View File

@ -145,14 +145,14 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
safeSetState(() async {
_resetAnimationAndToggleAccess();
});
FFAppState().fingerprint
AppState().fingerprint
? await _showBiometricsAuth(context)
: await _showQrCodeBottomSheet(context);
},
child: buildQrCode(
dimension: dimension,
errorCorrectLevel: QrErrorCorrectLevel.M,
identifier: FFAppState().userDevUUID,
identifier: AppState().userDevUUID,
pass: _model.key!,
direction: 5,
),
@ -200,7 +200,7 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
alignment: const AlignmentDirectional(0.0, 0.0),
child: FFButtonWidget(
onPressed: () async {
FFAppState().fingerprint
AppState().fingerprint
? await _showBiometricsAuth(context)
: await _showQrCodeBottomSheet(context);
},
@ -362,9 +362,9 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
}
Future<void> _showBiometricsAuth(BuildContext context) async {
FFAppState()
AppState()
.checkBiometrics()
.then((value) => FFAppState().authenticateBiometric().then((value) {
.then((value) => AppState().authenticateBiometric().then((value) {
safeSetState(() {
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
animationsMap['barcodeOnActionTriggerAnimation']!
@ -375,7 +375,7 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
.reverse();
}
_model.isAccess = !_model.isAccess;
_model.key = FFAppState().fingerprintPass;
_model.key = AppState().fingerprintPass;
});
}))
.onError((error, StackTrace) {

View File

@ -37,7 +37,7 @@ class _RegisterVisitorPageWidgetState extends State<RegisterVisitorPageWidget> {
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return Scaffold(
appBar: AppBar(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,

View File

@ -1,22 +1,15 @@
import 'dart:developer';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/actions/actions.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
import 'package:hub/components/templates_components/details_component/details_component_action.dart';
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart';
import 'package:hub/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart';
import 'package:hub/flutter_flow/custom_functions.dart';
import 'package:hub/flutter_flow/flutter_flow_drop_down.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
@ -149,7 +142,7 @@ class _ScheduleCompleteVisitPageWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus
@ -872,7 +865,7 @@ Widget scheduleVisit(BuildContext context,
fadeOutDuration:
const Duration(milliseconds: 500),
imageUrl:
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(visitorListViewItem, r'''$.VTE_DOCUMENTO''').toString()}&tipo=E",
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${AppState().devUUID}&userUUID=${AppState().userUUID}&cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(visitorListViewItem, r'''$.VTE_DOCUMENTO''').toString()}&tipo=E",
fit: BoxFit.cover,
),
),
@ -1086,9 +1079,9 @@ Widget scheduleVisit(BuildContext context,
decoration: const BoxDecoration(),
child: FutureBuilder<ApiCallResponse>(
future: PhpGroup.getDadosCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliUUID: FFAppState().cliUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
cliUUID: AppState().cliUUID,
atividade: 'getDados',
),
builder: (context, snapshot) {
@ -1239,9 +1232,9 @@ Widget scheduleVisit(BuildContext context,
decoration: const BoxDecoration(),
child: FutureBuilder<ApiCallResponse>(
future: PhpGroup.getDadosCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliUUID: FFAppState().cliUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
cliUUID: AppState().cliUUID,
atividade: 'getDados',
),
builder: (context, snapshot) {
@ -1667,8 +1660,8 @@ Widget scheduleVisit(BuildContext context,
), () async {
await PhpGroup.postScheduleVisitCall
.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
atividade: 'putVisita',
devDesc: _model.textController3.text,
idVisitante: _model.visitorStrList,
@ -1684,7 +1677,7 @@ Widget scheduleVisit(BuildContext context,
idNAC: extractIdToStr(
_model.dropDownValue2!),
obs: _model.textController3.text,
cliID: FFAppState().cliUUID,
cliID: AppState().cliUUID,
)
.catchError((e) async {
await DialogUtil.errorDefault(context);
@ -1738,7 +1731,7 @@ Widget scheduleVisit(BuildContext context,
),
],
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${_model.visitorJsonList[0]['VTE_DOCUMENTO'] ?? ''}&tipo=E',
'https://freaccess.com.br/freaccess/getImage.php?cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${_model.visitorJsonList[0]['VTE_DOCUMENTO'] ?? ''}&tipo=E',
labelsHashMap: {
'Nome': _model.visitorJsonList[0]['VTE_NOME'],
'Start': _model.textController1.text,

View File

@ -1,22 +1,19 @@
import 'dart:developer';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import '/backend/api_requests/api_calls.dart';
import '/components/molecular_components/throw_exception/throw_exception_widget.dart';
import '/flutter_flow/flutter_flow_icon_button.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/flutter_flow/flutter_flow_widgets.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:easy_debounce/easy_debounce.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_model.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:provider/provider.dart';
import '/backend/api_requests/api_calls.dart';
import '/flutter_flow/flutter_flow_icon_button.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/flutter_flow/flutter_flow_widgets.dart';
class ScheduleProvisionalVisitPageWidget extends StatefulWidget {
const ScheduleProvisionalVisitPageWidget({super.key});
@ -68,7 +65,7 @@ class _ScheduleProvisionalVisitPageWidgetState
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
@ -226,7 +223,7 @@ class _ScheduleProvisionalVisitPageWidgetState
fadeOutDuration: const Duration(
milliseconds: 200),
imageUrl:
'https://freaccess.com.br/freaccess/Images/Clients/${FFAppState().cliUUID}.png',
'https://freaccess.com.br/freaccess/Images/Clients/${AppState().cliUUID}.png',
width: 35.0,
height: 35.0,
fit: BoxFit.contain,
@ -238,7 +235,7 @@ class _ScheduleProvisionalVisitPageWidgetState
padding: const EdgeInsetsDirectional
.fromSTEB(15.0, 0.0, 0.0, 0.0),
child: Text(
FFAppState().local,
AppState().local,
style:
FlutterFlowTheme.of(context)
.bodyMedium
@ -983,16 +980,16 @@ class _ScheduleProvisionalVisitPageWidgetState
_model.provVisitSchedule = await PhpGroup
.postProvVisitSchedulingCall
.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
cliID: AppState().cliUUID,
atividade: 'putAgendamentoProv',
data:
_model.dateTimeTextController.text,
motivo: _model.notesTextController.text,
nome: _model
.personNameTextController.text,
proID: FFAppState().ownerUUID,
proID: AppState().ownerUUID,
);
if (PhpGroup.postProvVisitSchedulingCall

View File

@ -1,15 +1,10 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:hub/actions/actions.dart';
import 'package:hub/app_state.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
import 'package:hub/components/templates_components/details_component/details_component_action.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
@ -22,7 +17,8 @@ class VisitHistoryWidget extends StatefulWidget {
_VisitHistoryWidgetState createState() => _VisitHistoryWidgetState();
}
class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProviderStateMixin {
class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
with TickerProviderStateMixin {
late ScrollController _scrollController;
int _pageNumber = 1;
final int _pageSize = 10;
@ -37,11 +33,13 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProv
super.initState();
_visitFuture = _fetchVisits();
_scrollController = ScrollController()..addListener(() {
if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) {
_scrollController = ScrollController()
..addListener(() {
if (_scrollController.position.atEdge &&
_scrollController.position.pixels != 0) {
_loadMore();
}
});
});
}
@override
@ -56,9 +54,9 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProv
var response = await ScheduleCompleteVisitPageModel().visitHistory(
requestFn: () => PhpGroup.getVisitsCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID,
devUUID: AppState().devUUID,
userUUID: AppState().userUUID,
cliID: AppState().cliUUID,
atividade: 'getVisitas',
pageSize: _pageSize,
pageNumber: _pageNumber,
@ -87,7 +85,8 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProv
return null;
} catch (e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s);
LogUtil.requestAPIFailed(
"proccessRequest.php", "", "Consulta de Visitas", e, s);
setState(() {
_hasData = false;
_loading = false;
@ -117,7 +116,6 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProv
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
@ -138,21 +136,20 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProv
)
else if (_hasData == true || _pageNumber >= 1)
Expanded(
child: FutureBuilder<void>(
future: _visitFuture,
builder: (context, snapshot) {
return ListView.builder(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
controller: _scrollController,
itemCount: _visitWrap.length,
itemBuilder: (context, index) {
final item = _visitWrap[index];
return _item(context, item);
});
},
)
),
child: FutureBuilder<void>(
future: _visitFuture,
builder: (context, snapshot) {
return ListView.builder(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
controller: _scrollController,
itemCount: _visitWrap.length,
itemBuilder: (context, index) {
final item = _visitWrap[index];
return _item(context, item);
});
},
)),
if (_hasData == true && _loading == true)
Container(
padding: const EdgeInsets.only(top: 15, bottom: 15),
@ -166,18 +163,27 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProv
)
].addToStart(const SizedBox(height: 0)),
);
}
Widget _item(BuildContext context, dynamic visitaWrapItem) {
return CardItemTemplateComponentWidget(
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${visitaWrapItem['VTE_DOCUMENTO'] ?? ''}&tipo=E',
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${AppState().devUUID}&userUUID=${AppState().userUUID}&cliID=${AppState().cliUUID}&atividade=getFoto&Documento=${visitaWrapItem['VTE_DOCUMENTO'] ?? ''}&tipo=E',
labelsHashMap: {
'${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:': visitaWrapItem['VTE_NOME'] ?? '',
'${FFLocalizations.of(context).getVariableText(ptText: "Inicio", enText: "Start")}:': visitaWrapItem['VAW_DTINICIO'] != '' && visitaWrapItem['VAW_DTINICIO'] != null ? ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', visitaWrapItem['VAW_DTINICIO']) : '',
'${FFLocalizations.of(context).getVariableText(ptText: "Fim", enText: "End")}:': visitaWrapItem['VAW_DTFIM'] != '' && visitaWrapItem['VAW_DTFIM'] != null ? ValidatorUtil.toLocalDateTime('yyyy-MM-dd HH:mm:ss', visitaWrapItem['VAW_DTFIM']) : '',
'${FFLocalizations.of(context).getVariableText(ptText: "Nome", enText: "Name")}:':
visitaWrapItem['VTE_NOME'] ?? '',
'${FFLocalizations.of(context).getVariableText(ptText: "Inicio", enText: "Start")}:':
visitaWrapItem['VAW_DTINICIO'] != '' &&
visitaWrapItem['VAW_DTINICIO'] != null
? ValidatorUtil.toLocalDateTime(
'yyyy-MM-dd HH:mm:ss', visitaWrapItem['VAW_DTINICIO'])
: '',
'${FFLocalizations.of(context).getVariableText(ptText: "Fim", enText: "End")}:':
visitaWrapItem['VAW_DTFIM'] != '' &&
visitaWrapItem['VAW_DTFIM'] != null
? ValidatorUtil.toLocalDateTime(
'yyyy-MM-dd HH:mm:ss', visitaWrapItem['VAW_DTFIM'])
: '',
},
statusHashMap: [
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
@ -238,16 +244,15 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> with TickerProv
);
},
).whenComplete(() {
safeSetState(() {
_pageNumber = 1;
_visitWrap = [];
_visitFuture = _fetchVisits();
});
}).catchError((e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s);
LogUtil.requestAPIFailed(
"proccessRequest.php", "", "Consulta de Visitas", e, s);
safeSetState(() {
_hasData = false;
_loading = false;

View File

@ -28,13 +28,13 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
// On page load action.
SchedulerBinding.instance.addPostFrameCallback((_) async {
if (isAndroid == true) {
FFAppState().device = 'Android';
AppState().device = 'Android';
setState(() {});
} else if (isiOS == true) {
FFAppState().device = 'iOS';
AppState().device = 'iOS';
setState(() {});
} else {
FFAppState().device = 'Web';
AppState().device = 'Web';
setState(() {});
}
});
@ -49,7 +49,7 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
context.watch<AppState>();
return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus
@ -77,4 +77,4 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
),
);
}
}
}

View File

@ -1,15 +1,14 @@
import 'dart:developer';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
class LogUtil {
static void requestAPIFailed(String url, String body, String reason, dynamic error, StackTrace stack) async {
FirebaseCrashlytics.instance.setCustomKey('URL', "${PhpGroup.getBaseUrl()}/$url");
static void requestAPIFailed(String url, String body, String reason,
dynamic error, StackTrace stack) async {
FirebaseCrashlytics.instance
.setCustomKey('URL', "${PhpGroup.getBaseUrl()}/$url");
FirebaseCrashlytics.instance.setCustomKey('Body', body);
await FirebaseCrashlytics.instance.recordError(error, stack, reason: reason);
await FirebaseCrashlytics.instance
.recordError(error, stack, reason: reason);
}
}
}

14051
log

File diff suppressed because one or more lines are too long

View File

@ -41,6 +41,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.0"
awesome_notifications:
dependency: "direct main"
description:
name: awesome_notifications
sha256: d9e46ce7f5171ee1e9b1c5bc6dc40bd77528561f592842ce97ce3a0a9ae155ef
url: "https://pub.dev"
source: hosted
version: "0.9.3+1"
barcode:
dependency: transitive
description:
@ -173,10 +181,10 @@ packages:
dependency: transitive
description:
name: crypto
sha256: "1dceb0cf05cb63a7852c11560060e53ec2f182079a16ced6f4395c5b0875baf8"
sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27
url: "https://pub.dev"
source: hosted
version: "3.0.4"
version: "3.0.5"
csslib:
dependency: transitive
description:
@ -518,30 +526,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.0"
flutter_local_notifications:
dependency: "direct main"
description:
name: flutter_local_notifications
sha256: c500d5d9e7e553f06b61877ca6b9c8b92c570a4c8db371038702e8ce57f8a50f
url: "https://pub.dev"
source: hosted
version: "17.2.2"
flutter_local_notifications_linux:
dependency: transitive
description:
name: flutter_local_notifications_linux
sha256: c49bd06165cad9beeb79090b18cd1eb0296f4bf4b23b84426e37dd7c027fc3af
url: "https://pub.dev"
source: hosted
version: "4.0.1"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
name: flutter_local_notifications_platform_interface
sha256: "85f8d07fe708c1bdcf45037f2c0109753b26ae077e9d9e899d55971711a4ea66"
url: "https://pub.dev"
source: hosted
version: "7.2.0"
flutter_localizations:
dependency: "direct main"
description: flutter
@ -1073,10 +1057,10 @@ packages:
dependency: transitive
description:
name: permission_handler_android
sha256: eaf2a1ec4472775451e88ca6a7b86559ef2f1d1ed903942ed135e38ea0097dca
sha256: "76e4ab092c1b240d31177bb64d2b0bea43f43d0e23541ec866151b9f7b2490fa"
url: "https://pub.dev"
source: hosted
version: "12.0.8"
version: "12.0.12"
permission_handler_apple:
dependency: transitive
description:
@ -1089,10 +1073,10 @@ packages:
dependency: transitive
description:
name: permission_handler_html
sha256: "6cac773d389e045a8d4f85418d07ad58ef9e42a56e063629ce14c4c26344de24"
sha256: af26edbbb1f2674af65a8f4b56e1a6f526156bc273d0e65dd8075fab51c78851
url: "https://pub.dev"
source: hosted
version: "0.1.2"
version: "0.1.3+2"
permission_handler_platform_interface:
dependency: transitive
description:
@ -1302,10 +1286,10 @@ packages:
dependency: transitive
description:
name: sqflite_common
sha256: c5e5b2a142a893a752cb36ae5888680248686725a54afceff31f9a3a76bc53c2
sha256: "7b41b6c3507854a159e24ae90a8e3e9cc01eb26a477c118d6dca065b5f55453e"
url: "https://pub.dev"
source: hosted
version: "2.5.4+1"
version: "2.5.4+2"
stack_trace:
dependency: transitive
description:
@ -1370,14 +1354,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.6.1"
timezone:
dependency: transitive
description:
name: timezone
sha256: "2236ec079a174ce07434e89fcd3fcda430025eb7692244139a9cf54fdcf1fc7d"
url: "https://pub.dev"
source: hosted
version: "0.9.4"
typed_data:
dependency: transitive
description:
@ -1550,10 +1526,10 @@ packages:
dependency: "direct main"
description:
name: webview_flutter
sha256: "6869c8786d179f929144b4a1f86e09ac0eddfe475984951ea6c634774c16b522"
sha256: ec81f57aa1611f8ebecf1d2259da4ef052281cb5ad624131c93546c79ccc7736
url: "https://pub.dev"
source: hosted
version: "4.8.0"
version: "4.9.0"
webview_flutter_android:
dependency: transitive
description:
@ -1574,10 +1550,10 @@ packages:
dependency: transitive
description:
name: webview_flutter_wkwebview
sha256: "9c62cc46fa4f2d41e10ab81014c1de470a6c6f26051a2de32111b2ee55287feb"
sha256: "1942a12224ab31e9508cf00c0c6347b931b023b8a4f0811e5dec3b06f94f117d"
url: "https://pub.dev"
source: hosted
version: "3.14.0"
version: "3.15.0"
win32:
dependency: "direct overridden"
description:
@ -1620,4 +1596,4 @@ packages:
version: "3.1.2"
sdks:
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.22.0"
flutter: ">=3.24.0"

View File

@ -24,7 +24,6 @@ dependencies:
crop_your_image: 1.1.0
csv: 6.0.0
device_info_plus: 10.1.0
flutter_local_notifications: ^17.2.2
firebase_messaging: 15.0.1
dropdown_button2: 2.3.9
easy_debounce: 2.0.3
@ -87,6 +86,7 @@ dependencies:
video_player_avfoundation: 2.6.1
video_player_platform_interface: 6.2.2
video_player_web: 2.3.1
fluttertoast: ^8.2.8
cupertino_icons: ^1.0.0
flutter_bloc: ^8.1.6
@ -94,7 +94,7 @@ dependencies:
qr_flutter: ^4.1.0
permission_handler: ^11.3.1
firebase_crashlytics: ^4.0.1
fluttertoast: ^8.2.8
awesome_notifications: ^0.9.3+1
dependency_overrides:
http: 1.2.1