Skip to content

Commit eaf79c7

Browse files
committed
all_channels: Make row item at least 44px tall ConstrainedBox
Make sure every row is at least 44px in height by specifiying BoxConstraints(minHeight: 44)
1 parent 7e3f92e commit eaf79c7

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

lib/widgets/all_channels.dart

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -103,25 +103,26 @@ class AllChannelsListEntry extends StatelessWidget {
103103
MessageListPage.buildRoute(context: context,
104104
narrow: ChannelNarrow(channel.streamId))),
105105
onLongPress: () => showChannelActionSheet(context, channelId: channel.streamId),
106-
child: Padding(
107-
padding: EdgeInsetsDirectional.only(start: 8, end: 12),
108-
child: Row(spacing: 6, children: [
109-
Icon(
110-
size: 20,
111-
color: colorSwatchFor(context, subscription).iconOnPlainBackground,
112-
iconDataForStream(channel)),
113-
Expanded(
114-
child: Text(
115-
maxLines: 1,
116-
overflow: TextOverflow.ellipsis,
117-
style: TextStyle(
118-
color: designVariables.textMessage,
119-
fontSize: 17,
120-
height: 20 / 17,
121-
).merge(weightVariableTextStyle(context, wght: 600)),
122-
channel.name)),
123-
if (hasContentAccess) _SubscribeToggle(channel: channel),
124-
])));
106+
child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 44),
107+
child: Padding(
108+
padding: EdgeInsetsDirectional.only(start: 8, end: 12),
109+
child: Row(spacing: 6, children: [
110+
Icon(
111+
size: 20,
112+
color: colorSwatchFor(context, subscription).iconOnPlainBackground,
113+
iconDataForStream(channel)),
114+
Expanded(
115+
child: Text(
116+
maxLines: 1,
117+
overflow: TextOverflow.ellipsis,
118+
style: TextStyle(
119+
color: designVariables.textMessage,
120+
fontSize: 17,
121+
height: 20 / 17,
122+
).merge(weightVariableTextStyle(context, wght: 600)),
123+
channel.name)),
124+
hasContentAccess ? _SubscribeToggle(channel: channel) : const SizedBox(height: 40, width: 52)
125+
]))));
125126
}
126127
}
127128

test/widgets/all_channels_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ void main() {
203203
} else {
204204
check(maybeToggle).isNull();
205205
}
206+
207+
final touchTargetSize = tester.getSize(findElement);
208+
check(touchTargetSize.height).equals(44);
206209
}
207210
});
208211

0 commit comments

Comments
 (0)