Skip to content

armgit / ente

Public Imported from GitHub
0

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

updates

Prateek Sunalb0b8e9343758
diff --git a/mobile/apps/auth/lib/ui/components/buttons/icon_button_widget.dart b/mobile/apps/auth/lib/ui/components/buttons/icon_button_widget.dart
index d57438ee61..3d722711af 100644
--- a/mobile/apps/auth/lib/ui/components/buttons/icon_button_widget.dart
+++ b/mobile/apps/auth/lib/ui/components/buttons/icon_button_widget.dart
@@ -16,7 +16,10 @@ class IconButtonWidget extends StatefulWidget {
final Color? defaultColor;
final Color? pressedColor;
final Color? iconColor;
-const IconButtonWidget({
+ final EdgeInsetsGeometry padding;
+ final double size;
+
+ const IconButtonWidget({
super.key,
required this.icon,
required this.iconButtonType,
@@ -25,6 +28,8 @@ const IconButtonWidget({
this.defaultColor,
this.pressedColor,
this.iconColor,
+ this.padding = const EdgeInsets.all(8),
+ this.size = 24,
});
@override
@@ -66,9 +71,11 @@ class _IconButtonWidgetState extends State<IconButtonWidget> {
padding: const EdgeInsets.all(4.0),
child: AnimatedContainer(
duration: const Duration(milliseconds: 20),
- padding: const EdgeInsets.all(8),
+ padding: widget.padding,
decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(20),
+ borderRadius: BorderRadius.circular(
+ widget.iconButtonType == IconButtonType.rounded ? widget.size : 20,
+ ),
color: iconStateColor,
),
child: Icon(
@@ -77,7 +84,7 @@ class _IconButtonWidgetState extends State<IconButtonWidget> {
(widget.iconButtonType == IconButtonType.secondary
? colorTheme.strokeMuted
: colorTheme.strokeBase),
- size: 24,
+ size: widget.size,
),
),
);
diff --git a/mobile/apps/auth/lib/ui/scanner_page.dart b/mobile/apps/auth/lib/ui/scanner_page.dart
index 897034e666..6b4f85b329 100644
--- a/mobile/apps/auth/lib/ui/scanner_page.dart
+++ b/mobile/apps/auth/lib/ui/scanner_page.dart
@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/code.dart';
+import 'package:ente_auth/ui/components/buttons/icon_button_widget.dart';
import 'package:ente_auth/utils/gallery_import_util.dart';
import 'package:ente_auth/utils/platform_util.dart';
import 'package:ente_auth/utils/toast_util.dart';
@@ -49,6 +50,13 @@ class ScannerPageState extends State<ScannerPage> {
Widget build(BuildContext context) {
final l10n = context.l10n;
final bool showGalleryImport = PlatformUtil.isMobile();
+ final theme = Theme.of(context);
+ final bool isLight = theme.brightness == Brightness.light;
+ final Color galleryBackgroundColor =
+ isLight ? Colors.black.withOpacity(0.035) : Colors.white.withOpacity(0.18);
+ final Color galleryPressedColor =
+ isLight ? Colors.black.withOpacity(0.07) : Colors.white.withOpacity(0.26);
+ final Color galleryIconColor = isLight ? Colors.black : Colors.white;
return Scaffold(
appBar: AppBar(
title: Text(l10n.scan),
@@ -73,17 +81,36 @@ class ScannerPageState extends State<ScannerPage> {
? Row(
children: [
Expanded(
- child: Text(
- totp ?? l10n.scanACode,
- style: Theme.of(context).textTheme.titleMedium,
- ),
+ child: totp != null
+ ? Text(
+ totp!,
+ style: Theme.of(context)
+ .textTheme
+ .titleMedium,
+ )
+ : const SizedBox.shrink(),
),
- TextButton.icon(
- onPressed: _isImportingFromGallery
- ? null
- : _handleImportFromGallery,
- icon: const Icon(Icons.photo_library_outlined),
- label: Text(l10n.importFromGallery),
+ Semantics(
+ button: true,
+ label: l10n.importFromGallery,
+ child: Opacity(
+ opacity: _isImportingFromGallery ? 0.5 : 1,
+ child: Padding(
+ padding: const EdgeInsets.only(left: 12),
+ child: IconButtonWidget(
+ icon: Icons.photo_library_outlined,
+ iconButtonType: IconButtonType.rounded,
+ onTap: _isImportingFromGallery
+ ? null
+ : _handleImportFromGallery,
+ defaultColor: galleryBackgroundColor,
+ iconColor: galleryIconColor,
+ pressedColor: galleryPressedColor,
+ size: 28,
+ padding: const EdgeInsets.all(14),
+ ),
+ ),
+ ),
),
],
)