mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-30 18:22:37 -04:00 
			
		
		
		
	* chore: bump dart sdk to 3.8 * chore: make build * make pigeon * chore: format files --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
		
			
				
	
	
		
			85 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:easy_localization/easy_localization.dart';
 | |
| import 'package:flutter/material.dart';
 | |
| import 'package:flutter_hooks/flutter_hooks.dart';
 | |
| import 'package:hooks_riverpod/hooks_riverpod.dart';
 | |
| import 'package:immich_mobile/extensions/build_context_extensions.dart';
 | |
| import 'package:immich_mobile/extensions/theme_extensions.dart';
 | |
| import 'package:immich_mobile/widgets/asset_grid/asset_grid_data_structure.dart';
 | |
| import 'package:immich_mobile/providers/app_settings.provider.dart';
 | |
| import 'package:immich_mobile/services/app_settings.service.dart';
 | |
| import 'package:immich_mobile/providers/haptic_feedback.provider.dart';
 | |
| 
 | |
| class GroupDividerTitle extends HookConsumerWidget {
 | |
|   const GroupDividerTitle({
 | |
|     super.key,
 | |
|     required this.text,
 | |
|     required this.multiselectEnabled,
 | |
|     required this.onSelect,
 | |
|     required this.onDeselect,
 | |
|     required this.selected,
 | |
|   });
 | |
| 
 | |
|   final String text;
 | |
|   final bool multiselectEnabled;
 | |
|   final Function onSelect;
 | |
|   final Function onDeselect;
 | |
|   final bool selected;
 | |
| 
 | |
|   @override
 | |
|   Widget build(BuildContext context, WidgetRef ref) {
 | |
|     final appSettingService = ref.watch(appSettingsServiceProvider);
 | |
|     final groupBy = useState(GroupAssetsBy.day);
 | |
| 
 | |
|     useEffect(() {
 | |
|       groupBy.value = GroupAssetsBy.values[appSettingService.getSetting<int>(AppSettingsEnum.groupAssetsBy)];
 | |
|       return null;
 | |
|     }, []);
 | |
| 
 | |
|     void handleTitleIconClick() {
 | |
|       ref.read(hapticFeedbackProvider.notifier).heavyImpact();
 | |
|       if (selected) {
 | |
|         onDeselect();
 | |
|       } else {
 | |
|         onSelect();
 | |
|       }
 | |
|     }
 | |
| 
 | |
|     return Padding(
 | |
|       padding: EdgeInsets.only(
 | |
|         top: groupBy.value == GroupAssetsBy.month ? 32.0 : 16.0,
 | |
|         bottom: 16.0,
 | |
|         left: 12.0,
 | |
|         right: 12.0,
 | |
|       ),
 | |
|       child: Row(
 | |
|         children: [
 | |
|           Text(
 | |
|             text,
 | |
|             style: groupBy.value == GroupAssetsBy.month
 | |
|                 ? context.textTheme.bodyLarge?.copyWith(fontSize: 24.0)
 | |
|                 : context.textTheme.labelLarge?.copyWith(
 | |
|                     color: context.textTheme.labelLarge?.color?.withAlpha(250),
 | |
|                     fontWeight: FontWeight.w500,
 | |
|                   ),
 | |
|           ),
 | |
|           const Spacer(),
 | |
|           GestureDetector(
 | |
|             onTap: handleTitleIconClick,
 | |
|             child: multiselectEnabled && selected
 | |
|                 ? Icon(
 | |
|                     Icons.check_circle_rounded,
 | |
|                     color: context.primaryColor,
 | |
|                     semanticLabel: "unselect_all_in".tr(namedArgs: {"group": text}),
 | |
|                   )
 | |
|                 : Icon(
 | |
|                     Icons.check_circle_outline_rounded,
 | |
|                     color: context.colorScheme.onSurfaceSecondary,
 | |
|                     semanticLabel: "select_all_in".tr(namedArgs: {"group": text}),
 | |
|                   ),
 | |
|           ),
 | |
|         ],
 | |
|       ),
 | |
|     );
 | |
|   }
 | |
| }
 |