mirror of
				https://github.com/johrpan/memor.git
				synced 2025-10-28 03:07:25 +01:00 
			
		
		
		
	Highlight memos from the past
This commit is contained in:
		
							parent
							
								
									3b33e6879a
								
							
						
					
					
						commit
						c8a93c715f
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		|  | @ -41,6 +41,7 @@ class HomeScreen extends StatelessWidget { | ||||||
|               builder: (context, snapshot) { |               builder: (context, snapshot) { | ||||||
|                 if (snapshot.hasData) { |                 if (snapshot.hasData) { | ||||||
|                   final memos = snapshot.data; |                   final memos = snapshot.data; | ||||||
|  |                   final now = DateTime.now(); | ||||||
| 
 | 
 | ||||||
|                   if (memos.isNotEmpty) { |                   if (memos.isNotEmpty) { | ||||||
|                     return ListView.builder( |                     return ListView.builder( | ||||||
|  | @ -48,6 +49,7 @@ class HomeScreen extends StatelessWidget { | ||||||
|                       itemBuilder: (context, index) { |                       itemBuilder: (context, index) { | ||||||
|                         final memo = memos[index]; |                         final memo = memos[index]; | ||||||
|                         final scheduled = memo.scheduled; |                         final scheduled = memo.scheduled; | ||||||
|  |                         final isPast = scheduled.compareTo(now) <= 0; | ||||||
|                         final dateString = scheduled.dateString(context); |                         final dateString = scheduled.dateString(context); | ||||||
|                         final timeOfDayString = |                         final timeOfDayString = | ||||||
|                             scheduled.timeOfDay.format(context); |                             scheduled.timeOfDay.format(context); | ||||||
|  | @ -69,7 +71,11 @@ class HomeScreen extends StatelessWidget { | ||||||
|                           child: ListTile( |                           child: ListTile( | ||||||
|                             title: Text(memo.text), |                             title: Text(memo.text), | ||||||
|                             subtitle: Text( |                             subtitle: Text( | ||||||
|                                 l10n.scheduled(dateString, timeOfDayString)), |                               l10n.scheduled(dateString, timeOfDayString), | ||||||
|  |                               style: TextStyle( | ||||||
|  |                                 color: isPast ? Colors.red : null, | ||||||
|  |                               ), | ||||||
|  |                             ), | ||||||
|                             onTap: () async { |                             onTap: () async { | ||||||
|                               final result = |                               final result = | ||||||
|                                   await _showMemoEditor(context, memo); |                                   await _showMemoEditor(context, memo); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Elias Projahn
						Elias Projahn