better algorithm to open time dependent page
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
// ignore_for_file: file_names
|
||||
|
||||
int getInitialPageIndex() {
|
||||
DateTime currentDate = DateTime.now();
|
||||
final DateTime currentDate = DateTime.now();
|
||||
final int time = currentDate.hour * 60 + currentDate.minute;
|
||||
late final int initPage;
|
||||
if (currentDate.hour < 10) {
|
||||
if (time < 600) {
|
||||
initPage = 0;
|
||||
} else if (currentDate.hour >= 10 && currentDate.hour < 15) {
|
||||
} else if (time >= 600 && time < 860) {
|
||||
initPage = 1;
|
||||
} else if (currentDate.hour >= 15 && currentDate.hour < 18) {
|
||||
} else if (time >= 860 && time < 1080) {
|
||||
initPage = 2;
|
||||
} else {
|
||||
initPage = 3;
|
||||
}
|
||||
print(initPage);
|
||||
// print(initPage);
|
||||
return initPage;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user