Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update selection sheet styling tokens

ashilkn2a485ba60a4d
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/action_bar_widget.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/action_bar_widget.dart
index c6568ef9f8..7ee0c7cc0a 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/action_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/action_bar_widget.dart
@@ -1,8 +1,8 @@
+import 'package:ente_components/ente_components.dart' as components;
import 'package:flutter/material.dart';
import 'package:photos/core/configuration.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/selected_files.dart';
-import 'package:photos/theme/ente_theme.dart';
class ActionBarWidget extends StatefulWidget {
final SelectedFiles? selectedFiles;
@@ -42,7 +42,10 @@ class _ActionBarWidgetState extends State<ActionBarWidget> {
@override
Widget build(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
+ final colors = components.ComponentTheme.colorsOf(context);
+ final miniStyle = components.TextStyles.mini.copyWith(
+ color: colors.textBase,
+ );
return SizedBox(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 8, 20, 8),
@@ -64,7 +67,7 @@ class _ActionBarWidgetState extends State<ActionBarWidget> {
: AppLocalizations.of(context).selectedPhotos(
count: _selectedFilesNotifier.value,
),
- style: textTheme.miniMuted,
+ style: miniStyle,
);
},
),
@@ -82,7 +85,7 @@ class _ActionBarWidgetState extends State<ActionBarWidget> {
alignment: Alignment.centerRight,
child: Text(
AppLocalizations.of(context).cancel,
- style: textTheme.mini,
+ style: miniStyle,
),
),
),
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_action_bar_widget.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_action_bar_widget.dart
index 33ded23c07..ead83c8012 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_action_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_action_bar_widget.dart
@@ -1,7 +1,7 @@
+import "package:ente_components/ente_components.dart" as components;
import "package:flutter/material.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/selected_albums.dart";
-import "package:photos/theme/ente_theme.dart";
class AlbumActionBarWidget extends StatefulWidget {
final SelectedAlbums? selectedAlbums;
@@ -34,7 +34,10 @@ class _AlbumActionBarWidgetState extends State<AlbumActionBarWidget> {
@override
Widget build(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
+ final colors = components.ComponentTheme.colorsOf(context);
+ final miniStyle = components.TextStyles.mini.copyWith(
+ color: colors.textBase,
+ );
return SizedBox(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 8, 20, 8),
@@ -50,7 +53,7 @@ class _AlbumActionBarWidgetState extends State<AlbumActionBarWidget> {
AppLocalizations.of(context).selectedAlbums(
count: widget.selectedAlbums?.albums.length ?? 0,
),
- style: textTheme.miniMuted,
+ style: miniStyle,
);
},
),
@@ -68,7 +71,7 @@ class _AlbumActionBarWidgetState extends State<AlbumActionBarWidget> {
alignment: Alignment.centerRight,
child: Text(
AppLocalizations.of(context).cancel,
- style: textTheme.mini,
+ style: miniStyle,
),
),
),
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_bottom_action_bar_widget.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_bottom_action_bar_widget.dart
index 3312584085..79f6d070bf 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_bottom_action_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/album_bottom_action_bar_widget.dart
@@ -1,7 +1,7 @@
+import "package:ente_components/ente_components.dart" as components;
import "package:flutter/material.dart";
import "package:photos/core/constants.dart";
import "package:photos/models/selected_albums.dart";
-import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/collections/collection_list_page.dart";
import "package:photos/ui/components/bottom_action_bar/album_action_bar_widget.dart";
import "package:photos/ui/components/divider_widget.dart";
@@ -25,13 +25,13 @@ class AlbumBottomActionBarWidget extends StatelessWidget {
Widget build(BuildContext context) {
final bottomPadding = MediaQuery.paddingOf(context).bottom;
final widthOfScreen = MediaQuery.sizeOf(context).width;
- final colorScheme = getEnteColorScheme(context);
+ final colors = components.ComponentTheme.colorsOf(context);
final double leftRightPadding = widthOfScreen > restrictedMaxWidth
? (widthOfScreen - restrictedMaxWidth) / 2
: 0;
return Container(
decoration: BoxDecoration(
- color: backgroundColor ?? colorScheme.backgroundElevated2,
+ color: backgroundColor ?? colors.fillLight,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart
index f2c16c8c39..a554042a7b 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/bottom_action_bar_widget.dart
@@ -1,10 +1,10 @@
+import "package:ente_components/ente_components.dart" as components;
import 'package:flutter/material.dart';
import 'package:photos/core/constants.dart';
import 'package:photos/models/collection/collection.dart';
import "package:photos/models/gallery_type.dart";
import "package:photos/models/ml/face/person.dart";
import 'package:photos/models/selected_files.dart';
-import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/components/bottom_action_bar/action_bar_widget.dart';
import "package:photos/ui/components/divider_widget.dart";
import "package:photos/ui/viewer/actions/file_selection_actions_widget.dart";
@@ -33,13 +33,13 @@ class BottomActionBarWidget extends StatelessWidget {
Widget build(BuildContext context) {
final bottomPadding = MediaQuery.paddingOf(context).bottom;
final widthOfScreen = MediaQuery.of(context).size.width;
- final colorScheme = getEnteColorScheme(context);
+ final colors = components.ComponentTheme.colorsOf(context);
final double leftRightPadding = widthOfScreen > restrictedMaxWidth
? (widthOfScreen - restrictedMaxWidth) / 2
: 0;
return Container(
decoration: BoxDecoration(
- color: backgroundColor ?? colorScheme.backgroundElevated2,
+ color: backgroundColor ?? colors.fillLight,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_action_bar_widget.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_action_bar_widget.dart
index ea0214e4aa..3aaf183bc9 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_action_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_action_bar_widget.dart
@@ -1,7 +1,7 @@
+import "package:ente_components/ente_components.dart" as components;
import "package:flutter/material.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/models/selected_people.dart";
-import "package:photos/theme/ente_theme.dart";
class PeopleActionBarWidget extends StatefulWidget {
final SelectedPeople? selectedPeople;
@@ -34,7 +34,10 @@ class _PeopleActionBarWidgetState extends State<PeopleActionBarWidget> {
@override
Widget build(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
+ final colors = components.ComponentTheme.colorsOf(context);
+ final miniStyle = components.TextStyles.mini.copyWith(
+ color: colors.textBase,
+ );
return SizedBox(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 8, 20, 8),
@@ -49,7 +52,7 @@ class _PeopleActionBarWidgetState extends State<PeopleActionBarWidget> {
final count = widget.selectedPeople?.personIds.length ?? 0;
return Text(
AppLocalizations.of(context).selectedPhotos(count: count),
- style: textTheme.miniMuted,
+ style: miniStyle,
);
},
),
@@ -67,7 +70,7 @@ class _PeopleActionBarWidgetState extends State<PeopleActionBarWidget> {
alignment: Alignment.centerRight,
child: Text(
AppLocalizations.of(context).cancel,
- style: textTheme.mini,
+ style: miniStyle,
),
),
),
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_bottom_action_bar_widget.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_bottom_action_bar_widget.dart
index db73e07a9f..41eb6ca3be 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_bottom_action_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/people_bottom_action_bar_widget.dart
@@ -1,7 +1,7 @@
+import "package:ente_components/ente_components.dart" as components;
import "package:flutter/material.dart";
import "package:photos/core/constants.dart";
import "package:photos/models/selected_people.dart";
-import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/components/bottom_action_bar/people_action_bar_widget.dart";
import "package:photos/ui/components/divider_widget.dart";
import "package:photos/ui/viewer/actions/people_selection_action_widget.dart";
@@ -22,13 +22,13 @@ class PeopleBottomActionBarWidget extends StatelessWidget {
Widget build(BuildContext context) {
final bottomPadding = MediaQuery.paddingOf(context).bottom;
final widthOfScreen = MediaQuery.sizeOf(context).width;
- final colorScheme = getEnteColorScheme(context);
+ final colors = components.ComponentTheme.colorsOf(context);
final double leftRightPadding = widthOfScreen > restrictedMaxWidth
? (widthOfScreen - restrictedMaxWidth) / 2
: 0;
return Container(
decoration: BoxDecoration(
- color: backgroundColor ?? colorScheme.backgroundElevated2,
+ color: backgroundColor ?? colors.fillLight,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
diff --git a/mobile/apps/photos/lib/ui/components/bottom_action_bar/selection_action_button_widget.dart b/mobile/apps/photos/lib/ui/components/bottom_action_bar/selection_action_button_widget.dart
index 8ca5e90470..49a96b834b 100644
--- a/mobile/apps/photos/lib/ui/components/bottom_action_bar/selection_action_button_widget.dart
+++ b/mobile/apps/photos/lib/ui/components/bottom_action_bar/selection_action_button_widget.dart
@@ -1,8 +1,8 @@
import 'dart:math' as math;
+import "package:ente_components/ente_components.dart" as components;
import "package:flutter/material.dart";
import "package:flutter_svg/svg.dart";
-import "package:photos/theme/ente_theme.dart";
/// Pass icon or asset path of svg
class SelectionActionButton extends StatelessWidget {
@@ -12,6 +12,7 @@ class SelectionActionButton extends StatelessWidget {
final String? svgAssetPath;
final VoidCallback? onTap;
final bool shouldShow;
+ final bool isCritical;
const SelectionActionButton({
required this.labelText,
@@ -20,6 +21,7 @@ class SelectionActionButton extends StatelessWidget {
this.svgAssetPath,
this.iconWidget,
this.shouldShow = true,
+ this.isCritical = false,
super.key,
});
@@ -38,6 +40,7 @@ class SelectionActionButton extends StatelessWidget {
onTap: onTap,
svgAssetPath: svgAssetPath,
iconWidget: iconWidget,
+ isCritical: isCritical,
)
: const SizedBox(
height: 60,
@@ -53,9 +56,11 @@ class _Body extends StatefulWidget {
final String? svgAssetPath;
final Widget? iconWidget;
final VoidCallback? onTap;
+ final bool isCritical;
const _Body({
required this.labelText,
required this.onTap,
+ required this.isCritical,
this.icon,
this.svgAssetPath,
this.iconWidget,
@@ -73,12 +78,18 @@ class __BodyState extends State<_Body> {
@override
Widget build(BuildContext context) {
widthOfButton = getWidthOfButton();
- final colorScheme = getEnteColorScheme(context);
+ final colors = components.ComponentTheme.colorsOf(context);
+ final foregroundColor = widget.isCritical
+ ? colors.warning
+ : colors.textBase;
+ final labelStyle = components.TextStyles.mini.copyWith(
+ color: foregroundColor,
+ );
return GestureDetector(
onTap: widget.onTap,
onTapDown: (details) {
setState(() {
- backgroundColor = colorScheme.fillFaintPressed;
+ backgroundColor = colors.fillDark;
});
},
onTapUp: (details) {
@@ -110,34 +121,14 @@ class __BodyState extends State<_Body> {
child: Icon(
widget.icon,
size: 24,
- color: getEnteColorScheme(context).primary300,
- shadows: const [
- BoxShadow(
- color: Color.fromARGB(12, 0, 179, 60),
- offset: Offset(0, 2.51),
- blurRadius: 5.02,
- spreadRadius: 0,
- ),
- BoxShadow(
- color: Color.fromARGB(24, 0, 179, 60),
- offset: Offset(0, 1.25),
- blurRadius: 3.76,
- spreadRadius: 0,
- ),
- BoxShadow(
- color: Color.fromARGB(24, 0, 179, 60),
- offset: Offset(0, 0.63),
- blurRadius: 1.88,
- spreadRadius: 0,
- ),
- ],
+ color: foregroundColor,
),
)
else if (widget.svgAssetPath != null)
SvgPicture.asset(
widget.svgAssetPath!,
colorFilter: ColorFilter.mode(
- getEnteColorScheme(context).textMuted,
+ foregroundColor,
BlendMode.srcIn,
),
width: 24,
@@ -149,14 +140,14 @@ class __BodyState extends State<_Body> {
Icon(
widget.icon,
size: 24,
- color: getEnteColorScheme(context).textMuted,
+ color: foregroundColor,
),
const SizedBox(height: 4),
Text(
widget.labelText,
textAlign: TextAlign.center,
//textTheme in [getWidthOfLongestWord] should be same as this
- style: getEnteTextTheme(context).miniMuted,
+ style: labelStyle,
),
],
),
@@ -180,8 +171,10 @@ class __BodyState extends State<_Body> {
double maxWidth = 0.0;
for (String word in words) {
- final width =
- computeWidthOfWord(word, getEnteTextTheme(context).miniMuted);
+ final width = computeWidthOfWord(
+ word,
+ components.TextStyles.mini,
+ );
if (width > maxWidth) {
maxWidth = width;
}
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
index 2d7afab392..c6fafc83b9 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
@@ -100,6 +100,7 @@ class _AlbumSelectionActionWidgetState
labelText: AppLocalizations.of(context).delete,
icon: Icons.delete_outline,
onTap: _trashCollection,
+ isCritical: true,
),
);
items.add(
@@ -125,6 +126,7 @@ class _AlbumSelectionActionWidgetState
labelText: AppLocalizations.of(context).delete,
icon: Icons.delete_outline,
onTap: _trashCollection,
+ isCritical: true,
),
);
} else if (widget.sectionType == UISectionType.hiddenCollections) {
@@ -141,6 +143,7 @@ class _AlbumSelectionActionWidgetState
labelText: AppLocalizations.of(context).delete,
icon: Icons.delete_outline,
onTap: _trashCollection,
+ isCritical: true,
),
);
} else {
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_overlay_bar.dart b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_overlay_bar.dart
index cf3c4304cc..b98ab6e01e 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_overlay_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_overlay_bar.dart
@@ -1,9 +1,9 @@
+import "package:ente_components/ente_components.dart" as components;
import 'package:flutter/material.dart';
import "package:photos/generated/l10n.dart";
import "package:photos/models/collection/collection.dart";
import "package:photos/models/selected_albums.dart";
import "package:photos/theme/effects.dart";
-import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/collections/collection_list_page.dart";
import "package:photos/ui/components/bottom_action_bar/album_bottom_action_bar_widget.dart";
@@ -119,7 +119,7 @@ class _SelectAllAlbumsButtonState extends State<SelectAllAlbumsButton> {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
+ final colors = components.ComponentTheme.colorsOf(context);
return GestureDetector(
onTap: () {
setState(() {
@@ -138,7 +138,7 @@ class _SelectAllAlbumsButtonState extends State<SelectAllAlbumsButton> {
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
- color: widget.backgroundColor ?? colorScheme.backgroundElevated2,
+ color: widget.backgroundColor ?? colors.fillLight,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
@@ -154,7 +154,9 @@ class _SelectAllAlbumsButtonState extends State<SelectAllAlbumsButton> {
children: [
Text(
AppLocalizations.of(context).selectAllShort,
- style: getEnteTextTheme(context).miniMuted,
+ style: components.TextStyles.mini.copyWith(
+ color: colors.textBase,
+ ),
),
const SizedBox(width: 4),
ListenableBuilder(
@@ -170,7 +172,7 @@ class _SelectAllAlbumsButtonState extends State<SelectAllAlbumsButton> {
_allSelected
? Icons.check_circle
: Icons.check_circle_outline,
- color: _allSelected ? null : colorScheme.strokeMuted,
+ color: colors.textBase,
size: 18,
);
},
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
index 390492210c..cacc446da5 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
@@ -178,6 +178,7 @@ class _FileSelectionActionsWidgetState
icon: Icons.delete_forever_outlined,
labelText: AppLocalizations.of(context).permanentlyDelete,
onTap: _permanentlyDelete,
+ isCritical: true,
),
);
} else if (widget.type == GalleryType.cleanupHiddenFromDevice) {
@@ -186,6 +187,7 @@ class _FileSelectionActionsWidgetState
icon: Icons.delete_outline,
labelText: AppLocalizations.of(context).deleteFromDevice,
onTap: _deleteSelectedFromDevice,
+ isCritical: true,
),
);
} else if (widget.type == GalleryType.deleteSuggestions) {
@@ -194,6 +196,7 @@ class _FileSelectionActionsWidgetState
icon: Icons.delete_outline,
labelText: AppLocalizations.of(context).delete,
onTap: split.ownedByCurrentUser.isNotEmpty ? _onDeleteClick : null,
+ isCritical: true,
),
);
items.add(
@@ -318,6 +321,7 @@ class _FileSelectionActionsWidgetState
labelText: AppLocalizations.of(context).delete,
onTap: anyOwnedFiles ? _onDeleteClick : null,
shouldShow: allOwnedFiles,
+ isCritical: true,
),
);
}
@@ -457,6 +461,7 @@ class _FileSelectionActionsWidgetState
icon: Icons.delete_forever_outlined,
labelText: AppLocalizations.of(context).permanentlyDelete,
onTap: _permanentlyDelete,
+ isCritical: true,
),
);
}
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
index a32b7dbd55..14acb78bfd 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
@@ -1,5 +1,6 @@
import "dart:io";
+import "package:ente_components/ente_components.dart" as components;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import "package:photos/generated/l10n.dart";
@@ -11,7 +12,6 @@ import "package:photos/models/search/hierarchical/hierarchical_search_filter.dar
import "package:photos/models/search/hierarchical/only_them_filter.dart";
import 'package:photos/models/selected_files.dart';
import "package:photos/theme/effects.dart";
-import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/components/bottom_action_bar/bottom_action_bar_widget.dart';
import "package:photos/ui/viewer/gallery/state/boundary_reporter_mixin.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
@@ -272,7 +272,7 @@ class _SelectAllButtonState extends State<SelectAllButton> {
selectionState != null,
"SelectionState not found in context, SelectionState should be an ancestor of FileSelectionOverlayBar",
);
- final colorScheme = getEnteColorScheme(context);
+ final colors = components.ComponentTheme.colorsOf(context);
return GestureDetector(
onTap: () {
HapticFeedback.selectionClick();
@@ -292,7 +292,7 @@ class _SelectAllButtonState extends State<SelectAllButton> {
child: Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
- color: widget.backgroundColor ?? colorScheme.backgroundElevated2,
+ color: widget.backgroundColor ?? colors.fillLight,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
@@ -308,7 +308,9 @@ class _SelectAllButtonState extends State<SelectAllButton> {
children: [
Text(
AppLocalizations.of(context).selectAllShort,
- style: getEnteTextTheme(context).miniMuted,
+ style: components.TextStyles.mini.copyWith(
+ color: colors.textBase,
+ ),
),
const SizedBox(width: 4),
ListenableBuilder(
@@ -324,7 +326,7 @@ class _SelectAllButtonState extends State<SelectAllButton> {
_allSelected
? Icons.check_circle
: Icons.check_circle_outline,
- color: _allSelected ? null : colorScheme.strokeMuted,
+ color: colors.textBase,
size: 18,
);
},