Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] Migrate save and note inputs to component theme

aman-pilot2b3a0438d66f
diff --git a/mobile/apps/locker/lib/ui/components/item_list_view.dart b/mobile/apps/locker/lib/ui/components/item_list_view.dart
index 1b1cd3f2bb..b1d589e63c 100644
--- a/mobile/apps/locker/lib/ui/components/item_list_view.dart
+++ b/mobile/apps/locker/lib/ui/components/item_list_view.dart
@@ -1,5 +1,5 @@
+import "package:ente_components/ente_components.dart";
import 'package:ente_pure_utils/ente_pure_utils.dart';
-import "package:ente_ui/theme/ente_theme.dart";
import "package:ente_ui/utils/toast_util.dart";
import "package:flutter/material.dart";
import "package:flutter/services.dart";
@@ -211,13 +211,17 @@ class _ItemListViewState extends State<ItemListView> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
- const Icon(Icons.folder_off, size: 64, color: Colors.grey),
+ Icon(
+ Icons.folder_off,
+ size: 64,
+ color: context.componentColors.textLight,
+ ),
const SizedBox(height: 16),
Text(
context.l10n.noFilesFound,
- style: getEnteTextTheme(
- context,
- ).body.copyWith(color: Colors.grey),
+ style: TextStyles.body.copyWith(
+ color: context.componentColors.textLight,
+ ),
textAlign: TextAlign.center,
),
],
@@ -315,8 +319,7 @@ class FileListViewHelpers {
required String searchQuery,
required VoidCallback onTap,
}) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
return Container(
margin: const EdgeInsets.all(16.0),
child: Card(
@@ -328,7 +331,7 @@ class FileListViewHelpers {
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
- Icon(Icons.search, color: colorScheme.primary700, size: 24),
+ Icon(Icons.search, color: colors.primary, size: 24),
const SizedBox(width: 16),
Expanded(
child: Column(
@@ -336,16 +339,13 @@ class FileListViewHelpers {
children: [
Text(
context.l10n.searchEverywhereTitle(searchQuery),
- style: textTheme.large.copyWith(
- fontWeight: FontWeight.w500,
- color: colorScheme.primary700,
- ),
+ style: TextStyles.large.copyWith(color: colors.primary),
),
const SizedBox(height: 4),
Text(
context.l10n.searchEverywhereSubtitle,
- style: textTheme.body.copyWith(
- color: colorScheme.textMuted,
+ style: TextStyles.body.copyWith(
+ color: colors.textLight,
),
),
],
@@ -353,7 +353,7 @@ class FileListViewHelpers {
),
Icon(
Icons.arrow_forward_ios,
- color: colorScheme.textMuted,
+ color: colors.textLight,
size: 16,
),
],
diff --git a/mobile/apps/locker/lib/ui/pages/personal_note_page.dart b/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
index 5468d89610..5b731475a3 100644
--- a/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/personal_note_page.dart
@@ -2,7 +2,6 @@ import 'dart:math' as math;
import 'package:ente_components/ente_components.dart';
import 'package:ente_ui/components/alert_bottom_sheet.dart';
-import 'package:ente_ui/theme/ente_theme.dart';
import 'package:ente_ui/utils/toast_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -201,14 +200,8 @@ class _PersonalNotePageState
BoxConstraints constraints, {
required bool isEditing,
}) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
final dimensions = _calculateEditorDimensions(context, constraints);
- final accentBlue = Color.lerp(
- colorScheme.primary500,
- const Color(0xFF3B82F6),
- 0.7,
- )!;
_contentFocusNode.canRequestFocus = isEditing;
if (!isEditing && _contentFocusNode.hasFocus) {
@@ -216,8 +209,8 @@ class _PersonalNotePageState
}
final isEditorFocused = isEditing && _contentFocusNode.hasFocus;
final editorFillColor = isEditorFocused
- ? accentBlue.withValues(alpha: 0.14)
- : colorScheme.fillFaint;
+ ? colors.primaryLight
+ : colors.fillDark;
final contentPadding = isEditing
? _editorContentPadding
@@ -271,11 +264,11 @@ class _PersonalNotePageState
minLines: null,
expands: true,
textAlignVertical: TextAlignVertical.top,
- style: textTheme.body.copyWith(height: 1.69),
+ style: TextStyles.body.copyWith(height: 1.69),
decoration: InputDecoration.collapsed(
hintText: context.l10n.noteContentHint,
- hintStyle: textTheme.body.copyWith(
- color: colorScheme.textFaint,
+ hintStyle: TextStyles.body.copyWith(
+ color: colors.textLighter,
height: 1.69,
),
),
@@ -292,15 +285,13 @@ class _PersonalNotePageState
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
- color: colorScheme.fillBase.withValues(
- alpha: 0.2,
- ),
+ color: colors.fillBase.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(12),
),
child: Icon(
Icons.copy,
size: 16,
- color: colorScheme.textMuted,
+ color: colors.textLight,
),
),
),
@@ -317,7 +308,6 @@ class _PersonalNotePageState
@override
Widget buildAppBarTitle(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
final isEditing = isInEditMode;
if (!isEditing && _titleFocusNode.hasFocus) {
@@ -325,7 +315,7 @@ class _PersonalNotePageState
}
_titleFocusNode.canRequestFocus = isEditing;
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
return TextField(
controller: _nameController,
@@ -333,13 +323,16 @@ class _PersonalNotePageState
readOnly: !isEditing,
showCursor: isEditing,
enableInteractiveSelection: true,
- style: textTheme.h3Bold,
+ style: TextStyles.h2.copyWith(fontSize: 24),
decoration: InputDecoration(
border: InputBorder.none,
isDense: true,
contentPadding: EdgeInsets.zero,
hintText: context.l10n.noteNameHint,
- hintStyle: textTheme.h3Bold.copyWith(color: colorScheme.textFaint),
+ hintStyle: TextStyles.h2.copyWith(
+ fontSize: 24,
+ color: colors.textLighter,
+ ),
),
textCapitalization: TextCapitalization.sentences,
maxLines: 1,
diff --git a/mobile/apps/locker/lib/ui/pages/save_page.dart b/mobile/apps/locker/lib/ui/pages/save_page.dart
index 51574f7448..7df6c91d6c 100644
--- a/mobile/apps/locker/lib/ui/pages/save_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/save_page.dart
@@ -1,9 +1,6 @@
import 'dart:async';
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:hugeicons/hugeicons.dart';
import 'package:locker/l10n/l10n.dart';
@@ -40,8 +37,7 @@ class SaveBottomSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
final maxHeight = MediaQuery.of(context).size.height * 0.75;
return BottomSheetComponent(
@@ -52,7 +48,7 @@ class SaveBottomSheet extends StatelessWidget {
children: [
Text(
context.l10n.informationDescription,
- style: textTheme.smallMuted,
+ style: TextStyles.body.copyWith(color: colors.textLight),
),
const SizedBox(height: 24),
ConstrainedBox(
@@ -66,19 +62,18 @@ class SaveBottomSheet extends StatelessWidget {
icon: HugeIcon(
icon: HugeIcons.strokeRoundedFileUpload,
size: 24,
- color: colorScheme.primary700,
+ color: colors.primary,
),
title: context.l10n.saveDocumentTitle,
description: context.l10n.saveDocumentDescription,
type: SaveOptionType.document,
- colorScheme: colorScheme,
- textTheme: textTheme,
),
const SizedBox(height: 16),
_buildSaveOption(
context,
rootContext: rootContext,
icon: InfoItemUtils.getInfoIcon(
+ context,
InfoType.note,
showBackground: false,
size: 24,
@@ -86,14 +81,13 @@ class SaveBottomSheet extends StatelessWidget {
title: context.l10n.personalNote,
description: context.l10n.personalNoteDescription,
type: SaveOptionType.note,
- colorScheme: colorScheme,
- textTheme: textTheme,
),
const SizedBox(height: 16),
_buildSaveOption(
context,
rootContext: rootContext,
icon: InfoItemUtils.getInfoIcon(
+ context,
InfoType.physicalRecord,
showBackground: false,
size: 24,
@@ -101,14 +95,13 @@ class SaveBottomSheet extends StatelessWidget {
title: context.l10n.physicalRecords,
description: context.l10n.physicalRecordsDescription,
type: SaveOptionType.physicalRecord,
- colorScheme: colorScheme,
- textTheme: textTheme,
),
const SizedBox(height: 16),
_buildSaveOption(
context,
rootContext: rootContext,
icon: InfoItemUtils.getInfoIcon(
+ context,
InfoType.accountCredential,
showBackground: false,
size: 24,
@@ -116,8 +109,6 @@ class SaveBottomSheet extends StatelessWidget {
title: context.l10n.accountCredentials,
description: context.l10n.accountCredentialsDescription,
type: SaveOptionType.credentials,
- colorScheme: colorScheme,
- textTheme: textTheme,
),
],
),
@@ -135,9 +126,8 @@ class SaveBottomSheet extends StatelessWidget {
required String title,
required String description,
required SaveOptionType type,
- required EnteColorScheme colorScheme,
- required EnteTextTheme textTheme,
}) {
+ final colors = sheetContext.componentColors;
return GestureDetector(
onTap: () {
Navigator.of(sheetContext).pop();
@@ -150,7 +140,7 @@ class SaveBottomSheet extends StatelessWidget {
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
- color: colorScheme.backdropBase,
+ color: colors.fillLight,
),
child: Row(
children: [
@@ -160,13 +150,16 @@ class SaveBottomSheet extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(title, style: textTheme.bodyBold),
+ Text(title, style: TextStyles.bodyBold),
const SizedBox(height: 4),
- Text(description, style: textTheme.smallMuted),
+ Text(
+ description,
+ style: TextStyles.body.copyWith(color: colors.textLight),
+ ),
],
),
),
- Icon(Icons.chevron_right, color: colorScheme.textBase),
+ Icon(Icons.chevron_right, color: colors.textBase),
],
),
),