Skip to content

Commit

Permalink
fix: correct greeting
Browse files Browse the repository at this point in the history
  • Loading branch information
Mastersam07 committed Nov 14, 2024
1 parent e432298 commit a1297f4
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ class HomeScreen extends ConsumerStatefulWidget {
class _HomeScreenState extends ConsumerState<HomeScreen> {
EventDay _day = EventDay.one;

String get _getGreeting {
final hour = DateTime.now().hour;
if (hour < 12) {
return '🌤️ Good morning';
} else if (hour < 17) {
return '🌞 Good afternoon';
} else {
return '🌙 Good evening';
}
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -70,7 +81,7 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
SliverToBoxAdapter(
child: HeaderText(
title: Text(
'🌤️ Good morning, ${ref.watch(userViewModelNotifier.select((value) => value.user.fullName.split(' ').first))}'),
'$_getGreeting, ${ref.watch(userViewModelNotifier.select((value) => value.user.fullName.split(' ').first))}'),
subtitle: Text(
'You start on the street, work till you are eleniyan.'),
),
Expand Down

0 comments on commit a1297f4

Please sign in to comment.