Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] Wrap search field in light Theme instead of input overrides

aman-pilot41b44908b8be
diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dart
index 89db4c489b..2a8e02176a 100644
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@ -130,42 +130,48 @@ class CustomLockerAppBar extends StatelessWidget
top: 16,
bottom: 16,
),
- child: TextInputComponent(
- controller: searchController,
- focusNode: searchFocusNode,
- hintText: context.l10n.searchHint,
- onChanged: onSearchChanged,
- autocorrect: false,
- enableSuggestions: false,
- shouldUnfocusOnClearOrSubmit: true,
- backgroundColor: colors.specialWhite,
- textColor: Colors.black,
- prefix: HugeIcon(
- icon: HugeIcons.strokeRoundedSearch01,
- color: colors.primary,
- size: 20,
- strokeWidth: 1.75,
+ child: Theme(
+ data: ComponentTheme.lightTheme(app: ComponentApp.locker),
+ child: Builder(
+ builder: (context) {
+ final fieldColors = context.componentColors;
+ return TextInputComponent(
+ controller: searchController,
+ focusNode: searchFocusNode,
+ hintText: context.l10n.searchHint,
+ onChanged: onSearchChanged,
+ autocorrect: false,
+ enableSuggestions: false,
+ shouldUnfocusOnClearOrSubmit: true,
+ prefix: HugeIcon(
+ icon: HugeIcons.strokeRoundedSearch01,
+ color: fieldColors.primary,
+ size: 20,
+ strokeWidth: 1.75,
+ ),
+ suffix: showClearIcon
+ ? IconButton(
+ onPressed: onClearSearch,
+ splashRadius: 1,
+ padding: EdgeInsets.zero,
+ constraints: const BoxConstraints.tightFor(
+ width: 24,
+ height: 24,
+ ),
+ visualDensity: const VisualDensity(
+ horizontal: -1,
+ vertical: -1,
+ ),
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ color: fieldColors.textLighter,
+ size: 20,
+ ),
+ )
+ : null,
+ );
+ },
),
- suffix: showClearIcon
- ? IconButton(
- onPressed: onClearSearch,
- splashRadius: 1,
- padding: EdgeInsets.zero,
- constraints: const BoxConstraints.tightFor(
- width: 24,
- height: 24,
- ),
- visualDensity: const VisualDensity(
- horizontal: -1,
- vertical: -1,
- ),
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedCancel01,
- color: colors.textLighter,
- size: 20,
- ),
- )
- : null,
),
),
],
diff --git a/mobile/packages/ente_components/lib/components/text_input_component.dart b/mobile/packages/ente_components/lib/components/text_input_component.dart
index a9b4c88925..eea93b58b7 100644
--- a/mobile/packages/ente_components/lib/components/text_input_component.dart
+++ b/mobile/packages/ente_components/lib/components/text_input_component.dart
@@ -44,8 +44,6 @@ class TextInputComponent extends StatefulWidget {
this.inputFormatters,
this.keyboardType,
this.enableFillColor = true,
- this.backgroundColor,
- this.textColor,
this.autocorrect = true,
this.enableSuggestions = true,
this.isRequired = false,
@@ -91,8 +89,6 @@ class TextInputComponent extends StatefulWidget {
final List<TextInputFormatter>? inputFormatters;
final TextInputType? keyboardType;
final bool enableFillColor;
- final Color? backgroundColor;
- final Color? textColor;
final bool autocorrect;
final bool enableSuggestions;
final bool isRequired;
@@ -273,7 +269,6 @@ class _TextInputComponentState extends State<TextInputComponent> {
child: TextField(
controller: _controller,
focusNode: _focusNode,
- cursorColor: widget.textColor,
enabled: !widget.isDisabled,
autofocus: widget.autofocus,
obscureText: _obscureText,
@@ -375,15 +370,12 @@ class _TextInputComponentState extends State<TextInputComponent> {
}
Color _backgroundColor(ColorTokens colors) {
- if (widget.isDisabled) {
- return colors.fillDark;
- }
- if (widget.backgroundColor != null) {
- return widget.backgroundColor!;
- }
if (!widget.enableFillColor) {
return Colors.transparent;
}
+ if (widget.isDisabled) {
+ return colors.fillDark;
+ }
return colors.fillLight;
}
@@ -401,8 +393,7 @@ class _TextInputComponentState extends State<TextInputComponent> {
}
Color _textColor(ColorTokens colors) {
- if (widget.isDisabled) return colors.textLightest;
- return widget.textColor ?? colors.textBase;
+ return widget.isDisabled ? colors.textLightest : colors.textBase;
}
Color _hintColor(ColorTokens colors) {