📅  最后修改于: 2022-03-11 14:55:35.133000             🧑  作者: Mango
String greetingMessage(){
var timeNow = DateTime.now().hour;
if (timeNow <= 12) {
return 'Good Morning';
} else if ((timeNow > 12) && (timeNow <= 16)) {
return 'Good Afternoon';
} else if ((timeNow > 16) && (timeNow < 20)) {
return 'Good Evening';
} else {
return 'Good Night';
}
}