Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

refactor: enhance layout and replace custom FilterChip with CollectionChip component

AmanRajSinghMourya88f404258d9c
diff --git a/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart b/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
index 975610ef1e..be818b4a2d 100644
--- a/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
@@ -171,7 +171,7 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {
radius: const Radius.circular(4),
child: SingleChildScrollView(
controller: _scrollController,
- padding: const EdgeInsets.only(right: 12),
+ padding: const EdgeInsets.only(right: 12, bottom: 12),
child: Wrap(
spacing: 8,
runSpacing: 12,
diff --git a/mobile/apps/locker/lib/ui/components/recents_section_widget.dart b/mobile/apps/locker/lib/ui/components/recents_section_widget.dart
index e4720f24b7..9716bb7412 100644
--- a/mobile/apps/locker/lib/ui/components/recents_section_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/recents_section_widget.dart
@@ -11,6 +11,7 @@ import "package:locker/models/selected_files.dart";
import 'package:locker/services/collections/collections_service.dart';
import 'package:locker/services/collections/models/collection.dart';
import 'package:locker/services/files/sync/models/file.dart';
+import 'package:locker/ui/components/collection_chip.dart';
import "package:locker/ui/components/empty_state_widget.dart";
import 'package:locker/ui/components/item_list_view.dart';
import 'package:locker/ui/pages/all_collections_page.dart';
@@ -512,27 +513,30 @@ class _FilterChipsRow extends StatelessWidget {
),
const SizedBox(width: 8),
Expanded(
- child: AnimatedSwitcher(
- duration: const Duration(milliseconds: 300),
- child: ListView.builder(
- key: ValueKey(listKey),
- scrollDirection: Axis.horizontal,
- itemCount: chips.length,
- itemBuilder: (context, index) {
- final chip = chips[index];
- return AnimatedContainer(
- duration: const Duration(milliseconds: 200),
- margin: const EdgeInsets.only(right: 8),
- child: _FilterChip(
- label: chip.label,
- isSelected: chip.isSelected,
- onTap: chip.onTap,
- colorScheme: colorScheme,
- textTheme: textTheme,
- backgroundColor: colorScheme.backdropBase,
- ),
- );
- },
+ child: ClipRRect(
+ borderRadius: BorderRadius.circular(16),
+ child: AnimatedSwitcher(
+ duration: const Duration(milliseconds: 300),
+ child: ListView.builder(
+ key: ValueKey(listKey),
+ scrollDirection: Axis.horizontal,
+ itemCount: chips.length,
+ itemBuilder: (context, index) {
+ final chip = chips[index];
+ return AnimatedContainer(
+ duration: const Duration(milliseconds: 200),
+ margin: const EdgeInsets.only(right: 8),
+ child: CollectionChip(
+ label: chip.label,
+ isSelected: chip.isSelected,
+ onTap: chip.onTap,
+ colorScheme: colorScheme,
+ textTheme: textTheme,
+ backgroundColor: colorScheme.backdropBase,
+ ),
+ );
+ },
+ ),
),
),
),
@@ -607,77 +611,6 @@ class _FilterIconButton extends StatelessWidget {
}
}
-class _FilterChip extends StatelessWidget {
- const _FilterChip({
- required this.label,
- required this.isSelected,
- required this.onTap,
- required this.colorScheme,
- required this.textTheme,
- required this.backgroundColor,
- });
-
- final String label;
- final bool isSelected;
- final VoidCallback onTap;
- final EnteColorScheme colorScheme;
- final EnteTextTheme textTheme;
- final Color backgroundColor;
-
- @override
- Widget build(BuildContext context) {
- return AnimatedSize(
- duration: const Duration(milliseconds: 300),
- curve: Curves.easeOut,
- alignment: Alignment.centerLeft,
- child: GestureDetector(
- onTap: onTap,
- child: Container(
- constraints: const BoxConstraints(minHeight: 44),
- padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
- decoration: BoxDecoration(
- color: isSelected ? colorScheme.primary700 : backgroundColor,
- borderRadius: BorderRadius.circular(16),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- label,
- style: textTheme.small.copyWith(
- color: isSelected ? Colors.white : colorScheme.textMuted,
- ),
- ),
- AnimatedSwitcher(
- duration: const Duration(milliseconds: 300),
- switchInCurve: Curves.easeOut,
- switchOutCurve: Curves.easeIn,
- transitionBuilder: (Widget child, Animation<double> animation) {
- return SlideTransition(
- position: Tween<Offset>(
- begin: const Offset(1.0, 0.0),
- end: Offset.zero,
- ).animate(
- CurvedAnimation(
- parent: animation,
- curve: Curves.easeOut,
- ),
- ),
- child: FadeTransition(
- opacity: animation,
- child: child,
- ),
- );
- },
- ),
- ],
- ),
- ),
- ),
- );
- }
-}
-
class _FilterClearButton extends StatelessWidget {
const _FilterClearButton({
required this.onTap,
@@ -808,7 +741,7 @@ class _FilterBottomSheet extends StatelessWidget {
spacing: 8,
runSpacing: 8,
children: chips.map((chip) {
- return _FilterChip(
+ return CollectionChip(
label: chip.label,
isSelected: chip.isSelected,
onTap: chip.onTap,