Skip to content

Commit ebff35f

Browse files
gnpricechrisbobbe
authored andcommitted
inbox [nfc]: Cut superfluous StickyHeaderItems on individual conversations
These were never getting consulted, because these aren't entire items of the enclosing list view; rather the items are the whole sections, i.e. either a whole stream or all DMs. Because they weren't doing anything, they're confusing for understanding how this code works and making changes to it. I think this happened because in an early draft of #381, the list-view items were individual conversations. That's the arrangement that would be better for performance/smoothness reasons anyway, but it won't work until we make some changes to the sticky_header library; see #389. When we go to do #389, we can always add these StickyHeaderItem widgets back.
1 parent 5421518 commit ebff35f

File tree

1 file changed

+54
-81
lines changed

1 file changed

+54
-81
lines changed

lib/widgets/inbox.dart

Lines changed: 54 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,6 @@ class _AllDmsSection extends StatelessWidget {
301301
return _DmItem(
302302
narrow: narrow,
303303
count: count,
304-
allDmsCount: data.count,
305-
pageState: pageState,
306304
);
307305
}),
308306
]));
@@ -313,14 +311,10 @@ class _DmItem extends StatelessWidget {
313311
const _DmItem({
314312
required this.narrow,
315313
required this.count,
316-
required this.allDmsCount,
317-
required this.pageState
318314
});
319315

320316
final DmNarrow narrow;
321317
final int count;
322-
final int allDmsCount;
323-
final _InboxPageState pageState;
324318

325319
@override
326320
Widget build(BuildContext context) {
@@ -337,39 +331,32 @@ class _DmItem extends StatelessWidget {
337331
_ => narrow.otherRecipientIds.map((id) => store.users[id]?.fullName ?? '(unknown user)').join(', '),
338332
};
339333

340-
return StickyHeaderItem(
341-
header: _AllDmsHeaderItem(
342-
count: allDmsCount,
343-
collapsed: false,
344-
pageState: pageState,
345-
),
346-
allowOverflow: true,
347-
child: Material(
348-
color: Colors.white,
349-
child: InkWell(
350-
onTap: () {
351-
Navigator.push(context,
352-
MessageListPage.buildRoute(context: context, narrow: narrow));
353-
},
354-
child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 34),
355-
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
356-
const SizedBox(width: 63),
357-
Expanded(child: Padding(
358-
padding: const EdgeInsets.symmetric(vertical: 4),
359-
child: Text(
360-
style: const TextStyle(
361-
fontSize: 17,
362-
height: (20 / 17),
363-
color: Color(0xFF222222),
364-
),
365-
maxLines: 2,
366-
overflow: TextOverflow.ellipsis,
367-
title))),
368-
const SizedBox(width: 12),
369-
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
370-
child: UnreadCountBadge(backgroundColor: null,
371-
count: count)),
372-
])))));
334+
return Material(
335+
color: Colors.white,
336+
child: InkWell(
337+
onTap: () {
338+
Navigator.push(context,
339+
MessageListPage.buildRoute(context: context, narrow: narrow));
340+
},
341+
child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 34),
342+
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
343+
const SizedBox(width: 63),
344+
Expanded(child: Padding(
345+
padding: const EdgeInsets.symmetric(vertical: 4),
346+
child: Text(
347+
style: const TextStyle(
348+
fontSize: 17,
349+
height: (20 / 17),
350+
color: Color(0xFF222222),
351+
),
352+
maxLines: 2,
353+
overflow: TextOverflow.ellipsis,
354+
title))),
355+
const SizedBox(width: 12),
356+
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
357+
child: UnreadCountBadge(backgroundColor: null,
358+
count: count)),
359+
]))));
373360
}
374361
}
375362

@@ -432,8 +419,6 @@ class _StreamSection extends StatelessWidget {
432419
streamId: data.streamId,
433420
topic: topic,
434421
count: count,
435-
streamCount: data.count,
436-
pageState: pageState,
437422
);
438423
}),
439424
]));
@@ -445,56 +430,44 @@ class _TopicItem extends StatelessWidget {
445430
required this.streamId,
446431
required this.topic,
447432
required this.count,
448-
required this.streamCount,
449-
required this.pageState,
450433
});
451434

452435
final int streamId;
453436
final String topic;
454437
final int count;
455-
final int streamCount;
456-
final _InboxPageState pageState;
457438

458439
@override
459440
Widget build(BuildContext context) {
460441
final store = PerAccountStoreWidget.of(context);
461442
final subscription = store.subscriptions[streamId]!;
462443

463-
return StickyHeaderItem(
464-
header: _StreamHeaderItem(
465-
subscription: subscription,
466-
count: streamCount,
467-
collapsed: false,
468-
pageState: pageState,
469-
),
470-
allowOverflow: true,
471-
child: Material(
472-
color: Colors.white,
473-
child: InkWell(
474-
onTap: () {
475-
final narrow = TopicNarrow(streamId, topic);
476-
Navigator.push(context,
477-
MessageListPage.buildRoute(context: context, narrow: narrow));
478-
},
479-
child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 34),
480-
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
481-
const SizedBox(width: 63),
482-
Expanded(child: Padding(
483-
padding: const EdgeInsets.symmetric(vertical: 4),
484-
child: Text(
485-
style: const TextStyle(
486-
fontSize: 17,
487-
height: (20 / 17),
488-
color: Color(0xFF222222),
489-
),
490-
maxLines: 2,
491-
overflow: TextOverflow.ellipsis,
492-
topic))),
493-
const SizedBox(width: 12),
494-
// TODO(#384) show @-mention indicator when it applies
495-
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
496-
child: UnreadCountBadge(backgroundColor: subscription.colorSwatch(),
497-
count: count)),
498-
])))));
444+
return Material(
445+
color: Colors.white,
446+
child: InkWell(
447+
onTap: () {
448+
final narrow = TopicNarrow(streamId, topic);
449+
Navigator.push(context,
450+
MessageListPage.buildRoute(context: context, narrow: narrow));
451+
},
452+
child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 34),
453+
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
454+
const SizedBox(width: 63),
455+
Expanded(child: Padding(
456+
padding: const EdgeInsets.symmetric(vertical: 4),
457+
child: Text(
458+
style: const TextStyle(
459+
fontSize: 17,
460+
height: (20 / 17),
461+
color: Color(0xFF222222),
462+
),
463+
maxLines: 2,
464+
overflow: TextOverflow.ellipsis,
465+
topic))),
466+
const SizedBox(width: 12),
467+
// TODO(#384) show @-mention indicator when it applies
468+
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
469+
child: UnreadCountBadge(backgroundColor: subscription.colorSwatch(),
470+
count: count)),
471+
]))));
499472
}
500473
}

0 commit comments

Comments
 (0)