Skip to content

Commit

Permalink
Make tagline non-nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
CTalvio committed Aug 30, 2023
1 parent 893bc82 commit c5fac13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/community/pages/community_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ class _CommunityPageState extends State<CommunityPage> with AutomaticKeepAliveCl
onSaveAction: (int postId, bool save) => context.read<CommunityBloc>().add(SavePostEvent(postId: postId, save: save)),
onVoteAction: (int postId, VoteType voteType) => context.read<CommunityBloc>().add(VotePostEvent(postId: postId, score: voteType)),
onToggleReadAction: (int postId, bool read) => context.read<CommunityBloc>().add(MarkPostAsReadEvent(postId: postId, read: read)),
tagline: state.tagline,
tagline: state.tagline!,
);
case CommunityStatus.empty:
return Center(child: Text(AppLocalizations.of(context)!.noPosts));
Expand Down
18 changes: 9 additions & 9 deletions lib/community/widgets/post_card_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PostCardList extends StatefulWidget {
final SubscribedType? subscribeType;
final BlockedCommunity? blockedCommunity;
final SortType? sortType;
final String? tagline;
final String tagline;
final bool indicateRead;

final VoidCallback onScrollEndReached;
Expand All @@ -56,7 +56,7 @@ class PostCardList extends StatefulWidget {
required this.onToggleReadAction,
this.sortType,
this.blockedCommunity,
this.tagline,
this.tagline = '',
this.indicateRead = true,
});

Expand Down Expand Up @@ -194,8 +194,8 @@ class _PostCardListState extends State<PostCardList> with TickerProviderStateMix
},
child: CommunityHeader(communityInfo: widget.communityInfo),
);
} else if (widget.tagline?.isNotEmpty == true) {
final bool taglineIsLong = widget.tagline!.length > 200;
} else if (widget.tagline.isNotEmpty == true) {
final bool taglineIsLong = widget.tagline.length > 200;

return Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 10),
Expand All @@ -211,7 +211,7 @@ class _PostCardListState extends State<PostCardList> with TickerProviderStateMix
child: !taglineIsLong
// TODO: Eventually pass in textScalingFactor
? CommonMarkdownBody(
body: widget.tagline!,
body: widget.tagline,
)
: ExpandableNotifier(
child: Column(
Expand All @@ -222,7 +222,7 @@ class _PostCardListState extends State<PostCardList> with TickerProviderStateMix
children: [
// TODO: Eventually pass in textScalingFactor
CommonMarkdownBody(
body: '${widget.tagline!.substring(0, 150)}...',
body: '${widget.tagline.substring(0, 150)}...',
),
ExpandableButton(
theme: const ExpandableThemeData(
Expand All @@ -241,7 +241,7 @@ class _PostCardListState extends State<PostCardList> with TickerProviderStateMix
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
CommonMarkdownBody(
body: widget.tagline!,
body: widget.tagline,
),
ExpandableButton(
theme: const ExpandableThemeData(
Expand All @@ -265,7 +265,7 @@ class _PostCardListState extends State<PostCardList> with TickerProviderStateMix
);
}
}
if (index == ((widget.communityId != null || widget.communityName != null || widget.tagline?.isNotEmpty == true) ? widget.postViews!.length + 1 : widget.postViews!.length)) {
if (index == ((widget.communityId != null || widget.communityName != null || widget.tagline.isNotEmpty == true) ? widget.postViews!.length + 1 : widget.postViews!.length)) {
if (widget.hasReachedEnd == true) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
Expand Down Expand Up @@ -296,7 +296,7 @@ class _PostCardListState extends State<PostCardList> with TickerProviderStateMix
);
}
} else {
PostViewMedia postViewMedia = widget.postViews![(widget.communityId != null || widget.communityName != null || widget.tagline?.isNotEmpty == true) ? index - 1 : index];
PostViewMedia postViewMedia = widget.postViews![(widget.communityId != null || widget.communityName != null || widget.tagline.isNotEmpty == true) ? index - 1 : index];
return AnimatedSwitcher(
switchOutCurve: Curves.ease,
duration: const Duration(milliseconds: 0),
Expand Down

0 comments on commit c5fac13

Please sign in to comment.