Skip to content

Commit 32a8451

Browse files
committed
profile: Use weightVariableTextStyle instead of TextStyle.fontWeight
Now, this text is styled with a `wght` value of 700, instead of 400 from the ambient style. The FontWeight.bold seems to have already been causing the spans to render more boldly than surrounding text, but in a way that doesn't match what we get for Source Code Pro with `wght` 700. I think this is because of flutter/flutter#136779 . The slightly changed appearance is making some profile field labels run onto two lines on my device on CZO, instead of just one line, as Alya pointed out: zulip#728 (comment) So I'll follow up by giving those labels a bit more horizontal room.
1 parent 50eba89 commit 32a8451

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/widgets/profile.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ import 'content.dart';
1010
import 'message_list.dart';
1111
import 'page.dart';
1212
import 'store.dart';
13+
import 'text.dart';
1314

1415
class _TextStyles {
1516
static const primaryFieldText = TextStyle(fontSize: 20);
16-
static const customProfileFieldLabel = TextStyle(fontSize: 15, fontWeight: FontWeight.bold);
17+
18+
static TextStyle customProfileFieldLabel(BuildContext context) =>
19+
const TextStyle(fontSize: 15)
20+
.merge(weightVariableTextStyle(context, wght: 700));
21+
1722
static const customProfileFieldText = TextStyle(fontSize: 15);
1823
}
1924

@@ -43,7 +48,8 @@ class ProfilePage extends StatelessWidget {
4348
const SizedBox(height: 16),
4449
Text(user.fullName,
4550
textAlign: TextAlign.center,
46-
style: _TextStyles.primaryFieldText.merge(const TextStyle(fontWeight: FontWeight.bold))),
51+
style: _TextStyles.primaryFieldText
52+
.merge(weightVariableTextStyle(context, wght: 700))),
4753
// TODO(#291) render email field
4854
Text(roleToLabel(user.role, zulipLocalizations),
4955
textAlign: TextAlign.center,
@@ -192,7 +198,8 @@ class _ProfileDataTable extends StatelessWidget {
192198
textBaseline: TextBaseline.alphabetic,
193199
children: [
194200
SizedBox(width: 96,
195-
child: Text(realmField.name, style: _TextStyles.customProfileFieldLabel)),
201+
child: Text(style: _TextStyles.customProfileFieldLabel(context),
202+
realmField.name)),
196203
const SizedBox(width: 8),
197204
Flexible(child: widget),
198205
]));

0 commit comments

Comments
 (0)