WIP
This commit is contained in:
parent
e646f56bff
commit
0aaee82b77
|
@ -123,10 +123,13 @@ class _LocalProfileComponentWidgetState
|
||||||
showDragHandle: false,
|
showDragHandle: false,
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => Padding(
|
builder: (context) => PopScope(
|
||||||
|
canPop: false,
|
||||||
|
child: Padding(
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
padding: MediaQuery.viewInsetsOf(context),
|
||||||
child: const BottomArrowLinkedLocalsComponentWidget(),
|
child: const BottomArrowLinkedLocalsComponentWidget(),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
).then((_) async {
|
).then((_) async {
|
||||||
onUpdate();
|
onUpdate();
|
||||||
});
|
});
|
||||||
|
|
|
@ -120,6 +120,22 @@ class ScheduleProvisionalVisitPageModel
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DateTime selectedDateTime;
|
||||||
|
DateTime currentDateTime = DateTime.now();
|
||||||
|
selectedDateTime =
|
||||||
|
DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
||||||
|
|
||||||
|
try {
|
||||||
|
selectedDateTime =
|
||||||
|
DateFormat('dd/MM/yyyy HH:mm:ss').parse(dateTimeTextController.text);
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedDateTime.isBefore(currentDateTime)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ class HomePageWidget extends StatefulWidget {
|
||||||
class _HomePageWidgetState extends State<HomePageWidget> {
|
class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
late HomePageModel _model;
|
late HomePageModel _model;
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
late LocalProfileComponentWidget _localProfileComponentWidget;
|
late LocalProfileComponentWidget _localProfileComponentWidget;
|
||||||
|
|
||||||
_HomePageWidgetState() {
|
_HomePageWidgetState() {
|
||||||
|
@ -54,11 +55,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
StorageUtil().context = context;
|
StorageUtil().context = context;
|
||||||
return GestureDetector(
|
return Scaffold(
|
||||||
onTap: () => _model.unfocusNode.canRequestFocus
|
|
||||||
? FocusScope.of(context).requestFocus(_model.unfocusNode)
|
|
||||||
: FocusScope.of(context).unfocus(),
|
|
||||||
child: Scaffold(
|
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
// drawer: buildDrawer(context),
|
// drawer: buildDrawer(context),
|
||||||
|
@ -112,7 +109,6 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
elevation: 0.0,
|
elevation: 0.0,
|
||||||
),
|
),
|
||||||
body: buildPage(context),
|
body: buildPage(context),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,10 +124,13 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget>
|
||||||
enableDrag: false,
|
enableDrag: false,
|
||||||
isDismissible: false,
|
isDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => Padding(
|
builder: (context) => PopScope(
|
||||||
|
canPop: false,
|
||||||
|
child: Padding(
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
padding: MediaQuery.viewInsetsOf(context),
|
||||||
child: const BottomArrowLinkedLocalsComponentWidget(),
|
child: const BottomArrowLinkedLocalsComponentWidget(),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
).then((_) async {
|
).then((_) async {
|
||||||
StorageUtil().haveLocal = true;
|
StorageUtil().haveLocal = true;
|
||||||
await processData();
|
await processData();
|
||||||
|
|
|
@ -83,8 +83,31 @@ class ScheduleCompleteVisitPageModel
|
||||||
(textController2!.text != '') &&
|
(textController2!.text != '') &&
|
||||||
(dropDownValue1 != null && dropDownValue1 != '') &&
|
(dropDownValue1 != null && dropDownValue1 != '') &&
|
||||||
(dropDownValue2 != null && dropDownValue2 != '')) {
|
(dropDownValue2 != null && dropDownValue2 != '')) {
|
||||||
|
DateTime selectedDateTime;
|
||||||
|
DateTime currentDateTime = DateTime.now().subtract(Duration(minutes: 10));
|
||||||
|
try {
|
||||||
|
selectedDateTime =
|
||||||
|
DateFormat('dd/MM/yyyy HH:mm:ss').parse(textController1.text);
|
||||||
|
if (selectedDateTime.isBefore(currentDateTime)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
selectedDateTime =
|
||||||
|
DateFormat('dd/MM/yyyy HH:mm:ss').parse(textController2.text);
|
||||||
|
if (selectedDateTime.isBefore(currentDateTime)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +137,8 @@ class ScheduleCompleteVisitPageModel
|
||||||
enText: 'Start date must be before end date.',
|
enText: 'Start date must be before end date.',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (startDate.isBefore(DateTime.now())) {
|
if (startDate
|
||||||
|
.isBefore(DateTime.now().subtract(const Duration(minutes: 10)))) {
|
||||||
return FFLocalizations.of(context).getVariableText(
|
return FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'Start date must be after current date.',
|
enText: 'Start date must be after current date.',
|
||||||
ptText: 'A data de início deve ser posterior à data atual.',
|
ptText: 'A data de início deve ser posterior à data atual.',
|
||||||
|
@ -152,7 +176,8 @@ class ScheduleCompleteVisitPageModel
|
||||||
ptText: 'A data de término deve ser posterior à data de início.',
|
ptText: 'A data de término deve ser posterior à data de início.',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (endDate.isBefore(DateTime.now())) {
|
if (startDate
|
||||||
|
.isBefore(DateTime.now().subtract(const Duration(minutes: 10)))) {
|
||||||
return FFLocalizations.of(context).getVariableText(
|
return FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'End date must be after current date.',
|
enText: 'End date must be after current date.',
|
||||||
ptText: 'A data de término deve ser posterior à data atual.',
|
ptText: 'A data de término deve ser posterior à data atual.',
|
||||||
|
|
|
@ -16,7 +16,7 @@ class SecureStorageHelper extends ChangeNotifier implements Storage {
|
||||||
|
|
||||||
Future<void> setAndCacheString(
|
Future<void> setAndCacheString(
|
||||||
String key, String value, Function(String) cacheSetter) async {
|
String key, String value, Function(String) cacheSetter) async {
|
||||||
log('setAndCacheString value for key: $key to $value');
|
log('SecureStorageHelper -> setAndCacheString value for key: $key to $value');
|
||||||
await _secureStorage.write(key: key, value: value);
|
await _secureStorage.write(key: key, value: value);
|
||||||
CacheUtil.instance.set(key, value);
|
CacheUtil.instance.set(key, value);
|
||||||
cacheSetter(value);
|
cacheSetter(value);
|
||||||
|
@ -24,7 +24,7 @@ class SecureStorageHelper extends ChangeNotifier implements Storage {
|
||||||
|
|
||||||
Future<void> setAndCacheBool(
|
Future<void> setAndCacheBool(
|
||||||
String key, bool value, Function(bool) cacheSetter) async {
|
String key, bool value, Function(bool) cacheSetter) async {
|
||||||
log('setAndCacheBool value for key: $key to $value');
|
log('SecureStorageHelper -> setAndCacheBool value for key: $key to $value');
|
||||||
await _secureStorage.write(key: key, value: value.toString());
|
await _secureStorage.write(key: key, value: value.toString());
|
||||||
CacheUtil.instance.set(key, value);
|
CacheUtil.instance.set(key, value);
|
||||||
cacheSetter(value);
|
cacheSetter(value);
|
||||||
|
@ -32,19 +32,19 @@ class SecureStorageHelper extends ChangeNotifier implements Storage {
|
||||||
|
|
||||||
Future<void> setAndCacheObject(
|
Future<void> setAndCacheObject(
|
||||||
String key, String value, Function(String) cacheSetter) async {
|
String key, String value, Function(String) cacheSetter) async {
|
||||||
log('setAndCacheObject value for key: $key to $value');
|
log('SecureStorageHelper -> setAndCacheObject value for key: $key to $value');
|
||||||
await _secureStorage.write(key: key, value: value);
|
await _secureStorage.write(key: key, value: value);
|
||||||
CacheUtil.instance.set(key, value);
|
CacheUtil.instance.set(key, value);
|
||||||
cacheSetter(value);
|
cacheSetter(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> getString(String key) async {
|
Future<String?> getString(String key) async {
|
||||||
log('getString value for key: $key');
|
|
||||||
var value = CacheUtil.instance.get(key);
|
var value = CacheUtil.instance.get(key);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
value = await _secureStorage.read(key: key);
|
value = await _secureStorage.read(key: key);
|
||||||
CacheUtil.instance.set(key, value);
|
CacheUtil.instance.set(key, value);
|
||||||
}
|
}
|
||||||
|
log('SecureStorageHelper -> getString $value for key: $key');
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,20 +53,20 @@ class SecureStorageHelper extends ChangeNotifier implements Storage {
|
||||||
if (value == null || value == 'null') {
|
if (value == null || value == 'null') {
|
||||||
value = await _secureStorage.read(key: key);
|
value = await _secureStorage.read(key: key);
|
||||||
CacheUtil.instance.set(key, value);
|
CacheUtil.instance.set(key, value);
|
||||||
log('getBool $value for key: $key');
|
log('SecureStorageHelper -> getBool $value for key: $key');
|
||||||
return value == 'true';
|
return value == 'true';
|
||||||
}
|
}
|
||||||
log('getBool $value for key: $key');
|
log('SecureStorageHelper -> getBool $value for key: $key');
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<BuildContext?> getObject(String key) async {
|
Future<BuildContext?> getObject(String key) async {
|
||||||
log('getObject value for key: $key');
|
|
||||||
var value = CacheUtil.instance.get(key);
|
var value = CacheUtil.instance.get(key);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
value = await _secureStorage.read(key: key);
|
value = await _secureStorage.read(key: key);
|
||||||
CacheUtil.instance.set(key, value);
|
CacheUtil.instance.set(key, value);
|
||||||
}
|
}
|
||||||
|
log('SecureStorageHelper -> getObject $value for key: $key');
|
||||||
return value as BuildContext?;
|
return value as BuildContext?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class SecureStorageHelper extends ChangeNotifier implements Storage {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<dynamic> get(String key) async {
|
Future<dynamic> get(String key) async {
|
||||||
log('get value for key: $key');
|
log('SecureStorageHelper -> get value for key: $key');
|
||||||
var stringValue = await getString(key);
|
var stringValue = await getString(key);
|
||||||
if (stringValue != null) return stringValue;
|
if (stringValue != null) return stringValue;
|
||||||
|
|
||||||
|
@ -99,13 +99,13 @@ class SecureStorageHelper extends ChangeNotifier implements Storage {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> delete(String key) async {
|
Future<void> delete(String key) async {
|
||||||
log('delete value for key: $key');
|
log('SecureStorageHelper -> delete value for key: $key');
|
||||||
await _secureStorage.delete(key: key);
|
await _secureStorage.delete(key: key);
|
||||||
CacheUtil.instance.delete(key);
|
CacheUtil.instance.delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> purge() async {
|
Future<void> purge() async {
|
||||||
log('Purging secure storage');
|
log('SecureStorageHelper -> Purging secure storage');
|
||||||
await _secureStorage.deleteAll();
|
await _secureStorage.deleteAll();
|
||||||
CacheUtil.instance.clear();
|
CacheUtil.instance.clear();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue