Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] Migrate collection and sharing surfaces to component theme

aman-pilote51129f1dd2e
diff --git a/mobile/apps/locker/lib/ui/components/collection_list_widget.dart b/mobile/apps/locker/lib/ui/components/collection_list_widget.dart
index 3cb4e50cfa..9c22477ca6 100644
--- a/mobile/apps/locker/lib/ui/components/collection_list_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/collection_list_widget.dart
@@ -1,6 +1,6 @@
+import "package:ente_components/ente_components.dart";
import "package:ente_sharing/models/user.dart";
import "package:ente_sharing/user_avator_widget.dart";
-import "package:ente_ui/theme/ente_theme.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:locker/extensions/collection_extension.dart";
@@ -28,8 +28,7 @@ class CollectionListWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
final bool isFavourite = collection.type == CollectionType.favorites;
final bool hasSharees = collection.sharees.isNotEmpty;
@@ -45,39 +44,37 @@ class CollectionListWidget extends StatelessWidget {
child: Row(
children: [
SizedBox(
- height: 60,
- width: 60,
+ height: 40,
+ width: 40,
child: Stack(
+ clipBehavior: Clip.none,
children: [
- Padding(
- padding: const EdgeInsets.all(10.0),
- child: Container(
- decoration: BoxDecoration(
- color: colorScheme.backgroundElevated,
- borderRadius: BorderRadius.circular(12),
- ),
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: collection.type == CollectionType.favorites
- ? HugeIcon(
- icon: HugeIcons.strokeRoundedStar,
- color: colorScheme.primary700,
- )
- : HugeIcon(
- icon: HugeIcons.strokeRoundedWallet05,
- color: colorScheme.textBase,
- ),
- ),
+ Container(
+ decoration: BoxDecoration(
+ color: colors.backgroundBase,
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: collection.type == CollectionType.favorites
+ ? HugeIcon(
+ icon: HugeIcons.strokeRoundedStar,
+ color: colors.primary,
+ )
+ : HugeIcon(
+ icon: HugeIcons.strokeRoundedWallet05,
+ color: colors.textBase,
+ ),
),
),
if (showSharingIndicator)
Positioned(
- right: 1,
- bottom: 10,
+ right: -4,
+ bottom: -4,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
- color: colorScheme.backdropBase,
+ color: colors.fillLight,
),
padding: const EdgeInsets.all(1.0),
child: HugeIcon(
@@ -85,7 +82,7 @@ class CollectionListWidget extends StatelessWidget {
? HugeIcons.strokeRoundedCircleArrowUpRight
: HugeIcons.strokeRoundedCircleArrowDownLeft,
strokeWidth: 2.0,
- color: colorScheme.primary700,
+ color: colors.primary,
size: 16.0,
),
),
@@ -101,6 +98,7 @@ class CollectionListWidget extends StatelessWidget {
children: [
Text(
collection.displayName ?? 'Unnamed Collection',
+ style: TextStyles.body,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
@@ -110,9 +108,7 @@ class CollectionListWidget extends StatelessWidget {
final fileCount = snapshot.data ?? 0;
return Text(
context.l10n.items(fileCount),
- style: textTheme.small.copyWith(
- color: colorScheme.textMuted,
- ),
+ style: TextStyles.mini.copyWith(color: colors.textLight),
);
},
),
@@ -145,14 +141,13 @@ class CollectionListWidget extends StatelessWidget {
return AnimatedContainer(
duration: const Duration(milliseconds: 300),
curve: Curves.easeOut,
+ padding: const EdgeInsets.only(left: 12, top: 12, bottom: 12),
decoration: BoxDecoration(
border: Border.all(
- color: isSelected
- ? colorScheme.primary700
- : colorScheme.backdropBase,
+ color: isSelected ? colors.strokeDark : colors.fillLight,
width: 1.5,
),
- color: colorScheme.backdropBase,
+ color: colors.fillLight,
borderRadius: const BorderRadius.all(Radius.circular(20)),
),
child: Row(
@@ -176,11 +171,21 @@ class CollectionListWidget extends StatelessWidget {
);
},
child: isSelected
- ? Icon(
+ ? Container(
key: const ValueKey("selected"),
- Icons.check_circle_rounded,
- color: colorScheme.primary700,
- size: 24,
+ width: 18,
+ height: 18,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ color: colors.primary,
+ shape: BoxShape.circle,
+ ),
+ child: const HugeIcon(
+ icon: HugeIcons.strokeRoundedTick02,
+ color: Colors.white,
+ size: 12,
+ strokeWidth: 2,
+ ),
)
: showSharingIndicator
? (isIncoming
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 b7f721bc6c..41e52f4993 100644
--- a/mobile/apps/locker/lib/ui/components/recents_section_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/recents_section_widget.dart
@@ -1,7 +1,4 @@
import "package:ente_components/ente_components.dart";
-import "package:ente_ui/theme/colors.dart";
-import 'package:ente_ui/theme/ente_theme.dart';
-import "package:ente_ui/theme/text_style.dart";
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import "package:hugeicons/hugeicons.dart";
@@ -545,8 +542,7 @@ class _FilterBottomSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
return Column(
mainAxisSize: MainAxisSize.min,
@@ -558,15 +554,13 @@ class _FilterBottomSheet extends StatelessWidget {
_ActionPillButton(
label: context.l10n.seeAllCollections,
onTap: onSeeAllCollections,
- colorScheme: colorScheme,
- textTheme: textTheme,
+ colors: colors,
),
const Spacer(),
_ActionPillButton(
label: context.l10n.clearAllFilters,
onTap: onClearAllFilters,
- colorScheme: colorScheme,
- textTheme: textTheme,
+ colors: colors,
),
],
),
@@ -605,14 +599,12 @@ class _ActionPillButton extends StatelessWidget {
const _ActionPillButton({
required this.label,
required this.onTap,
- required this.colorScheme,
- required this.textTheme,
+ required this.colors,
});
final String label;
final VoidCallback onTap;
- final EnteColorScheme colorScheme;
- final EnteTextTheme textTheme;
+ final ColorTokens colors;
@override
Widget build(BuildContext context) {
@@ -620,12 +612,12 @@ class _ActionPillButton extends StatelessWidget {
onTap: onTap,
child: Container(
decoration: BoxDecoration(
- color: colorScheme.backgroundElevated2,
+ color: colors.fillLight,
borderRadius: BorderRadius.circular(50),
- border: Border.all(color: colorScheme.strokeFaint, width: 1),
+ border: Border.all(color: colors.strokeFaint, width: 1),
),
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
- child: Text(label, style: textTheme.small),
+ child: Text(label, style: TextStyles.body),
),
);
}
diff --git a/mobile/apps/locker/lib/ui/components/selection_action_button_widget.dart b/mobile/apps/locker/lib/ui/components/selection_action_button_widget.dart
index e18f41c1b1..5e71eb72e4 100644
--- a/mobile/apps/locker/lib/ui/components/selection_action_button_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/selection_action_button_widget.dart
@@ -1,4 +1,4 @@
-import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
class SelectionActionButton extends StatelessWidget {
@@ -22,16 +22,15 @@ class SelectionActionButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final color = isDestructive ? colorScheme.warning500 : colorScheme.textBase;
+ final colors = context.componentColors;
+ final color = isDestructive ? colors.warning : colors.textBase;
final iconWidget = hugeIcon ?? Icon(icon!, color: color, size: 24);
return GestureDetector(
onTap: onTap,
child: Container(
decoration: BoxDecoration(
- color: colorScheme.backgroundElevated2,
+ color: colors.fillLight,
borderRadius: BorderRadius.circular(24.0),
),
padding: const EdgeInsets.symmetric(vertical: 16.0),
@@ -43,7 +42,7 @@ class SelectionActionButton extends StatelessWidget {
const SizedBox(height: 8),
Text(
label,
- style: textTheme.small.copyWith(color: color),
+ style: TextStyles.body.copyWith(color: color),
textAlign: TextAlign.center,
),
],
diff --git a/mobile/apps/locker/lib/ui/components/share_link_sheet.dart b/mobile/apps/locker/lib/ui/components/share_link_sheet.dart
index b3e3c31ad7..0979722c15 100644
--- a/mobile/apps/locker/lib/ui/components/share_link_sheet.dart
+++ b/mobile/apps/locker/lib/ui/components/share_link_sheet.dart
@@ -2,7 +2,6 @@ import "package:ente_components/ente_components.dart";
import "package:ente_ui/components/alert_bottom_sheet.dart";
import "package:ente_ui/components/buttons/button_widget.dart";
import "package:ente_ui/components/buttons/models/button_result.dart";
-import "package:ente_ui/theme/ente_theme.dart";
import "package:ente_ui/utils/dialog_util.dart";
import "package:ente_ui/utils/toast_util.dart";
import "package:ente_utils/share_utils.dart";
@@ -47,8 +46,7 @@ class ShareLinkSheet extends StatefulWidget {
class _ShareLinkSheetState extends State<ShareLinkSheet> {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
final l10n = context.l10n;
return BottomSheetComponent(
@@ -59,12 +57,12 @@ class _ShareLinkSheetState extends State<ShareLinkSheet> {
children: [
Text(
l10n.shareThisLink,
- style: textTheme.body.copyWith(color: colorScheme.textMuted),
+ style: TextStyles.body.copyWith(color: colors.textLight),
),
const SizedBox(height: 24),
Container(
decoration: BoxDecoration(
- color: colorScheme.backgroundElevated,
+ color: colors.fillLight,
borderRadius: BorderRadius.circular(12),
),
child: Stack(
@@ -79,8 +77,8 @@ class _ShareLinkSheetState extends State<ShareLinkSheet> {
Expanded(
child: SelectableText(
widget.url,
- style: textTheme.small.copyWith(
- color: colorScheme.textBase,
+ style: TextStyles.body.copyWith(
+ color: colors.textBase,
fontFamily: 'monospace',
),
),
@@ -97,7 +95,7 @@ class _ShareLinkSheetState extends State<ShareLinkSheet> {
visualDensity: VisualDensity.compact,
icon: HugeIcon(
icon: HugeIcons.strokeRoundedCopy01,
- color: colorScheme.textBase,
+ color: colors.textBase,
size: 18,
),
tooltip: 'Copy link',
diff --git a/mobile/apps/locker/lib/ui/components/usage_card_widget.dart b/mobile/apps/locker/lib/ui/components/usage_card_widget.dart
index 19c3921bd5..09729c9301 100644
--- a/mobile/apps/locker/lib/ui/components/usage_card_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/usage_card_widget.dart
@@ -1,7 +1,6 @@
import "package:ente_accounts/models/user_details.dart";
+import 'package:ente_components/ente_components.dart';
import "package:ente_ui/components/loading_widget.dart";
-import "package:ente_ui/theme/colors.dart";
-import "package:ente_ui/theme/ente_theme.dart";
import "package:flutter/material.dart";
import "package:intl/intl.dart";
import "package:locker/l10n/l10n.dart";
@@ -13,6 +12,7 @@ class UsageCardWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ final colors = context.componentColors;
final inheritedDetails = InheritedUserDetails.of(context);
final userDetails = inheritedDetails?.userDetails;
final isCached = inheritedDetails?.isCached ?? false;
@@ -35,7 +35,10 @@ class UsageCardWidget extends StatelessWidget {
child: Stack(
children: [
Positioned.fill(
- child: CustomPaint(painter: _DotsPainter(), size: Size.infinite),
+ child: CustomPaint(
+ painter: _DotsPainter(colors.specialWhite),
+ size: Size.infinite,
+ ),
),
Padding(
padding: const EdgeInsets.all(16),
@@ -52,6 +55,10 @@ class UsageCardWidget extends StatelessWidget {
}
class _DotsPainter extends CustomPainter {
+ final Color dotColor;
+
+ const _DotsPainter(this.dotColor);
+
static const double _dotRadius = 2.0;
static const double _horizontalSpacing = 24.0;
static const double _verticalSpacing = 24.0;
@@ -59,7 +66,7 @@ class _DotsPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()
- ..color = textBaseDark.withValues(alpha: 0.03)
+ ..color = dotColor.withValues(alpha: 0.03)
..style = PaintingStyle.fill;
final horizontalCount = (size.width / _horizontalSpacing).ceil() + 1;
@@ -89,9 +96,10 @@ class _UsageContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
+ final cardText = colors.specialWhite;
+ final cardTextMuted = cardText.withValues(alpha: 0.7);
final maxFileCount = _effectiveLockerFileLimit(
userDetails,
).clamp(1, double.maxFinite).toInt();
@@ -116,41 +124,29 @@ class _UsageContent extends StatelessWidget {
children: [
Text(
context.l10n.itemsStored,
- style: textTheme.brandSmall.copyWith(
- color: textMutedDark,
+ style: TextStyles.bodyBold.copyWith(
+ color: cardTextMuted,
fontSize: 16,
),
),
const SizedBox(height: 4),
if (isLoading)
- const SizedBox(
+ SizedBox(
height: 40,
child: Align(
alignment: Alignment.centerLeft,
- child: EnteLoadingWidget(
- size: 24,
- padding: 0,
- color: textBaseDark,
- ),
+ child: EnteLoadingWidget(size: 24, padding: 0, color: cardText),
),
)
else
RichText(
text: TextSpan(
- style: textTheme.h2Bold.copyWith(
- color: textBaseDark,
- fontFamily: 'Montserrat',
- fontWeight: FontWeight.w500,
- ),
+ style: TextStyles.h1.copyWith(color: cardText),
children: [
TextSpan(text: formattedUsed),
TextSpan(
text: " ${context.l10n.of_} ",
- style: textTheme.h2Bold.copyWith(
- color: textMutedDark,
- fontFamily: 'Montserrat',
- fontWeight: FontWeight.w500,
- ),
+ style: TextStyles.h1.copyWith(color: cardTextMuted),
),
TextSpan(text: formattedMax),
],
@@ -165,7 +161,7 @@ class _UsageContent extends StatelessWidget {
width: double.infinity,
height: 8,
decoration: BoxDecoration(
- color: const Color.fromRGBO(193, 193, 193, 0.11),
+ color: colors.specialWhiteOverlay,
borderRadius: BorderRadius.circular(4),
),
),
@@ -176,7 +172,7 @@ class _UsageContent extends StatelessWidget {
width: constraints.maxWidth * familyProgress,
height: 8,
decoration: BoxDecoration(
- color: textBaseDark,
+ color: cardText,
borderRadius: BorderRadius.circular(4),
),
);
@@ -188,9 +184,7 @@ class _UsageContent extends StatelessWidget {
width: constraints.maxWidth * userProgress,
height: 8,
decoration: BoxDecoration(
- color: showFamilyBreakup
- ? colorScheme.primary700
- : colorScheme.primary700,
+ color: colors.primary,
borderRadius: BorderRadius.circular(4),
),
);
@@ -208,27 +202,27 @@ class _UsageContent extends StatelessWidget {
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
- color: colorScheme.primary700,
+ color: colors.primary,
),
),
const SizedBox(width: 4),
Text(
context.l10n.usageYou,
- style: textTheme.miniBold.copyWith(color: textBaseDark),
+ style: TextStyles.mini.copyWith(color: cardText),
),
const SizedBox(width: 16),
Container(
width: 8,
height: 8,
- decoration: const BoxDecoration(
+ decoration: BoxDecoration(
shape: BoxShape.circle,
- color: textBaseDark,
+ color: cardText,
),
),
const SizedBox(width: 4),
Text(
context.l10n.usageFamily,
- style: textTheme.miniBold.copyWith(color: textBaseDark),
+ style: TextStyles.mini.copyWith(color: cardText),
),
],
)
diff --git a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart b/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
index dc16aae46d..11f60c75a6 100644
--- a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
@@ -3,7 +3,6 @@ import 'dart:async';
import 'package:ente_components/ente_components.dart';
import 'package:ente_events/event_bus.dart';
import "package:ente_ui/components/title_bar_title_widget.dart";
-import 'package:ente_ui/theme/ente_theme.dart';
import 'package:flutter/material.dart';
import "package:hugeicons/hugeicons.dart";
import 'package:locker/events/collections_updated_event.dart';
@@ -115,12 +114,12 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
return Scaffold(
- backgroundColor: colorScheme.backgroundBase,
+ backgroundColor: colors.backgroundBase,
appBar: AppBar(
- backgroundColor: colorScheme.backgroundBase,
+ backgroundColor: colors.backgroundBase,
surfaceTintColor: Colors.transparent,
toolbarHeight: 48,
leadingWidth: 48,
@@ -144,8 +143,7 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {
}
Widget _buildBody(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
final safeBottomInset = MediaQuery.of(context).padding.bottom;
final bottomPadding = safeBottomInset + 24.0;
@@ -214,7 +212,7 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {
TitleBarTitleWidget(title: context.l10n.collections),
Text(
_sortedCollections.length.toString() + " items",
- style: textTheme.smallMuted,
+ style: TextStyles.body.copyWith(color: colors.textLight),
),
],
),
@@ -227,12 +225,12 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {
width: 44,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
- color: colorScheme.backdropBase,
+ color: colors.fillLight,
),
padding: const EdgeInsets.all(12),
child: HugeIcon(
icon: HugeIcons.strokeRoundedAdd01,
- color: colorScheme.textBase,
+ color: colors.textBase,
),
),
),
@@ -257,7 +255,7 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {
Widget _buildUncategorizedHook() {
if (_uncategorizedCollection == null) return const SizedBox.shrink();
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
final borderRadius = BorderRadius.circular(20.0);
return Container(
@@ -268,62 +266,42 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
decoration: BoxDecoration(
- color: Theme.of(context).colorScheme.surface.withAlpha(30),
- border: Border.all(
- color: Theme.of(context).dividerColor.withAlpha(50),
- width: 0.5,
- ),
+ color: colors.fillLight,
+ border: Border.all(color: colors.strokeFaint, width: 0.5),
borderRadius: borderRadius,
),
child: Row(
children: [
HugeIcon(
icon: HugeIcons.strokeRoundedFolderUnknown,
- color: Theme.of(
- context,
- ).textTheme.bodyLarge?.color?.withAlpha(70),
+ color: colors.textLight,
size: 22,
),
const SizedBox(width: 12),
Expanded(
child: Row(
children: [
- Text(
- context.l10n.uncategorized,
- style: textTheme.large.copyWith(
- fontWeight: FontWeight.w500,
- ),
- ),
+ Text(context.l10n.uncategorized, style: TextStyles.large),
if (_uncategorizedFileCount! > 0) ...[
const SizedBox(width: 8),
Text(
'β€’',
- style: textTheme.small.copyWith(
- color: Theme.of(
- context,
- ).textTheme.bodySmall?.color?.withAlpha(50),
+ style: TextStyles.body.copyWith(
+ color: colors.textLighter,
),
),
const SizedBox(width: 8),
Text(
'${_uncategorizedFileCount!}',
- style: textTheme.small.copyWith(
- color: Theme.of(
- context,
- ).textTheme.bodySmall?.color?.withAlpha(70),
+ style: TextStyles.body.copyWith(
+ color: colors.textLight,
),
),
],
],
),
),
- Icon(
- Icons.chevron_right,
- color: Theme.of(
- context,
- ).textTheme.bodyMedium?.color?.withAlpha(60),
- size: 20,
- ),
+ Icon(Icons.chevron_right, color: colors.textLight, size: 20),
],
),
),
diff --git a/mobile/apps/locker/lib/ui/pages/base_info_page.dart b/mobile/apps/locker/lib/ui/pages/base_info_page.dart
index b7a3f10f8d..9ac3bfc875 100644
--- a/mobile/apps/locker/lib/ui/pages/base_info_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/base_info_page.dart
@@ -4,7 +4,6 @@ import 'package:ente_components/ente_components.dart';
import 'package:ente_events/event_bus.dart';
import 'package:ente_ui/components/alert_bottom_sheet.dart';
import "package:ente_ui/components/title_bar_title_widget.dart";
-import 'package:ente_ui/theme/ente_theme.dart';
import 'package:ente_ui/utils/dialog_util.dart';
import 'package:ente_ui/utils/toast_util.dart';
import "package:ente_utils/email_util.dart";
@@ -510,8 +509,7 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
bool isSecret = false,
int? maxLines,
}) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -519,7 +517,7 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
if (label.isNotEmpty) ...[
Text(
label,
- style: textTheme.body,
+ style: TextStyles.body,
), // Use default style to match FormTextInputWidget
const SizedBox(height: 12),
],
@@ -533,12 +531,12 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
width: double.infinity,
padding: const EdgeInsets.fromLTRB(12, 12, 12, 12),
decoration: BoxDecoration(
- color: colorScheme.fillFaint,
+ color: colors.fillDark,
borderRadius: BorderRadius.circular(8),
),
child: Text(
isSecret ? 'β€’β€’β€’β€’β€’β€’β€’β€’' : value,
- style: textTheme.body,
+ style: TextStyles.body,
maxLines: maxLines,
overflow: maxLines != null ? TextOverflow.ellipsis : null,
),
@@ -554,7 +552,7 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
child: Icon(
Icons.copy,
size: 16,
- color: colorScheme.textMuted,
+ color: colors.textLight,
),
),
),
@@ -603,7 +601,7 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
Widget build(BuildContext context) {
final isViewMode = _currentMode == InfoPageMode.view;
final isEditMode = _currentMode == InfoPageMode.edit;
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
return PopScope(
canPop: false,
@@ -614,7 +612,7 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
},
child: Scaffold(
appBar: AppBar(
- backgroundColor: colorScheme.backgroundBase,
+ backgroundColor: colors.backgroundBase,
surfaceTintColor: Colors.transparent,
toolbarHeight: 48,
leadingWidth: 48,
@@ -642,7 +640,7 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>
),
],
),
- backgroundColor: colorScheme.backgroundBase,
+ backgroundColor: colors.backgroundBase,
body: GestureDetector(
onTap: Platform.isIOS
? () {
diff --git a/mobile/apps/locker/lib/ui/pages/collection_page.dart b/mobile/apps/locker/lib/ui/pages/collection_page.dart
index 6a1ed79044..7614b9e798 100644
--- a/mobile/apps/locker/lib/ui/pages/collection_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/collection_page.dart
@@ -1,10 +1,8 @@
import "dart:async";
+import 'package:ente_components/ente_components.dart';
import 'package:ente_events/event_bus.dart';
import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/theme/colors.dart";
-import 'package:ente_ui/theme/ente_theme.dart';
-import "package:ente_ui/theme/text_style.dart";
import "package:ente_ui/utils/dialog_util.dart";
import 'package:flutter/material.dart';
import "package:hugeicons/hugeicons.dart";
@@ -183,15 +181,14 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
return KeyboardListener(
focusNode: FocusNode(),
onKeyEvent: handleKeyEvent,
child: Scaffold(
appBar: AppBar(
- backgroundColor: colorScheme.backgroundBase,
+ backgroundColor: colors.backgroundBase,
surfaceTintColor: Colors.transparent,
toolbarHeight: 48,
leadingWidth: 48,
@@ -202,11 +199,11 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
child: const Icon(Icons.arrow_back_outlined),
),
),
- backgroundColor: colorScheme.backgroundBase,
+ backgroundColor: colors.backgroundBase,
body: Stack(
alignment: Alignment.bottomCenter,
children: [
- _buildBody(colorScheme, textTheme),
+ _buildBody(colors),
FileSelectionOverlayBar(
files: _displayedFiles,
selectedFiles: _selectedFiles,
@@ -219,7 +216,7 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
);
}
- Widget _buildShareButton(EnteColorScheme colorScheme) {
+ Widget _buildShareButton(ColorTokens colors) {
if (isFavorite) {
return const SizedBox.shrink();
}
@@ -239,18 +236,18 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
width: 44,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
- color: colorScheme.backdropBase,
+ color: colors.fillLight,
),
padding: const EdgeInsets.all(12),
child: HugeIcon(
icon: HugeIcons.strokeRoundedShare08,
- color: colorScheme.textBase,
+ color: colors.textBase,
),
),
);
}
- Widget _buildMenuButton(EnteColorScheme colorScheme) {
+ Widget _buildMenuButton(ColorTokens colors) {
if (isFavorite) {
return SizedBox.fromSize();
}
@@ -271,18 +268,18 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
width: 44,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
- color: colorScheme.backdropBase,
+ color: colors.fillLight,
),
padding: const EdgeInsets.all(12),
child: HugeIcon(
icon: HugeIcons.strokeRoundedMoreVertical,
- color: colorScheme.textBase,
+ color: colors.textBase,
),
),
);
}
- Widget _buildBody(EnteColorScheme colorScheme, EnteTextTheme textTheme) {
+ Widget _buildBody(ColorTokens colors) {
if (isSearchActive) {
return SearchResultView(
collections: const [], // CollectionPage primarily shows files
@@ -306,14 +303,14 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
trailingWidgets: widget.isUncategorized
? const []
: [
- _buildShareButton(colorScheme),
+ _buildShareButton(colors),
const SizedBox(width: 12),
- _buildMenuButton(colorScheme),
+ _buildMenuButton(colors),
],
),
Text(
_displayedFiles.length.toString(),
- style: textTheme.smallMuted,
+ style: TextStyles.body.copyWith(color: colors.textLight),
),
],
),
diff --git a/mobile/apps/locker/lib/ui/pages/onboarding_page.dart b/mobile/apps/locker/lib/ui/pages/onboarding_page.dart
index 51184e1814..79dc640d23 100644
--- a/mobile/apps/locker/lib/ui/pages/onboarding_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/onboarding_page.dart
@@ -8,7 +8,6 @@ import 'package:ente_accounts/pages/password_reentry_page.dart';
import 'package:ente_components/ente_components.dart';
import 'package:ente_ui/components/alert_bottom_sheet.dart';
import "package:ente_ui/pages/developer_settings_page.dart";
-import "package:ente_ui/theme/ente_theme.dart";
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import "package:flutter_svg/flutter_svg.dart";
@@ -106,18 +105,18 @@ class _OnboardingPageState extends State<OnboardingPage> {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
final lightComponentTheme = ComponentTheme.lightTheme(
app: ComponentApp.locker,
);
debugPrint("Building OnboardingPage");
final l10n = context.l10n;
return Scaffold(
- backgroundColor: colorScheme.primary700,
+ backgroundColor: colors.primary,
appBar: AppBar(
leading: const SizedBox(),
title: SvgPicture.asset("assets/svg/app-logo.svg"),
- backgroundColor: colorScheme.primary700,
+ backgroundColor: colors.primary,
elevation: 0,
scrolledUnderElevation: 0,
centerTitle: true,
@@ -181,8 +180,10 @@ class _OnboardingPageState extends State<OnboardingPage> {
milliseconds: 300,
),
decorator: DotsDecorator(
- activeColor: Colors.white,
- color: Colors.white.withValues(alpha: 0.32),
+ activeColor: colors.specialWhite,
+ color: colors.specialWhite.withValues(
+ alpha: 0.32,
+ ),
activeShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14),
),
@@ -220,10 +221,10 @@ class _OnboardingPageState extends State<OnboardingPage> {
onPressed: _navigateToSignInPage,
child: Text(
l10n.loginToExistingAccount,
- style: getEnteTextTheme(context).body.copyWith(
+ style: TextStyles.body.copyWith(
decoration: TextDecoration.underline,
- decorationColor: Colors.white,
- color: Colors.white,
+ decorationColor: colors.specialWhite,
+ color: colors.specialWhite,
),
),
),
@@ -338,7 +339,8 @@ class FeatureItemWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
+
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -351,7 +353,7 @@ class FeatureItemWidget extends StatelessWidget {
children: [
Text(
featureTitleFirstLine,
- style: textTheme.largeBold.copyWith(color: Colors.white),
+ style: TextStyles.large.copyWith(color: colors.specialWhite),
textAlign: TextAlign.center,
),
],
diff --git a/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart b/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart
index 3fcd70f49d..b044582697 100644
--- a/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart
+++ b/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart
@@ -9,9 +9,6 @@ import "package:ente_sharing/verify_identity_dialog.dart";
import "package:ente_ui/components/captioned_text_widget_v2.dart";
import "package:ente_ui/components/divider_widget.dart";
import "package:ente_ui/components/menu_item_widget_v2.dart";
-import "package:ente_ui/theme/colors.dart";
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:ente_ui/theme/text_style.dart";
import "package:flutter/material.dart";
import "package:intl/intl.dart";
import "package:locker/l10n/l10n.dart";
@@ -87,8 +84,6 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
content: ValueListenableBuilder<int>(
valueListenable: ContactsDisplayService.instance.changes,
builder: (context, _, _) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -96,11 +91,11 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
_buildEmailInputField(),
if (_suggestedUsers.isNotEmpty) ...[
const SizedBox(height: 20),
- _buildExistingContactsSection(colorScheme, textTheme),
+ _buildExistingContactsSection(),
],
if (_shareLater) ...[
const SizedBox(height: 12),
- _buildScheduleDateTimeRow(colorScheme, textTheme),
+ _buildScheduleDateTimeRow(),
],
],
);
@@ -127,10 +122,8 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
);
}
- Widget _buildExistingContactsSection(
- EnteColorScheme colorScheme,
- EnteTextTheme textTheme,
- ) {
+ Widget _buildExistingContactsSection() {
+ final colors = context.componentColors;
final filteredUsers =
_suggestedUsers
.where(
@@ -155,7 +148,7 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
children: [
Text(
context.l10n.chooseFromAnExistingContact,
- style: textTheme.small.copyWith(color: colorScheme.textMuted),
+ style: TextStyles.body.copyWith(color: colors.textLight),
),
const SizedBox(height: 8),
Row(
@@ -182,7 +175,7 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
if (!isFirst)
DividerWidget(
dividerType: DividerType.menu,
- bgColor: colorScheme.fillFaint,
+ bgColor: colors.fillLight,
),
MenuItemWidgetV2(
captionedTextWidget: CaptionedTextWidgetV2(
@@ -194,7 +187,7 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
type: AvatarType.mini,
config: Configuration.instance,
),
- menuItemColor: colorScheme.fillFaint,
+ menuItemColor: colors.fillLight,
surfaceExecutionStates: false,
onTap: () async {
_textFieldFocusNode.unfocus();
@@ -228,7 +221,6 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
itemCount: filteredUsers.length,
visibleItems: 2,
containerHeight: maxVisibleHeight,
- colorScheme: colorScheme,
),
],
],
@@ -237,10 +229,8 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
);
}
- Widget _buildScheduleDateTimeRow(
- EnteColorScheme colorScheme,
- EnteTextTheme textTheme,
- ) {
+ Widget _buildScheduleDateTimeRow() {
+ final colors = context.componentColors;
final dateText = _scheduledDate != null
? DateFormat("dd/MM/yy").format(_scheduledDate!)
: "DD/MM/YY";
@@ -256,7 +246,7 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
decoration: BoxDecoration(
- color: colorScheme.fillFaint,
+ color: colors.fillLight,
borderRadius: BorderRadius.circular(8),
),
child: Row(
@@ -264,15 +254,15 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
Icon(
Icons.calendar_today_outlined,
size: 18,
- color: colorScheme.textMuted,
+ color: colors.textLight,
),
const SizedBox(width: 8),
Text(
dateText,
- style: textTheme.small.copyWith(
+ style: TextStyles.body.copyWith(
color: _scheduledDate != null
- ? colorScheme.textBase
- : colorScheme.textMuted,
+ ? colors.textBase
+ : colors.textLight,
),
),
],
@@ -287,7 +277,7 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
decoration: BoxDecoration(
- color: colorScheme.fillFaint,
+ color: colors.fillLight,
borderRadius: BorderRadius.circular(8),
),
child: Row(
@@ -295,15 +285,15 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
Icon(
Icons.access_time_outlined,
size: 18,
- color: colorScheme.textMuted,
+ color: colors.textLight,
),
const SizedBox(width: 8),
Text(
timeText,
- style: textTheme.small.copyWith(
+ style: TextStyles.body.copyWith(
color: _scheduledTime != null
- ? colorScheme.textBase
- : colorScheme.textMuted,
+ ? colors.textBase
+ : colors.textLight,
),
),
],
diff --git a/mobile/apps/locker/lib/ui/sharing/manage_links_widget.dart b/mobile/apps/locker/lib/ui/sharing/manage_links_widget.dart
index 27e73605c8..df3e37b4e1 100644
--- a/mobile/apps/locker/lib/ui/sharing/manage_links_widget.dart
+++ b/mobile/apps/locker/lib/ui/sharing/manage_links_widget.dart
@@ -1,14 +1,13 @@
import "dart:async";
import "dart:convert";
+import 'package:ente_components/ente_components.dart';
import "package:ente_crypto_api/ente_crypto_api.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:ente_ui/components/captioned_text_widget_v2.dart";
import "package:ente_ui/components/divider_widget.dart";
import "package:ente_ui/components/menu_item_widget_v2.dart";
import "package:ente_ui/components/toggle_switch_widget.dart";
-import "package:ente_ui/theme/colors.dart";
-import "package:ente_ui/theme/ente_theme.dart";
import "package:ente_ui/utils/dialog_util.dart";
import "package:ente_ui/utils/toast_util.dart";
import "package:ente_utils/share_utils.dart";
@@ -44,7 +43,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
@override
Widget build(BuildContext context) {
- final enteColorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
final PublicURL url = widget.collection!.publicURLs.firstOrNull!;
final String urlValue = CollectionService.instance.getPublicUrl(
widget.collection!,
@@ -76,14 +75,14 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
),
))
: context.l10n.never,
- subTitleColor: url.isExpired ? warning500 : null,
+ subTitleColor: url.isExpired ? colors.warning : null,
),
trailingWidget: HugeIcon(
icon: HugeIcons.strokeRoundedArrowRight01,
- color: enteColorScheme.textMuted,
+ color: colors.textLight,
size: 20,
),
- menuItemColor: enteColorScheme.fillFaint,
+ menuItemColor: colors.fillLight,
surfaceExecutionStates: false,
onTap: () async {
unawaited(
@@ -106,10 +105,10 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
),
trailingWidget: HugeIcon(
icon: HugeIcons.strokeRoundedArrowRight01,
- color: enteColorScheme.textMuted,
+ color: colors.textLight,
size: 20,
),
- menuItemColor: enteColorScheme.fillFaint,
+ menuItemColor: colors.fillLight,
alignCaptionedTextToLeft: true,
isBottomBorderRadiusRemoved: true,
onTap: () async {
@@ -126,7 +125,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
),
DividerWidget(
dividerType: DividerType.menu,
- bgColor: enteColorScheme.fillFaint,
+ bgColor: colors.fillLight,
),
MenuItemWidgetV2(
key: ValueKey("Password lock ${url.passwordEnabled}"),
@@ -135,7 +134,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
),
alignCaptionedTextToLeft: true,
isTopBorderRadiusRemoved: true,
- menuItemColor: getEnteColorScheme(context).fillFaint,
+ menuItemColor: context.componentColors.fillLight,
trailingWidget: ToggleSwitchWidget(
value: () => url.passwordEnabled,
onChanged: () async {
@@ -175,11 +174,11 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
MenuItemWidgetV2(
captionedTextWidget: CaptionedTextWidgetV2(
title: context.l10n.linkExpired,
- textColor: getEnteColorScheme(context).warning500,
+ textColor: context.componentColors.warning,
),
leadingIcon: Icons.error_outline,
- leadingIconColor: getEnteColorScheme(context).warning500,
- menuItemColor: getEnteColorScheme(context).fillFaint,
+ leadingIconColor: context.componentColors.warning,
+ menuItemColor: context.componentColors.fillLight,
),
if (!url.isExpired)
MenuItemWidgetV2(
@@ -189,10 +188,10 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
),
leadingIconWidget: HugeIcon(
icon: HugeIcons.strokeRoundedCopy01,
- color: enteColorScheme.textBase,
+ color: colors.textBase,
size: 20,
),
- menuItemColor: getEnteColorScheme(context).fillFaint,
+ menuItemColor: context.componentColors.fillLight,
showOnlyLoadingState: true,
onTap: () async {
await Clipboard.setData(ClipboardData(text: urlValue));
@@ -206,7 +205,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
if (!url.isExpired)
DividerWidget(
dividerType: DividerType.menu,
- bgColor: getEnteColorScheme(context).fillFaint,
+ bgColor: context.componentColors.fillLight,
),
if (!url.isExpired)
MenuItemWidgetV2(
@@ -217,10 +216,10 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
),
leadingIconWidget: HugeIcon(
icon: HugeIcons.strokeRoundedShare08,
- color: enteColorScheme.textBase,
+ color: colors.textBase,
size: 20,
),
- menuItemColor: getEnteColorScheme(context).fillFaint,
+ menuItemColor: context.componentColors.fillLight,
onTap: () async {
unawaited(shareText(urlValue, context: context));
},
@@ -230,15 +229,15 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
MenuItemWidgetV2(
captionedTextWidget: CaptionedTextWidgetV2(
title: context.l10n.removeLink,
- textColor: warning500,
+ textColor: colors.warning,
makeTextBold: true,
),
- leadingIconWidget: const HugeIcon(
+ leadingIconWidget: HugeIcon(
icon: HugeIcons.strokeRoundedDelete02,
- color: warning500,
+ color: colors.warning,
size: 20,
),
- menuItemColor: getEnteColorScheme(context).fillFaint,
+ menuItemColor: context.componentColors.fillLight,
surfaceExecutionStates: false,
onTap: () async {
final bool result = await CollectionActions.disableUrl(
diff --git a/mobile/apps/locker/lib/ui/sharing/more_count_badge.dart b/mobile/apps/locker/lib/ui/sharing/more_count_badge.dart
index c6038fc110..b244951547 100644
--- a/mobile/apps/locker/lib/ui/sharing/more_count_badge.dart
+++ b/mobile/apps/locker/lib/ui/sharing/more_count_badge.dart
@@ -1,4 +1,4 @@
-import "package:ente_ui/theme/ente_theme.dart";
+import 'package:ente_components/ente_components.dart';
import 'package:flutter/material.dart';
import 'package:tuple/tuple.dart';
@@ -18,20 +18,22 @@ class MoreCountWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
final displayChar = "+$count";
- final Color decorationColor = colorScheme.avatarColors[1];
+ final Color decorationColor = colors.accentOrange;
final avatarStyle = getAvatarStyle(context, type);
final double size = avatarStyle.item1;
- final TextStyle textStyle = avatarStyle.item2.copyWith(color: Colors.white);
+ final TextStyle textStyle = avatarStyle.item2.copyWith(
+ color: colors.specialWhite,
+ );
return Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
- color: getEnteColorScheme(context).backdropBase,
+ color: context.componentColors.fillLight,
width: 1.0,
strokeAlign: BorderSide.strokeAlignOutside,
),
@@ -54,16 +56,15 @@ class MoreCountWidget extends StatelessWidget {
BuildContext context,
MoreCountType type,
) {
- final enteTextTheme = getEnteTextTheme(context);
switch (type) {
case MoreCountType.small:
- return Tuple2(32.0, enteTextTheme.small);
+ return const Tuple2(32.0, TextStyles.body);
case MoreCountType.mini:
- return Tuple2(24.0, enteTextTheme.mini);
+ return const Tuple2(24.0, TextStyles.mini);
case MoreCountType.tiny:
- return Tuple2(18.0, enteTextTheme.tiny);
+ return const Tuple2(18.0, TextStyles.tiny);
case MoreCountType.extra:
- return Tuple2(18.0, enteTextTheme.tiny);
+ return const Tuple2(18.0, TextStyles.tiny);
}
}
}
diff --git a/mobile/apps/locker/lib/ui/sharing/share_collection_bottom_sheet.dart b/mobile/apps/locker/lib/ui/sharing/share_collection_bottom_sheet.dart
index 52d135e78d..b934a2ec1d 100644
--- a/mobile/apps/locker/lib/ui/sharing/share_collection_bottom_sheet.dart
+++ b/mobile/apps/locker/lib/ui/sharing/share_collection_bottom_sheet.dart
@@ -6,9 +6,6 @@ import "package:ente_ui/components/alert_bottom_sheet.dart";
import "package:ente_ui/components/captioned_text_widget_v2.dart";
import "package:ente_ui/components/divider_widget.dart";
import "package:ente_ui/components/menu_item_widget_v2.dart";
-import "package:ente_ui/theme/colors.dart";
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:ente_ui/theme/text_style.dart";
import "package:ente_utils/share_utils.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
@@ -67,8 +64,7 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
final shouldShowSharedWithLabel = !_isOwner || _sharees.isNotEmpty;
return BottomSheetComponent(
@@ -77,18 +73,15 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- if (_isOwner) ...[
- _buildOwnerActions(colorScheme, textTheme),
- const SizedBox(height: 20),
- ],
+ if (_isOwner) ...[_buildOwnerActions(), const SizedBox(height: 20)],
if (shouldShowSharedWithLabel) ...[
Text(
context.l10n.sharedWith,
- style: textTheme.small.copyWith(color: colorScheme.textMuted),
+ style: TextStyles.body.copyWith(color: colors.textLight),
),
const SizedBox(height: 8),
],
- _buildShareesList(colorScheme, textTheme),
+ _buildShareesList(),
],
),
);
@@ -96,10 +89,8 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
bool get _hasPublicLink => widget.collection.publicURLs.isNotEmpty;
- Widget _buildShareesList(
- EnteColorScheme colorScheme,
- EnteTextTheme textTheme,
- ) {
+ Widget _buildShareesList() {
+ final colors = context.componentColors;
final currentUserId = Configuration.instance.getUserID() ?? -1;
final List<User> allUsers = [];
@@ -145,7 +136,7 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
if (!isFirst)
DividerWidget(
dividerType: DividerType.menu,
- bgColor: colorScheme.fillFaint,
+ bgColor: colors.fillLight,
),
MenuItemWidgetV2(
captionedTextWidget: CaptionedTextWidgetV2(
@@ -158,10 +149,10 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
config: Configuration.instance,
type: AvatarType.mini,
),
- menuItemColor: colorScheme.fillFaint,
+ menuItemColor: colors.fillLight,
trailingWidget: _isOwner
- ? _buildRolePopupMenu(user, colorScheme)
- : _buildRoleIcon(role, colorScheme),
+ ? _buildRolePopupMenu(user)
+ : _buildRoleIcon(role),
surfaceExecutionStates: false,
isTopBorderRadiusRemoved: !isFirst,
isBottomBorderRadiusRemoved: !isLast,
@@ -180,17 +171,13 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
itemCount: allUsers.length,
visibleItems: 4,
containerHeight: maxVisibleHeight,
- colorScheme: colorScheme,
),
],
],
);
}
- Widget _buildOwnerActions(
- EnteColorScheme colorScheme,
- EnteTextTheme textTheme,
- ) {
+ Widget _buildOwnerActions() {
return Row(
children: [
_ShareActionOption(
@@ -247,7 +234,8 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
}
}
- Widget _buildRoleIcon(CollectionParticipantRole role, colorScheme) {
+ Widget _buildRoleIcon(CollectionParticipantRole role) {
+ final colors = context.componentColors;
final icon = switch (role) {
CollectionParticipantRole.owner => HugeIcons.strokeRoundedCrown03,
CollectionParticipantRole.collaborator =>
@@ -258,15 +246,16 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
return Container(
decoration: BoxDecoration(
- color: colorScheme.backdropBase,
+ color: colors.fillLight,
borderRadius: BorderRadius.circular(10),
),
padding: const EdgeInsets.all(8),
- child: HugeIcon(icon: icon, color: colorScheme.textMuted, size: 20),
+ child: HugeIcon(icon: icon, color: colors.textLight, size: 20),
);
}
- Widget _buildRolePopupMenu(User user, colorScheme) {
+ Widget _buildRolePopupMenu(User user) {
+ final colors = context.componentColors;
return PopupMenuButton<String>(
onSelected: (value) {
if (value == "viewer") {
@@ -279,11 +268,11 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
- side: BorderSide(color: colorScheme.strokeFaint),
+ side: BorderSide(color: colors.strokeFaint),
),
padding: EdgeInsets.zero,
menuPadding: EdgeInsets.zero,
- color: colorScheme.backdropBase,
+ color: colors.fillLight,
surfaceTintColor: Colors.transparent,
elevation: 15,
shadowColor: Colors.black.withValues(alpha: 0.08),
@@ -291,7 +280,7 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
position: PopupMenuPosition.under,
child: HugeIcon(
icon: HugeIcons.strokeRoundedMoreVertical,
- color: colorScheme.textBase,
+ color: colors.textBase,
),
itemBuilder: (context) => [
// TODO: Re-enable viewer option when ready
@@ -333,7 +322,7 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
child: PopupMenuItemWidget(
icon: HugeIcon(
icon: HugeIcons.strokeRoundedDelete02,
- color: colorScheme.warning500,
+ color: colors.warning,
size: 20,
),
label: context.l10n.removeAccess,
@@ -433,8 +422,7 @@ class _ShareActionOption extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
return Expanded(
child: GestureDetector(
@@ -444,7 +432,7 @@ class _ShareActionOption extends StatelessWidget {
},
child: Container(
decoration: BoxDecoration(
- color: colorScheme.fillFaint,
+ color: colors.fillLight,
borderRadius: BorderRadius.circular(16),
),
padding: const EdgeInsets.symmetric(vertical: 16),
@@ -452,12 +440,12 @@ class _ShareActionOption extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
- HugeIcon(icon: icon, color: colorScheme.textBase, size: 24),
+ HugeIcon(icon: icon, color: colors.textBase, size: 24),
const SizedBox(height: 8),
Text(
label,
textAlign: TextAlign.center,
- style: textTheme.small.copyWith(color: colorScheme.textBase),
+ style: TextStyles.body.copyWith(color: colors.textBase),
),
],
),