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( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( MediaQuery(
label, data: MediaQuery.of(context).copyWith(
style: TextStyle( textScaler: const TextScaler.linear(1),
color: state == TagChipState.selected || ),
Theme.of(context).brightness == Brightness.dark child: Text(
? Colors.white label,
: colorScheme.tagTextUnselectedColor, style: TextStyle(
color: state == TagChipState.selected ||
Theme.of(context).brightness == Brightness.dark
? Colors.white
: colorScheme.tagTextUnselectedColor,
fontSize: 14,
),
), ),
), ),
if (state == TagChipState.selected && if (state == TagChipState.selected &&

View File

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

View File

@ -11,17 +11,22 @@ class SpeedDialLabelWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return MediaQuery(
margin: const EdgeInsets.all(4), data: const MediaQueryData(
padding: const EdgeInsets.all(12), textScaler: TextScaler.linear(1),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Theme.of(context).colorScheme.fabBackgroundColor,
), ),
child: Text( child: Container(
label, margin: const EdgeInsets.all(4),
style: TextStyle( padding: const EdgeInsets.all(12),
color: Theme.of(context).colorScheme.fabForegroundColor, 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" url: "https://pub.dev"
source: hosted source: hosted
version: "2.11.0" 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: base32:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1707,10 +1715,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "14.2.4" version: "14.2.5"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:

View File

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

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