Skip to content

armgit / ente

Public Imported from GitHub
0

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

update components

AmanRajSinghMourya131e7f9120b7
diff --git a/mobile/apps/photos/lib/ui/components/buttons/button_widget_v2.dart b/mobile/apps/photos/lib/ui/components/buttons/button_widget_v2.dart
index 0fa9e17494..5ca2ee29a5 100644
--- a/mobile/apps/photos/lib/ui/components/buttons/button_widget_v2.dart
+++ b/mobile/apps/photos/lib/ui/components/buttons/button_widget_v2.dart
@@ -23,6 +23,7 @@ class ButtonWidgetV2 extends StatefulWidget {
final Widget? trailingWidget;
final bool shouldSurfaceExecutionStates;
final bool shouldStickToDarkTheme;
+ final bool shouldStickToLightTheme;
final ButtonSizeV2 buttonSize;
final Widget? leadingWidget;
final Color? iconColor;
@@ -39,6 +40,7 @@ class ButtonWidgetV2 extends StatefulWidget {
this.trailingWidget,
this.shouldSurfaceExecutionStates = true,
this.shouldStickToDarkTheme = false,
+ this.shouldStickToLightTheme = false,
this.buttonSize = ButtonSizeV2.large,
this.leadingWidget,
this.iconColor,
@@ -109,12 +111,16 @@ class _ButtonWidgetV2State extends State<ButtonWidgetV2>
@override
Widget build(BuildContext context) {
- final colorScheme = widget.shouldStickToDarkTheme
- ? darkScheme
- : getEnteColorScheme(context);
- final textTheme = widget.shouldStickToDarkTheme
- ? darkTextTheme
- : getEnteTextTheme(context);
+ final colorScheme = widget.shouldStickToLightTheme
+ ? lightScheme
+ : widget.shouldStickToDarkTheme
+ ? darkScheme
+ : getEnteColorScheme(context);
+ final textTheme = widget.shouldStickToLightTheme
+ ? lightTextTheme
+ : widget.shouldStickToDarkTheme
+ ? darkTextTheme
+ : getEnteTextTheme(context);
final showLoading = _executionState == ExecutionState.inProgress &&
widget.shouldSurfaceExecutionStates;
@@ -282,13 +288,11 @@ class _ButtonWidgetV2State extends State<ButtonWidgetV2>
});
}
- final labelStyle = textTheme.bodyBold.copyWith(
+ final isLink = widget.buttonType == ButtonTypeV2.link;
+ final labelStyle = (isLink ? textTheme.body : textTheme.bodyBold).copyWith(
color: colors.textColor,
- decoration: widget.buttonType == ButtonTypeV2.link
- ? TextDecoration.underline
- : null,
- decorationColor:
- widget.buttonType == ButtonTypeV2.link ? colors.textColor : null,
+ decoration: isLink ? TextDecoration.underline : null,
+ decorationColor: isLink ? colors.textColor : null,
);
final hasLeading = widget.leadingWidget != null;
diff --git a/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart b/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart
index 576e83b116..ecbd98e8f0 100644
--- a/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart
+++ b/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart
@@ -36,8 +36,8 @@ ButtonTheme _primaryPalette(EnteColorScheme c) => ButtonTheme(
defaultBg: c.greenBase,
hoverBg: c.greenDark,
pressedBg: c.greenDarker,
- disabledBg: c.fillBaseGrey,
- foreground: c.contentReverse,
+ disabledBg: c.fillDark,
+ foreground: Colors.white,
disabledForeground: c.contentLighter,
);
@@ -45,33 +45,33 @@ ButtonTheme _criticalPalette(EnteColorScheme c) => ButtonTheme(
defaultBg: c.redBase,
hoverBg: c.redDark,
pressedBg: c.redDarker,
- disabledBg: c.fillBaseGrey,
+ disabledBg: c.fillDark,
foreground: c.contentReverse,
disabledForeground: c.contentLighter,
);
ButtonTheme _secondaryPalette(EnteColorScheme c) => ButtonTheme(
- defaultBg: c.fillFaint,
- hoverBg: c.fillFaintPressed,
- pressedBg: c.fillMuted,
- disabledBg: c.fillFaint,
- foreground: c.textBase,
- disabledForeground: c.textFaint,
- defaultBorder: c.strokeFaint,
- disabledBorder: c.strokeFaint,
- iconColor: c.strokeBase,
- disabledIconColor: c.strokeMuted,
+ defaultBg: c.fillDark,
+ hoverBg: c.fillDarker,
+ pressedBg: c.fillDarkest,
+ disabledBg: c.fillDark,
+ foreground: c.content,
+ disabledForeground: c.contentLighter,
+ iconColor: c.content,
+ disabledIconColor: c.contentLighter,
+ checkmarkColor: c.content,
);
ButtonTheme _neutralPalette(EnteColorScheme c) => ButtonTheme(
- defaultBg: c.fillBase,
- hoverBg: c.fillStrong,
- pressedBg: c.fillBasePressed,
- disabledBg: c.fillFaint,
+ defaultBg: c.fillReverse,
+ hoverBg: c.fillReverse,
+ pressedBg: c.fillReverse,
+ disabledBg: c.fillDark,
foreground: c.contentReverse,
- disabledForeground: c.textFaint,
- disabledIconColor: c.strokeMuted,
- checkmarkColor: c.greenBase,
+ disabledForeground: c.contentLighter,
+ iconColor: c.contentReverse,
+ disabledIconColor: c.contentLighter,
+ checkmarkColor: c.contentReverse,
);
ButtonTheme _tertiaryCriticalPalette(EnteColorScheme c) => ButtonTheme(
@@ -84,7 +84,7 @@ ButtonTheme _tertiaryCriticalPalette(EnteColorScheme c) => ButtonTheme(
pressedForeground: c.redDarker,
disabledForeground: c.contentLighter,
defaultBorder: c.redBase,
- disabledBorder: c.fillBaseGrey,
+ disabledBorder: c.fillDark,
disabledIconColor: c.contentLighter,
);
diff --git a/mobile/apps/photos/lib/ui/components/text_input_widget_v2.dart b/mobile/apps/photos/lib/ui/components/text_input_widget_v2.dart
index f28b4eff36..21b56907a1 100644
--- a/mobile/apps/photos/lib/ui/components/text_input_widget_v2.dart
+++ b/mobile/apps/photos/lib/ui/components/text_input_widget_v2.dart
@@ -44,6 +44,10 @@ class TextInputWidgetV2 extends StatefulWidget {
final IconData? messageIcon;
final bool isDisabled;
final bool shouldStickToDarkTheme;
+ final List<String>? autofillHints;
+ final int? maxLines;
+ final int? minLines;
+ final bool finishAutofillContextOnEditingComplete;
const TextInputWidgetV2({
this.onSubmit,
@@ -79,6 +83,10 @@ class TextInputWidgetV2 extends StatefulWidget {
this.messageIcon,
this.isDisabled = false,
this.shouldStickToDarkTheme = false,
+ this.autofillHints,
+ this.maxLines,
+ this.minLines,
+ this.finishAutofillContextOnEditingComplete = false,
super.key,
});
@@ -241,6 +249,10 @@ class _TextInputWidgetV2State extends State<TextInputWidgetV2>
_executionState == ExecutionState.successful &&
widget.shouldSurfaceExecutionStates;
+ bool get _isMultiline =>
+ !widget.isPasswordInput &&
+ (widget.maxLines == null || (widget.maxLines ?? 1) > 1);
+
@override
Widget build(BuildContext context) {
final colorScheme = widget.shouldStickToDarkTheme
@@ -292,9 +304,13 @@ class _TextInputWidgetV2State extends State<TextInputWidgetV2>
onTap: widget.isDisabled ? null : _focusNode.requestFocus,
behavior: HitTestBehavior.opaque,
child: Container(
- height: _kHeight,
- padding:
- const EdgeInsets.symmetric(horizontal: _kHorizontalPadding),
+ height: _isMultiline ? null : _kHeight,
+ constraints:
+ _isMultiline ? const BoxConstraints(minHeight: _kHeight) : null,
+ padding: EdgeInsets.symmetric(
+ horizontal: _kHorizontalPadding,
+ vertical: _isMultiline ? 16 : 0,
+ ),
decoration: BoxDecoration(
color: colors.backgroundColor,
borderRadius: BorderRadius.circular(_kRadius),
@@ -315,9 +331,12 @@ class _TextInputWidgetV2State extends State<TextInputWidgetV2>
textCapitalization: widget.textCapitalization!,
autofocus: widget.autoFocus ?? false,
autocorrect: widget.autoCorrect,
- autofillHints: widget.isPasswordInput
- ? const [AutofillHints.password]
- : const [],
+ maxLines: widget.isPasswordInput ? 1 : widget.maxLines,
+ minLines: widget.isPasswordInput ? null : widget.minLines,
+ autofillHints: widget.autofillHints ??
+ (widget.isPasswordInput
+ ? const [AutofillHints.password]
+ : const []),
inputFormatters: widget.textInputFormatter ??
(widget.maxLength != null
? [
@@ -476,6 +495,9 @@ class _TextInputWidgetV2State extends State<TextInputWidgetV2>
}
void _handleEditingComplete() {
+ if (widget.finishAutofillContextOnEditingComplete) {
+ TextInput.finishAutofillContext();
+ }
if (widget.onSubmit == null) {
if (widget.shouldUnfocusOnClearOrSubmit) {
FocusScope.of(context).unfocus();