This commit is contained in:
jantunemesssias 2025-02-03 09:02:23 -03:00
parent a07edd0c21
commit 73ea7d5641
38 changed files with 1254 additions and 589 deletions

View File

@ -6,7 +6,8 @@ class AuthenticationTest {
'Sign-In with fuzzed emails',
(PatrolIntegrationTester tester) async {
$ = tester;
$.tester.printToConsole('Authentication Test - Sign-In with fuzzed emails');
$.tester
.printToConsole('Authentication Test - Sign-In with fuzzed emails');
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
final Fuzzer fuzzer = Fuzzer(
@ -32,7 +33,8 @@ class AuthenticationTest {
],
iterations: 2,
);
Map<String, String> concat(String username, String domain, String password) {
Map<String, String> concat(
String username, String domain, String password) {
return {
'emailTextFormField': '$username@$domain.test',
'passwordTextFormField': password,
@ -61,7 +63,8 @@ class AuthenticationTest {
'Sign-In with email_app@exemplo.com',
(PatrolIntegrationTester tester) async {
$ = tester;
$.tester.printToConsole('Authentication Test - Sign-In with email_app@exemplo.com');
$.tester.printToConsole(
'Authentication Test - Sign-In with email_app@exemplo.com');
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
final Map<String, String> credentials = {
@ -82,7 +85,8 @@ class AuthenticationTest {
'Sign Up - credenciais já registradas',
(PatrolIntegrationTester tester) async {
$ = tester;
$.tester.printToConsole('Authentication Test - Sign-Up: credenciais já registradas');
$.tester.printToConsole(
'Authentication Test - Sign-Up: credenciais já registradas');
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
final Map<String, String> credentials = {
@ -102,7 +106,8 @@ class AuthenticationTest {
'Sign Up - credenciais novas',
(PatrolIntegrationTester tester) async {
$ = tester;
$.tester.printToConsole('Authentication Test - Sign-Up: credenciais novas');
$.tester
.printToConsole('Authentication Test - Sign-Up: credenciais novas');
final PatrolFinder throwsException = $(Dialog).$(ThrowExceptionWidget);
@ -135,7 +140,8 @@ class AuthenticationTest {
],
iterations: 2,
);
Map<String, String> concat(String name, String username, String domain, String password) {
Map<String, String> concat(
String name, String username, String domain, String password) {
return {
'nameTextFormField': name,
'emailTextFormField': '$username@$domain.test',
@ -168,7 +174,8 @@ class AuthenticationTest {
'Deslogar da Conta',
(PatrolIntegrationTester tester) async {
$ = tester;
$.tester.printToConsole('Authentication Test - Sign-Out: Deslogar da Conta');
$.tester.printToConsole(
'Authentication Test - Sign-Out: Deslogar da Conta');
await _loggedWithMultiLocalsAccount($);
await $.pumpWidget(const App());
@ -179,7 +186,9 @@ class AuthenticationTest {
await $.waitUntilVisible($(MenuListView));
await $(Icons.exit_to_app).waitUntilVisible().tap(settlePolicy: SettlePolicy.trySettle);
await $(Icons.exit_to_app)
.waitUntilVisible()
.tap(settlePolicy: SettlePolicy.trySettle);
await Future.delayed(const Duration(milliseconds: 500));
},
@ -203,7 +212,8 @@ class AuthenticationTest {
Future.delayed(Duration(seconds: 3));
await $.pump(Duration(seconds: 3));
await $.pumpAndSettle();
final PatrolFinder forgotPassword = await $(#ForgotPasswordScreen).waitUntilVisible();
final PatrolFinder forgotPassword =
await $(#ForgotPasswordScreen).waitUntilVisible();
expect(forgotPassword, findsOneWidget);
});
}
@ -230,7 +240,8 @@ Future<void> _enterCredentials(
}
}
Future<void> _submit(String key, PatrolIntegrationTester $, PatrolFinder throwsException) async {
Future<void> _submit(
String key, PatrolIntegrationTester $, PatrolFinder throwsException) async {
await $(ValueKey(key)) //
.waitUntilVisible()
.tap();
@ -248,5 +259,6 @@ Future<void> _submit(String key, PatrolIntegrationTester $, PatrolFinder throwsE
String _generateRandomString(int length) {
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
final rand = Random();
return List.generate(length, (index) => chars[rand.nextInt(chars.length)]).join();
return List.generate(length, (index) => chars[rand.nextInt(chars.length)])
.join();
}

View File

@ -0,0 +1 @@

View File

@ -59,7 +59,8 @@ Future<void> main() async {
// Maybe somewhat counterintuitively, this callback runs *after* the calls
// to group() below.
final topLevelGroup = Invoker.current!.liveTest.groups.first;
final dartTestGroup = createDartTestGroup(topLevelGroup,
final dartTestGroup = createDartTestGroup(
topLevelGroup,
tags: null,
excludeTags: null,
);

View File

@ -1,6 +1,7 @@
part of 'app_test.dart';
Future<void> _loggedWithMultiLocalsAccount(PatrolIntegrationTester $, [bool forceLinkedLocal = true]) async {
Future<void> _loggedWithMultiLocalsAccount(PatrolIntegrationTester $,
[bool forceLinkedLocal = true]) async {
await _init($);
await StorageHelper() //
.set(SecureStorageKey.isLogged.value, 'true');
@ -20,13 +21,15 @@ Future<void> _loggedWithMultiLocalsAccount(PatrolIntegrationTester $, [bool forc
if (forceLinkedLocal == true) {
await StorageHelper().set(ProfileStorageKey.clientUUID.key, '7');
await StorageHelper().set(ProfileStorageKey.ownerUUID.key, '7');
await StorageHelper().set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO');
await StorageHelper()
.set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO');
await PhpGroup.resopndeVinculo.call(tarefa: 'A');
await LicenseRepositoryImpl().resetLicense();
}
}
Future<void> _loggedWithSomeoneLocalAccount(PatrolIntegrationTester $, [bool forceLinkedLocal = true]) async {
Future<void> _loggedWithSomeoneLocalAccount(PatrolIntegrationTester $,
[bool forceLinkedLocal = true]) async {
await _init($);
await StorageHelper() //
.set(SecureStorageKey.isLogged.value, 'true');
@ -46,7 +49,8 @@ Future<void> _loggedWithSomeoneLocalAccount(PatrolIntegrationTester $, [bool for
if (forceLinkedLocal == true) {
await StorageHelper().set(ProfileStorageKey.clientUUID.key, '7');
await StorageHelper().set(ProfileStorageKey.ownerUUID.key, '7');
await StorageHelper().set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO');
await StorageHelper()
.set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO');
await PhpGroup.resopndeVinculo.call(tarefa: 'A');
await LicenseRepositoryImpl().resetLicense();
}
@ -95,7 +99,8 @@ Future<void> _navigateToSignUp(PatrolIntegrationTester $) async {
}
Future<void> _navigateBackUsingSystemGesture() async =>
IntegrationTestWidgetsFlutterBinding.instance.keyboard.isLogicalKeyPressed(LogicalKeyboardKey.escape);
IntegrationTestWidgetsFlutterBinding.instance.keyboard
.isLogicalKeyPressed(LogicalKeyboardKey.escape);
Future<void> _initializeTracking() async {
print('Requesting tracking authorization...');

View File

@ -41,8 +41,9 @@ class VehicleTest {
expect(listViewFinder, findsOneWidget);
final PatrolFinder entriesFinder =
await $(listViewFinder).$(CardItemTemplateComponentWidget).waitUntilVisible();
final PatrolFinder entriesFinder = await $(listViewFinder)
.$(CardItemTemplateComponentWidget)
.waitUntilVisible();
expect(entriesFinder, findsWidgets);
final int entriesCount = entriesFinder.evaluate().length;
@ -51,13 +52,16 @@ class VehicleTest {
for (int i = 0; i < entriesCount; i++) {
await $(entriesFinder.at(i)).scrollTo();
await $(entriesFinder.at(i)).waitUntilVisible(timeout: const Duration(seconds: 1)).tap(
await $(entriesFinder.at(i))
.waitUntilVisible(timeout: const Duration(seconds: 1))
.tap(
settleTimeout: const Duration(seconds: 1),
settlePolicy: SettlePolicy.noSettle,
);
await $.pumpAndSettle(duration: Duration(milliseconds: 500));
final PatrolFinder detailsFinder = await $(DetailsComponentWidget).waitUntilVisible();
final PatrolFinder detailsFinder =
await $(DetailsComponentWidget).waitUntilVisible();
expect(detailsFinder, findsOneWidget);
await $.native.pressBack().then((_) => $.pumpAndSettle());
@ -124,8 +128,9 @@ class VehicleTest {
expect(listViewFinder, findsOneWidget);
final PatrolFinder entriesFinder =
await $(listViewFinder).$(CardItemTemplateComponentWidget).waitUntilVisible();
final PatrolFinder entriesFinder = await $(listViewFinder)
.$(CardItemTemplateComponentWidget)
.waitUntilVisible();
expect(entriesFinder, findsWidgets);
await $.pumpAndSettle();
@ -170,8 +175,9 @@ class VehicleTest {
expect(listViewFinder, findsOneWidget);
final PatrolFinder entriesFinder =
await $(listViewFinder).$(CardItemTemplateComponentWidget).waitUntilVisible();
final PatrolFinder entriesFinder = await $(listViewFinder)
.$(CardItemTemplateComponentWidget)
.waitUntilVisible();
expect(entriesFinder, findsWidgets);
final int entriesCount = entriesFinder.evaluate().length;
@ -180,13 +186,16 @@ class VehicleTest {
for (int i = 0; i < entriesCount; i++) {
await $(entriesFinder.at(i)).scrollTo();
await $(entriesFinder.at(i)).waitUntilVisible(timeout: const Duration(seconds: 1)).tap(
await $(entriesFinder.at(i))
.waitUntilVisible(timeout: const Duration(seconds: 1))
.tap(
settleTimeout: const Duration(seconds: 1),
settlePolicy: SettlePolicy.noSettle,
);
await $.pumpAndSettle(duration: Duration(milliseconds: 500));
final PatrolFinder detailsFinder = await $(DetailsComponentWidget).waitUntilVisible();
final PatrolFinder detailsFinder =
await $(DetailsComponentWidget).waitUntilVisible();
expect(detailsFinder, findsOneWidget);
await $.native.pressBack().then((_) => $.pumpAndSettle());

View File

@ -150,7 +150,6 @@ class _CustomInputUtilState extends State<CustomInputUtil> {
maxLines: null,
maxLength: widget.haveMaxLength ? widget.maxLength : null,
keyboardType: widget.keyboardType,
inputFormatters: [
LengthLimitingTextInputFormatter(widget.maxLength),
],

View File

@ -41,7 +41,8 @@ class TabViewUtil extends StatelessWidget {
fontFamily: FlutterFlowTheme.of(context).titleMediumFamily,
fontSize: LimitedFontSizeUtil.getBodyFontSize(context),
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).titleMediumFamily),
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).titleMediumFamily),
),
unselectedLabelStyle: const TextStyle(),
indicatorColor: FlutterFlowTheme.of(context).primary,

View File

@ -19,10 +19,12 @@ class BottomArrowLinkedLocalsComponentWidget extends StatefulWidget {
ApiCallResponse? response;
@override
State<BottomArrowLinkedLocalsComponentWidget> createState() => _BottomArrowLinkedLocalsComponentWidgetState();
State<BottomArrowLinkedLocalsComponentWidget> createState() =>
_BottomArrowLinkedLocalsComponentWidgetState();
}
class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLinkedLocalsComponentWidget> {
class _BottomArrowLinkedLocalsComponentWidgetState
extends State<BottomArrowLinkedLocalsComponentWidget> {
late BottomArrowLinkedLocalsComponentModel _model;
bool _loading = false;
@ -40,7 +42,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
@override
void initState() {
super.initState();
_model = createModel(context, () => BottomArrowLinkedLocalsComponentModel());
_model =
createModel(context, () => BottomArrowLinkedLocalsComponentModel());
_localsFuture = _fetchLocals();
}
@ -106,10 +109,14 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
if (isEnabled) {
final local = locals[0];
await StorageHelper().set(ProfileStorageKey.clientName.key, local['CLI_NOME']);
await StorageHelper().set(ProfileStorageKey.ownerName.key, local['CLU_OWNER_DSC']);
await StorageHelper().set(ProfileStorageKey.clientUUID.key, local['CLI_ID']);
await StorageHelper().set(ProfileStorageKey.ownerUUID.key, local['CLU_OWNER_ID']);
await StorageHelper()
.set(ProfileStorageKey.clientName.key, local['CLI_NOME']);
await StorageHelper()
.set(ProfileStorageKey.ownerName.key, local['CLU_OWNER_DSC']);
await StorageHelper()
.set(ProfileStorageKey.clientUUID.key, local['CLI_ID']);
await StorageHelper()
.set(ProfileStorageKey.ownerUUID.key, local['CLU_OWNER_ID']);
context.pop();
return widget.response;
@ -133,7 +140,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
return null;
}
static Future<void> _handleError(BuildContext context, String errorMsg) async {
static Future<void> _handleError(
BuildContext context, String errorMsg) async {
await DialogUtil.error(context, errorMsg);
}
@ -145,8 +153,9 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
if (response.jsonBody['error'] == false) {
return {
'error': false,
'error_msg': FFLocalizations.of(context)
.getVariableText(ptText: "Vínculo Ativado com Sucesso", enText: "Link Activated Successfully")
'error_msg': FFLocalizations.of(context).getVariableText(
ptText: "Vínculo Ativado com Sucesso",
enText: "Link Activated Successfully")
};
} else {
await StorageHelper().set(ProfileStorageKey.clientUUID.key, '');
@ -154,7 +163,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
}
} catch (e, s) {
await DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed('responderVinculo.php', '', 'Responder Vínculo', e, s);
LogUtil.requestAPIFailed(
'responderVinculo.php', '', 'Responder Vínculo', e, s);
return {
'error': true,
'error_msg': FFLocalizations.of(context).getVariableText(
@ -179,14 +189,17 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
Map<String, Color> _statusHashMap(dynamic local) {
return Map<String, Color>.from({
if (local['CLU_STATUS'] == 'A')
FFLocalizations.of(context).getVariableText(ptText: 'Ativo', enText: 'Active'):
FlutterFlowTheme.of(context).success
FFLocalizations.of(context).getVariableText(
ptText: 'Ativo',
enText: 'Active'): FlutterFlowTheme.of(context).success
else if (local['CLU_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: 'Pendente', enText: 'Pending'):
FlutterFlowTheme.of(context).warning
FFLocalizations.of(context).getVariableText(
ptText: 'Pendente',
enText: 'Pending'): FlutterFlowTheme.of(context).warning
});
}
@ -200,16 +213,21 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
statusHashMap: [_statusHashMap(local)],
onTapCardItemAction: () async {
if (local['CLU_STATUS'] == 'A') {
await StorageHelper().set(ProfileStorageKey.clientUUID.key, local['CLI_ID']);
await StorageHelper().set(ProfileStorageKey.clientName.key, local['CLI_NOME']);
await StorageHelper().set(ProfileStorageKey.ownerName.key, local['CLU_OWNER_DSC']);
await StorageHelper().set(ProfileStorageKey.ownerUUID.key, local['CLU_OWNER_ID']);
await StorageHelper()
.set(ProfileStorageKey.clientUUID.key, local['CLI_ID']);
await StorageHelper()
.set(ProfileStorageKey.clientName.key, local['CLI_NOME']);
await StorageHelper()
.set(ProfileStorageKey.ownerName.key, local['CLU_OWNER_DSC']);
await StorageHelper()
.set(ProfileStorageKey.ownerUUID.key, local['CLU_OWNER_ID']);
context.pop(true);
return true;
} else if (local['CLU_STATUS'] == 'B') {
String message = FFLocalizations.of(context).getVariableText(
ptText: 'Local Bloqueado para Acesso, Entre em Contato com Administração',
ptText:
'Local Bloqueado para Acesso, Entre em Contato com Administração',
enText: 'Location Blocked for Access, Contact Administration',
);
@ -225,7 +243,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
String localName = local['CLI_NOME'];
showAlertDialog(
context,
FFLocalizations.of(context).getVariableText(ptText: 'Ativar Vínculo', enText: 'Activate Link'),
FFLocalizations.of(context).getVariableText(
ptText: 'Ativar Vínculo', enText: 'Activate Link'),
FFLocalizations.of(context).getVariableText(
ptText: 'Deseja aceitar o vínculo a $localName?',
enText: 'Do you wish to accept the link to $localName?'),
@ -282,7 +301,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
height: height - (height * 0.5),
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: const BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25))),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(25), topRight: Radius.circular(25))),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
@ -294,13 +314,16 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
mainAxisSize: MainAxisSize.max,
children: [
Center(
child: Text(FFLocalizations.of(context)
.getVariableText(ptText: "Nenhum Local Encontrado.", enText: "No local found")),
child: Text(FFLocalizations.of(context).getVariableText(
ptText: "Nenhum Local Encontrado.",
enText: "No local found")),
)
],
),
)
else if (_hasData == true && _loading == false && _localsWrap.isNotEmpty)
else if (_hasData == true &&
_loading == false &&
_localsWrap.isNotEmpty)
Expanded(child: _listItems(context)),
if (_loading == true)
Container(
@ -317,7 +340,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState extends State<BottomArrowLink
padding: const EdgeInsets.only(top: 10),
child: Center(
child: Text(
FFLocalizations.of(context).getVariableText(ptText: 'Escolha um local', enText: 'Choose a location'),
FFLocalizations.of(context).getVariableText(
ptText: 'Escolha um local', enText: 'Choose a location'),
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontWeight: FontWeight.bold),
)))),

View File

@ -63,7 +63,6 @@ class FreCardPin extends StatelessWidget {
}
}
class CardItemTemplateComponentWidget extends StatefulWidget {
const CardItemTemplateComponentWidget({
super.key,
@ -182,33 +181,28 @@ class _CardItemTemplateComponentWidgetState
);
}
Widget _generateIcon() {
Widget _generateIcon() {
return Column(
children: [
widget.icon!,
],
);
}
}
Widget _generatePin() {
Widget _generatePin() {
return widget.pin!;
}
}
List<Widget> _generateStatus() {
double limitedBodyTextSize = LimitedFontSizeUtil.getBodyFontSize(context);
return statusLinkedHashMap.expand((statusLinked) {
log('statusHashMap: ${statusLinked.length}');
return statusLinked.entries.map((entry) {
final text = entry.key;
final color = entry.value;
return Tooltip(
message: text,
child: Container(
@ -245,9 +239,9 @@ class _CardItemTemplateComponentWidgetState
mainAxisSize: MainAxisSize.max,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.max,
children: [if(widget.pin != null) _generatePin()]),
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.max,
children: [if (widget.pin != null) _generatePin()]),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -258,7 +252,6 @@ class _CardItemTemplateComponentWidgetState
mainAxisSize: MainAxisSize.min,
children: [
..._generateLabels(),
Wrap(
spacing: 8,
runSpacing: 4,
@ -270,23 +263,20 @@ class _CardItemTemplateComponentWidgetState
.addToStart(const SizedBox(height: 5)),
),
),
if(widget.icon != null) _generateIcon(),
if (widget.icon != null) _generateIcon(),
if (widget.imagePath != null) _generateImage()
]
.addToEnd(const SizedBox(width: 10))
.addToStart(const SizedBox(width: 10)),
),
]
.addToStart(SizedBox(height: 5))
.addToEnd(SizedBox(height: 5)),
].addToStart(SizedBox(height: 5)).addToEnd(SizedBox(height: 5)),
);
} else {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
if (widget.imagePath != null) _generateImage(),
if(widget.icon != null) _generateIcon(),
if (widget.icon != null) _generateIcon(),
Container(
padding: const EdgeInsets.all(8),
child: Column(

View File

@ -98,7 +98,7 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
useOldImageOnUrlChange: true,
),
),
if (widget.icon != null && widget.icon != '')
if (widget.icon != null && widget.icon != '')
Container(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.width * 0.3,
@ -171,19 +171,18 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
),
),
style: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
fontWeight: FontWeight.bold,
color: FlutterFlowTheme.of(context).info,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.labelMediumFamily,
),
fontSize: limitedBodyFontSize,
.labelMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
fontWeight: FontWeight.bold,
color: FlutterFlowTheme.of(context).info,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily,
),
fontSize: limitedBodyFontSize,
),
textAlign: TextAlign.center,
maxLines: null,
keyboardType: TextInputType.name,

View File

@ -19,10 +19,12 @@ class ForgotPasswordTemplateComponentWidget extends StatefulWidget {
const ForgotPasswordTemplateComponentWidget({super.key});
@override
State<ForgotPasswordTemplateComponentWidget> createState() => _ForgotPasswordTemplateComponentWidgetState();
State<ForgotPasswordTemplateComponentWidget> createState() =>
_ForgotPasswordTemplateComponentWidgetState();
}
class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTemplateComponentWidget> {
class _ForgotPasswordTemplateComponentWidgetState
extends State<ForgotPasswordTemplateComponentWidget> {
late ForgotPasswordTemplateComponentModel _model;
@override
@ -49,9 +51,11 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
@override
Widget build(BuildContext context) {
double limitedSubHeaderFontSize = LimitedFontSizeUtil.getSubHeaderFontSize(context);
double limitedSubHeaderFontSize =
LimitedFontSizeUtil.getSubHeaderFontSize(context);
double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context);
double limitedHeaderFontSize = LimitedFontSizeUtil.getHeaderFontSize(context);
double limitedHeaderFontSize =
LimitedFontSizeUtil.getHeaderFontSize(context);
return Align(
key: ValueKey('ForgotPasswordTemplateComponentWidget'),
@ -84,7 +88,8 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
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(
key: const ValueKey<String>('BackButton'),
splashColor: Colors.transparent,
@ -98,7 +103,8 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
mainAxisSize: MainAxisSize.max,
children: [
const Padding(
padding: EdgeInsetsDirectional.fromSTEB(0.0, 12.0, 0.0, 12.0),
padding: EdgeInsetsDirectional.fromSTEB(
0.0, 12.0, 0.0, 12.0),
child: Icon(
Icons.arrow_back_rounded,
color: Color(0xFF15161E),
@ -106,16 +112,20 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
),
),
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: FlutterFlowTheme.of(context).bodyMedium.override(
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Plus Jakarta Sans',
color: const Color(0xFF15161E),
fontSize: limitedHeaderFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
),
),
@ -124,30 +134,36 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
),
),
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).getText('xxm3ajsy' /* ESQUECEU SUA SENHA? */),
FFLocalizations.of(context)
.getText('xxm3ajsy' /* ESQUECEU SUA SENHA? */),
style: FlutterFlowTheme.of(context).headlineMedium.override(
fontFamily: 'Outfit',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: limitedHeaderFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Outfit'),
useGoogleFonts:
GoogleFonts.asMap().containsKey('Outfit'),
),
),
),
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).getText('wu2f7yzo' /* Não se preucupe nós vamos te a... */),
FFLocalizations.of(context).getText(
'wu2f7yzo' /* Não se preucupe nós vamos te a... */),
style: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: limitedSubHeaderFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
),
),
@ -155,7 +171,8 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
key: _model.formKey,
autovalidateMode: AutovalidateMode.onUserInteraction,
child: 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(
@ -172,15 +189,18 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getText('mtz8l7ft' /* E-mail */),
labelStyle: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primary,
fontSize: limitedInputFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
),
labelText: FFLocalizations.of(context)
.getText('mtz8l7ft' /* E-mail */),
labelStyle:
FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).primary,
fontSize: limitedInputFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
enabledBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.black,
@ -209,7 +229,8 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
),
borderRadius: BorderRadius.circular(12.0),
),
contentPadding: const EdgeInsetsDirectional.fromSTEB(24.0, 24.0, 20.0, 24.0),
contentPadding: const EdgeInsetsDirectional.fromSTEB(
24.0, 24.0, 20.0, 24.0),
suffixIcon: Icon(
Icons.email,
color: FlutterFlowTheme.of(context).primary,
@ -222,12 +243,14 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
fontSize: limitedInputFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
maxLines: null,
keyboardType: TextInputType.emailAddress,
cursorColor: FlutterFlowTheme.of(context).primary,
validator: _model.emailAddressTextControllerValidator.asValidator(context),
validator: _model.emailAddressTextControllerValidator
.asValidator(context),
),
),
),
@ -235,13 +258,17 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
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(
key: const ValueKey<String>('SendButtonWidget'),
onPressed: (_model.emailAddressTextController.text == '' ||
!ValidatorUtil.isValidEmail(_model.emailAddressTextController.text))
onPressed: (_model.emailAddressTextController.text ==
'' ||
!ValidatorUtil.isValidEmail(
_model.emailAddressTextController.text))
? null
: () async => await AuthenticationService.forgotPassword(
: () async =>
await AuthenticationService.forgotPassword(
context,
_model.emailAddressTextController.text,
).then((v) => v == true ? context.pop() : null),
@ -251,23 +278,28 @@ class _ForgotPasswordTemplateComponentWidgetState extends State<ForgotPasswordTe
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: FlutterFlowTheme.of(context).primary,
textStyle: FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Plus Jakarta Sans',
color: Colors.white,
fontSize: limitedInputFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
),
textStyle:
FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Plus Jakarta Sans',
color: Colors.white,
fontSize: limitedInputFontSize,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans'),
),
elevation: 3.0,
borderSide: const BorderSide(
color: Colors.transparent,
width: 1.0,
),
disabledColor: FlutterFlowTheme.of(context).customColor5,
disabledColor:
FlutterFlowTheme.of(context).customColor5,
disabledTextColor: Colors.white,
),
showLoadingIndicator: true,

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:hub/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart';
import 'package:hub/features/backend/index.dart';

View File

@ -1,4 +1,3 @@
class DeadCode {
final String? desc;

View File

@ -3,7 +3,6 @@
import 'package:hub/features/backend/index.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
class DeviceStruct extends BaseStruct {
DeviceStruct({
String? devUUID,

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import '/flutter_flow/flutter_flow_util.dart';

View File

@ -16,7 +16,8 @@ class HomePageWidget extends StatefulWidget {
State<HomePageWidget> createState() => _HomePageWidgetState();
}
class _HomePageWidgetState extends State<HomePageWidget> with WidgetsBindingObserver {
class _HomePageWidgetState extends State<HomePageWidget>
with WidgetsBindingObserver {
final scaffoldKey = GlobalKey<ScaffoldState>();
@override
@ -96,7 +97,8 @@ class _HomePageWidgetState extends State<HomePageWidget> with WidgetsBindingObse
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).info,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
),
].divide(const SizedBox(width: 8.0)),

View File

@ -24,7 +24,8 @@ abstract class LocalsRemoteDataSource {
}
class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
static final LocalsRemoteDataSourceImpl _instance = LocalsRemoteDataSourceImpl._internal();
static final LocalsRemoteDataSourceImpl _instance =
LocalsRemoteDataSourceImpl._internal();
factory LocalsRemoteDataSourceImpl() => _instance;
LocalsRemoteDataSourceImpl._internal();
@ -50,7 +51,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
final List<dynamic> locals = response.jsonBody['locais'] ?? [];
final bool isEmpty = locals.isEmpty;
final bool isActive = locals.where((local) => local['CLU_STATUS'] != 'B').isNotEmpty;
final bool isActive =
locals.where((local) => local['CLU_STATUS'] != 'B').isNotEmpty;
final bool isEnable = !isEmpty && isActive;
if (isEnable) {
@ -95,7 +97,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
final bool isInactived = await LocalUtil.isInactived(locals);
final bool isPending = LocalUtil.isPending(locals);
final bool isUnique = locals.length == 1;
final bool isBlocked = locals.where((local) => local['CLU_STATUS'] == 'B').isNotEmpty;
final bool isBlocked =
locals.where((local) => local['CLU_STATUS'] == 'B').isNotEmpty;
final bool isEnabled = isUnique && isActive;
final bool isDisabled = isUnique && isBlocked;
final bool isUnselected = await LocalUtil.isUnselected();
@ -148,8 +151,10 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
@override
Future<bool> checkLocals(BuildContext context) async {
final String? cliUUID = await StorageHelper().get(ProfileStorageKey.clientUUID.key);
final String? cliName = await StorageHelper().get(ProfileStorageKey.clientName.key);
final String? cliUUID =
await StorageHelper().get(ProfileStorageKey.clientUUID.key);
final String? cliName =
await StorageHelper().get(ProfileStorageKey.clientName.key);
final haveCli = cliUUID != null && cliUUID.isNotEmpty;
final haveName = cliName != null && cliName.isNotEmpty;
return haveCli && haveName;
@ -175,7 +180,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
if (isError == true) {
final GetLocalsCall callback = PhpGroup.getLocalsCall;
response = await callback.call();
final String errorMsg = response.jsonBody['error_msg'] ?? 'Local indisponível';
final String errorMsg =
response.jsonBody['error_msg'] ?? 'Local indisponível';
// await DialogUtil.error(context, errorMsg).whenComplete(() async => await selectLocal(context, response));
return false;
} else {
@ -194,7 +200,8 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
}
@override
Future<bool> selectLocal(BuildContext context, ApiCallResponse? response) async {
Future<bool> selectLocal(
BuildContext context, ApiCallResponse? response) async {
return await showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
@ -224,13 +231,15 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
enText: 'Device unlinked successfully',
ptText: 'Dispositivo desvinculado com sucesso',
);
final bool status = await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async {
final bool status =
await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async {
if (value.jsonBody['error'] == false) {
await StorageHelper().set(ProfileStorageKey.clientName.key, '');
await StorageHelper().set(ProfileStorageKey.ownerName.key, '');
await StorageHelper().set(ProfileStorageKey.clientUUID.key, '');
context.pop();
context.go('/homePage', extra: {'update': LocalsRepositoryImpl().update});
context.go('/homePage',
extra: {'update': LocalsRepositoryImpl().update});
SnackBarUtil.showSnackBar(context, content);
return true;
}

View File

@ -49,8 +49,10 @@ class LocalsRepositoryImpl implements LocalsRepository {
}
Future<void> check(BuildContext context) async {
final String? cliUUID = await StorageHelper().get(ProfileStorageKey.clientUUID.key);
final String? ownerUUID = await StorageHelper().get(ProfileStorageKey.ownerUUID.key);
final String? cliUUID =
await StorageHelper().get(ProfileStorageKey.clientUUID.key);
final String? ownerUUID =
await StorageHelper().get(ProfileStorageKey.ownerUUID.key);
final bool haveCli = cliUUID != null && cliUUID.isNotEmpty;
final bool haveOwner = ownerUUID != null && ownerUUID.isNotEmpty;
if (!haveCli && !haveOwner) {

View File

@ -11,10 +11,13 @@ import 'package:hub/shared/utils/log_util.dart';
class LocalUtil {
static void handleError(BuildContext context, String errorMsg) async {
final String devUUID = await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
final String userUUID = await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? '';
final String devUUID =
await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
final String userUUID =
await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? '';
final bool isAuthenticated = userUUID.isNotEmpty && devUUID.isNotEmpty;
final bool isDevLinked = !errorMsg.contains('Esse dispositivo nao pertence a esse usuario');
final bool isDevLinked =
!errorMsg.contains('Esse dispositivo nao pertence a esse usuario');
log('() => isLinked: $errorMsg');
if (!isAuthenticated) {
errorMsg = FFLocalizations.of(context).getVariableText(
@ -36,13 +39,18 @@ class LocalUtil {
// await DialogUtil.error(context, errorMsg).whenComplete(() async => await LocalsRemoteDataSourceImpl().selectLocal(context, null));
}
static Future<bool> handleUnavailable(BuildContext context, List<dynamic> locals) async {
static Future<bool> handleUnavailable(
BuildContext context, List<dynamic> locals) async {
log('() => isUnavailable');
try {
await StorageHelper().set(ProfileStorageKey.clientUUID.key, locals[0]['CLI_ID']);
await StorageHelper().set(ProfileStorageKey.ownerUUID.key, locals[0]['CLU_OWNER_ID']);
await StorageHelper().set(ProfileStorageKey.clientName.key, locals[0]['CLI_NOME']);
await StorageHelper().set(ProfileStorageKey.ownerName.key, locals[0]['CLU_OWNER_DSC']);
await StorageHelper()
.set(ProfileStorageKey.clientUUID.key, locals[0]['CLI_ID']);
await StorageHelper()
.set(ProfileStorageKey.ownerUUID.key, locals[0]['CLU_OWNER_ID']);
await StorageHelper()
.set(ProfileStorageKey.clientName.key, locals[0]['CLI_NOME']);
await StorageHelper()
.set(ProfileStorageKey.ownerName.key, locals[0]['CLU_OWNER_DSC']);
var response = await PhpGroup.resopndeVinculo.call(tarefa: 'A');
if (response.jsonBody['error'] == true) {
@ -54,10 +62,13 @@ class LocalUtil {
return false;
}
if (response.jsonBody['error'] == false)
return await LocalsRemoteDataSourceImpl().processProperty(context).then((value) => value);
return await LocalsRemoteDataSourceImpl()
.processProperty(context)
.then((value) => value);
} catch (e, s) {
await DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed('responderVinculo.php', '', 'Responder Vínculo', e, s);
LogUtil.requestAPIFailed(
'responderVinculo.php', '', 'Responder Vínculo', e, s);
return false;
}
return false;
@ -65,12 +76,19 @@ class LocalUtil {
static Future<bool> handleEnabled(BuildContext context, dynamic local) async {
log('() => isEnabled');
await StorageHelper().set(ProfileStorageKey.clientUUID.key, local['CLI_ID']);
await StorageHelper().set(ProfileStorageKey.ownerUUID.key, local['CLU_OWNER_ID']);
await StorageHelper().set(ProfileStorageKey.clientName.key, local['CLI_NOME']);
await StorageHelper().set(ProfileStorageKey.ownerName.key, local['CLU_OWNER_DSC']);
await StorageHelper().set(ProfileStorageKey.userName.key, local['USU_NOME']);
return await LocalsRemoteDataSourceImpl().processProperty(context).then((v) async {
await StorageHelper()
.set(ProfileStorageKey.clientUUID.key, local['CLI_ID']);
await StorageHelper()
.set(ProfileStorageKey.ownerUUID.key, local['CLU_OWNER_ID']);
await StorageHelper()
.set(ProfileStorageKey.clientName.key, local['CLI_NOME']);
await StorageHelper()
.set(ProfileStorageKey.ownerName.key, local['CLU_OWNER_DSC']);
await StorageHelper()
.set(ProfileStorageKey.userName.key, local['USU_NOME']);
return await LocalsRemoteDataSourceImpl()
.processProperty(context)
.then((v) async {
if (v == true) return await LicenseRepositoryImpl().updateLicense();
return v;
});
@ -93,9 +111,12 @@ class LocalUtil {
static Future<bool> updateStorageUtil(Map<String, dynamic> jsonBody) async {
try {
await StorageHelper().set(LocalsStorageKey.whatsapp.key, jsonBody['whatsapp'] ?? false);
await StorageHelper().set(LocalsStorageKey.provisional.key, jsonBody['provisional'] ?? false);
await StorageHelper().set(LocalsStorageKey.vehicleAutoApproval.key, jsonBody['vehicleAutoApproval'] ?? false);
await StorageHelper()
.set(LocalsStorageKey.whatsapp.key, jsonBody['whatsapp'] ?? false);
await StorageHelper().set(
LocalsStorageKey.provisional.key, jsonBody['provisional'] ?? false);
await StorageHelper().set(LocalsStorageKey.vehicleAutoApproval.key,
jsonBody['vehicleAutoApproval'] ?? false);
await StorageHelper().set(
LocalsStorageKey.pets.key,
@ -118,19 +139,28 @@ class LocalUtil {
);
}
await StorageHelper().set(LocalsStorageKey.petAmount.key,
jsonBody['petAmountRegister']?.toString().isEmpty ?? true ? '0' : jsonBody['petAmountRegister'].toString());
await StorageHelper().set(
LocalsStorageKey.petAmount.key,
jsonBody['petAmountRegister']?.toString().isEmpty ?? true
? '0'
: jsonBody['petAmountRegister'].toString());
await StorageHelper().set(LocalsStorageKey.vehicleAmountRegister.key,
jsonBody['vehicleAmountRegister']?.toString().isEmpty ?? true ? '0' : jsonBody['vehicleAmountRegister'].toString());
await StorageHelper().set(
LocalsStorageKey.vehicleAmountRegister.key,
jsonBody['vehicleAmountRegister']?.toString().isEmpty ?? true
? '0'
: jsonBody['vehicleAmountRegister'].toString());
await StorageHelper().set(ProfileStorageKey.userName.key, jsonBody['visitado']['VDO_NOME'] ?? '');
await StorageHelper().set(ProfileStorageKey.userEmail.key, jsonBody['visitado']['VDO_EMAIL'] ?? '');
await StorageHelper().set(LocalsStorageKey.provisional.key, jsonBody['provisional'] ?? false);
await StorageHelper().set(ProfileStorageKey.userName.key,
jsonBody['visitado']['VDO_NOME'] ?? '');
await StorageHelper().set(ProfileStorageKey.userEmail.key,
jsonBody['visitado']['VDO_EMAIL'] ?? '');
await StorageHelper().set(
LocalsStorageKey.provisional.key, jsonBody['provisional'] ?? false);
final bool isNewVersion = jsonBody['newVersion'] ?? false;
await StorageHelper().set(LocalsStorageKey.isNewVersion.key, isNewVersion);
await StorageHelper()
.set(LocalsStorageKey.isNewVersion.key, isNewVersion);
return isNewVersion;
} catch (e, s) {
log('Error in _updateStorageUtil: $e', stackTrace: s);
@ -143,30 +173,44 @@ class LocalUtil {
}
static Future<bool> isInactived(List<dynamic> locals) async {
String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
return locals.where((local) => local['CLI_ID'] != cliUUID && local['CLU_STATUS'] == 'A').isNotEmpty;
String cliUUID =
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
return locals
.where(
(local) => local['CLI_ID'] != cliUUID && local['CLU_STATUS'] == 'A')
.isNotEmpty;
}
static bool isPending(List<dynamic> locals) {
return locals.where((local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A').isNotEmpty;
return locals
.where(
(local) => local['CLU_STATUS'] != 'B' && local['CLU_STATUS'] != 'A')
.isNotEmpty;
}
static Future<bool> isUnselected() async {
String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
String cliName = (await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? '';
String ownerUUID = (await StorageHelper().get(ProfileStorageKey.ownerUUID.key)) ?? '';
String cliUUID =
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
String cliName =
(await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? '';
String ownerUUID =
(await StorageHelper().get(ProfileStorageKey.ownerUUID.key)) ?? '';
return cliUUID.isEmpty && cliName.isEmpty && ownerUUID.isEmpty;
}
static Future<bool> isSelected(bool isInactived) async {
String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
String cliName = (await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? '';
String cliUUID =
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
String cliName =
(await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? '';
return cliUUID.isNotEmpty && cliName.isNotEmpty && isInactived;
}
static Future<bool> isAvailable() async {
String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
String cliName = (await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? '';
String cliUUID =
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
String cliName =
(await StorageHelper().get(ProfileStorageKey.clientName.key)) ?? '';
return cliUUID.isNotEmpty && cliName.isNotEmpty;
}
}

View File

@ -9,16 +9,19 @@ import 'package:hub/shared/extensions/dialog_extensions.dart';
import 'package:hub/shared/utils/path_util.dart';
abstract class MenuLocalDataSource {
Future<MenuItem?> addMenuEntry(
Key key, EnumMenuItem item, List<MenuItem?> entries, IconData icon, String text, Function() action);
Future<MenuItem?> addMenuEntry(Key key, EnumMenuItem item,
List<MenuItem?> entries, IconData icon, String text, Function() action);
Future<bool> processDisplayDefault(EnumMenuItem item, MenuEntry opt, List<MenuItem?> entries);
Future<bool> processDisplayDefault(
EnumMenuItem item, MenuEntry opt, List<MenuItem?> entries);
Future<void> handleMenu(EnumMenuItem item, EnumDisplay display, MenuEntry opt, List<MenuItem?> entries);
Future<void> handleMenu(EnumMenuItem item, EnumDisplay display, MenuEntry opt,
List<MenuItem?> entries);
}
class MenuLocalDataSourceImpl implements MenuLocalDataSource {
static final MenuLocalDataSourceImpl _instance = MenuLocalDataSourceImpl._internal();
static final MenuLocalDataSourceImpl _instance =
MenuLocalDataSourceImpl._internal();
factory MenuLocalDataSourceImpl() => _instance;
@ -45,9 +48,12 @@ class MenuLocalDataSourceImpl implements MenuLocalDataSource {
}
@override
Future<bool> processDisplayDefault(EnumMenuItem item, MenuEntry opt, List<MenuItem?> entries) async {
Future<bool> processDisplayDefault(
EnumMenuItem item, MenuEntry opt, List<MenuItem?> entries) async {
if (opt.key == 'FRE-HUB-LOGOUT') {
await addMenuEntry(ValueKey<String>(opt.key), item, entries, opt.icon, opt.name, () async {
await addMenuEntry(
ValueKey<String>(opt.key), item, entries, opt.icon, opt.name,
() async {
await AuthenticationService.signOut(navigatorKey.currentContext!);
});
return true;
@ -56,17 +62,23 @@ class MenuLocalDataSourceImpl implements MenuLocalDataSource {
}
@override
Future<void> handleMenu(EnumMenuItem item, EnumDisplay display, MenuEntry opt, List<MenuItem?> entries) async {
Future<void> handleMenu(EnumMenuItem item, EnumDisplay display, MenuEntry opt,
List<MenuItem?> entries) async {
try {
switch (display.value) {
case 'VISIVEL':
await addMenuEntry(ValueKey<String>(opt.key), item, entries, opt.icon, opt.name, () async {
await addMenuEntry(
ValueKey<String>(opt.key), item, entries, opt.icon, opt.name,
() async {
await PathUtil.nav(opt.route);
});
break;
case 'DESABILITADO':
await addMenuEntry(ValueKey<String>(opt.key), item, entries, opt.icon, opt.name, () async {
await DialogUnavailable.unavailableFeature(navigatorKey.currentContext!);
await addMenuEntry(
ValueKey<String>(opt.key), item, entries, opt.icon, opt.name,
() async {
await DialogUnavailable.unavailableFeature(
navigatorKey.currentContext!);
});
break;
case 'INVISIVEL':

View File

@ -10,13 +10,15 @@ class MenuRepositoryImpl implements MenuRepository {
final MenuLocalDataSource menuDataSource = MenuLocalDataSourceImpl();
@override
Future<List<MenuItem?>> entries2Items(List<MenuEntry> menuEntries, EnumMenuItem menuItem) async {
Future<List<MenuItem?>> entries2Items(
List<MenuEntry> menuEntries, EnumMenuItem menuItem) async {
List<MenuItem?> entries = [];
// final bool isNewVersion = await StorageHelper().get(KeychainStorageKey.isNewVersion.value).then((v) => v.toBoolean());
try {
for (var entry in menuEntries) {
final bool isDefault = await menuDataSource.processDisplayDefault(menuItem, entry, entries);
final bool isDefault = await menuDataSource.processDisplayDefault(
menuItem, entry, entries);
if (isDefault) continue;
final licenseValue = await LicenseRepositoryImpl().getModule(entry.key);
if (licenseValue != null) {
@ -25,17 +27,20 @@ class MenuRepositoryImpl implements MenuRepository {
final startDate = licenseMap['startDate'] ?? '';
final expirationDate = licenseMap['expirationDate'] ?? '';
final isStarted = await DateTimeUtil.processStartDate(startDate);
final isExpired = await DateTimeUtil.processExpirationDate(expirationDate);
final isExpired =
await DateTimeUtil.processExpirationDate(expirationDate);
if (isStarted && !isExpired) {
await menuDataSource.handleMenu(menuItem, display, entry, entries);
}
if (isExpired) {
log('Entry ${entry.key} is expired');
await menuDataSource.handleMenu(menuItem, EnumDisplay.inactive, entry, entries);
await menuDataSource.handleMenu(
menuItem, EnumDisplay.inactive, entry, entries);
}
if (!isStarted) {
log('Entry ${entry.key} is not started');
await menuDataSource.handleMenu(menuItem, EnumDisplay.inactive, entry, entries);
await menuDataSource.handleMenu(
menuItem, EnumDisplay.inactive, entry, entries);
}
}
}
@ -45,9 +50,11 @@ class MenuRepositoryImpl implements MenuRepository {
return entries;
}
Future<EnumDisplay> processDisplay(Map<String, dynamic> module, bool isNewVersion) async {
Future<EnumDisplay> processDisplay(
Map<String, dynamic> module, bool isNewVersion) async {
if (await _shouldUpdateDisplay(module, isNewVersion)) {
final displayValue = module['display'] == EnumDisplay.active ? 'VISIVEL' : 'INVISIVEL';
final displayValue =
module['display'] == EnumDisplay.active ? 'VISIVEL' : 'INVISIVEL';
await LicenseLocalDataSourceImpl(DatabaseService.database)
.setDisplayByKey(['FRE-HUB-ABOUT-PROPERTY'], displayValue);
return EnumDisplay.fromString(displayValue);
@ -56,8 +63,13 @@ class MenuRepositoryImpl implements MenuRepository {
return EnumDisplay.fromString(module['display']);
}
Future<bool> _shouldUpdateDisplay(Map<String, dynamic> module, bool isNewVersion) async {
const keysToCheck = [LicenseKeys.residents, LicenseKeys.vehicles, LicenseKeys.openedVisits];
Future<bool> _shouldUpdateDisplay(
Map<String, dynamic> module, bool isNewVersion) async {
const keysToCheck = [
LicenseKeys.residents,
LicenseKeys.vehicles,
LicenseKeys.openedVisits
];
return isNewVersion && keysToCheck.any((key) => module['key'] == key.value);
}
}

View File

@ -61,7 +61,9 @@ class License {
}
static Future<String> _precessWpp() async {
final bool whatsapp = await StorageHelper().get(LocalsStorageKey.whatsapp.key).then((v) => v.toBoolean);
final bool whatsapp = await StorageHelper()
.get(LocalsStorageKey.whatsapp.key)
.then((v) => v.toBoolean);
if (whatsapp)
return ModuleStatus.active.key;
else
@ -69,7 +71,9 @@ class License {
}
static Future<String> _processProvisional() async {
final bool provisional = await StorageHelper().get(LocalsStorageKey.provisional.key).then((v) => v.toBoolean);
final bool provisional = await StorageHelper()
.get(LocalsStorageKey.provisional.key)
.then((v) => v.toBoolean);
if (provisional)
return ModuleStatus.active.key;
else
@ -77,7 +81,9 @@ class License {
}
static Future<String> _processPets() async {
final bool pets = await StorageHelper().get(LocalsStorageKey.pets.key).then((v) => v.toBoolean);
final bool pets = await StorageHelper()
.get(LocalsStorageKey.pets.key)
.then((v) => v.toBoolean);
if (pets)
return ModuleStatus.active.key;
else
@ -134,14 +140,18 @@ class License {
),
Module(
key: LicenseKeys.openedVisits.value,
display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key,
display: isNewVersionWithModule
? ModuleStatus.active.key
: ModuleStatus.inactive.key,
expirationDate: '',
startDate: '',
quantity: 0,
),
Module(
key: LicenseKeys.vehicles.value,
display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key,
display: isNewVersionWithModule
? ModuleStatus.active.key
: ModuleStatus.inactive.key,
expirationDate: '',
startDate: '',
quantity: 0,
@ -155,7 +165,9 @@ class License {
),
Module(
key: LicenseKeys.residents.value,
display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key,
display: isNewVersionWithModule
? ModuleStatus.active.key
: ModuleStatus.inactive.key,
expirationDate: '',
startDate: '',
quantity: 0,
@ -218,14 +230,18 @@ class License {
),
Module(
key: LicenseKeys.property.value,
display: isNewVersionWithModule ? ModuleStatus.active.key : ModuleStatus.inactive.key,
display: isNewVersionWithModule
? ModuleStatus.active.key
: ModuleStatus.inactive.key,
expirationDate: '',
startDate: '',
quantity: 0,
),
Module(
key: LicenseKeys.people.value,
display: isNewVersionWithModule ? ModuleStatus.inactive.key : ModuleStatus.active.key,
display: isNewVersionWithModule
? ModuleStatus.inactive.key
: ModuleStatus.active.key,
expirationDate: '',
startDate: '',
quantity: 0,

View File

@ -65,7 +65,8 @@ class DeepLinkService {
),
),
isScrollControlled: true,
backgroundColor: FlutterFlowTheme.of(navigatorKey.currentContext!).primaryBackground,
backgroundColor: FlutterFlowTheme.of(navigatorKey.currentContext!)
.primaryBackground,
showDragHandle: true,
useSafeArea: true,
enableDrag: true,

View File

@ -86,11 +86,20 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
builder: (context, _) {
return FutureBuilder<Widget>(
future: () async {
final bool isLogged = await StorageHelper().get(SecureStorageKey.isLogged.value) == 'true';
final bool haveLocal = await StorageHelper().get(SecureStorageKey.haveLocal.value) == 'true';
final bool isLogged =
await StorageHelper().get(SecureStorageKey.isLogged.value) ==
'true';
final bool haveLocal =
await StorageHelper().get(SecureStorageKey.haveLocal.value) ==
'true';
final bool haveUserUUID =
(await StorageHelper().get(ProfileStorageKey.userUUID.key))?.isNotEmpty ?? false;
final bool haveDevUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key))?.isNotEmpty ?? false;
(await StorageHelper().get(ProfileStorageKey.userUUID.key))
?.isNotEmpty ??
false;
final bool haveDevUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key))
?.isNotEmpty ??
false;
if (isLogged && haveDevUUID && haveUserUUID) {
return haveLocal
@ -100,17 +109,20 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
create: (context) => MenuBloc(
style: MenuView.list_grid,
item: EnumMenuItem.button,
entries: MenuEntry.getEntriesByType(MenuEntryType.Home),
entries: MenuEntry.getEntriesByType(
MenuEntryType.Home),
)..add(MenuEvent()),
),
BlocProvider<HomeBloc>(
create: (context) => HomeBloc()..add(HomeEvent()),
),
BlocProvider(
create: (context) => LocalProfileBloc()..add(LocalProfileEvent()),
create: (context) =>
LocalProfileBloc()..add(LocalProfileEvent()),
),
],
child: HomePageWidget(key: UniqueKey(), LocalsRepositoryImpl().update),
child: HomePageWidget(
key: UniqueKey(), LocalsRepositoryImpl().update),
)
: const ReceptionPageWidget();
} else {
@ -134,8 +146,10 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
name: 'forgotPassword',
path: '/forgotPassword',
builder: (context, params) {
late final String email = params.getParam('email', ParamType.String);
late final String token = params.getParam('token', ParamType.String);
late final String email =
params.getParam('email', ParamType.String);
late final String token =
params.getParam('token', ParamType.String);
return ForgotPasswordScreen(
key: ValueKey('ForgotPasswordScreen'),
@ -152,7 +166,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
name: 'homePage',
path: '/homePage',
builder: (context, params) {
final Future<bool> Function(BuildContext context)? update = params.getParam('update', ParamType.Function);
final Future<bool> Function(BuildContext context)? update =
params.getParam('update', ParamType.Function);
return MultiBlocProvider(
providers: [
BlocProvider(
@ -166,7 +181,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
create: (context) => HomeBloc()..add(HomeEvent()),
),
BlocProvider(
create: (context) => LocalProfileBloc()..add(LocalProfileEvent()),
create: (context) =>
LocalProfileBloc()..add(LocalProfileEvent()),
),
],
child: HomePageWidget(key: UniqueKey(), update),
@ -175,12 +191,16 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
FFRoute(
name: 'petsOnThePropertyPage',
path: '/petsOnThePropertyPage',
builder: (context, params) => Scaffold(body: const PetsHistoryScreen(isApp: true))),
builder: (context, params) =>
Scaffold(body: const PetsHistoryScreen(isApp: true))),
FFRoute(
name: 'vehiclesOnThePropertyPage',
path: '/vehiclesOnThePropertyPage',
builder: (context, params) => const VehiclePage()),
FFRoute(name: 'receptionPage', path: '/receptionPage', builder: (context, params) => const ReceptionPageWidget()),
FFRoute(
name: 'receptionPage',
path: '/receptionPage',
builder: (context, params) => const ReceptionPageWidget()),
FFRoute(
name: 'messageHistoryPage',
path: '/messageHistoryPage',
@ -192,19 +212,28 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
FFRoute(
name: 'scheduleCompleteVisitPage',
path: '/scheduleCompleteVisitPage',
builder: (context, params) => const ScheduleCompleteVisitPageWidget()),
builder: (context, params) =>
const ScheduleCompleteVisitPageWidget()),
FFRoute(
name: 'deliverySchedule', path: '/deliverySchedule', builder: (context, params) => const DeliverySchedule()),
name: 'deliverySchedule',
path: '/deliverySchedule',
builder: (context, params) => const DeliverySchedule()),
FFRoute(
name: 'provisionalSchedule',
path: '/provisionalSchedule',
builder: (context, params) => const ProvisionalSchedule()),
FFRoute(name: 'fastPassPage', path: '/fastPassPage', builder: (context, params) => FastPassPageWidget()),
FFRoute(
name: 'fastPassPage',
path: '/fastPassPage',
builder: (context, params) => FastPassPageWidget()),
FFRoute(
name: 'preferencesSettings',
path: '/preferencesSettings',
builder: (context, params) => PreferencesPageWidget()),
FFRoute(name: 'aboutProperty', path: '/aboutProperty', builder: (context, params) => AboutPropertyPage()),
FFRoute(
name: 'aboutProperty',
path: '/aboutProperty',
builder: (context, params) => AboutPropertyPage()),
FFRoute(
name: 'residentsOnThePropertyPage',
path: '/residentsOnThePropertyPage',
@ -220,8 +249,11 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
FFRoute(
name: 'acessHistoryPage',
path: '/acessHistoryPage',
builder: (context, params) =>
AccessHistoryScreen(opt: const {'personType': '.*', 'accessType': '.*', 'search': '.*'})),
builder: (context, params) => AccessHistoryScreen(opt: const {
'personType': '.*',
'accessType': '.*',
'search': '.*'
})),
FFRoute(
name: 'provisionalHistoryPage',
path: '/provisionalHistoryPage',
@ -230,13 +262,34 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
name: 'liberationHistory',
path: '/liberationHistory',
builder: (context, params) => const LiberationHistoryWidget()),
FFRoute(name: 'signInPage', path: '/signInPage', builder: (context, params) => const SignInPageWidget()),
FFRoute(name: 'signUpPage', path: '/signUpPage', builder: (context, params) => const SignUpPageWidget()),
FFRoute(name: 'welcomePage', path: '/welcomePage', builder: (context, params) => const WelcomePage()),
FFRoute(name: 'qrCodePage', path: '/qrCodePage', builder: (context, params) => const QrCodePageWidget()),
FFRoute(name: 'preferencesPage', path: '/preferencesPage', builder: (context, params) => PreferencesPageWidget()),
FFRoute(name: 'packageOrder', path: '/packageOrder', builder: (context, params) => const PackageOrderPage()),
FFRoute(name: 'reservation', path: '/reservation', builder: (context, params) => ReservationPageWidget()),
FFRoute(
name: 'signInPage',
path: '/signInPage',
builder: (context, params) => const SignInPageWidget()),
FFRoute(
name: 'signUpPage',
path: '/signUpPage',
builder: (context, params) => const SignUpPageWidget()),
FFRoute(
name: 'welcomePage',
path: '/welcomePage',
builder: (context, params) => const WelcomePage()),
FFRoute(
name: 'qrCodePage',
path: '/qrCodePage',
builder: (context, params) => const QrCodePageWidget()),
FFRoute(
name: 'preferencesPage',
path: '/preferencesPage',
builder: (context, params) => PreferencesPageWidget()),
FFRoute(
name: 'packageOrder',
path: '/packageOrder',
builder: (context, params) => const PackageOrderPage()),
FFRoute(
name: 'reservation',
path: '/reservation',
builder: (context, params) => ReservationPageWidget()),
FFRoute(
name: 'petsPage',
path: '/petsPage',
@ -252,7 +305,9 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
extension NavParamExtensions on Map<String, String?> {
Map<String, String> get withoutNulls => Map.fromEntries(
entries.where((e) => e.value != null).map((e) => MapEntry(e.key, e.value!)),
entries
.where((e) => e.value != null)
.map((e) => MapEntry(e.key, e.value!)),
);
}
@ -266,7 +321,8 @@ extension NavigationExtensions on BuildContext {
}
extension _GoRouterStateExtensions on GoRouterState {
Map<String, dynamic> get extraMap => extra != null ? extra as Map<String, dynamic> : {};
Map<String, dynamic> get extraMap =>
extra != null ? extra as Map<String, dynamic> : {};
Map<String, dynamic> get allParams => <String, dynamic>{}
..addAll(pathParameters)
..addAll(uri.queryParameters)
@ -279,8 +335,9 @@ extension _GoRouterStateExtensions on GoRouterState {
extension GoRouterLocationExtension on GoRouter {
String getCurrentLocation() {
final RouteMatch lastMatch = routerDelegate.currentConfiguration.last;
final RouteMatchList matchList =
lastMatch is ImperativeRouteMatch ? lastMatch.matches : routerDelegate.currentConfiguration;
final RouteMatchList matchList = lastMatch is ImperativeRouteMatch
? lastMatch.matches
: routerDelegate.currentConfiguration;
return matchList.uri.toString();
}
}
@ -293,13 +350,17 @@ class FFParameters {
Map<String, dynamic> futureParamValues = {};
bool get isEmpty =>
state.allParams.isEmpty || (state.allParams.length == 1 && state.extraMap.containsKey(kTransitionInfoKey));
bool isAsyncParam(MapEntry<String, dynamic> param) => asyncParams.containsKey(param.key) && param.value is String;
state.allParams.isEmpty ||
(state.allParams.length == 1 &&
state.extraMap.containsKey(kTransitionInfoKey));
bool isAsyncParam(MapEntry<String, dynamic> param) =>
asyncParams.containsKey(param.key) && param.value is String;
bool get hasFutures => state.allParams.entries.any(isAsyncParam);
Future<bool> completeFutures() => Future.wait(
state.allParams.entries.where(isAsyncParam).map(
(param) async {
final doc = await asyncParams[param.key]!(param.value).onError((_, __) => null);
final doc = await asyncParams[param.key]!(param.value)
.onError((_, __) => null);
if (doc != null) {
futureParamValues[param.key] = doc;
return true;
@ -309,12 +370,15 @@ class FFParameters {
),
).onError((_, __) => [false]).then((v) => v.every((e) => e));
dynamic getParam<T>(String paramName, ParamType type, {bool isList = false, StructBuilder<T>? structBuilder}) {
if (futureParamValues.containsKey(paramName)) return futureParamValues[paramName];
dynamic getParam<T>(String paramName, ParamType type,
{bool isList = false, StructBuilder<T>? structBuilder}) {
if (futureParamValues.containsKey(paramName))
return futureParamValues[paramName];
if (!state.allParams.containsKey(paramName)) return null;
final param = state.allParams[paramName];
if (param is! String) return param;
return deserializeParam<T>(param, type, isList, structBuilder: structBuilder);
return deserializeParam<T>(param, type, isList,
structBuilder: structBuilder);
}
}
@ -354,13 +418,16 @@ class FFRoute {
key: state.pageKey,
child: child,
transitionDuration: transitionInfo.duration,
transitionsBuilder: (context, animation, secondaryAnimation, child) => PageTransition(
transitionsBuilder:
(context, animation, secondaryAnimation, child) =>
PageTransition(
type: transitionInfo.transitionType,
duration: transitionInfo.duration,
reverseDuration: transitionInfo.duration,
alignment: transitionInfo.alignment,
child: child,
).buildTransitions(context, animation, secondaryAnimation, child),
).buildTransitions(
context, animation, secondaryAnimation, child),
)
: MaterialPage(key: state.pageKey, child: child);
},
@ -381,7 +448,8 @@ class TransitionInfo {
final Duration duration;
final Alignment? alignment;
static TransitionInfo appDefault() => const TransitionInfo(hasTransition: false);
static TransitionInfo appDefault() =>
const TransitionInfo(hasTransition: false);
}
class RootPageContext {
@ -393,7 +461,9 @@ class RootPageContext {
final rootPageContext = context.read<RootPageContext?>();
final isRootPage = rootPageContext?.isRootPage ?? false;
final location = GoRouterState.of(context).uri.toString();
return isRootPage && location != '/' && location != rootPageContext?.errorRoute;
return isRootPage &&
location != '/' &&
location != rootPageContext?.errorRoute;
}
static Widget wrap(Widget child, {String? errorRoute}) =>

View File

@ -1,4 +1,3 @@
import 'package:app_tracking_transparency/app_tracking_transparency.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';

View File

@ -53,7 +53,8 @@ class App extends StatefulWidget {
@override
State<App> createState() => _AppState();
static _AppState of(BuildContext context) => context.findAncestorStateOfType<_AppState>()!;
static _AppState of(BuildContext context) =>
context.findAncestorStateOfType<_AppState>()!;
}
class _AppState extends State<App> {
@ -95,7 +96,8 @@ class _AppState extends State<App> {
}),
),
);
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates = const [
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates =
const [
FFLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
@ -137,7 +139,8 @@ class _AppState extends State<App> {
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
log('onMessageOpenedApp');
} else {
onMessageReceived(message.data, message.notification!.body, message.data['click_action']);
onMessageReceived(message.data, message.notification!.body,
message.data['click_action']);
}
});
FirebaseMessaging.instance.getInitialMessage().then((message) async {
@ -171,7 +174,9 @@ class _AppState extends State<App> {
_router = createRouter(_appStateNotifier);
Future.delayed(
const Duration(milliseconds: 1000),
() => mounted ? setState(() => _appStateNotifier.stopShowingSplashImage()) : null,
() => mounted
? setState(() => _appStateNotifier.stopShowingSplashImage())
: null,
);
_setupFirebaseMessaging();

View File

@ -15,7 +15,8 @@ import '../../flutter_flow/internationalization.dart';
import 'forgot_password_model.dart';
class ForgotPasswordScreen extends StatefulWidget {
const ForgotPasswordScreen({super.key, required this.email, required this.token});
const ForgotPasswordScreen(
{super.key, required this.email, required this.token});
final String email;
final String token;
@ -23,7 +24,8 @@ class ForgotPasswordScreen extends StatefulWidget {
State<ForgotPasswordScreen> createState() => _ForgotPasswordScreenState();
}
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with TickerProviderStateMixin {
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen>
with TickerProviderStateMixin {
late ForgotPasswordScreenModel _model;
final animationsMap = <String, AnimationInfo>{};
@ -148,7 +150,8 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
width: MediaQuery.of(context).size.width,
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 0.0),
padding: const EdgeInsets.only(
left: 15.0, right: 15.0, top: 10.0, bottom: 0.0),
child: Container(
width: double.infinity,
constraints: const BoxConstraints(maxWidth: 570.0),
@ -157,7 +160,8 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
borderRadius: BorderRadius.circular(12.0),
),
child: Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20.0, top: 10.0, bottom: 0.0),
padding: const EdgeInsets.only(
left: 20.0, right: 20.0, top: 10.0, bottom: 0.0),
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
@ -171,21 +175,25 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
fontSize: 24.0,
fontWeight: FontWeight.bold,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
useGoogleFonts:
GoogleFonts.asMap().containsKey('Nunito'),
),
)),
Align(
alignment: const AlignmentDirectional(-1.0, 0.0),
child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(20.0, 24.0, 0.0, 30.0),
padding: const EdgeInsetsDirectional.fromSTEB(
20.0, 24.0, 0.0, 30.0),
child: Text(
message,
textAlign: TextAlign.start,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
fontWeight: FontWeight.bold,
useGoogleFonts:
GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
),
),
@ -201,32 +209,42 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
controller: _model.passwordRegisterFormTextController,
focusNode: _model.passwordRegisterFormFocusNode,
visibility: _model.passwordRegisterFormVisibility,
onVisibilityToggle: () => setState(
() => _model.passwordRegisterFormVisibility = !_model.passwordRegisterFormVisibility),
label:
FFLocalizations.of(context).getVariableText(ptText: 'Nova Senha', enText: 'New Password'),
hint: FFLocalizations.of(context)
.getVariableText(ptText: 'Insira sua senha', enText: 'Enter your password'),
asValidator: _model.passwordRegisterFormTextControllerValidator.asValidator(context),
onVisibilityToggle: () => setState(() =>
_model.passwordRegisterFormVisibility =
!_model.passwordRegisterFormVisibility),
label: FFLocalizations.of(context).getVariableText(
ptText: 'Nova Senha', enText: 'New Password'),
hint: FFLocalizations.of(context).getVariableText(
ptText: 'Insira sua senha',
enText: 'Enter your password'),
asValidator: _model
.passwordRegisterFormTextControllerValidator
.asValidator(context),
),
_buildPasswordField(
context,
controller: _model.passwordConfirmFormTextController,
focusNode: _model.passwordConfirmFormFocusNode,
visibility: _model.passwordConfirmFormVisibility,
onVisibilityToggle: () => setState(
() => _model.passwordConfirmFormVisibility = !_model.passwordConfirmFormVisibility),
label: FFLocalizations.of(context)
.getVariableText(ptText: 'Confirme a Senha', enText: 'Confirm Password'),
hint: FFLocalizations.of(context)
.getVariableText(ptText: 'Confirme sua senha', enText: 'Confirm your password'),
asValidator: _model.passwordConfirmFormTextControllerValidator.asValidator(context),
onVisibilityToggle: () => setState(() =>
_model.passwordConfirmFormVisibility =
!_model.passwordConfirmFormVisibility),
label: FFLocalizations.of(context).getVariableText(
ptText: 'Confirme a Senha',
enText: 'Confirm Password'),
hint: FFLocalizations.of(context).getVariableText(
ptText: 'Confirme sua senha',
enText: 'Confirm your password'),
asValidator: _model
.passwordConfirmFormTextControllerValidator
.asValidator(context),
),
],
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 16.0),
padding: const EdgeInsetsDirectional.fromSTEB(
0.0, 0.0, 0.0, 16.0),
child: FFButtonWidget(
key: const ValueKey<String>('SubmitButtonWidget'),
onPressed: _model.isFormInvalid()
@ -248,16 +266,22 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
width: double.infinity,
height: 44.0,
color: FlutterFlowTheme.of(context).accent1,
textStyle: FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Plus Jakarta Sans',
color: FlutterFlowTheme.of(context).secondaryText,
fontSize: 16.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans')),
textStyle: FlutterFlowTheme.of(context)
.titleSmall
.override(
fontFamily: 'Plus Jakarta Sans',
color:
FlutterFlowTheme.of(context).secondaryText,
fontSize: 16.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap()
.containsKey('Plus Jakarta Sans')),
elevation: 3.0,
borderSide: const BorderSide(color: Colors.transparent, width: 1.0),
borderSide: const BorderSide(
color: Colors.transparent, width: 1.0),
borderRadius: BorderRadius.circular(12.0),
disabledColor: FlutterFlowTheme.of(context).customColor5,
disabledColor:
FlutterFlowTheme.of(context).customColor5,
disabledTextColor: Colors.white,
),
showLoadingIndicator: true,
@ -305,22 +329,28 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 16.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
useGoogleFonts:
GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: FlutterFlowTheme.of(context).customColor1, width: 0.25),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).customColor1,
width: 0.25),
borderRadius: BorderRadius.circular(12.0),
),
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Color(0xFF1AAB5F), width: 0.25),
borderSide:
const BorderSide(color: Color(0xFF1AAB5F), width: 0.25),
borderRadius: BorderRadius.circular(12.0),
),
errorBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Color(0xFFFF5963), width: 0.25),
borderSide:
const BorderSide(color: Color(0xFFFF5963), width: 0.25),
borderRadius: BorderRadius.circular(12.0),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Color(0xFFFF5963), width: 0.25),
borderSide:
const BorderSide(color: Color(0xFFFF5963), width: 0.25),
borderRadius: BorderRadius.circular(12.0),
),
filled: true,
@ -330,7 +360,9 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
onTap: onVisibilityToggle,
focusNode: FocusNode(skipTraversal: true),
child: Icon(
visibility ? Icons.visibility_outlined : Icons.visibility_off_outlined,
visibility
? Icons.visibility_outlined
: Icons.visibility_off_outlined,
color: FlutterFlowTheme.of(context).accent1,
size: 24.0,
),
@ -341,7 +373,8 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> with Ticker
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 16.0,
fontWeight: FontWeight.w500,
useGoogleFonts: GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
useGoogleFonts:
GoogleFonts.asMap().containsKey('Plus Jakarta Sans'),
),
validator: asValidator,
),

View File

@ -504,7 +504,6 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
);
});
});
},
options: FFButtonOptions(
height: 40,

View File

@ -1049,6 +1049,4 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
),
);
}
}

View File

@ -1,4 +1,3 @@
import 'package:awesome_notifications/awesome_notifications.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

View File

@ -35,10 +35,13 @@ class _VehicleRegisterScreenState extends State<VehicleRegisterScreen> {
children: [
CustomInputUtil(
controller: widget.model.textFieldControllerLicensePlate,
validator: widget.model.textControllerLicensePlateValidator.asValidator(context),
validator: widget.model.textControllerLicensePlateValidator
.asValidator(context),
focusNode: widget.model.textFieldFocusLicensePlate,
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
hintText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
labelText: FFLocalizations.of(context)
.getVariableText(ptText: 'Placa', enText: 'License Plate'),
hintText: FFLocalizations.of(context)
.getVariableText(ptText: 'Placa', enText: 'License Plate'),
suffixIcon: Symbols.format_color_text,
haveMaxLength: true,
onChanged: (value) => setState(() {}),
@ -46,9 +49,11 @@ class _VehicleRegisterScreenState extends State<VehicleRegisterScreen> {
),
CustomInputUtil(
controller: widget.model.textFieldControllerModel,
validator: widget.model.textControllerModelValidator.asValidator(context),
validator: widget.model.textControllerModelValidator
.asValidator(context),
focusNode: widget.model.textFieldFocusModel,
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Modelo', enText: 'Model'),
labelText: FFLocalizations.of(context)
.getVariableText(ptText: 'Modelo', enText: 'Model'),
hintText: FFLocalizations.of(context).getVariableText(
ptText: 'Ex: Voyage, Ford',
enText: 'e.g. Voyage, Ford',
@ -60,9 +65,11 @@ class _VehicleRegisterScreenState extends State<VehicleRegisterScreen> {
),
CustomInputUtil(
controller: widget.model.textFieldControllerColor,
validator: widget.model.textControllerColorValidator.asValidator(context),
validator: widget.model.textControllerColorValidator
.asValidator(context),
focusNode: widget.model.textFieldFocusColor,
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cor', enText: 'Color'),
labelText: FFLocalizations.of(context)
.getVariableText(ptText: 'Cor', enText: 'Color'),
hintText: FFLocalizations.of(context).getVariableText(
ptText: 'Ex: Preto, Amarelo, Branco',
enText: 'e.g. Black, Yellow, White',
@ -75,8 +82,11 @@ class _VehicleRegisterScreenState extends State<VehicleRegisterScreen> {
Padding(
padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),
child: SubmitButtonUtil(
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cadastrar', enText: 'Register'),
onPressed: widget.model.isFormValid(context) ? widget.model.registerVehicle : null),
labelText: FFLocalizations.of(context)
.getVariableText(ptText: 'Cadastrar', enText: 'Register'),
onPressed: widget.model.isFormValid(context)
? widget.model.registerVehicle
: null),
),
],
));
@ -84,7 +94,8 @@ class _VehicleRegisterScreenState extends State<VehicleRegisterScreen> {
Align _buildHeader(BuildContext context) {
// double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context);
double limitedHeaderFontSize = LimitedFontSizeUtil.getHeaderFontSize(context);
double limitedHeaderFontSize =
LimitedFontSizeUtil.getHeaderFontSize(context);
// double limitedSubHeaderFontSize = LimitedFontSizeUtil.getSubHeaderFontSize(context);
return Align(
@ -93,14 +104,16 @@ class _VehicleRegisterScreenState extends State<VehicleRegisterScreen> {
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15),
child: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Preencha o formulário de cadastro com os dados do seu veículo',
ptText:
'Preencha o formulário de cadastro com os dados do seu veículo',
enText: 'Fill out the registration form with your vehicle data',
),
textAlign: TextAlign.start,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
useGoogleFonts: GoogleFonts.asMap()
.containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
fontSize: limitedHeaderFontSize,
),
),

View File

@ -24,14 +24,16 @@ class _VehicleUpdateScreenState extends State<VehicleUpdateScreen> {
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15),
child: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Preencha o formulário de alteração com os dados do seu veículo',
ptText:
'Preencha o formulário de alteração com os dados do seu veículo',
enText: 'Fill out the update form with your vehicle data',
),
textAlign: TextAlign.start,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
),
),
@ -45,10 +47,13 @@ class _VehicleUpdateScreenState extends State<VehicleUpdateScreen> {
children: [
CustomInputUtil(
controller: widget.model.textFieldControllerLicensePlate,
validator: widget.model.textControllerLicensePlateValidator.asValidator(context),
validator: widget.model.textControllerLicensePlateValidator
.asValidator(context),
focusNode: widget.model.textFieldFocusLicensePlate,
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
hintText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
labelText: FFLocalizations.of(context).getVariableText(
ptText: 'Placa', enText: 'License Plate'),
hintText: FFLocalizations.of(context).getVariableText(
ptText: 'Placa', enText: 'License Plate'),
suffixIcon: Symbols.format_color_text,
haveMaxLength: true,
onChanged: (value) => setState(() {}),
@ -58,9 +63,11 @@ class _VehicleUpdateScreenState extends State<VehicleUpdateScreen> {
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
child: CustomInputUtil(
controller: widget.model.textFieldControllerModel,
validator: widget.model.textControllerModelValidator.asValidator(context),
validator: widget.model.textControllerModelValidator
.asValidator(context),
focusNode: widget.model.textFieldFocusModel,
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Modelo', enText: 'Model'),
labelText: FFLocalizations.of(context)
.getVariableText(ptText: 'Modelo', enText: 'Model'),
hintText: FFLocalizations.of(context).getVariableText(
ptText: 'Ex: Voyage, Ford',
enText: 'e.g. Voyage, Ford',
@ -75,9 +82,11 @@ class _VehicleUpdateScreenState extends State<VehicleUpdateScreen> {
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
child: CustomInputUtil(
controller: widget.model.textFieldControllerColor,
validator: widget.model.textControllerColorValidator.asValidator(context),
validator: widget.model.textControllerColorValidator
.asValidator(context),
focusNode: widget.model.textFieldFocusColor,
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cor', enText: 'Color'),
labelText: FFLocalizations.of(context)
.getVariableText(ptText: 'Cor', enText: 'Color'),
hintText: FFLocalizations.of(context).getVariableText(
ptText: 'Ex: Preto, Amarelo, Branco',
enText: 'e.g. Black, Yellow, White',
@ -91,8 +100,11 @@ class _VehicleUpdateScreenState extends State<VehicleUpdateScreen> {
Padding(
padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),
child: SubmitButtonUtil(
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Salvar', enText: 'Save'),
onPressed: widget.model.isFormValid(context) ? widget.model.updateVehicle : null),
labelText: FFLocalizations.of(context)
.getVariableText(ptText: 'Salvar', enText: 'Save'),
onPressed: widget.model.isFormValid(context)
? widget.model.updateVehicle
: null),
),
],
)),

View File

@ -1,4 +1,3 @@
import 'dart:collection';
import 'package:flutter/material.dart';
@ -31,7 +30,8 @@ class VehiclePage extends StatefulWidget {
_VehiclePageState createState() => _VehiclePageState();
}
class _VehiclePageState extends State<VehiclePage> with TickerProviderStateMixin {
class _VehiclePageState extends State<VehiclePage>
with TickerProviderStateMixin {
int count = 0;
late final VehicleModel _model;
@ -99,7 +99,8 @@ class _VehiclePageState extends State<VehiclePage> with TickerProviderStateMixin
Future<bool> _initializeModule() async {
try {
final module = await LicenseRepositoryImpl().getModule('FRE-HUB-VEHICLES-MANAGER');
final module =
await LicenseRepositoryImpl().getModule('FRE-HUB-VEHICLES-MANAGER');
return await LicenseUtil.processModule(module);
} catch (e) {
WidgetsBinding.instance.addPostFrameCallback((_) async {
@ -121,20 +122,25 @@ class _VehiclePageState extends State<VehiclePage> with TickerProviderStateMixin
}
Widget _buildVehicleManager(BuildContext context) {
final vehicleHistoryScreenLabel =
FFLocalizations.of(context).getVariableText(ptText: 'Consultar', enText: 'History');
final vehicleRegisterScreenLabel =
FFLocalizations.of(context).getVariableText(ptText: 'Cadastrar', enText: 'Register');
final vehicleUpdateScreenLabel = FFLocalizations.of(context).getVariableText(ptText: 'Editar', enText: 'Edit');
final vehicleHistoryScreenLabel = FFLocalizations.of(context)
.getVariableText(ptText: 'Consultar', enText: 'History');
final vehicleRegisterScreenLabel = FFLocalizations.of(context)
.getVariableText(ptText: 'Cadastrar', enText: 'Register');
final vehicleUpdateScreenLabel = FFLocalizations.of(context)
.getVariableText(ptText: 'Editar', enText: 'Edit');
return TabViewUtil(
context: context,
model: _model,
labelTab1: vehicleHistoryScreenLabel,
labelTab2: _model.isEditing ? vehicleUpdateScreenLabel : vehicleRegisterScreenLabel,
labelTab2: _model.isEditing
? vehicleUpdateScreenLabel
: vehicleRegisterScreenLabel,
controller: _model.tabBarController,
widget1: VehicleHistoryScreen(_model),
widget2: _model.isEditing ? VehicleUpdateScreen(_model) : VehicleRegisterScreen(_model),
widget2: _model.isEditing
? VehicleUpdateScreen(_model)
: VehicleRegisterScreen(_model),
onEditingChanged: onEditingChanged,
);
}
@ -145,14 +151,16 @@ class _VehiclePageState extends State<VehiclePage> with TickerProviderStateMixin
final theme = FlutterFlowTheme.of(context);
final backgroundColor = theme.primaryBackground;
final primaryText = theme.primaryText;
final title = FFLocalizations.of(context).getVariableText(enText: 'Vehicles', ptText: 'Veículos');
final title = FFLocalizations.of(context)
.getVariableText(enText: 'Vehicles', ptText: 'Veículos');
final titleStyle = theme.headlineMedium.override(
fontFamily: theme.headlineMediumFamily,
color: primaryText,
fontSize: 16.0,
fontWeight: FontWeight.bold,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(theme.headlineMediumFamily),
useGoogleFonts:
GoogleFonts.asMap().containsKey(theme.headlineMediumFamily),
);
final backButton = _backButton(context, theme);

View File

@ -11,7 +11,8 @@ class VisitsModel extends FlutterFlowModel<VehiclePage> {
VisitsModel._internal({this.onRefresh});
factory VisitsModel({VoidCallback? onRefresh}) => _instance ??= VisitsModel._internal(onRefresh: onRefresh);
factory VisitsModel({VoidCallback? onRefresh}) =>
_instance ??= VisitsModel._internal(onRefresh: onRefresh);
static void resetInstance() => _instance = null;
late final VoidCallback? onRefresh;
@ -33,7 +34,8 @@ class VisitsModel extends FlutterFlowModel<VehiclePage> {
Future<void> initAsync() async {
devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
cliUUID =
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
onRefresh?.call();
}
@ -87,7 +89,9 @@ class VisitsModel extends FlutterFlowModel<VehiclePage> {
FFLocalizations.of(context).getVariableText(
ptText: item['VTA_FIXA'] ? "Entrada Recorrente" : "Entrada Única",
enText: item['VTA_FIXA'] ? "Recurrent Entry" : "Single Entry",
): item['VTA_FIXA'] == false ? FlutterFlowTheme.of(context).success : FlutterFlowTheme.of(context).warning,
): item['VTA_FIXA'] == false
? FlutterFlowTheme.of(context).success
: FlutterFlowTheme.of(context).warning,
})
],
);

View File

@ -0,0 +1 @@

View File

@ -10,7 +10,7 @@ extension StringNullableExtensions on String? {
return false;
}
bool get isNotNullAndEmpty {
bool get isNotNullAndEmpty {
if (this == null) return false;
if (this == '') return false;
return true;
@ -19,7 +19,6 @@ extension StringNullableExtensions on String? {
extension StringExtensions on String {
bool get toBoolean {
return toLowerCase() == 'true';
}
}

View File

@ -10,7 +10,8 @@ class LicenseUtil {
final expirationDate = moduleMap['expirationDate'] ?? '';
final isStarted = await DateTimeUtil.processStartDate(startDate);
final isExpired = await DateTimeUtil.processExpirationDate(expirationDate);
if (isStarted && !isExpired) return EnumDisplay.fromString(moduleMap["display"]) == EnumDisplay.active;
if (isStarted && !isExpired)
return EnumDisplay.fromString(moduleMap["display"]) == EnumDisplay.active;
if (isExpired) return false;
return false;
}