Skip to content

Commit 597cc8a

Browse files
committed
fix: use font weight specified via font variant
Fixes #315
1 parent 8cf7564 commit 597cc8a

37 files changed

+397
-169
lines changed

app/lib/conversation_details/add_members_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class AddMembersScreenView extends StatelessWidget {
6666
),
6767
title: Text(
6868
contact.userName,
69-
style: labelStyle,
69+
style: Theme.of(context).textTheme.labelMedium,
7070
overflow: TextOverflow.ellipsis,
7171
),
7272
trailing: Checkbox(

app/lib/conversation_details/connection_details.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ class ConnectionDetails extends StatelessWidget {
3737
),
3838
Text(
3939
conversation.title,
40-
style: labelStyle,
40+
style: Theme.of(context).textTheme.labelMedium,
4141
),
4242
Text(
4343
conversation.conversationType.description,
44-
style: labelStyle,
44+
style: Theme.of(context).textTheme.labelMedium,
4545
),
4646
],
4747
),

app/lib/conversation_details/conversation_screen.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ class _EmptyConversationPane extends StatelessWidget {
5757
return Scaffold(
5858
body: Center(
5959
child: Text(
60-
style: labelStyle.copyWith(color: colorDMB),
60+
style: Theme.of(context)
61+
.textTheme
62+
.labelMedium
63+
?.copyWith(color: colorDMB),
6164
"Select a chat to start messaging",
6265
),
6366
),

app/lib/conversation_details/group_details.dart

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ class GroupDetails extends StatelessWidget {
5151
final bytes = await image?.readAsBytes();
5252
conversationDetailsCubit.setConversationPicture(bytes: bytes);
5353
}),
54-
Text(conversation.title, style: labelStyle),
54+
Text(
55+
conversation.title,
56+
style: Theme.of(context).textTheme.labelMedium,
57+
),
5558
Text(
5659
conversation.conversationType.description,
57-
style: labelStyle,
60+
style: Theme.of(context).textTheme.labelMedium,
5861
),
5962
Expanded(
6063
child: Container(
@@ -64,9 +67,12 @@ class GroupDetails extends StatelessWidget {
6467
child: Column(
6568
crossAxisAlignment: CrossAxisAlignment.start,
6669
children: [
67-
const Text(
70+
Text(
6871
"Members",
69-
style: boldLabelStyle,
72+
style: Theme.of(context)
73+
.textTheme
74+
.labelMedium
75+
?.merge(VariableFontWeight.bold),
7076
),
7177
Expanded(
7278
child: ListView.builder(
@@ -82,7 +88,7 @@ class GroupDetails extends StatelessWidget {
8288
),
8389
title: Text(
8490
member,
85-
style: labelStyle,
91+
style: Theme.of(context).textTheme.labelMedium,
8692
overflow: TextOverflow.ellipsis,
8793
),
8894
trailing: const Icon(Icons.more_horiz),

app/lib/conversation_details/member_details_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class MemberDetailsScreen extends StatelessWidget {
6060
const SizedBox(height: _padding),
6161
Text(
6262
memberUsername,
63-
style: labelStyle,
63+
style: Theme.of(context).textTheme.labelMedium,
6464
),
6565
const SizedBox(height: _padding),
6666
],

app/lib/conversation_list/conversation_list_content.dart

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ class _UnreadBadge extends StatelessWidget {
186186
child: Text(
187187
badgeText,
188188
style: const TextStyle(
189-
color: Colors.white,
190-
fontSize: 10,
191-
fontVariations: variationSemiBold,
192-
letterSpacing: 0),
189+
color: Colors.white,
190+
fontSize: 10,
191+
letterSpacing: 0,
192+
).merge(VariableFontWeight.semiBold),
193193
),
194194
);
195195
}
@@ -210,16 +210,14 @@ class _LastMessage extends StatelessWidget {
210210
final style = TextStyle(
211211
color: colorDMB,
212212
fontSize: isSmallScreen(context) ? 14 : 13,
213-
fontVariations: variationRegular,
214-
letterSpacing: -0.2,
215213
height: 1.2,
216214
);
217215

218216
final contentStyle = conversation.unreadMessages > 0
219-
? style.copyWith(fontVariations: variationMedium)
217+
? style.merge(VariableFontWeight.medium)
220218
: style;
221219

222-
final senderStyle = style.copyWith(fontVariations: variationSemiBold);
220+
final senderStyle = style.merge(VariableFontWeight.semiBold);
223221

224222
final (sender, displayedLastMessage) = switch (lastMessage?.message) {
225223
UiMessage_Content(field0: final content) => (
@@ -263,8 +261,6 @@ class _LastUpdated extends StatelessWidget {
263261
style: const TextStyle(
264262
color: colorDMB,
265263
fontSize: 11,
266-
fontVariations: variationRegular,
267-
letterSpacing: -0.2,
268264
),
269265
),
270266
);
@@ -289,9 +285,7 @@ class _ConversationTitle extends StatelessWidget {
289285
style: const TextStyle(
290286
color: convListItemTextColor,
291287
fontSize: 14,
292-
fontVariations: variationSemiBold,
293-
letterSpacing: -0.2,
294-
),
288+
).merge(VariableFontWeight.semiBold),
295289
),
296290
);
297291
}

app/lib/conversation_list/conversation_list_header.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,16 @@ class _UsernameSpace extends StatelessWidget {
100100
displayName ?? "",
101101
style: const TextStyle(
102102
color: colorDMB,
103-
fontVariations: variationBold,
104103
fontSize: 13,
105-
letterSpacing: -0.2,
106-
),
104+
).merge(VariableFontWeight.bold),
107105
),
108106
const SizedBox(height: 5),
109107
Text(
110108
userName,
111109
style: const TextStyle(
112110
color: colorDMB,
113111
fontSize: 10,
114-
fontVariations: variationMedium,
115-
letterSpacing: -0.2,
116-
),
112+
).merge(VariableFontWeight.medium),
117113
overflow: TextOverflow.ellipsis,
118114
),
119115
],

app/lib/conversation_list/create_conversation_view.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ class _CreateConversationViewState extends State<CreateConversationView> {
5151
crossAxisAlignment: CrossAxisAlignment.start,
5252
children: [
5353
const SizedBox(height: 50),
54-
Text(widget.prompt, style: labelStyle),
54+
Text(
55+
widget.prompt,
56+
style: Theme.of(context).textTheme.labelMedium,
57+
),
5558
const SizedBox(height: 20),
5659
Form(
5760
autovalidateMode: AutovalidateMode.always,

app/lib/developer/developer_settings_screen.dart

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class DeveloperSettingsScreen extends StatefulWidget {
2121
_DeveloperSettingsScreenState();
2222
}
2323

24+
final _titleFontWeight = VariableFontWeight.medium;
25+
2426
class _DeveloperSettingsScreenState extends State<DeveloperSettingsScreen> {
2527
String? deviceToken;
2628

@@ -69,8 +71,6 @@ class _DeveloperSettingsScreenState extends State<DeveloperSettingsScreen> {
6971
}
7072
}
7173

72-
const _titleFontWeight = FontWeight.w600;
73-
7474
class DeveloperSettingsScreenView extends StatelessWidget {
7575
const DeveloperSettingsScreenView({
7676
required this.deviceToken,
@@ -87,13 +87,13 @@ class DeveloperSettingsScreenView extends StatelessWidget {
8787
Widget build(BuildContext context) {
8888
final user = context.select((LoadableUserCubit cubit) => cubit.state.user);
8989

90-
return SafeArea(
91-
child: Scaffold(
92-
appBar: AppBar(
93-
title: const Text('Developer Settings'),
94-
leading: const AppBarBackButton(),
95-
),
96-
body: Center(
90+
return Scaffold(
91+
appBar: AppBar(
92+
title: const Text('Developer Settings'),
93+
leading: const AppBarBackButton(),
94+
),
95+
body: SafeArea(
96+
child: Center(
9797
child: Container(
9898
constraints:
9999
isPointer() ? const BoxConstraints(maxWidth: 800) : null,
@@ -103,7 +103,7 @@ class DeveloperSettingsScreenView extends StatelessWidget {
103103
titleTextStyle: Theme.of(context)
104104
.textTheme
105105
.bodyLarge!
106-
.copyWith(fontWeight: _titleFontWeight),
106+
.merge(_titleFontWeight),
107107
),
108108
child: ListView(
109109
children: [
@@ -137,10 +137,13 @@ class DeveloperSettingsScreenView extends StatelessWidget {
137137
ListTile(
138138
title: Text(
139139
user.userName,
140-
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
140+
style: Theme.of(context)
141+
.textTheme
142+
.bodyLarge
143+
?.copyWith(
141144
color: Colors.red,
142-
fontWeight: _titleFontWeight,
143-
),
145+
)
146+
.merge(_titleFontWeight),
144147
),
145148
subtitle: Text("id: ${user.clientId}"),
146149
trailing: const Icon(Icons.delete),
@@ -155,10 +158,13 @@ class DeveloperSettingsScreenView extends StatelessWidget {
155158
ListTile(
156159
title: Text(
157160
'Erase All Databases',
158-
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
161+
style: Theme.of(context)
162+
.textTheme
163+
.bodyLarge
164+
?.copyWith(
159165
color: Colors.red,
160-
fontWeight: _titleFontWeight,
161-
),
166+
)
167+
.merge(_titleFontWeight),
162168
),
163169
trailing: const Icon(Icons.delete),
164170
onTap: () => _confirmDialog(

app/lib/intro_screen.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class IntroScreen extends StatelessWidget {
3535
filterQuality: FilterQuality.high,
3636
color: Colors.grey[350],
3737
),
38-
const _GradientText(
38+
_GradientText(
3939
"Prototype.",
40-
gradient: LinearGradient(
40+
gradient: const LinearGradient(
4141
colors: [
4242
Color.fromARGB(255, 34, 163, 255),
4343
Color.fromARGB(255, 72, 23, 250)
@@ -46,9 +46,8 @@ class IntroScreen extends StatelessWidget {
4646
),
4747
style: TextStyle(
4848
fontSize: 36,
49-
fontVariations: variationMedium,
5049
letterSpacing: -0.9,
51-
),
50+
).merge(VariableFontWeight.medium),
5251
),
5352
// Text button that opens the developer settings screen
5453
TextButton(

app/lib/message_list/display_message_tile.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,9 @@ class SystemMessageContent extends StatelessWidget {
8989
message.message,
9090
style: TextStyle(
9191
color: Colors.grey[700],
92-
fontVariations: variationBold,
93-
letterSpacing: -0.02,
9492
fontSize: 10,
9593
height: 1.4,
96-
),
94+
).merge(VariableFontWeight.bold),
9795
),
9896
);
9997
}
@@ -115,10 +113,9 @@ class ErrorMessageContent extends StatelessWidget {
115113
message.message,
116114
style: const TextStyle(
117115
color: Colors.red,
118-
fontWeight: FontWeight.w200,
119116
fontSize: 10,
120117
height: 1.0,
121-
),
118+
).merge(VariableFontWeight.w200),
122119
),
123120
);
124121
}

app/lib/message_list/message_renderer.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ TextSpan _styledTextSpan(
3636
child: SelectionContainer.disabled(
3737
child: Text(
3838
keyword,
39-
style: style?.copyWith(
40-
//color: colorDMB,
41-
fontSize: 12,
42-
fontVariations: variationSemiBold,
43-
),
39+
style: style
40+
?.copyWith(
41+
//color: colorDMB,
42+
fontSize: 12,
43+
)
44+
.merge(VariableFontWeight.semiBold),
4445
),
4546
),
4647
),

app/lib/message_list/text_message_tile.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ class TextMessageTile extends StatelessWidget {
104104
style: TextStyle(
105105
color: colorGreyDark,
106106
fontSize: isLargeScreen(context) ? 10 : 11,
107-
fontVariations: variationMedium,
108107
letterSpacing: -0.1,
109-
),
108+
).merge(VariableFontWeight.medium),
110109
),
111110
),
112111
);
@@ -165,10 +164,8 @@ class TextMessageTile extends StatelessWidget {
165164
isSender ? "You" : contentMessage.sender.split("@").firstOrNull ?? "",
166165
style: const TextStyle(
167166
color: colorDMB,
168-
fontVariations: variationSemiBold,
169167
fontSize: 12,
170-
letterSpacing: -0.2,
171-
),
168+
).merge(VariableFontWeight.semiBold),
172169
overflow: TextOverflow.ellipsis,
173170
),
174171
);

app/lib/message_list/tile_timestamp.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ class TileTimestamp extends StatelessWidget {
2929
timeString(timestamp),
3030
style: const TextStyle(
3131
color: colorDMB,
32-
fontWeight: FontWeight.w200,
3332
fontSize: 10,
34-
letterSpacing: -0.2,
35-
),
33+
).merge(VariableFontWeight.w200),
3634
),
3735
),
3836
);

app/lib/registration/server_choice.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class ServerChoice extends StatelessWidget {
3131
crossAxisAlignment: CrossAxisAlignment.center,
3232
mainAxisAlignment: MainAxisAlignment.spaceAround,
3333
children: [
34-
const Text(
34+
Text(
3535
'Choose a server where you want to create your account',
36-
style: labelStyle,
36+
style: Theme.of(context).textTheme.labelMedium,
3737
),
3838
Form(
3939
autovalidateMode: AutovalidateMode.always,

app/lib/registration/username_password.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class UsernamePasswordChoice extends StatelessWidget {
3131
crossAxisAlignment: CrossAxisAlignment.center,
3232
mainAxisAlignment: MainAxisAlignment.spaceAround,
3333
children: [
34-
const Text(
34+
Text(
3535
'Choose a username and password',
36-
style: labelStyle,
36+
style: Theme.of(context).textTheme.labelMedium,
3737
),
3838
Form(
3939
autovalidateMode: AutovalidateMode.always,

0 commit comments

Comments
 (0)