π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Replace legacy gradient buttons (#11757)
aman-pilot5e2d8959d0f8
diff --git a/mobile/apps/photos/assets/2.0x/gallery_locked.png b/mobile/apps/photos/assets/2.0x/gallery_locked.pngdeleted file mode 100644index 2d0924ca7d..0000000000Binary files a/mobile/apps/photos/assets/2.0x/gallery_locked.png and /dev/null differdiff --git a/mobile/apps/photos/assets/3.0x/gallery_locked.png b/mobile/apps/photos/assets/3.0x/gallery_locked.pngdeleted file mode 100644index e8d0645c3c..0000000000Binary files a/mobile/apps/photos/assets/3.0x/gallery_locked.png and /dev/null differdiff --git a/mobile/apps/photos/assets/gallery_locked.png b/mobile/apps/photos/assets/gallery_locked.pngdeleted file mode 100644index 8c5918bbe1..0000000000Binary files a/mobile/apps/photos/assets/gallery_locked.png and /dev/null differdiff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arbindex d96e6e0faa..6e05ec6080 100644--- a/mobile/apps/photos/lib/l10n/intl_en.arb+++ b/mobile/apps/photos/lib/l10n/intl_en.arb@@ -1426,6 +1426,44 @@"authToViewYourMemories": "Please authenticate to view your memories","unlock": "Unlock","freeUpSpace": "Free up space",+ "reclaimSpace": "Reclaim {sizeInMBorGB}",+ "@reclaimSpace": {+ "description": "Heading that shows how much device storage can be reclaimed",+ "placeholders": {+ "sizeInMBorGB": {+ "example": "2.28 GB",+ "type": "String"+ }+ }+ },+ "filesSafelyOnEnte": "{count, plural, one {This item is backed up to Ente, delete the device copy to free space without losing it.} other {All {formattedNumber} items are backed up to Ente, delete device copies to free space without losing them.}}",+ "@filesSafelyOnEnte": {+ "description": "Explains that device copies can be deleted because the files are stored on Ente",+ "placeholders": {+ "count": {+ "example": "395",+ "type": "int"+ },+ "formattedNumber": {+ "example": "395",+ "type": "String"+ }+ }+ },+ "filesInAlbumSafelyOnEnte": "{count, plural, one {This item in the album is backed up to Ente, delete the device copy to free space without losing it.} other {All {formattedNumber} items in the album are backed up to Ente, delete device copies to free space without losing them.}}",+ "@filesInAlbumSafelyOnEnte": {+ "description": "Explains that device copies for files in an album can be deleted because the files are stored on Ente",+ "placeholders": {+ "count": {+ "example": "395",+ "type": "int"+ },+ "formattedNumber": {+ "example": "395",+ "type": "String"+ }+ }+ },"freeUpSpaceSaving": "{count, plural, one {It can be deleted from the device to free up {formattedSize}} other {They can be deleted from the device to free up {formattedSize}}}","filesBackedUpInAlbum": "{count, plural, one {{formattedNumber} file} other {{formattedNumber} files}} in this album has been backed up safely","@filesBackedUpInAlbum": {diff --git a/mobile/apps/photos/lib/ui/common/gradient_button.dart b/mobile/apps/photos/lib/ui/common/gradient_button.dartdeleted file mode 100644index f71266b049..0000000000--- a/mobile/apps/photos/lib/ui/common/gradient_button.dart+++ /dev/null@@ -1,79 +0,0 @@-import 'package:flutter/material.dart';-import 'package:photos/theme/ente_theme.dart';--class GradientButton extends StatelessWidget {- final List<Color> linearGradientColors;- final Function? onTap;-- // text is ignored if child is specified- final String text;-- // nullable- final IconData? iconData;-- // padding between the text and icon- final double paddingValue;-- const GradientButton({- super.key,- this.linearGradientColors = const [Color(0xFF2CD267), Color(0xFF1DB954)],- this.onTap,- this.text = '',- this.iconData,- this.paddingValue = 0.0,- });-- @override- Widget build(BuildContext context) {- Widget buttonContent;- if (iconData == null) {- buttonContent = Text(- text,- style: const TextStyle(- color: Colors.white,- fontWeight: FontWeight.w600,- fontFamily: 'Inter-SemiBold',- fontSize: 18,- ),- );- } else {- buttonContent = Row(- mainAxisAlignment: MainAxisAlignment.center,- crossAxisAlignment: CrossAxisAlignment.center,- children: [- Icon(iconData, size: 20, color: Colors.white),- const Padding(padding: EdgeInsets.symmetric(horizontal: 6)),- Text(- text,- style: const TextStyle(- color: Colors.white,- fontWeight: FontWeight.w600,- fontFamily: 'Inter-SemiBold',- fontSize: 18,- ),- ),- ],- );- }- return InkWell(- onTap: onTap as void Function()?,- child: Container(- height: 56,- decoration: BoxDecoration(- gradient: LinearGradient(- begin: const Alignment(0.1, -0.9),- end: const Alignment(-0.6, 0.9),- colors: onTap != null- ? linearGradientColors- : [- getEnteColorScheme(context).fillMuted,- getEnteColorScheme(context).fillMuted,- ],- ),- borderRadius: BorderRadius.circular(8),- ),- child: Center(child: buttonContent),- ),- );- }-}diff --git a/mobile/apps/photos/lib/ui/social/widgets/delete_comment_confirmation_dialog.dart b/mobile/apps/photos/lib/ui/social/widgets/delete_comment_confirmation_dialog.dartindex 40f59b9296..f8d425c5b5 100644--- a/mobile/apps/photos/lib/ui/social/widgets/delete_comment_confirmation_dialog.dart+++ b/mobile/apps/photos/lib/ui/social/widgets/delete_comment_confirmation_dialog.dart@@ -1,7 +1,7 @@+import "package:ente_components/ente_components.dart";import "package:flutter/material.dart";import "package:photos/generated/l10n.dart";import "package:photos/theme/ente_theme.dart";-import "package:photos/ui/common/gradient_button.dart";import "package:photos/ui/components/buttons/icon_button_widget.dart";/// Shows a bottom sheet confirmation dialog for deleting a comment.@@ -90,13 +90,10 @@ class _DeleteCommentConfirmationSheet extends StatelessWidget {const SizedBox(height: 24),SizedBox(width: double.infinity,- child: GradientButton(+ child: ButtonComponent(onTap: () => Navigator.of(context).pop(true),- text: l10n.deleteComment,- linearGradientColors: const [- Color(0xFFF63A3A),- Color(0xFFF63A3A),- ],+ label: l10n.deleteComment,+ variant: .critical,),),const SizedBox(height: 16),diff --git a/mobile/apps/photos/lib/ui/tools/free_space_page.dart b/mobile/apps/photos/lib/ui/tools/free_space_page.dartindex d3aadac9f0..8a31aac39f 100644--- a/mobile/apps/photos/lib/ui/tools/free_space_page.dart+++ b/mobile/apps/photos/lib/ui/tools/free_space_page.dart@@ -7,7 +7,6 @@ import 'package:intl/intl.dart';import 'package:logging/logging.dart';import "package:photos/generated/l10n.dart";import 'package:photos/models/freeable_space_info.dart';-import 'package:photos/ui/common/gradient_button.dart';import "package:photos/ui/notification/toast.dart";import 'package:photos/utils/delete_file_util.dart';@@ -29,139 +28,76 @@ class _FreeSpacePageState extends State<FreeSpacePage> {@overrideWidget build(BuildContext context) {return Scaffold(- appBar: AppBar(- elevation: 0,- title: Text(AppLocalizations.of(context).freeUpSpace),+ backgroundColor: context.componentColors.backgroundBase,+ body: AppBarComponent(+ title: AppLocalizations.of(context).freeUpDeviceSpace,+ backgroundColor: context.componentColors.backgroundBase,+ slivers: [+ SliverSafeArea(+ top: false,+ sliver: SliverFillRemaining(+ hasScrollBody: false,+ child: _getBody(widget.status),+ ),+ ),+ ],),- body: _getBody(),);}- Widget _getBody() {- Logger("FreeSpacePage").info(- "Number of uploaded files: " + widget.status.localIDs.length.toString(),- );+ Widget _getBody(FreeableSpaceInfo status) {Logger("FreeSpacePage",- ).info("Space consumed: " + widget.status.size.toString());- return SingleChildScrollView(child: _getWidget(widget.status));- }-- Widget _getWidget(FreeableSpaceInfo status) {+ ).info("Number of uploaded files: " + status.localIDs.length.toString());+ Logger("FreeSpacePage").info("Space consumed: " + status.size.toString());final count = status.localIDs.length;final formattedCount = NumberFormat().format(count);- final String textMessage = widget.clearSpaceForFolder- ? AppLocalizations.of(- context,- ).filesBackedUpInAlbum(count: count, formattedNumber: formattedCount)- : AppLocalizations.of(context).filesBackedUpFromDevice(- count: count,- formattedNumber: formattedCount,- );- final informationTextStyle = TextStyle(- fontSize: 14,- height: 1.3,- color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.8),- fontWeight: FontWeight.w500,- );- final isLightMode = Theme.of(context).brightness == Brightness.light;- return Column(- mainAxisAlignment: MainAxisAlignment.center,- crossAxisAlignment: CrossAxisAlignment.center,- children: [- const SizedBox(height: 24),- Stack(- alignment: Alignment.center,+ final formattedSize = formatBytes(status.size);+ final l10n = AppLocalizations.of(context);+ final colors = context.componentColors;++ return Padding(+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 32),+ child: Align(+ alignment: const Alignment(0, -0.2),+ child: Column(+ mainAxisSize: MainAxisSize.min,children: [- isLightMode- ? Image.asset(- 'assets/loading_photos_background.png',- color: Colors.white.withValues(alpha: 0.4),- colorBlendMode: BlendMode.modulate,- )- : Image.asset(- 'assets/loading_photos_background_dark.png',- color: Colors.white.withValues(alpha: 0.25),- ),- Padding(- padding: const EdgeInsets.only(top: 16),- child: Image.asset("assets/gallery_locked.png", height: 160),+ Image.asset("assets/on_ente.png", width: 260, fit: BoxFit.contain),+ const SizedBox(height: 42),+ Text(+ l10n.reclaimSpace(sizeInMBorGB: formattedSize),+ textAlign: TextAlign.center,+ style: TextStyles.display2.copyWith(color: colors.textBase),),- ],- ),- const SizedBox(height: 24),- Padding(- padding: const EdgeInsets.only(left: 36, right: 40),- child: Row(- children: [- const Icon(- Icons.cloud_done_outlined,- color: Color.fromRGBO(45, 194, 98, 1.0),- ),- const Padding(padding: EdgeInsets.all(10)),- Expanded(child: Text(textMessage, style: informationTextStyle)),- ],- ),- ),- const Padding(padding: EdgeInsets.all(12)),- Padding(- padding: const EdgeInsets.only(left: 36, right: 40),- child: Row(- children: [- const Icon(- Icons.delete_outline,- color: Color.fromRGBO(45, 194, 98, 1.0),+ const SizedBox(height: 8),+ SizedBox(+ width: 300,+ child: Text(+ widget.clearSpaceForFolder+ ? l10n.filesInAlbumSafelyOnEnte(+ count: count,+ formattedNumber: formattedCount,+ )+ : l10n.filesSafelyOnEnte(+ count: count,+ formattedNumber: formattedCount,+ ),+ textAlign: TextAlign.center,+ style: TextStyles.mini.copyWith(color: colors.textLight),),- const Padding(padding: EdgeInsets.all(10)),- Expanded(- child: Text(- AppLocalizations.of(context).freeUpSpaceSaving(- count: count,- formattedSize: formatBytes(status.size),- ),- style: informationTextStyle,- ),- ),- ],- ),- ),- const Padding(padding: EdgeInsets.all(12)),- Padding(- padding: const EdgeInsets.only(left: 36, right: 40),- child: Row(- children: [- const Icon(- Icons.devices,- color: Color.fromRGBO(45, 194, 98, 1.0),- ),- const Padding(padding: EdgeInsets.all(10)),- Expanded(- child: Text(- AppLocalizations.of(- context,- ).freeUpAccessPostDelete(count: count),- style: informationTextStyle,- ),- ),- ],- ),- ),- const Padding(padding: EdgeInsets.all(24)),- Container(- width: double.infinity,- constraints: const BoxConstraints(minHeight: 64),- padding: const EdgeInsets.fromLTRB(60, 0, 60, 0),- child: GradientButton(- onTap: () async {- await _showConfirmFreeSpaceSheet(context, status);- },- text: AppLocalizations.of(- context,- ).freeUpAmount(sizeInMBorGB: formatBytes(status.size)),- ),+ ),+ const SizedBox(height: 32),+ ButtonComponent(+ shouldSurfaceExecutionStates: false,+ onTap: () async {+ await _showConfirmFreeSpaceSheet(context, status);+ },+ label: l10n.freeUpAmount(sizeInMBorGB: formattedSize),+ ),+ ],),- const Padding(padding: EdgeInsets.all(24)),- ],+ ),);}