Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inbox [nfc]: Cut superfluous StickyHeaderItems on individual conversations #510

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 54 additions & 81 deletions lib/widgets/inbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,6 @@ class _AllDmsSection extends StatelessWidget {
return _DmItem(
narrow: narrow,
count: count,
allDmsCount: data.count,
pageState: pageState,
);
}),
]));
Expand All @@ -313,14 +311,10 @@ class _DmItem extends StatelessWidget {
const _DmItem({
required this.narrow,
required this.count,
required this.allDmsCount,
required this.pageState
});

final DmNarrow narrow;
final int count;
final int allDmsCount;
final _InboxPageState pageState;

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

return StickyHeaderItem(
header: _AllDmsHeaderItem(
count: allDmsCount,
collapsed: false,
pageState: pageState,
),
allowOverflow: true,
child: Material(
color: Colors.white,
child: InkWell(
onTap: () {
Navigator.push(context,
MessageListPage.buildRoute(context: context, narrow: narrow));
},
child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 34),
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
const SizedBox(width: 63),
Expanded(child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Text(
style: const TextStyle(
fontSize: 17,
height: (20 / 17),
color: Color(0xFF222222),
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
title))),
const SizedBox(width: 12),
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
child: UnreadCountBadge(backgroundColor: null,
count: count)),
])))));
return Material(
color: Colors.white,
child: InkWell(
onTap: () {
Navigator.push(context,
MessageListPage.buildRoute(context: context, narrow: narrow));
},
child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 34),
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
const SizedBox(width: 63),
Expanded(child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Text(
style: const TextStyle(
fontSize: 17,
height: (20 / 17),
color: Color(0xFF222222),
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
title))),
const SizedBox(width: 12),
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
child: UnreadCountBadge(backgroundColor: null,
count: count)),
]))));
}
}

Expand Down Expand Up @@ -432,8 +419,6 @@ class _StreamSection extends StatelessWidget {
streamId: data.streamId,
topic: topic,
count: count,
streamCount: data.count,
pageState: pageState,
);
}),
]));
Expand All @@ -445,56 +430,44 @@ class _TopicItem extends StatelessWidget {
required this.streamId,
required this.topic,
required this.count,
required this.streamCount,
required this.pageState,
});

final int streamId;
final String topic;
final int count;
final int streamCount;
final _InboxPageState pageState;

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

return StickyHeaderItem(
header: _StreamHeaderItem(
subscription: subscription,
count: streamCount,
collapsed: false,
pageState: pageState,
),
allowOverflow: true,
child: Material(
color: Colors.white,
child: InkWell(
onTap: () {
final narrow = TopicNarrow(streamId, topic);
Navigator.push(context,
MessageListPage.buildRoute(context: context, narrow: narrow));
},
child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 34),
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
const SizedBox(width: 63),
Expanded(child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Text(
style: const TextStyle(
fontSize: 17,
height: (20 / 17),
color: Color(0xFF222222),
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
topic))),
const SizedBox(width: 12),
// TODO(#384) show @-mention indicator when it applies
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
child: UnreadCountBadge(backgroundColor: subscription.colorSwatch(),
count: count)),
])))));
return Material(
color: Colors.white,
child: InkWell(
onTap: () {
final narrow = TopicNarrow(streamId, topic);
Navigator.push(context,
MessageListPage.buildRoute(context: context, narrow: narrow));
},
child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 34),
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
const SizedBox(width: 63),
Expanded(child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Text(
style: const TextStyle(
fontSize: 17,
height: (20 / 17),
color: Color(0xFF222222),
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
topic))),
const SizedBox(width: 12),
// TODO(#384) show @-mention indicator when it applies
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
child: UnreadCountBadge(backgroundColor: subscription.colorSwatch(),
count: count)),
]))));
}
}
Loading