π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update button widget v2
AmanRajSinghMourya4b59c7ba59e2
diff --git a/mobile/apps/photos/lib/theme/colors.dart b/mobile/apps/photos/lib/theme/colors.dartindex 3ec47940e3..cb48e28d65 100644--- a/mobile/apps/photos/lib/theme/colors.dart+++ b/mobile/apps/photos/lib/theme/colors.dart@@ -61,6 +61,30 @@ class EnteColorScheme {// Menu item icon stroke colorfinal Color menuItemIconStroke;+ final Color fill;+ final Color fillDarker;+ final Color fillDarkest;++ final Color content;+ final Color contentLighter;+ final Color contentLightest;+ final Color contentReverse;++ final Color strokeSolid;+ final Color strokeSolidDark;++ final Color backgroundColour;++ final Color greenBase;+ final Color greenDark;+ final Color greenDarker;+ final Color greenLight;++ final Color redBase;+ final Color redDark;+ final Color redDarker;+ final Color redLight;+const EnteColorScheme(this.backgroundBase,this.backgroundElevated,@@ -88,7 +112,25 @@ class EnteColorScheme {this.blurStrokePressed,this.tabIcon,this.avatarColors,- this.menuItemIconStroke, {+ this.menuItemIconStroke,+ this.fill,+ this.fillDarker,+ this.fillDarkest,+ this.content,+ this.contentLighter,+ this.contentLightest,+ this.contentReverse,+ this.strokeSolid,+ this.strokeSolidDark,+ this.backgroundColour,+ this.greenBase,+ this.greenDark,+ this.greenDarker,+ this.greenLight,+ this.redBase,+ this.redDark,+ this.redDarker,+ this.redLight, {this.primary700 = _primary700,this.primary500 = _primary500,this.primary400 = _primary400,@@ -131,6 +173,24 @@ const EnteColorScheme lightScheme = EnteColorScheme(tabIconLight,avatarLight,menuItemIconStrokeLight,+ fillLight,+ fillDarkerLight,+ fillDarkestLight,+ contentLight,+ contentLighterLight,+ contentLightestLight,+ contentReverseLight,+ strokeLight,+ strokeDarkLight,+ backgroundColourLight,+ green,+ greenDark,+ greenDarker,+ greenLightLight,+ red,+ redDark,+ redDarker,+ redLightLight,);const EnteColorScheme darkScheme = EnteColorScheme(@@ -161,6 +221,24 @@ const EnteColorScheme darkScheme = EnteColorScheme(tabIconDark,avatarDark,menuItemIconStrokeDark,+ fillDark,+ fillDarkerDark,+ fillDarkestDark,+ contentDark,+ contentLighterDark,+ contentLightestDark,+ contentReverseDark,+ strokeDark,+ strokeDarkDark,+ backgroundColourDark,+ green,+ greenDark,+ greenDarker,+ greenLightDark,+ red,+ redDark,+ redDarker,+ redLightDark,);// Background Colors@@ -248,26 +326,6 @@ const Color _primary500 = Color.fromRGBO(29, 185, 84, 1);const Color _primary400 = Color.fromRGBO(38, 203, 95, 1);const Color _primary300 = Color.fromRGBO(1, 222, 77, 1);--// Green Colors-const Color green = Color.fromRGBO(8, 194, 37, 1);-const Color greenLightLight = Color.fromRGBO(231, 246, 233, 1);-const Color greenLightDark = Color.fromRGBO(33, 33, 33, 1);-const Color greenDark = Color.fromRGBO(6, 157, 30, 1);-const Color greenDarker = Color.fromRGBO(5, 124, 24, 1);--// Red Colors-const Color red = Color.fromRGBO(246, 58, 58, 1);-const Color redLightLight = Color.fromRGBO(250, 235, 235, 1);-const Color redLightDark = Color.fromRGBO(33, 33, 33, 1);-const Color redDark = Color.fromRGBO(221, 52, 52, 1);-const Color redDarker = Color.fromRGBO(197, 46, 46, 1);--// Button Colors-const Color buttonDisabledBg = Color(0xFFF5F5F5);-const Color buttonDisabledText = Color(0xFF969696);-const Color buttonTextOnColor = Color(0xFFFFFFFF);-const Color _warning700 = Color.fromRGBO(234, 63, 63, 1);const Color _warning500 = Color.fromRGBO(255, 101, 101, 1);const Color warning500 = Color.fromRGBO(255, 101, 101, 1);@@ -330,3 +388,66 @@ const List<Color> avatarDark = [Color.fromRGBO(209, 132, 132, 1),Color.fromRGBO(120, 181, 167, 1),];++// Green Colors+const Color green = Color.fromRGBO(8, 194, 37, 1);+const Color greenLightLight = Color.fromRGBO(231, 246, 233, 1);+const Color greenLightDark = Color.fromRGBO(33, 33, 33, 1);+const Color greenDark = Color.fromRGBO(6, 157, 30, 1);+const Color greenDarker = Color.fromRGBO(5, 124, 24, 1);++// Red Colors+const Color red = Color.fromRGBO(246, 58, 58, 1);+const Color redLightLight = Color.fromRGBO(250, 235, 235, 1);+const Color redLightDark = Color.fromRGBO(33, 33, 33, 1);+const Color redDark = Color.fromRGBO(221, 52, 52, 1);+const Color redDarker = Color.fromRGBO(197, 46, 46, 1);++// Fill Colors+const Color fillLight = Color.fromRGBO(255, 255, 255, 1);+const Color fillDark = Color.fromRGBO(33, 33, 33, 1);++const Color fillDarkLight = Color.fromRGBO(245, 245, 245, 1);+const Color fillDarkDark = Color.fromRGBO(10, 10, 10, 1);++const Color fillDarkerLight = Color.fromRGBO(233, 233, 233, 1);+const Color fillDarkerDark = Color.fromRGBO(20, 20, 20, 1);++const Color fillDarkestLight = Color.fromRGBO(210, 210, 210, 1);+const Color fillDarkestDark = Color.fromRGBO(41, 41, 41, 1);++const Color fillReverseLight = Color.fromRGBO(0, 0, 0, 1);+const Color fillReverseDark = Color.fromRGBO(255, 255, 255, 1);++// Content Colors+const Color contentLight = Color.fromRGBO(0, 0, 0, 1);+const Color contentDark = Color.fromRGBO(255, 255, 255, 1);++const Color contentDarkLight = Color.fromRGBO(26, 26, 26, 1);+const Color contentDarkDark = Color.fromRGBO(229, 229, 229, 1);++const Color contentDarkerLight = Color.fromRGBO(21, 21, 21, 1);+const Color contentDarkerDark = Color.fromRGBO(204, 204, 204, 1);++const Color contentLightLight = Color.fromRGBO(102, 102, 102, 1);+const Color contentLightDark = Color.fromRGBO(153, 153, 153, 1);++const Color contentLighterLight = Color.fromRGBO(150, 150, 150, 1);+const Color contentLighterDark = Color.fromRGBO(150, 150, 150, 1);++const Color contentLightestLight = Color.fromRGBO(222, 222, 222, 1);+const Color contentLightestDark = Color.fromRGBO(10, 10, 10, 1);++const Color contentReverseLight = Color.fromRGBO(255, 255, 255, 1);+const Color contentReverseDark = Color.fromRGBO(0, 0, 0, 1);++// Stroke Colors+const Color strokeLight = Color.fromRGBO(235, 235, 235, 1);+const Color strokeDark = Color.fromRGBO(20, 20, 20, 1);++const Color strokeDarkLight = Color.fromRGBO(224, 224, 224, 1);+const Color strokeDarkDark = Color.fromRGBO(62, 62, 62, 1);++// Background+const Color backgroundColourLight = Color.fromRGBO(250, 250, 250, 1);+const Color backgroundColourDark = Color.fromRGBO(22, 22, 22, 1);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.dartindex 157b10dd39..cdf7c6e174 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@@ -20,12 +20,11 @@ class ButtonWidgetV2 extends StatefulWidget {final String? labelText;final FutureVoidCallback? onTap;final bool isDisabled;- final IconData? trailingIcon;+ final Widget? trailingWidget;final bool shouldSurfaceExecutionStates;final bool shouldStickToDarkTheme;final ButtonSizeV2 buttonSize;- final IconData? icon;- final Widget? iconWidget;+ final Widget? leadingWidget;final Color? iconColor;final ButtonAction? buttonAction;final bool isInAlert;@@ -37,12 +36,11 @@ class ButtonWidgetV2 extends StatefulWidget {this.labelText,this.onTap,this.isDisabled = false,- this.trailingIcon,+ this.trailingWidget,this.shouldSurfaceExecutionStates = true,this.shouldStickToDarkTheme = false,this.buttonSize = ButtonSizeV2.large,- this.icon,- this.iconWidget,+ this.leadingWidget,this.iconColor,this.buttonAction,this.isInAlert = false,@@ -86,9 +84,8 @@ class _ButtonWidgetV2State extends State<ButtonWidgetV2>final idleContentChanged = widget.buttonType != oldWidget.buttonType ||widget.labelText != oldWidget.labelText ||- widget.icon != oldWidget.icon ||- widget.iconWidget != oldWidget.iconWidget ||- widget.trailingIcon != oldWidget.trailingIcon;+ widget.leadingWidget != oldWidget.leadingWidget ||+ widget.trailingWidget != oldWidget.trailingWidget;if (widget.buttonSize != oldWidget.buttonSize ||(widget.buttonSize == ButtonSizeV2.small && idleContentChanged)) {@@ -138,13 +135,11 @@ class _ButtonWidgetV2State extends State<ButtonWidgetV2>final isSmall = widget.buttonSize == ButtonSizeV2.small;final isScaledDown = _isFingerDown;- final double? height = isLink ? null : (isSmall ? null : 52);- final double borderRadius = isLink ? 0 : (isSmall ? 4 : 20);+ final double? height = isLink ? null : 52;+ final double borderRadius = isLink ? 0 : 20;final EdgeInsets padding = isLink? const EdgeInsets.symmetric(vertical: 4)- : (isSmall- ? const EdgeInsets.symmetric(vertical: 14, horizontal: 16)- : const EdgeInsets.symmetric(horizontal: 24));+ : const EdgeInsets.symmetric(vertical: 14, horizontal: 24);return MouseRegion(onEnter: (_) => _setHovered(true),@@ -264,8 +259,8 @@ class _ButtonWidgetV2State extends State<ButtonWidgetV2>Widget _buildSuccessContent(ButtonColors colors) {return Center(key: const ValueKey('success'),- child: Icon(- Icons.check_rounded,+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedTick02,color: colors.checkmarkColor,size: 24,),@@ -296,29 +291,27 @@ class _ButtonWidgetV2State extends State<ButtonWidgetV2>widget.buttonType == ButtonTypeV2.link ? colors.textColor : null,);- final hasLeadingIcon = widget.icon != null || widget.iconWidget != null;+ final hasLeading = widget.leadingWidget != null;final hasLabel = widget.labelText != null;- if (widget.buttonType.hasTrailingIcon || widget.trailingIcon != null) {+ if (widget.trailingWidget != null) {return Row(key: const ValueKey('idle'),mainAxisAlignment: MainAxisAlignment.spaceBetween,mainAxisSize: isSmall ? MainAxisSize.min : MainAxisSize.max,children: [- if (hasLeadingIcon) ...[- widget.iconWidget ??- Icon(- widget.icon,- color: colors.iconColor,- size: 20,- ),+ if (hasLeading) ...[+ IconTheme(+ data: IconThemeData(color: colors.iconColor, size: 20),+ child: widget.leadingWidget!,+ ),if (hasLabel) const SizedBox(width: 8),],if (hasLabel)Flexible(child: Padding(padding: EdgeInsets.symmetric(- horizontal: hasLeadingIcon ? 0 : 8,+ horizontal: hasLeading ? 0 : 8,),child: Text(widget.labelText!,@@ -328,12 +321,11 @@ class _ButtonWidgetV2State extends State<ButtonWidgetV2>),),),- if (widget.trailingIcon != null) ...[+ if (widget.trailingWidget != null) ...[const SizedBox(width: 12),- Icon(- widget.trailingIcon,- color: colors.iconColor,- size: 20,+ IconTheme(+ data: IconThemeData(color: colors.iconColor, size: 20),+ child: widget.trailingWidget!,),],],@@ -345,13 +337,11 @@ class _ButtonWidgetV2State extends State<ButtonWidgetV2>mainAxisSize: isSmall ? MainAxisSize.min : MainAxisSize.max,mainAxisAlignment: MainAxisAlignment.center,children: [- if (hasLeadingIcon) ...[- widget.iconWidget ??- Icon(- widget.icon,- color: colors.iconColor,- size: 20,- ),+ if (hasLeading) ...[+ IconTheme(+ data: IconThemeData(color: colors.iconColor, size: 20),+ child: widget.leadingWidget!,+ ),if (hasLabel) const SizedBox(width: 8),],if (hasLabel)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.dartindex 7b2fef096a..94f1a8afae 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@@ -12,70 +12,43 @@ enum ButtonTypeV2 {neutral,critical,tertiaryCritical,- link,- trailingIcon,- trailingIconPrimary,- trailingIconSecondary,- tertiary;-- bool get isPrimary =>- this == ButtonTypeV2.primary || this == ButtonTypeV2.trailingIconPrimary;-- bool get hasTrailingIcon =>- this == ButtonTypeV2.trailingIcon ||- this == ButtonTypeV2.trailingIconPrimary ||- this == ButtonTypeV2.trailingIconSecondary;-- bool get isSecondary =>- this == ButtonTypeV2.secondary ||- this == ButtonTypeV2.trailingIconSecondary;-- bool get isCritical =>- this == ButtonTypeV2.critical || this == ButtonTypeV2.tertiaryCritical;-- bool get isNeutral =>- this == ButtonTypeV2.neutral || this == ButtonTypeV2.trailingIcon;+ link;ButtonTheme getColorPalette(EnteColorScheme colorScheme) {switch (this) {case ButtonTypeV2.primary:- case ButtonTypeV2.trailingIconPrimary:- return _primaryPalette;+ return _primaryPalette(colorScheme);case ButtonTypeV2.critical:- return _criticalPalette;+ return _criticalPalette(colorScheme);case ButtonTypeV2.secondary:- case ButtonTypeV2.trailingIconSecondary:return _secondaryPalette(colorScheme);case ButtonTypeV2.neutral:- case ButtonTypeV2.trailingIcon:return _neutralPalette(colorScheme);case ButtonTypeV2.tertiaryCritical:return _tertiaryCriticalPalette(colorScheme);case ButtonTypeV2.link:return _linkPalette(colorScheme);- case ButtonTypeV2.tertiary:- return _tertiaryPalette(colorScheme);}}}-const _primaryPalette = ButtonTheme(- defaultBg: green,- hoverBg: greenDark,- pressedBg: greenDarker,- disabledBg: buttonDisabledBg,- foreground: buttonTextOnColor,- disabledForeground: buttonDisabledText,-);+ButtonTheme _primaryPalette(EnteColorScheme c) => ButtonTheme(+ defaultBg: c.greenBase,+ hoverBg: c.greenDark,+ pressedBg: c.greenDarker,+ disabledBg: c.fillBaseGrey,+ foreground: c.contentReverse,+ disabledForeground: c.contentLighter,+ );-const _criticalPalette = ButtonTheme(- defaultBg: red,- hoverBg: redDark,- pressedBg: redDarker,- disabledBg: buttonDisabledBg,- foreground: buttonTextOnColor,- disabledForeground: buttonDisabledText,-);+ButtonTheme _criticalPalette(EnteColorScheme c) => ButtonTheme(+ defaultBg: c.redBase,+ hoverBg: c.redDark,+ pressedBg: c.redDarker,+ disabledBg: c.fillBaseGrey,+ foreground: c.contentReverse,+ disabledForeground: c.contentLighter,+ );ButtonTheme _secondaryPalette(EnteColorScheme c) => ButtonTheme(defaultBg: c.fillFaint,@@ -90,20 +63,16 @@ ButtonTheme _secondaryPalette(EnteColorScheme c) => ButtonTheme(disabledIconColor: c.strokeMuted,);-ButtonTheme _neutralPalette(EnteColorScheme c) {- final inverseForeground =- c.fillBase == fillBaseLight ? textBaseDark : textBaseLight;- return ButtonTheme(- defaultBg: c.fillBase,- hoverBg: c.fillStrong,- pressedBg: c.fillBasePressed,- disabledBg: c.fillFaint,- foreground: inverseForeground,- disabledForeground: c.textFaint,- disabledIconColor: c.strokeMuted,- checkmarkColor: c.primary500,- );-}+ButtonTheme _neutralPalette(EnteColorScheme c) => ButtonTheme(+ defaultBg: c.fillBase,+ hoverBg: c.fillStrong,+ pressedBg: c.fillBasePressed,+ disabledBg: c.fillFaint,+ foreground: c.contentReverse,+ disabledForeground: c.textFaint,+ disabledIconColor: c.strokeMuted,+ checkmarkColor: c.primary500,+ );ButtonTheme _tertiaryCriticalPalette(EnteColorScheme c) => ButtonTheme(defaultBg: Colors.transparent,@@ -111,10 +80,10 @@ ButtonTheme _tertiaryCriticalPalette(EnteColorScheme c) => ButtonTheme(pressedBg: c.warning700.withValues(alpha: 0.1),disabledBg: Colors.transparent,foreground: c.warning500,- disabledForeground: c.textFaint,+ disabledForeground: c.contentLighter,defaultBorder: c.warning500,- disabledBorder: c.strokeMuted,- disabledIconColor: c.strokeMuted,+ disabledBorder: c.fillBaseGrey,+ disabledIconColor: c.contentLighter,);ButtonTheme _linkPalette(EnteColorScheme c) => ButtonTheme(@@ -129,17 +98,6 @@ ButtonTheme _linkPalette(EnteColorScheme c) => ButtonTheme(disabledIconColor: c.strokeMuted,);-ButtonTheme _tertiaryPalette(EnteColorScheme c) => ButtonTheme(- defaultBg: Colors.transparent,- hoverBg: c.fillFaint,- pressedBg: c.fillFaintPressed,- disabledBg: Colors.transparent,- foreground: c.textBase,- pressedForeground: c.fillBasePressed,- disabledForeground: c.textFaint,- disabledIconColor: c.strokeMuted,- );-class ButtonTheme {final Color defaultBg;final Color hoverBg;