fix cursorColor in TextFormFields
This commit is contained in:
parent
386db132cf
commit
67edb919a0
|
@ -1,650 +0,0 @@
|
||||||
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/components/molecular_components/option_selection_modal/option_selection_modal_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:hub/flutter_flow/random_data_util.dart';
|
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
|
||||||
import 'package:share_plus/share_plus.dart';
|
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
|
||||||
|
|
||||||
import '../shared/utils/log_util.dart';
|
|
||||||
|
|
||||||
Future<void> openTermsOfUse(BuildContext context) async {
|
|
||||||
final Uri url = Uri.parse('https://freaccess.com.br/pp/');
|
|
||||||
if (!await launchUrl(url)) {
|
|
||||||
throw Exception('Could not launch $url');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future repeatVisitScheduleAction(
|
|
||||||
BuildContext context, {
|
|
||||||
List<dynamic>? visitorJsonList,
|
|
||||||
String? visitorStrList,
|
|
||||||
String? visitStartDateStr,
|
|
||||||
String? visitEndDateStr,
|
|
||||||
String? visitReasonStr,
|
|
||||||
String? visitLevelStr,
|
|
||||||
bool? visitTempBol,
|
|
||||||
String? visitObsStr,
|
|
||||||
}) async {
|
|
||||||
context.go(
|
|
||||||
'/scheduleCompleteVisitPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
'visitStartDateStr': visitStartDateStr,
|
|
||||||
'visitEndDateStr': visitEndDateStr,
|
|
||||||
'visitReasonStr': visitReasonStr,
|
|
||||||
'visitLevelStr': visitLevelStr,
|
|
||||||
'visitTempBol': visitTempBol,
|
|
||||||
'visitObsStr': visitObsStr,
|
|
||||||
'visitorStrList': visitorStrList,
|
|
||||||
'visitorJsonList': visitorJsonList,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Color> manageStatusColorAction(
|
|
||||||
BuildContext context, {
|
|
||||||
required String? visitStatusStr,
|
|
||||||
}) async {
|
|
||||||
if (visitStatusStr == 'A') {
|
|
||||||
return FlutterFlowTheme.of(context).success;
|
|
||||||
} else if ((visitStatusStr == 'C') ||
|
|
||||||
(visitStatusStr == 'F') ||
|
|
||||||
(visitStatusStr == 'B') ||
|
|
||||||
(visitStatusStr == 'I')) {
|
|
||||||
return FlutterFlowTheme.of(context).error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FlutterFlowTheme.of(context).warning;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future signInLoginAction(
|
|
||||||
BuildContext context,
|
|
||||||
FlutterFlowModel model, {
|
|
||||||
String? emailAdress,
|
|
||||||
String? password,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
final ApiCallResponse? response;
|
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final LoginCall callback = PhpGroup.loginCall;
|
|
||||||
AppState().deviceDescription = randomString(
|
|
||||||
10,
|
|
||||||
10,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
|
|
||||||
final String? devUUID;
|
|
||||||
final String userUUID;
|
|
||||||
final String status;
|
|
||||||
final String userDevUUID;
|
|
||||||
final String userName;
|
|
||||||
final String email;
|
|
||||||
final String passwd;
|
|
||||||
final bool isLogged;
|
|
||||||
|
|
||||||
email = emailAdress!;
|
|
||||||
passwd = password!;
|
|
||||||
|
|
||||||
devUUID = await getDevUUID();
|
|
||||||
|
|
||||||
if ((email != '') && (passwd != '')) {
|
|
||||||
AppState().email = email;
|
|
||||||
AppState().passwd = passwd;
|
|
||||||
response = await callback.call();
|
|
||||||
|
|
||||||
if (response.jsonBody['error'] == false) {
|
|
||||||
userUUID = response.jsonBody['uid'];
|
|
||||||
|
|
||||||
status = response.jsonBody['user']['status'];
|
|
||||||
userDevUUID = response.jsonBody['user']['dev_id'];
|
|
||||||
userName = response.jsonBody['user']['name'];
|
|
||||||
|
|
||||||
db.update('devUUID', devUUID, 'user');
|
|
||||||
db.update('userUUID', userUUID, 'user');
|
|
||||||
db.update('userDevUUID', userDevUUID, 'user');
|
|
||||||
db.update('status', status, 'user');
|
|
||||||
db.update('userName', userName, 'user');
|
|
||||||
|
|
||||||
isLogged = true;
|
|
||||||
await checkLocals(context: context, model: model).then((value) {
|
|
||||||
AppState().haveLocal = value;
|
|
||||||
AppState().isLogged = isLogged;
|
|
||||||
AppState().update(() {});
|
|
||||||
toggleApp(context);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (response.jsonBody['error'] == null) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
} else {
|
|
||||||
DialogUtil.error(context, response.jsonBody['error_msg'].toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
} catch (e, s) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
LogUtil.requestAPIFailed(
|
|
||||||
'login.php', emailAdress.toString(), "Login", e, s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> signUpRegisterAction(
|
|
||||||
BuildContext context, {
|
|
||||||
required String? name,
|
|
||||||
String? passwd,
|
|
||||||
required String? email,
|
|
||||||
String? device,
|
|
||||||
}) async {
|
|
||||||
try {
|
|
||||||
ApiCallResponse? response;
|
|
||||||
|
|
||||||
if ((email != null && email != '') &&
|
|
||||||
(passwd != null && passwd != '' && passwd.length > 7) &&
|
|
||||||
(name != null && name != '')) {
|
|
||||||
response = await PhpGroup.registerCall.call(
|
|
||||||
name: name,
|
|
||||||
password: passwd,
|
|
||||||
email: email,
|
|
||||||
token: randomString(
|
|
||||||
36,
|
|
||||||
36,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
),
|
|
||||||
uuid: randomString(
|
|
||||||
36,
|
|
||||||
36,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
),
|
|
||||||
tipo: device,
|
|
||||||
descricao: randomString(
|
|
||||||
36,
|
|
||||||
36,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.jsonBody['error'] == false) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
DialogUtil.error(context, response.jsonBody['error_msg']);
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (e, s) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
LogUtil.requestAPIFailed(
|
|
||||||
'registro.php', email.toString(), "Register", e, s);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future forgotPasswdAction(
|
|
||||||
BuildContext context, {
|
|
||||||
required String? email,
|
|
||||||
}) async {
|
|
||||||
ApiCallResponse? response;
|
|
||||||
ForgotPasswordCall callback = PhpGroup.forgotPasswordCall;
|
|
||||||
|
|
||||||
response = await PhpGroup.forgotPasswordCall.call(
|
|
||||||
email: email,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.jsonBody['error'] != false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future toggleSignInPage(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/signInPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.fade,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future toggleSignUpPage(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/signUpPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.fade,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future toggleApp(BuildContext context) async {
|
|
||||||
final haveLocal = AppState().haveLocal;
|
|
||||||
if (haveLocal == true) {
|
|
||||||
context.go('/homePage');
|
|
||||||
} else if (haveLocal == false) {
|
|
||||||
context.go(
|
|
||||||
'/receptionPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.fade,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> visitCancelAction(BuildContext context,
|
|
||||||
{required int? idDestino,
|
|
||||||
required int? idVisita,
|
|
||||||
required String? accessKey,
|
|
||||||
required String? email}) async {
|
|
||||||
final ApiCallResponse? response;
|
|
||||||
final CancelaVisita callback = PhpGroup.cancelaVisita;
|
|
||||||
|
|
||||||
response = await callback.call(
|
|
||||||
idDestino: idDestino,
|
|
||||||
idVisita: idVisita,
|
|
||||||
AccessKey: accessKey,
|
|
||||||
UsuEmail: email,
|
|
||||||
DevDesc: '',
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
return !response.jsonBody['error'];
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> snackbar(BuildContext context, {required bool opt}) async {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
elevation: 10,
|
|
||||||
margin: const EdgeInsets.all(50),
|
|
||||||
content: Center(
|
|
||||||
child: Text(
|
|
||||||
opt
|
|
||||||
? FFLocalizations.of(context).getText('asjd2q3k2j4l21')
|
|
||||||
: FFLocalizations.of(context).getText('asda2e42fafa'),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
fontWeight: FontWeight.normal,
|
|
||||||
color: FlutterFlowTheme.of(context).info,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: opt
|
|
||||||
? FlutterFlowTheme.of(context).success.withOpacity(0.5)
|
|
||||||
: FlutterFlowTheme.of(context).error.withOpacity(0.5),
|
|
||||||
duration: const Duration(seconds: 3),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> checkLocals({
|
|
||||||
String? cliUUID,
|
|
||||||
required BuildContext context,
|
|
||||||
required FlutterFlowModel model,
|
|
||||||
}) async {
|
|
||||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
|
||||||
|
|
||||||
final response = await callback.call();
|
|
||||||
|
|
||||||
if (response.jsonBody['error']) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
|
||||||
|
|
||||||
if (locals.isEmpty) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> showShare(payload) async {
|
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final cliName = await db
|
|
||||||
.get(key: 'cliName', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
for (var i = 0; i < payload['convites'].length; i++) {
|
|
||||||
await Share.share('''
|
|
||||||
Olá, \*${payload['convites'][i]['VTE_NOME']}\*! Você foi convidado para \*$cliName\*.
|
|
||||||
|
|
||||||
\*Validade do Convite\*:
|
|
||||||
- Início: ${payload['convites'][i]['VAW_DTINICIO']}
|
|
||||||
- Fim: ${payload['convites'][i]['VAW_DTFIM']}
|
|
||||||
|
|
||||||
URL do Convite: https://visita.freaccess.com.br/${payload['convites'][i]['VAW_ID']}/$cliUUID/${payload['convites'][i]['VAW_CHAVE']}
|
|
||||||
''');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future answersRequest(
|
|
||||||
{required BuildContext context,
|
|
||||||
required String? ref,
|
|
||||||
required String? task,
|
|
||||||
required String? response,
|
|
||||||
required String? id}) async {
|
|
||||||
final ApiCallResponse? respondeSolicitacaoCall;
|
|
||||||
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall;
|
|
||||||
|
|
||||||
respondeSolicitacaoCall = await callback.call(
|
|
||||||
referencia: ref,
|
|
||||||
tarefa: task,
|
|
||||||
resposta: response,
|
|
||||||
idVisitante: id,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (respondeSolicitacaoCall.statusCode == 200) {
|
|
||||||
return !respondeSolicitacaoCall.jsonBody['error'];
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future changeStatusAction(
|
|
||||||
BuildContext context,
|
|
||||||
int idDestino,
|
|
||||||
int idVisita,
|
|
||||||
String accessKey,
|
|
||||||
String email,
|
|
||||||
) async {
|
|
||||||
// Navigator.pop(context, true);
|
|
||||||
context.pop(true);
|
|
||||||
|
|
||||||
bool? blockVisitRequest;
|
|
||||||
blockVisitRequest = await visitCancelAction(
|
|
||||||
context,
|
|
||||||
accessKey: accessKey,
|
|
||||||
idDestino: idDestino,
|
|
||||||
idVisita: idVisita,
|
|
||||||
email: email,
|
|
||||||
);
|
|
||||||
if (!context.mounted) return;
|
|
||||||
if (blockVisitRequest == true) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// QR Code
|
|
||||||
|
|
||||||
Uint8List assembleQRPacket(int direction, String identifier, String password) {
|
|
||||||
List<int> packet = [direction];
|
|
||||||
|
|
||||||
String paddedBadge = identifier.padLeft(30, '0');
|
|
||||||
|
|
||||||
for (var i = 0; i < paddedBadge.length; i += 2) {
|
|
||||||
packet.add(int.parse(paddedBadge.substring(i, i + 2), radix: 16));
|
|
||||||
}
|
|
||||||
|
|
||||||
DateTime now = DateTime.now();
|
|
||||||
int year = now.year % 100;
|
|
||||||
int month = now.month;
|
|
||||||
int day = now.day;
|
|
||||||
int hour = now.hour;
|
|
||||||
int minute = now.minute;
|
|
||||||
|
|
||||||
int sum = year + month + day + hour + minute;
|
|
||||||
|
|
||||||
if (sum == int.parse('0D', radix: 16) || sum == int.parse('0A', radix: 16)) {
|
|
||||||
packet.add(int.parse('FF', radix: 16));
|
|
||||||
} else {
|
|
||||||
packet.add(sum);
|
|
||||||
}
|
|
||||||
|
|
||||||
String paddedPassword = password.length != 4 ? 'FFFF' : password;
|
|
||||||
|
|
||||||
for (var i = 0; i < paddedPassword.length; i += 2) {
|
|
||||||
packet.add(int.parse(paddedPassword.substring(i, i + 2), radix: 16));
|
|
||||||
}
|
|
||||||
|
|
||||||
int check = 0x00;
|
|
||||||
|
|
||||||
for (var b in packet) {
|
|
||||||
check ^= b;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check == int.parse('0D', radix: 16) ||
|
|
||||||
check == int.parse('0A', radix: 16)) {
|
|
||||||
packet.add(int.parse('FF', radix: 16));
|
|
||||||
} else {
|
|
||||||
packet.add(check);
|
|
||||||
}
|
|
||||||
|
|
||||||
var bytes =
|
|
||||||
packet.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join((' '));
|
|
||||||
|
|
||||||
return Uint8List.fromList(packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
Uint8List hexStringToByteArray(String s) {
|
|
||||||
int len = s.length;
|
|
||||||
Uint8List data = Uint8List(len ~/ 2);
|
|
||||||
for (int i = 0; i < len; i += 2) {
|
|
||||||
data[i ~/ 2] =
|
|
||||||
((int.parse(s[i], radix: 16) << 4) + int.parse(s[i + 1], radix: 16));
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
String byteToHexa(Uint8List pDados) {
|
|
||||||
return pDados
|
|
||||||
.map((byte) => byte.toRadixString(16).padLeft(2, '0').toUpperCase())
|
|
||||||
.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> byteToString(Uint8List bytes) async {
|
|
||||||
return String.fromCharCodes(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildQrCode(
|
|
||||||
{
|
|
||||||
// required String data,
|
|
||||||
// required String type,
|
|
||||||
// required int version,
|
|
||||||
// required int maskPattern,
|
|
||||||
required int errorCorrectLevel,
|
|
||||||
required double dimension,
|
|
||||||
required String identifier,
|
|
||||||
required String pass,
|
|
||||||
required int direction}) {
|
|
||||||
try {
|
|
||||||
const Color backgroundColor = Colors.white;
|
|
||||||
const Color foregroundColor = Colors.black;
|
|
||||||
return QrImageView.withQr(
|
|
||||||
qr: QrCode.fromUint8List(
|
|
||||||
data: assembleQRPacket(direction, identifier, pass),
|
|
||||||
errorCorrectLevel: errorCorrectLevel),
|
|
||||||
size: dimension,
|
|
||||||
padding: const EdgeInsets.all(10),
|
|
||||||
backgroundColor: backgroundColor,
|
|
||||||
foregroundColor: foregroundColor);
|
|
||||||
} catch (e) {
|
|
||||||
return Text("Erro ao gerar QR Code: ${e.toString()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future scheduleVisitOptAction(BuildContext context) async {
|
|
||||||
await showAdaptiveDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return Padding(
|
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
|
||||||
child: OptionSelectionModalWidget(
|
|
||||||
routesListStr: <String>[
|
|
||||||
'scheduleCompleteVisitPage',
|
|
||||||
'scheduleProvisionalVisitPage',
|
|
||||||
'fastPassPage',
|
|
||||||
],
|
|
||||||
iconsListIcon: <IconData>[
|
|
||||||
Icons.date_range_rounded,
|
|
||||||
Icons.date_range_rounded,
|
|
||||||
Icons.date_range_rounded,
|
|
||||||
],
|
|
||||||
nameListStr: <String>[
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Visita\nCompleta',
|
|
||||||
enText: 'Complete\nSchedule',
|
|
||||||
),
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Visita\nProvisória',
|
|
||||||
enText: 'Provisional\nSchedule',
|
|
||||||
),
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Visita\nRápida',
|
|
||||||
enText: 'Fast\nSchedule',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future registerVisitorOptAction(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/registerVisitorPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future peopleOnThePropertyAction(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/peopleOnThePropertyPage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.fade,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future preferencesSettings(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/preferencesSettings',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future liberationHistoryOptAction(BuildContext context) async {
|
|
||||||
await showAdaptiveDialog(
|
|
||||||
// isScrollControlled: true,
|
|
||||||
// backgroundColor: Colors.transparent,
|
|
||||||
// enableDrag: false,
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return Padding(
|
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
|
||||||
child: OptionSelectionModalWidget(
|
|
||||||
routesListStr: <String>[
|
|
||||||
'liberationHistory',
|
|
||||||
'acessHistoryPage',
|
|
||||||
'scheduleCompleteVisitPage',
|
|
||||||
// 'messageHistoryPage',
|
|
||||||
],
|
|
||||||
iconsListIcon: <IconData>[
|
|
||||||
Icons.history_rounded,
|
|
||||||
Icons.history_rounded,
|
|
||||||
Icons.history_rounded,
|
|
||||||
// Icons.history_rounded,
|
|
||||||
],
|
|
||||||
nameListStr: <String>[
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Histórico\nde Liberação',
|
|
||||||
enText: 'Liberation\nHistory',
|
|
||||||
),
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Histórico\nde Acesso',
|
|
||||||
enText: 'Access\nHistory',
|
|
||||||
),
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Histórico\nde Visita',
|
|
||||||
enText: 'Visit\nHistory',
|
|
||||||
),
|
|
||||||
// FFLocalizations.of(context).getVariableText(
|
|
||||||
// ptText: 'Histórico\nde Mensagens',
|
|
||||||
// enText: 'Message\nHistory',
|
|
||||||
// ),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future accessQRCodeOptAction(BuildContext context) async {
|
|
||||||
context.go(
|
|
||||||
'/qrCodePage',
|
|
||||||
extra: <String, dynamic>{
|
|
||||||
kTransitionInfoKey: const TransitionInfo(
|
|
||||||
hasTransition: true,
|
|
||||||
transitionType: PageTransitionType.scale,
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum status { active, unknown, canceled, finished, blocked, inactive }
|
|
||||||
|
|
||||||
status? getStatus(dynamic data) {
|
|
||||||
switch (data) {
|
|
||||||
case 'A':
|
|
||||||
return status.active;
|
|
||||||
case 'F':
|
|
||||||
return status.finished;
|
|
||||||
case 'B':
|
|
||||||
return status.blocked;
|
|
||||||
case 'C':
|
|
||||||
return status.canceled;
|
|
||||||
case 'I':
|
|
||||||
return status.inactive;
|
|
||||||
default:
|
|
||||||
return status.unknown;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,7 +3,8 @@ import 'dart:developer';
|
||||||
import 'package:awesome_notifications/awesome_notifications.dart';
|
import 'package:awesome_notifications/awesome_notifications.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/actions/actions.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/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/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/message_notificaion_modal_template_component/message_notification_widget.dart';
|
||||||
|
@ -23,6 +24,28 @@ Future<void> onMessageReceived(
|
||||||
final cliUUID = await db
|
final cliUUID = await db
|
||||||
.get(key: 'cliUUID', field: 'value')
|
.get(key: 'cliUUID', field: 'value')
|
||||||
.then((value) => value.toString());
|
.then((value) => value.toString());
|
||||||
|
answersRequest(
|
||||||
|
{required BuildContext context,
|
||||||
|
required String? ref,
|
||||||
|
required String? task,
|
||||||
|
required String? response,
|
||||||
|
required String? id}) async {
|
||||||
|
final ApiCallResponse? respondeSolicitacaoCall;
|
||||||
|
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall;
|
||||||
|
|
||||||
|
respondeSolicitacaoCall = await callback.call(
|
||||||
|
referencia: ref,
|
||||||
|
tarefa: task,
|
||||||
|
resposta: response,
|
||||||
|
idVisitante: id,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (respondeSolicitacaoCall.statusCode == 200) {
|
||||||
|
return !respondeSolicitacaoCall.jsonBody['error'];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (handleClick) {
|
switch (handleClick) {
|
||||||
case 'visit_request':
|
case 'visit_request':
|
||||||
|
|
|
@ -58,6 +58,7 @@ class _CustomInputUtilState extends State<CustomInputUtil> {
|
||||||
controller: widget.controller,
|
controller: widget.controller,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
validator: widget.validator,
|
validator: widget.validator,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
autofocus: widget.autoFocus,
|
autofocus: widget.autoFocus,
|
||||||
focusNode: widget.focusNode,
|
focusNode: widget.focusNode,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
|
|
|
@ -3,7 +3,6 @@ import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||||
import 'package:hub/custom_code/actions/convert_to_upload_file.dart';
|
import 'package:hub/custom_code/actions/convert_to_upload_file.dart';
|
||||||
|
@ -13,6 +12,7 @@ import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/form_field_controller.dart';
|
import 'package:hub/flutter_flow/form_field_controller.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
||||||
|
import 'package:hub/shared/mixins/status_mixin.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ Widget buildVisitDetails({
|
||||||
}) {
|
}) {
|
||||||
return DetailsComponentWidget(
|
return DetailsComponentWidget(
|
||||||
buttons: [
|
buttons: [
|
||||||
if (getStatus(item['VAW_STATUS']) == status.active) // REJECT ACTION
|
if (Status.getStatus(item['VAW_STATUS']) ==
|
||||||
|
StatusEnum.active) // REJECT ACTION
|
||||||
FFButtonWidget(
|
FFButtonWidget(
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Cancelar',
|
ptText: 'Cancelar',
|
||||||
|
@ -105,7 +106,8 @@ Widget buildVisitDetails({
|
||||||
// borderRadius: 12,
|
// borderRadius: 12,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (getStatus(item['VAW_STATUS']) != status.active) // RECALL ACTION
|
if (Status.getStatus(item['VAW_STATUS']) !=
|
||||||
|
StatusEnum.active) // RECALL ACTION
|
||||||
FFButtonWidget(
|
FFButtonWidget(
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Reagendar',
|
ptText: 'Reagendar',
|
||||||
|
@ -138,7 +140,8 @@ Widget buildVisitDetails({
|
||||||
// borderRadius: 12,
|
// borderRadius: 12,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (getStatus(item['VAW_STATUS']) == status.active) // SHARE ACTION
|
if (Status.getStatus(item['VAW_STATUS']) ==
|
||||||
|
StatusEnum.active) // SHARE ACTION
|
||||||
FFButtonWidget(
|
FFButtonWidget(
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Compartilhar',
|
ptText: 'Compartilhar',
|
||||||
|
@ -189,42 +192,42 @@ URL do Convite: https://visita.freaccess.com.br/${item['VAW_ID']}/${cliUUID}/${i
|
||||||
imagePath:
|
imagePath:
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?cliID=${cliUUID}&atividade=getFoto&Documento=${item['VTE_DOCUMENTO'] ?? ''}&tipo=E',
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${cliUUID}&atividade=getFoto&Documento=${item['VTE_DOCUMENTO'] ?? ''}&tipo=E',
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
if (getStatus(item['VAW_STATUS']) == status.active)
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.active)
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Ativo',
|
ptText: 'Ativo',
|
||||||
enText: 'Active',
|
enText: 'Active',
|
||||||
): FlutterFlowTheme.of(context).warning,
|
): FlutterFlowTheme.of(context).warning,
|
||||||
}),
|
}),
|
||||||
if (getStatus(item['VAW_STATUS']) == status.unknown)
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.unknown)
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Pendente',
|
ptText: 'Pendente',
|
||||||
enText: 'Pending',
|
enText: 'Pending',
|
||||||
): FlutterFlowTheme.of(context).alternate,
|
): FlutterFlowTheme.of(context).alternate,
|
||||||
}),
|
}),
|
||||||
if (getStatus(item['VAW_STATUS']) == status.canceled)
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.canceled)
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Cancelado',
|
ptText: 'Cancelado',
|
||||||
enText: 'Canceled',
|
enText: 'Canceled',
|
||||||
): FlutterFlowTheme.of(context).error,
|
): FlutterFlowTheme.of(context).error,
|
||||||
}),
|
}),
|
||||||
if (getStatus(item['VAW_STATUS']) == status.finished)
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.finished)
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Finalizado',
|
ptText: 'Finalizado',
|
||||||
enText: 'Finished',
|
enText: 'Finished',
|
||||||
): FlutterFlowTheme.of(context).success,
|
): FlutterFlowTheme.of(context).success,
|
||||||
}),
|
}),
|
||||||
if (getStatus(item['VAW_STATUS']) == status.blocked)
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.blocked)
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Bloqueado',
|
ptText: 'Bloqueado',
|
||||||
enText: 'Blocked',
|
enText: 'Blocked',
|
||||||
): FlutterFlowTheme.of(context).error,
|
): FlutterFlowTheme.of(context).error,
|
||||||
}),
|
}),
|
||||||
if (getStatus(item['VAW_STATUS']) == status.inactive)
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.inactive)
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Inativo',
|
ptText: 'Inativo',
|
||||||
|
@ -238,8 +241,6 @@ URL do Convite: https://visita.freaccess.com.br/${item['VAW_ID']}/${cliUUID}/${i
|
||||||
Widget buildPetDetails({
|
Widget buildPetDetails({
|
||||||
required dynamic item,
|
required dynamic item,
|
||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
required Future<dynamic> Function(BuildContext, int, int, String, String)
|
|
||||||
changeStatusAction,
|
|
||||||
required String devUUID,
|
required String devUUID,
|
||||||
required String userUUID,
|
required String userUUID,
|
||||||
required String cliUUID,
|
required String cliUUID,
|
||||||
|
|
|
@ -250,6 +250,9 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
model.personNameTextController,
|
model.personNameTextController,
|
||||||
focusNode:
|
focusNode:
|
||||||
model.personNameFocusNode,
|
model.personNameFocusNode,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.primary,
|
||||||
onChanged: (_) =>
|
onChanged: (_) =>
|
||||||
EasyDebounce.debounce(
|
EasyDebounce.debounce(
|
||||||
'model.personNameTextController',
|
'model.personNameTextController',
|
||||||
|
@ -261,7 +264,7 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
TextInputAction.next,
|
TextInputAction.next,
|
||||||
obscureText: false,
|
obscureText: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: false,
|
isDense: true,
|
||||||
labelText:
|
labelText:
|
||||||
FFLocalizations.of(context)
|
FFLocalizations.of(context)
|
||||||
.getText(
|
.getText(
|
||||||
|
@ -402,6 +405,9 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
model.dateTimeTextController,
|
model.dateTimeTextController,
|
||||||
focusNode:
|
focusNode:
|
||||||
model.dateTimeFocusNode,
|
model.dateTimeFocusNode,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.primary,
|
||||||
onChanged: (_) =>
|
onChanged: (_) =>
|
||||||
EasyDebounce.debounce(
|
EasyDebounce.debounce(
|
||||||
'model.dateTimeTextController',
|
'model.dateTimeTextController',
|
||||||
|
@ -413,7 +419,7 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
obscureText: false,
|
obscureText: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: false,
|
isDense: true,
|
||||||
labelText:
|
labelText:
|
||||||
FFLocalizations.of(context)
|
FFLocalizations.of(context)
|
||||||
.getText(
|
.getText(
|
||||||
|
@ -738,11 +744,16 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
focusNode:
|
focusNode:
|
||||||
model.notesFocusNode,
|
model.notesFocusNode,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
|
showCursor: true,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(
|
||||||
|
context)
|
||||||
|
.primary,
|
||||||
textInputAction:
|
textInputAction:
|
||||||
TextInputAction.next,
|
TextInputAction.next,
|
||||||
obscureText: false,
|
obscureText: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: false,
|
isDense: true,
|
||||||
labelText:
|
labelText:
|
||||||
FFLocalizations.of(
|
FFLocalizations.of(
|
||||||
context)
|
context)
|
||||||
|
|
|
@ -170,6 +170,7 @@ class _QrCodePassKeyTemplateComponentWidgetState
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.keyTextFieldTextController,
|
controller: _model.keyTextFieldTextController,
|
||||||
focusNode: _model.keyTextFieldFocusNode,
|
focusNode: _model.keyTextFieldFocusNode,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
onChanged: (_) => EasyDebounce.debounce(
|
onChanged: (_) => EasyDebounce.debounce(
|
||||||
'_model.keyTextFieldTextController',
|
'_model.keyTextFieldTextController',
|
||||||
const Duration(milliseconds: 2000),
|
const Duration(milliseconds: 2000),
|
||||||
|
@ -271,7 +272,6 @@ class _QrCodePassKeyTemplateComponentWidgetState
|
||||||
maxLength}) =>
|
maxLength}) =>
|
||||||
null,
|
null,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
cursorColor: FlutterFlowTheme.of(context).primary,
|
|
||||||
validator: _model.keyTextFieldTextControllerValidator
|
validator: _model.keyTextFieldTextControllerValidator
|
||||||
.asValidator(context),
|
.asValidator(context),
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
|
|
|
@ -171,6 +171,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _model.textController2,
|
controller: _model.textController2,
|
||||||
focusNode: _model.textFieldFocusNode2,
|
focusNode: _model.textFieldFocusNode2,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
textCapitalization: TextCapitalization.none,
|
textCapitalization: TextCapitalization.none,
|
||||||
|
@ -307,6 +308,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController1,
|
controller: _model.textController1,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
focusNode: _model.textFieldFocusNode1,
|
focusNode: _model.textFieldFocusNode1,
|
||||||
onChanged: (_) => EasyDebounce.debounce(
|
onChanged: (_) => EasyDebounce.debounce(
|
||||||
'_model.textFieldFocusNode1',
|
'_model.textFieldFocusNode1',
|
||||||
|
@ -661,6 +663,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController3,
|
controller: _model.textController3,
|
||||||
focusNode: _model.textFieldFocusNode3,
|
focusNode: _model.textFieldFocusNode3,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
|
@ -749,6 +752,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
24.0, 0.0, 24.0, 0.0),
|
24.0, 0.0, 24.0, 0.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController4,
|
controller: _model.textController4,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
focusNode: _model.textFieldFocusNode4,
|
focusNode: _model.textFieldFocusNode4,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
|
import 'package:hub/custom_code/actions/get_dev_u_u_i_d.dart';
|
||||||
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
|
import 'package:hub/flutter_flow/random_data_util.dart';
|
||||||
import 'package:hub/pages/home_page/home_page_model.dart';
|
import 'package:hub/pages/home_page/home_page_model.dart';
|
||||||
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
|
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'sign_in_template_component_widget.dart'
|
import 'sign_in_template_component_widget.dart'
|
||||||
|
@ -48,6 +56,120 @@ class SignInTemplateComponentModel
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> checkLocals({
|
||||||
|
String? cliUUID,
|
||||||
|
required BuildContext context,
|
||||||
|
required FlutterFlowModel model,
|
||||||
|
}) async {
|
||||||
|
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||||
|
|
||||||
|
final response = await callback.call();
|
||||||
|
|
||||||
|
if (response.jsonBody['error']) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||||
|
|
||||||
|
if (locals.isEmpty) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future signInLoginAction(
|
||||||
|
BuildContext context,
|
||||||
|
FlutterFlowModel model, {
|
||||||
|
String? emailAdress,
|
||||||
|
String? password,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final ApiCallResponse? response;
|
||||||
|
final DatabaseHelper db = DatabaseHelper();
|
||||||
|
final LoginCall callback = PhpGroup.loginCall;
|
||||||
|
AppState().deviceDescription = randomString(
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
|
final String? devUUID;
|
||||||
|
final String userUUID;
|
||||||
|
final String status;
|
||||||
|
final String userDevUUID;
|
||||||
|
final String userName;
|
||||||
|
final String email;
|
||||||
|
final String passwd;
|
||||||
|
final bool isLogged;
|
||||||
|
|
||||||
|
email = emailAdress!;
|
||||||
|
passwd = password!;
|
||||||
|
|
||||||
|
devUUID = await getDevUUID();
|
||||||
|
|
||||||
|
if ((email != '') && (passwd != '')) {
|
||||||
|
AppState().email = email;
|
||||||
|
AppState().passwd = passwd;
|
||||||
|
response = await callback.call();
|
||||||
|
|
||||||
|
if (response.jsonBody['error'] == false) {
|
||||||
|
userUUID = response.jsonBody['uid'];
|
||||||
|
|
||||||
|
status = response.jsonBody['user']['status'];
|
||||||
|
userDevUUID = response.jsonBody['user']['dev_id'];
|
||||||
|
userName = response.jsonBody['user']['name'];
|
||||||
|
|
||||||
|
db.update('devUUID', devUUID, 'user');
|
||||||
|
db.update('userUUID', userUUID, 'user');
|
||||||
|
db.update('userDevUUID', userDevUUID, 'user');
|
||||||
|
db.update('status', status, 'user');
|
||||||
|
db.update('userName', userName, 'user');
|
||||||
|
|
||||||
|
isLogged = true;
|
||||||
|
await checkLocals(context: context, model: model).then((value) {
|
||||||
|
AppState().haveLocal = value;
|
||||||
|
AppState().isLogged = isLogged;
|
||||||
|
AppState().update(() {});
|
||||||
|
toggleApp(context);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (response.jsonBody['error'] == null) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
} else {
|
||||||
|
DialogUtil.error(
|
||||||
|
context, response.jsonBody['error_msg'].toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
} catch (e, s) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
LogUtil.requestAPIFailed(
|
||||||
|
'login.php', emailAdress.toString(), "Login", e, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future toggleApp(BuildContext context) async {
|
||||||
|
final haveLocal = AppState().haveLocal;
|
||||||
|
if (haveLocal == true) {
|
||||||
|
context.go('/homePage');
|
||||||
|
} else if (haveLocal == false) {
|
||||||
|
context.go(
|
||||||
|
'/receptionPage',
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
|
hasTransition: true,
|
||||||
|
transitionType: PageTransitionType.fade,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState(BuildContext context) {
|
void initState(BuildContext context) {
|
||||||
emailAddressTextControllerValidator = _emailAddressTextControllerValidator;
|
emailAddressTextControllerValidator = _emailAddressTextControllerValidator;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
|
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import '/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart';
|
import '/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart';
|
||||||
import '/flutter_flow/flutter_flow_animations.dart';
|
import '/flutter_flow/flutter_flow_animations.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
@ -241,6 +240,10 @@ class _SignInTemplateComponentWidgetState
|
||||||
.emailAddressTextController,
|
.emailAddressTextController,
|
||||||
focusNode: _model
|
focusNode: _model
|
||||||
.emailAddressFocusNode,
|
.emailAddressFocusNode,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(
|
||||||
|
context)
|
||||||
|
.primary,
|
||||||
onChanged: (_) =>
|
onChanged: (_) =>
|
||||||
EasyDebounce.debounce(
|
EasyDebounce.debounce(
|
||||||
'_model.emailAddressTextController',
|
'_model.emailAddressTextController',
|
||||||
|
@ -382,6 +385,10 @@ class _SignInTemplateComponentWidgetState
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model
|
controller: _model
|
||||||
.passwordTextController,
|
.passwordTextController,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(
|
||||||
|
context)
|
||||||
|
.primary,
|
||||||
focusNode:
|
focusNode:
|
||||||
_model.passwordFocusNode,
|
_model.passwordFocusNode,
|
||||||
onChanged: (_) =>
|
onChanged: (_) =>
|
||||||
|
@ -549,7 +556,7 @@ class _SignInTemplateComponentWidgetState
|
||||||
onPressed: _isFormInvalid()
|
onPressed: _isFormInvalid()
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
await action_blocks
|
await _model
|
||||||
.signInLoginAction(
|
.signInLoginAction(
|
||||||
context,
|
context,
|
||||||
_model,
|
_model,
|
||||||
|
@ -709,7 +716,7 @@ class _SignInTemplateComponentWidgetState
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
try {
|
try {
|
||||||
await action_blocks
|
await _model
|
||||||
.signInLoginAction(
|
.signInLoginAction(
|
||||||
context,
|
context,
|
||||||
_model,
|
_model,
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
|
import 'package:hub/flutter_flow/random_data_util.dart';
|
||||||
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
|
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'sign_up_template_component_widget.dart'
|
import 'sign_up_template_component_widget.dart'
|
||||||
show SignUpTemplateComponentWidget;
|
show SignUpTemplateComponentWidget;
|
||||||
|
@ -93,4 +99,62 @@ class SignUpTemplateComponentModel
|
||||||
passwordRegisterFormFocusNode?.dispose();
|
passwordRegisterFormFocusNode?.dispose();
|
||||||
passwordRegisterFormTextController?.dispose();
|
passwordRegisterFormTextController?.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> signUpRegisterAction(
|
||||||
|
BuildContext context, {
|
||||||
|
required String? name,
|
||||||
|
String? passwd,
|
||||||
|
required String? email,
|
||||||
|
String? device,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
ApiCallResponse? response;
|
||||||
|
|
||||||
|
if ((email != null && email != '') &&
|
||||||
|
(passwd != null && passwd != '' && passwd.length > 7) &&
|
||||||
|
(name != null && name != '')) {
|
||||||
|
response = await PhpGroup.registerCall.call(
|
||||||
|
name: name,
|
||||||
|
password: passwd,
|
||||||
|
email: email,
|
||||||
|
token: randomString(
|
||||||
|
36,
|
||||||
|
36,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
uuid: randomString(
|
||||||
|
36,
|
||||||
|
36,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
tipo: device,
|
||||||
|
descricao: randomString(
|
||||||
|
36,
|
||||||
|
36,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.jsonBody['error'] == false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
DialogUtil.error(context, response.jsonBody['error_msg']);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (e, s) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
LogUtil.requestAPIFailed(
|
||||||
|
'registro.php', email.toString(), "Register", e, s);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import 'package:hub/shared/components/atoms/atom_terms_of_use.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import '/flutter_flow/flutter_flow_animations.dart';
|
import '/flutter_flow/flutter_flow_animations.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
@ -690,9 +689,8 @@ class _SignUpTemplateComponentWidgetState
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
var shouldSetState = false;
|
var shouldSetState = false;
|
||||||
_model.signUp =
|
_model.signUp = await _model
|
||||||
await action_blocks
|
.signUpRegisterAction(
|
||||||
.signUpRegisterAction(
|
|
||||||
context,
|
context,
|
||||||
name: _model
|
name: _model
|
||||||
.nameRegisterFormTextController
|
.nameRegisterFormTextController
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// Automatic FlutterFlow imports
|
// Automatic FlutterFlow imports
|
||||||
import '/backend/schema/structs/index.dart';
|
import '/backend/schema/structs/index.dart';
|
||||||
import '/backend/schema/enums/enums.dart';
|
import '/backend/schema/enums/enums.dart';
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'index.dart'; // Imports other custom actions
|
import 'index.dart'; // Imports other custom actions
|
||||||
|
@ -14,7 +13,6 @@ import 'dart:convert'; // Import for base64 decoding
|
||||||
import 'dart:io'; // Import for file operations
|
import 'dart:io'; // Import for file operations
|
||||||
import 'package:path_provider/path_provider.dart'; // Import for temporary directory
|
import 'package:path_provider/path_provider.dart'; // Import for temporary directory
|
||||||
|
|
||||||
|
|
||||||
Future<FFUploadedFile> convertToUploadFile(String img) async {
|
Future<FFUploadedFile> convertToUploadFile(String img) async {
|
||||||
// Decode the base64 string into bytes
|
// Decode the base64 string into bytes
|
||||||
Uint8List bytes = base64.decode(img);
|
Uint8List bytes = base64.decode(img);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import '/backend/schema/structs/index.dart';
|
import '/backend/schema/structs/index.dart';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import '/backend/schema/enums/enums.dart';
|
import '/backend/schema/enums/enums.dart';
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'index.dart'; // Imports other custom actions
|
import 'index.dart'; // Imports other custom actions
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// // Automatic FlutterFlow imports
|
// // Automatic FlutterFlow imports
|
||||||
// import '/backend/schema/structs/index.dart';
|
// import '/backend/schema/structs/index.dart';
|
||||||
// import '/backend/schema/enums/enums.dart';
|
// import '/backend/schema/enums/enums.dart';
|
||||||
// import '/actions/actions.dart' as action_blocks;
|
|
||||||
// import '/flutter_flow/flutter_flow_theme.dart';
|
// import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
// import '/flutter_flow/flutter_flow_util.dart';
|
// import '/flutter_flow/flutter_flow_util.dart';
|
||||||
// import 'index.dart'; // Imports other custom widgets
|
// import 'index.dart'; // Imports other custom widgets
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
import 'package:hub/flutter_flow/request_manager.dart';
|
import 'package:hub/flutter_flow/request_manager.dart';
|
||||||
|
@ -49,6 +50,29 @@ class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
||||||
.then((value) => value.toString());
|
.then((value) => value.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future answersRequest(
|
||||||
|
{required BuildContext context,
|
||||||
|
required String? ref,
|
||||||
|
required String? task,
|
||||||
|
required String? response,
|
||||||
|
required String? id}) async {
|
||||||
|
final ApiCallResponse? respondeSolicitacaoCall;
|
||||||
|
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall;
|
||||||
|
|
||||||
|
respondeSolicitacaoCall = await callback.call(
|
||||||
|
referencia: ref,
|
||||||
|
tarefa: task,
|
||||||
|
resposta: response,
|
||||||
|
idVisitante: id,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (respondeSolicitacaoCall.statusCode == 200) {
|
||||||
|
return !respondeSolicitacaoCall.jsonBody['error'];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
unfocusNode.dispose();
|
unfocusNode.dispose();
|
||||||
|
|
|
@ -2,7 +2,6 @@ import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.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/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/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/components/templates_components/details_component/details_component_widget.dart';
|
||||||
|
@ -234,7 +233,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||||
),
|
),
|
||||||
icon: const Icon(Icons.done),
|
icon: const Icon(Icons.done),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
answersRequest
|
_model.answersRequest
|
||||||
.call(
|
.call(
|
||||||
context: context,
|
context: context,
|
||||||
ref: liberationHistoryItem['NOT_ID'].toString(),
|
ref: liberationHistoryItem['NOT_ID'].toString(),
|
||||||
|
@ -286,7 +285,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||||
),
|
),
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
return answersRequest
|
return _model.answersRequest
|
||||||
.call(
|
.call(
|
||||||
context: context,
|
context: context,
|
||||||
ref: liberationHistoryItem['NOT_ID'].toString(),
|
ref: liberationHistoryItem['NOT_ID'].toString(),
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
import 'package:hub/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_action.dart';
|
||||||
|
@ -267,7 +266,6 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
|
||||||
child: buildPetDetails(
|
child: buildPetDetails(
|
||||||
item: uItem,
|
item: uItem,
|
||||||
context: context,
|
context: context,
|
||||||
changeStatusAction: changeStatusAction,
|
|
||||||
devUUID: devUUID,
|
devUUID: devUUID,
|
||||||
userUUID: userUUID,
|
userUUID: userUUID,
|
||||||
cliUUID: cliUUID,
|
cliUUID: cliUUID,
|
||||||
|
|
|
@ -309,6 +309,8 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textControllerData,
|
controller: _model.textControllerData,
|
||||||
focusNode: _model.textFieldFocusData,
|
focusNode: _model.textFieldFocusData,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(context).primary,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
autovalidateMode:
|
autovalidateMode:
|
||||||
AutovalidateMode.onUserInteraction,
|
AutovalidateMode.onUserInteraction,
|
||||||
|
@ -772,6 +774,8 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textControllerData,
|
controller: _model.textControllerData,
|
||||||
focusNode: _model.textFieldFocusData,
|
focusNode: _model.textFieldFocusData,
|
||||||
|
cursorColor:
|
||||||
|
FlutterFlowTheme.of(context).primary,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
autovalidateMode:
|
autovalidateMode:
|
||||||
AutovalidateMode.onUserInteraction,
|
AutovalidateMode.onUserInteraction,
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:typed_data';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
import 'package:hub/pages/qr_code_page/qr_code_page_widget.dart';
|
import 'package:hub/pages/qr_code_page/qr_code_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
|
||||||
class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
|
class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
|
||||||
/// Local state fields for this page.
|
/// Local state fields for this page.
|
||||||
|
@ -39,6 +41,100 @@ class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
|
||||||
unfocusNode.dispose();
|
unfocusNode.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint8List assembleQRPacket(
|
||||||
|
int direction, String identifier, String password) {
|
||||||
|
List<int> packet = [direction];
|
||||||
|
|
||||||
|
String paddedBadge = identifier.padLeft(30, '0');
|
||||||
|
|
||||||
|
for (var i = 0; i < paddedBadge.length; i += 2) {
|
||||||
|
packet.add(int.parse(paddedBadge.substring(i, i + 2), radix: 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
int year = now.year % 100;
|
||||||
|
int month = now.month;
|
||||||
|
int day = now.day;
|
||||||
|
int hour = now.hour;
|
||||||
|
int minute = now.minute;
|
||||||
|
|
||||||
|
int sum = year + month + day + hour + minute;
|
||||||
|
|
||||||
|
if (sum == int.parse('0D', radix: 16) ||
|
||||||
|
sum == int.parse('0A', radix: 16)) {
|
||||||
|
packet.add(int.parse('FF', radix: 16));
|
||||||
|
} else {
|
||||||
|
packet.add(sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
String paddedPassword = password.length != 4 ? 'FFFF' : password;
|
||||||
|
|
||||||
|
for (var i = 0; i < paddedPassword.length; i += 2) {
|
||||||
|
packet.add(int.parse(paddedPassword.substring(i, i + 2), radix: 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
int check = 0x00;
|
||||||
|
|
||||||
|
for (var b in packet) {
|
||||||
|
check ^= b;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check == int.parse('0D', radix: 16) ||
|
||||||
|
check == int.parse('0A', radix: 16)) {
|
||||||
|
packet.add(int.parse('FF', radix: 16));
|
||||||
|
} else {
|
||||||
|
packet.add(check);
|
||||||
|
}
|
||||||
|
|
||||||
|
var bytes = packet
|
||||||
|
.map((byte) => byte.toRadixString(16).padLeft(2, '0'))
|
||||||
|
.join((' '));
|
||||||
|
|
||||||
|
return Uint8List.fromList(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint8List hexStringToByteArray(String s) {
|
||||||
|
int len = s.length;
|
||||||
|
Uint8List data = Uint8List(len ~/ 2);
|
||||||
|
for (int i = 0; i < len; i += 2) {
|
||||||
|
data[i ~/ 2] =
|
||||||
|
((int.parse(s[i], radix: 16) << 4) + int.parse(s[i + 1], radix: 16));
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
String byteToHexa(Uint8List pDados) {
|
||||||
|
return pDados
|
||||||
|
.map((byte) => byte.toRadixString(16).padLeft(2, '0').toUpperCase())
|
||||||
|
.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> byteToString(Uint8List bytes) async {
|
||||||
|
return String.fromCharCodes(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildQrCode(
|
||||||
|
{required int errorCorrectLevel,
|
||||||
|
required double dimension,
|
||||||
|
required String identifier,
|
||||||
|
required String pass,
|
||||||
|
required int direction}) {
|
||||||
|
try {
|
||||||
|
const Color backgroundColor = Colors.white;
|
||||||
|
const Color foregroundColor = Colors.black;
|
||||||
|
return QrImageView.withQr(
|
||||||
|
qr: QrCode.fromUint8List(
|
||||||
|
data: assembleQRPacket(direction, identifier, pass),
|
||||||
|
errorCorrectLevel: errorCorrectLevel),
|
||||||
|
size: dimension,
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
foregroundColor: foregroundColor);
|
||||||
|
} catch (e) {
|
||||||
|
return Text("Erro ao gerar QR Code: ${e.toString()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Action blocks.
|
/// Action blocks.
|
||||||
Future qrCodeEncoder(
|
Future qrCodeEncoder(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:flutter_animate/flutter_animate.dart';
|
import 'package:flutter_animate/flutter_animate.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
|
||||||
import 'package:hub/components/templates_components/qr_code_pass_key_template_component/qr_code_pass_key_template_component_widget.dart';
|
import 'package:hub/components/templates_components/qr_code_pass_key_template_component/qr_code_pass_key_template_component_widget.dart';
|
||||||
import 'package:hub/flutter_flow/custom_functions.dart';
|
import 'package:hub/flutter_flow/custom_functions.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_animations.dart';
|
import 'package:hub/flutter_flow/flutter_flow_animations.dart';
|
||||||
|
@ -146,7 +145,7 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
|
||||||
? await _showBiometricsAuth(context)
|
? await _showBiometricsAuth(context)
|
||||||
: await _showQrCodeBottomSheet(context);
|
: await _showQrCodeBottomSheet(context);
|
||||||
},
|
},
|
||||||
child: buildQrCode(
|
child: _model.buildQrCode(
|
||||||
dimension: dimension,
|
dimension: dimension,
|
||||||
errorCorrectLevel: QrErrorCorrectLevel.M,
|
errorCorrectLevel: QrErrorCorrectLevel.M,
|
||||||
identifier: _model.userDevUUID,
|
identifier: _model.userDevUUID,
|
||||||
|
|
|
@ -5,7 +5,6 @@ import 'package:flutter/scheduler.dart';
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:google_fonts/google_fonts.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/api_requests/api_calls.dart';
|
||||||
import 'package:hub/components/atomic_components/shared_components_atoms/toast.dart';
|
import 'package:hub/components/atomic_components/shared_components_atoms/toast.dart';
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||||
|
@ -21,6 +20,7 @@ import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
||||||
import 'package:hub/pages/visit_history_page/visit_history_page_widget.dart';
|
import 'package:hub/pages/visit_history_page/visit_history_page_widget.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/share_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ScheduleCompleteVisitPageWidget extends StatefulWidget {
|
class ScheduleCompleteVisitPageWidget extends StatefulWidget {
|
||||||
|
@ -1500,6 +1500,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
controller: _model.textController3,
|
controller: _model.textController3,
|
||||||
focusNode: _model.textFieldFocusNode3,
|
focusNode: _model.textFieldFocusNode3,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
obscureText: false,
|
obscureText: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
@ -1640,7 +1641,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
gravity: ToastGravity.TOP,
|
gravity: ToastGravity.TOP,
|
||||||
backgroundColor: Colors.green);
|
backgroundColor: Colors.green);
|
||||||
|
|
||||||
await showShare(value.jsonBody);
|
await ShareUtil.showShare(value.jsonBody);
|
||||||
} else {
|
} else {
|
||||||
await DialogUtil.errorDefault(context);
|
await DialogUtil.errorDefault(context);
|
||||||
context.pop();
|
context.pop();
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
|
import 'package:hub/shared/mixins/switcher_mixin.dart';
|
||||||
|
|
||||||
import '/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart';
|
import '/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'sign_in_page_model.dart';
|
import 'sign_in_page_model.dart';
|
||||||
export 'sign_in_page_model.dart';
|
export 'sign_in_page_model.dart';
|
||||||
|
|
||||||
class SignInPageWidget extends StatefulWidget {
|
class SignInPageWidget extends StatefulWidget with Switcher {
|
||||||
const SignInPageWidget({super.key});
|
const SignInPageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -48,7 +49,7 @@ class _SignInPageWidgetState extends State<SignInPageWidget> {
|
||||||
updateOnChange: true,
|
updateOnChange: true,
|
||||||
child: SignInTemplateComponentWidget(
|
child: SignInTemplateComponentWidget(
|
||||||
toggleSignUpPage: () async {
|
toggleSignUpPage: () async {
|
||||||
await action_blocks.toggleSignUpPage(context);
|
await Switcher.toggleSignUpPage(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
|
import 'package:hub/shared/mixins/switcher_mixin.dart';
|
||||||
|
|
||||||
import '/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart';
|
import '/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'sign_up_page_model.dart';
|
import 'sign_up_page_model.dart';
|
||||||
export 'sign_up_page_model.dart';
|
export 'sign_up_page_model.dart';
|
||||||
|
|
||||||
class SignUpPageWidget extends StatefulWidget {
|
class SignUpPageWidget extends StatefulWidget with Switcher {
|
||||||
const SignUpPageWidget({super.key});
|
const SignUpPageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -48,7 +49,7 @@ class _SignUpPageWidgetState extends State<SignUpPageWidget> {
|
||||||
updateOnChange: true,
|
updateOnChange: true,
|
||||||
child: SignUpTemplateComponentWidget(
|
child: SignUpTemplateComponentWidget(
|
||||||
toggleSignInPage: () async {
|
toggleSignInPage: () async {
|
||||||
await action_blocks.toggleSignInPage(context);
|
await Switcher.toggleSignInPage(context);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -1 +1,67 @@
|
||||||
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
|
import 'package:hub/pages/visit_history_page/visit_history_page_widget.dart';
|
||||||
|
|
||||||
|
class VisitHistoryModel extends FlutterFlowModel<VisitHistoryWidget> {
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
// TODO: implement dispose
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState(BuildContext context) {
|
||||||
|
// TODO: implement initState
|
||||||
|
}
|
||||||
|
|
||||||
|
Future changeStatusAction(
|
||||||
|
BuildContext context,
|
||||||
|
int idDestino,
|
||||||
|
int idVisita,
|
||||||
|
String accessKey,
|
||||||
|
String email,
|
||||||
|
) async {
|
||||||
|
// Navigator.pop(context, true);
|
||||||
|
context.pop(true);
|
||||||
|
|
||||||
|
bool? blockVisitRequest;
|
||||||
|
blockVisitRequest = await visitCancelAction(
|
||||||
|
context,
|
||||||
|
accessKey: accessKey,
|
||||||
|
idDestino: idDestino,
|
||||||
|
idVisita: idVisita,
|
||||||
|
email: email,
|
||||||
|
);
|
||||||
|
if (!context.mounted) return;
|
||||||
|
if (blockVisitRequest == true) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> visitCancelAction(BuildContext context,
|
||||||
|
{required int? idDestino,
|
||||||
|
required int? idVisita,
|
||||||
|
required String? accessKey,
|
||||||
|
required String? email}) async {
|
||||||
|
final ApiCallResponse? response;
|
||||||
|
final CancelaVisita callback = PhpGroup.cancelaVisita;
|
||||||
|
|
||||||
|
response = await callback.call(
|
||||||
|
idDestino: idDestino,
|
||||||
|
idVisita: idVisita,
|
||||||
|
AccessKey: accessKey,
|
||||||
|
UsuEmail: email,
|
||||||
|
DevDesc: '',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return !response.jsonBody['error'];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
import 'package:hub/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_action.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
||||||
|
import 'package:hub/pages/visit_history_page/visit_history_page_model.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
|
import 'package:hub/shared/mixins/status_mixin.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
|
@ -19,7 +20,7 @@ class VisitHistoryWidget extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
with TickerProviderStateMixin {
|
with TickerProviderStateMixin, Status {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final DatabaseHelper db = DatabaseHelper();
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
|
@ -29,6 +30,7 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
final int _pageSize = 10;
|
final int _pageSize = 10;
|
||||||
bool _hasData = false;
|
bool _hasData = false;
|
||||||
bool _loading = false;
|
bool _loading = false;
|
||||||
|
late VisitHistoryModel _model;
|
||||||
|
|
||||||
late Future<void> _visitFuture;
|
late Future<void> _visitFuture;
|
||||||
List<dynamic> _visitWrap = [];
|
List<dynamic> _visitWrap = [];
|
||||||
|
@ -48,6 +50,8 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
_model = createModel(context, () => VisitHistoryModel());
|
||||||
_initVariables();
|
_initVariables();
|
||||||
_visitFuture = _fetchVisits();
|
_visitFuture = _fetchVisits();
|
||||||
|
|
||||||
|
@ -200,42 +204,47 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
: '',
|
: '',
|
||||||
},
|
},
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) == StatusEnum.active)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Ativo',
|
ptText: 'Ativo',
|
||||||
enText: 'Active',
|
enText: 'Active',
|
||||||
): FlutterFlowTheme.of(context).warning,
|
): FlutterFlowTheme.of(context).warning,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.finished)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
StatusEnum.finished)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Finalizado',
|
ptText: 'Finalizado',
|
||||||
enText: 'Finished',
|
enText: 'Finished',
|
||||||
): FlutterFlowTheme.of(context).success,
|
): FlutterFlowTheme.of(context).success,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.unknown)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
StatusEnum.unknown)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Desconhecido',
|
ptText: 'Desconhecido',
|
||||||
enText: 'Unknown',
|
enText: 'Unknown',
|
||||||
): FlutterFlowTheme.of(context).alternate,
|
): FlutterFlowTheme.of(context).alternate,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.canceled)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
StatusEnum.canceled)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Cancelado',
|
ptText: 'Cancelado',
|
||||||
enText: 'Canceled',
|
enText: 'Canceled',
|
||||||
): FlutterFlowTheme.of(context).error,
|
): FlutterFlowTheme.of(context).error,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.blocked)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
StatusEnum.blocked)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Bloqueado',
|
ptText: 'Bloqueado',
|
||||||
enText: 'Blocked',
|
enText: 'Blocked',
|
||||||
): FlutterFlowTheme.of(context).error,
|
): FlutterFlowTheme.of(context).error,
|
||||||
},
|
},
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.inactive)
|
if (Status.getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
|
StatusEnum.inactive)
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Inativo',
|
ptText: 'Inativo',
|
||||||
|
@ -266,7 +275,7 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
child: buildVisitDetails(
|
child: buildVisitDetails(
|
||||||
item: visitaWrapItem,
|
item: visitaWrapItem,
|
||||||
context: context,
|
context: context,
|
||||||
changeStatusAction: changeStatusAction,
|
changeStatusAction: _model.changeStatusAction,
|
||||||
devUUID: devUUID,
|
devUUID: devUUID,
|
||||||
userUUID: userUUID,
|
userUUID: userUUID,
|
||||||
cliUUID: cliUUID,
|
cliUUID: cliUUID,
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
|
import 'package:hub/shared/mixins/switcher_mixin.dart';
|
||||||
|
|
||||||
import '/components/templates_components/welcome_template_component/welcome_template_component_widget.dart';
|
import '/components/templates_components/welcome_template_component/welcome_template_component_widget.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import '/actions/actions.dart' as action_blocks;
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'welcome_page_model.dart';
|
import 'welcome_page_model.dart';
|
||||||
export 'welcome_page_model.dart';
|
export 'welcome_page_model.dart';
|
||||||
|
|
||||||
class WelcomePageWidget extends StatefulWidget {
|
class WelcomePageWidget extends StatefulWidget with Switcher {
|
||||||
const WelcomePageWidget({super.key});
|
const WelcomePageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -66,10 +67,10 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
|
||||||
updateOnChange: true,
|
updateOnChange: true,
|
||||||
child: WelcomeTemplateComponentWidget(
|
child: WelcomeTemplateComponentWidget(
|
||||||
toggleSignUpPage: () async {
|
toggleSignUpPage: () async {
|
||||||
await action_blocks.toggleSignUpPage(context);
|
await Switcher.toggleSignUpPage(context);
|
||||||
},
|
},
|
||||||
toggleSignInPage: () async {
|
toggleSignInPage: () async {
|
||||||
await action_blocks.toggleSignInPage(context);
|
await Switcher.toggleSignInPage(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
enum StatusEnum { active, unknown, canceled, finished, blocked, inactive }
|
||||||
|
|
||||||
|
mixin Status {
|
||||||
|
static StatusEnum? getStatus(dynamic data) {
|
||||||
|
switch (data) {
|
||||||
|
case 'A':
|
||||||
|
return StatusEnum.active;
|
||||||
|
case 'F':
|
||||||
|
return StatusEnum.finished;
|
||||||
|
case 'B':
|
||||||
|
return StatusEnum.blocked;
|
||||||
|
case 'C':
|
||||||
|
return StatusEnum.canceled;
|
||||||
|
case 'I':
|
||||||
|
return StatusEnum.inactive;
|
||||||
|
default:
|
||||||
|
return StatusEnum.unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
|
|
||||||
|
mixin Switcher {
|
||||||
|
static Future toggleSignInPage(BuildContext context) async {
|
||||||
|
context.go(
|
||||||
|
'/signInPage',
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
|
hasTransition: true,
|
||||||
|
transitionType: PageTransitionType.fade,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future toggleSignUpPage(BuildContext context) async {
|
||||||
|
context.go(
|
||||||
|
'/signUpPage',
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
kTransitionInfoKey: const TransitionInfo(
|
||||||
|
hasTransition: true,
|
||||||
|
transitionType: PageTransitionType.fade,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
import 'package:hub/shared/helpers/db_helper.dart';
|
||||||
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
|
class ShareUtil {
|
||||||
|
static Future<void> showShare(payload) async {
|
||||||
|
final DatabaseHelper db = DatabaseHelper();
|
||||||
|
final cliName = await db
|
||||||
|
.get(key: 'cliName', field: 'value')
|
||||||
|
.then((value) => value.toString());
|
||||||
|
final cliUUID = await db
|
||||||
|
.get(key: 'cliUUID', field: 'value')
|
||||||
|
.then((value) => value.toString());
|
||||||
|
|
||||||
|
for (var i = 0; i < payload['convites'].length; i++) {
|
||||||
|
await Share.share('''
|
||||||
|
Olá, \*${payload['convites'][i]['VTE_NOME']}\*! Você foi convidado para \*$cliName\*.
|
||||||
|
|
||||||
|
\*Validade do Convite\*:
|
||||||
|
- Início: ${payload['convites'][i]['VAW_DTINICIO']}
|
||||||
|
- Fim: ${payload['convites'][i]['VAW_DTFIM']}
|
||||||
|
|
||||||
|
URL do Convite: https://visita.freaccess.com.br/${payload['convites'][i]['VAW_ID']}/$cliUUID/${payload['convites'][i]['VAW_CHAVE']}
|
||||||
|
''');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue