fix: scaling of text in code, etc

This commit is contained in:
Prateek Sunal 2024-08-24 19:37:52 +05:30 committed by Neeraj Gupta
parent 3b6c840a94
commit 1bcf2c92b4
6 changed files with 65 additions and 40 deletions

View File

@ -47,13 +47,19 @@ class TagChip extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
label,
style: TextStyle(
color: state == TagChipState.selected ||
Theme.of(context).brightness == Brightness.dark
? Colors.white
: colorScheme.tagTextUnselectedColor,
MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaler: const TextScaler.linear(1),
),
child: Text(
label,
style: TextStyle(
color: state == TagChipState.selected ||
Theme.of(context).brightness == Brightness.dark
? Colors.white
: colorScheme.tagTextUnselectedColor,
fontSize: 14,
),
),
),
if (state == TagChipState.selected &&

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:io';
import 'dart:ui' as ui;
import 'package:auto_size_text/auto_size_text.dart';
import 'package:clipboard/clipboard.dart';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/ente_theme_data.dart';
@ -113,7 +114,7 @@ class _CodeWidgetState extends State<CodeWidget> {
CodeTimerProgress(
period: widget.code.period,
),
const SizedBox(height: 16),
const SizedBox(height: 16 + 12),
Row(
children: [
_shouldShowLargeIcon ? _getIcon() : const SizedBox.shrink(),
@ -129,7 +130,7 @@ class _CodeWidgetState extends State<CodeWidget> {
],
),
const SizedBox(
height: 20,
height: 20 + 12,
),
],
),
@ -148,7 +149,6 @@ class _CodeWidgetState extends State<CodeWidget> {
Widget clippedCard(AppLocalizations l10n) {
return Container(
height: 132,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Theme.of(context).colorScheme.codeCardBackgroundColor,
@ -331,14 +331,16 @@ class _CodeWidgetState extends State<CodeWidget> {
builder: (context, value, child) {
return Material(
type: MaterialType.transparency,
child: Text(
child: AutoSizeText(
_getFormattedCode(value),
style: const TextStyle(fontSize: 24),
maxLines: 1,
),
);
},
),
),
const SizedBox(width: 8),
widget.code.type.isTOTPCompatible
? GestureDetector(
onTap: () {
@ -395,26 +397,28 @@ class _CodeWidgetState extends State<CodeWidget> {
return Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
safeDecode(widget.code.issuer).trim(),
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 2),
Text(
safeDecode(widget.code.account).trim(),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontSize: 12,
color: Colors.grey,
),
),
],
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
safeDecode(widget.code.issuer).trim(),
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 2),
Text(
safeDecode(widget.code.account).trim(),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontSize: 12,
color: Colors.grey,
),
),
],
),
),
const SizedBox(width: 8),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [

View File

@ -11,17 +11,22 @@ class SpeedDialLabelWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(4),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Theme.of(context).colorScheme.fabBackgroundColor,
return MediaQuery(
data: const MediaQueryData(
textScaler: TextScaler.linear(1),
),
child: Text(
label,
style: TextStyle(
color: Theme.of(context).colorScheme.fabForegroundColor,
child: Container(
margin: const EdgeInsets.all(4),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Theme.of(context).colorScheme.fabBackgroundColor,
),
child: Text(
label,
style: TextStyle(
color: Theme.of(context).colorScheme.fabForegroundColor,
),
),
),
);

View File

@ -65,6 +65,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.11.0"
auto_size_text:
dependency: "direct main"
description:
name: auto_size_text
sha256: "3f5261cd3fb5f2a9ab4e2fc3fba84fd9fcaac8821f20a1d4e71f557521b22599"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
base32:
dependency: "direct main"
description:
@ -1707,10 +1715,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
version: "14.2.4"
version: "14.2.5"
watcher:
dependency: transitive
description:

View File

@ -10,6 +10,7 @@ dependencies:
adaptive_theme: ^3.1.0 # done
app_links: ^3.5.0
archive: ^3.3.7
auto_size_text: ^3.0.0
base32: ^2.1.3
bip39: ^1.0.6 #done
bloc: ^8.1.2

@ -0,0 +1 @@
Subproject commit 16c7daea5d6b80235ac473f1a823b0ff44f5305e