Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix album delete sheet text style

ashilkn9607fcca31ca
diff --git a/mobile/apps/photos/lib/ui/actions/collection/collection_sharing_actions.dart b/mobile/apps/photos/lib/ui/actions/collection/collection_sharing_actions.dart
index 006b2ddda3..50b94c8cd2 100644
--- a/mobile/apps/photos/lib/ui/actions/collection/collection_sharing_actions.dart
+++ b/mobile/apps/photos/lib/ui/actions/collection/collection_sharing_actions.dart
@@ -1,5 +1,6 @@
import "dart:async";
+import 'package:ente_components/ente_components.dart';
import 'package:ente_pure_utils/ente_pure_utils.dart' hide isValidEmail;
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
@@ -18,8 +19,6 @@ import 'package:photos/services/account/user_service.dart';
import 'package:photos/services/collections_service.dart';
import 'package:photos/services/contacts/contact_identity_resolver.dart';
import 'package:photos/services/hidden_service.dart';
-import 'package:photos/theme/colors.dart';
-import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/common/progress_dialog.dart';
import "package:photos/ui/common/user_dialogs.dart";
import 'package:photos/ui/components/action_sheet_widget.dart';
@@ -345,7 +344,7 @@ class CollectionActions {
BuildContext context,
List<Collection> collections,
) async {
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
final actionResult = await showActionSheet(
context: context,
buttons: [
@@ -402,10 +401,10 @@ class CollectionActions {
text: AppLocalizations.of(
context,
).deleteMultipleAlbumDialog(count: collections.length),
- style: textTheme.body.copyWith(color: textMutedDark),
+ style: TextStyles.body.copyWith(color: colors.textLight),
tags: {
'bold': StyledTextTag(
- style: textTheme.body.copyWith(color: textBaseDark),
+ style: TextStyles.body.copyWith(color: colors.textBase),
),
},
),
@@ -432,7 +431,7 @@ class CollectionActions {
BuildContext bContext,
Collection collection,
) async {
- final textTheme = getEnteTextTheme(bContext);
+ final colors = bContext.componentColors;
final currentUserID = Configuration.instance.getUserID()!;
if (collection.owner.id != currentUserID) {
throw AssertionError("Can not delete album owned by others");
@@ -492,10 +491,10 @@ class CollectionActions {
],
bodyWidget: StyledText(
text: AppLocalizations.of(bContext).deleteAlbumDialog,
- style: textTheme.body.copyWith(color: textMutedDark),
+ style: TextStyles.body.copyWith(color: colors.textLight),
tags: {
'bold': StyledTextTag(
- style: textTheme.body.copyWith(color: textBaseDark),
+ style: TextStyles.body.copyWith(color: colors.textBase),
),
},
),
diff --git a/mobile/apps/photos/test/ui/actions/collection/collection_sharing_actions_test.dart b/mobile/apps/photos/test/ui/actions/collection/collection_sharing_actions_test.dart
new file mode 100644
index 0000000000..2cffde216c
--- /dev/null
+++ b/mobile/apps/photos/test/ui/actions/collection/collection_sharing_actions_test.dart
@@ -0,0 +1,69 @@
+import "package:ente_components/ente_components.dart";
+import "package:flutter/material.dart";
+import "package:flutter_test/flutter_test.dart";
+import "package:photos/ente_theme_data.dart";
+import "package:photos/generated/l10n.dart";
+import "package:photos/models/api/collection/user.dart";
+import "package:photos/models/collection/collection.dart";
+import "package:photos/services/collections_service.dart";
+import "package:photos/ui/actions/collection/collection_sharing_actions.dart";
+import "package:styled_text/styled_text.dart";
+
+void main() {
+ group("CollectionActions", () {
+ testWidgets("album delete body uses light theme text colors", (
+ tester,
+ ) async {
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: lightThemeData,
+ localizationsDelegates: AppLocalizations.localizationsDelegates,
+ supportedLocales: AppLocalizations.supportedLocales,
+ home: Scaffold(
+ body: Builder(
+ builder: (context) {
+ return TextButton(
+ onPressed: () async {
+ await CollectionActions(
+ CollectionsService.instance,
+ ).deleteMultipleCollectionSheet(context, [_collection()]);
+ },
+ child: const Text("Delete albums"),
+ );
+ },
+ ),
+ ),
+ ),
+ );
+
+ await tester.tap(find.text("Delete albums"));
+ await tester.pumpAndSettle();
+
+ final colors = ComponentTheme.colorsForApp(
+ ComponentApp.photos,
+ brightness: Brightness.light,
+ );
+ final body = tester.widget<StyledText>(find.byType(StyledText));
+ final boldTag = body.tags["bold"]! as StyledTextTag;
+ expect(body.style, TextStyles.body.copyWith(color: colors.textLight));
+ expect(boldTag.style, TextStyles.body.copyWith(color: colors.textBase));
+ });
+ });
+}
+
+Collection _collection() {
+ return Collection(
+ 1,
+ User(id: 1, email: "[email protected]"),
+ "",
+ null,
+ "Album",
+ null,
+ null,
+ CollectionType.album,
+ CollectionAttributes(),
+ const [],
+ const [],
+ 0,
+ );
+}