WIP
This commit is contained in:
parent
e646f56bff
commit
0aaee82b77
|
@ -123,9 +123,12 @@ class _LocalProfileComponentWidgetState
|
||||||
showDragHandle: false,
|
showDragHandle: false,
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => Padding(
|
builder: (context) => PopScope(
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
canPop: false,
|
||||||
child: const BottomArrowLinkedLocalsComponentWidget(),
|
child: Padding(
|
||||||
|
padding: MediaQuery.viewInsetsOf(context),
|
||||||
|
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,65 +55,60 @@ 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
|
key: scaffoldKey,
|
||||||
? FocusScope.of(context).requestFocus(_model.unfocusNode)
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
: FocusScope.of(context).unfocus(),
|
// drawer: buildDrawer(context),
|
||||||
child: Scaffold(
|
drawerEnableOpenDragGesture: true,
|
||||||
key: scaffoldKey,
|
drawerDragStartBehavior: DragStartBehavior.start,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
drawer: CustomDrawer(model: _model),
|
||||||
// drawer: buildDrawer(context),
|
appBar: AppBar(
|
||||||
drawerEnableOpenDragGesture: true,
|
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||||
drawerDragStartBehavior: DragStartBehavior.start,
|
automaticallyImplyLeading: false,
|
||||||
drawer: CustomDrawer(model: _model),
|
leading: FlutterFlowIconButton(
|
||||||
appBar: AppBar(
|
borderRadius: 20.0,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
borderWidth: 1.0,
|
||||||
automaticallyImplyLeading: false,
|
buttonSize: 40.0,
|
||||||
leading: FlutterFlowIconButton(
|
fillColor: FlutterFlowTheme.of(context).primary,
|
||||||
borderRadius: 20.0,
|
icon: const Icon(
|
||||||
borderWidth: 1.0,
|
Icons.menu_rounded,
|
||||||
buttonSize: 40.0,
|
color: Colors.white,
|
||||||
fillColor: FlutterFlowTheme.of(context).primary,
|
size: 28.0,
|
||||||
icon: const Icon(
|
|
||||||
Icons.menu_rounded,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 28.0,
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
scaffoldKey.currentState!.openDrawer();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
title: Row(
|
onPressed: () async {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
scaffoldKey.currentState!.openDrawer();
|
||||||
mainAxisSize: MainAxisSize.min,
|
},
|
||||||
children: [
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/images/logo.png',
|
|
||||||
width: 15.0,
|
|
||||||
height: 15.0,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'FRE ACCESS',
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
color: FlutterFlowTheme.of(context).info,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].divide(const SizedBox(width: 8.0)),
|
|
||||||
),
|
|
||||||
actions: const [],
|
|
||||||
centerTitle: true,
|
|
||||||
elevation: 0.0,
|
|
||||||
),
|
),
|
||||||
body: buildPage(context),
|
title: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/logo.png',
|
||||||
|
width: 15.0,
|
||||||
|
height: 15.0,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'FRE ACCESS',
|
||||||
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
color: FlutterFlowTheme.of(context).info,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
].divide(const SizedBox(width: 8.0)),
|
||||||
|
),
|
||||||
|
actions: const [],
|
||||||
|
centerTitle: true,
|
||||||
|
elevation: 0.0,
|
||||||
),
|
),
|
||||||
|
body: buildPage(context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,9 +124,12 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget>
|
||||||
enableDrag: false,
|
enableDrag: false,
|
||||||
isDismissible: false,
|
isDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => Padding(
|
builder: (context) => PopScope(
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
canPop: false,
|
||||||
child: const BottomArrowLinkedLocalsComponentWidget(),
|
child: Padding(
|
||||||
|
padding: MediaQuery.viewInsetsOf(context),
|
||||||
|
child: const BottomArrowLinkedLocalsComponentWidget(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
).then((_) async {
|
).then((_) async {
|
||||||
StorageUtil().haveLocal = true;
|
StorageUtil().haveLocal = true;
|
||||||
|
|
|
@ -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