Skip to content

armgit / ente

Public Imported from GitHub
0

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

Refine shared selection icon badges

ashilknae88cb4212b5
diff --git a/mobile/apps/photos/lib/ui/components/collection_share_badge.dart b/mobile/apps/photos/lib/ui/components/collection_share_badge.dart
index c7c6c8bc06..e347f997c0 100644
--- a/mobile/apps/photos/lib/ui/components/collection_share_badge.dart
+++ b/mobile/apps/photos/lib/ui/components/collection_share_badge.dart
@@ -2,6 +2,7 @@ import "package:ente_icons/ente_icons.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/viewer/actions/select_all_status_icon.dart";
const double kCollectionBadgeSize = 20.0;
const double kCollectionBadgeIconSize = 12.0;
@@ -34,21 +35,10 @@ class CollectionSelectedBadge extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- return Container(
- width: 18,
- height: 18,
- decoration: BoxDecoration(
- color: colorScheme.primary700,
- shape: BoxShape.circle,
- ),
- padding: const EdgeInsets.all(2),
- child: const HugeIcon(
- icon: HugeIcons.strokeRoundedTick02,
- size: kCollectionBadgeIconSize,
- color: Colors.white,
- strokeWidth: kCollectionBadgeStrokeWidth,
- ),
+ return const SelectAllStatusIcon(
+ isSelected: true,
+ size: 18,
+ tickIconSize: kCollectionBadgeIconSize,
);
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/select_all_status_icon.dart b/mobile/apps/photos/lib/ui/viewer/actions/select_all_status_icon.dart
index e794f9b5c3..0bccc61d2a 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/select_all_status_icon.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/select_all_status_icon.dart
@@ -10,6 +10,8 @@ class SelectAllStatusIcon extends StatelessWidget {
final Color? selectedFillColor;
final Color? selectedTickColor;
final Color? unselectedColor;
+ final double? tickIconSize;
+ final bool selectedTickCutsOut;
const SelectAllStatusIcon({
required this.isSelected,
@@ -17,18 +19,30 @@ class SelectAllStatusIcon extends StatelessWidget {
this.selectedFillColor,
this.selectedTickColor,
this.unselectedColor,
+ this.tickIconSize,
+ this.selectedTickCutsOut = false,
super.key,
});
@override
Widget build(BuildContext context) {
final colors = components.ComponentTheme.colorsOf(context);
- final tickSize = size * _tickScale;
+ final tickSize = tickIconSize ?? size * _tickScale;
final selectedFill = selectedFillColor ?? colors.fillBase;
final selectedTick = selectedTickColor ?? colors.textReverse;
final unselected = unselectedColor ?? colors.textLight;
if (isSelected) {
+ if (selectedTickCutsOut) {
+ return CustomPaint(
+ size: Size.square(size),
+ painter: _SelectedTickCutoutPainter(
+ fillColor: selectedFill,
+ tickSize: tickSize,
+ ),
+ );
+ }
+
return Container(
width: size,
height: size,
@@ -61,3 +75,53 @@ class SelectAllStatusIcon extends StatelessWidget {
);
}
}
+
+class _SelectedTickCutoutPainter extends CustomPainter {
+ static const _tickStrokeWidth = 1.5;
+
+ final Color fillColor;
+ final double tickSize;
+
+ const _SelectedTickCutoutPainter({
+ required this.fillColor,
+ required this.tickSize,
+ });
+
+ @override
+ void paint(Canvas canvas, Size size) {
+ final bounds = Offset.zero & size;
+ canvas.saveLayer(bounds, Paint());
+ canvas.drawCircle(
+ bounds.center,
+ size.shortestSide / 2,
+ Paint()..color = fillColor,
+ );
+
+ final scale = tickSize / 24;
+ final offset = Offset(
+ (size.width - tickSize) / 2,
+ (size.height - tickSize) / 2,
+ );
+ final tickPath = Path()
+ ..moveTo(offset.dx + 5 * scale, offset.dy + 14 * scale)
+ ..lineTo(offset.dx + 8.5 * scale, offset.dy + 17.5 * scale)
+ ..lineTo(offset.dx + 19 * scale, offset.dy + 6.5 * scale);
+
+ canvas.drawPath(
+ tickPath,
+ Paint()
+ ..blendMode = BlendMode.clear
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = _tickStrokeWidth * scale
+ ..strokeCap = StrokeCap.round
+ ..strokeJoin = StrokeJoin.round,
+ );
+ canvas.restore();
+ }
+
+ @override
+ bool shouldRepaint(covariant _SelectedTickCutoutPainter oldDelegate) {
+ return oldDelegate.fillColor != fillColor ||
+ oldDelegate.tickSize != tickSize;
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/component/gallery_file_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/component/gallery_file_widget.dart
index d7ccf35827..da0a032b54 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/component/gallery_file_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/component/gallery_file_widget.dart
@@ -165,7 +165,7 @@ class _GalleryFileWidgetState extends State<GalleryFileWidget> {
isSelected: true,
size: 16,
selectedFillColor: selectionColor, //same for both themes
- selectedTickColor: Colors.black,
+ selectedTickCutsOut: true,
),
),
],