mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 16:25:17 +00:00
Start to fix null safety migration errors
This commit is contained in:
@ -24,12 +24,12 @@ class AcceptedFriendTile extends StatelessWidget {
|
||||
final OnOpenPrivateConversation onOpenPrivateConversation;
|
||||
|
||||
const AcceptedFriendTile({
|
||||
Key key,
|
||||
@required this.friend,
|
||||
@required this.user,
|
||||
@required this.onRequestDelete,
|
||||
@required this.onSetFollowing,
|
||||
@required this.onOpenPrivateConversation,
|
||||
Key? key,
|
||||
required this.friend,
|
||||
required this.user,
|
||||
required this.onRequestDelete,
|
||||
required this.onSetFollowing,
|
||||
required this.onOpenPrivateConversation,
|
||||
}) : assert(friend != null),
|
||||
assert(user != null),
|
||||
assert(onRequestDelete != null),
|
||||
@ -40,24 +40,24 @@ class AcceptedFriendTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
onTap: () => openUserPage(context: context, userID: user.id),
|
||||
onTap: () => openUserPage(context: context, userID: user.id!),
|
||||
leading: AccountImageWidget(user: user),
|
||||
title: Text(user.displayName),
|
||||
subtitle: friend.isConnected
|
||||
? Text(
|
||||
tr(
|
||||
"Online",
|
||||
),
|
||||
)!,
|
||||
style: TextStyle(color: Colors.green),
|
||||
)
|
||||
: Text(
|
||||
diffTimeFromNowToStr(friend.lastActive),
|
||||
diffTimeFromNowToStr(friend.lastActive!)!,
|
||||
),
|
||||
trailing: PopupMenuButton<_FriendMenuChoices>(
|
||||
itemBuilder: (c) => [
|
||||
//Open a private conversation
|
||||
PopupMenuItem(
|
||||
child: Text(tr("Private conversation")),
|
||||
child: Text(tr("Private conversation")!),
|
||||
value: _FriendMenuChoices.PRIVATE_CONVERSATION,
|
||||
),
|
||||
|
||||
@ -69,7 +69,7 @@ class AcceptedFriendTile extends StatelessWidget {
|
||||
? Icons.check_box
|
||||
: Icons.check_box_outline_blank),
|
||||
Container(width: 10.0),
|
||||
Text(friend.following ? tr("Following") : tr("Follow")),
|
||||
Text(friend.following ? tr("Following")! : tr("Follow")!),
|
||||
],
|
||||
),
|
||||
value: _FriendMenuChoices.TOGGLE_FOLLOWING,
|
||||
@ -77,7 +77,7 @@ class AcceptedFriendTile extends StatelessWidget {
|
||||
|
||||
// Remove the friend from the list
|
||||
PopupMenuItem(
|
||||
child: Text(tr("Remove")),
|
||||
child: Text(tr("Remove")!),
|
||||
value: _FriendMenuChoices.REMOVE,
|
||||
),
|
||||
],
|
||||
|
@ -22,11 +22,11 @@ class CommentTile extends StatelessWidget {
|
||||
final void Function(Comment) onDeleteComment;
|
||||
|
||||
const CommentTile({
|
||||
Key key,
|
||||
@required this.comment,
|
||||
@required this.user,
|
||||
@required this.onUpdateComment,
|
||||
@required this.onDeleteComment,
|
||||
Key? key,
|
||||
required this.comment,
|
||||
required this.user,
|
||||
required this.onUpdateComment,
|
||||
required this.onDeleteComment,
|
||||
}) : assert(comment != null),
|
||||
assert(user != null),
|
||||
assert(onUpdateComment != null),
|
||||
@ -42,7 +42,7 @@ class CommentTile extends StatelessWidget {
|
||||
),
|
||||
subtitle: _buildCommentContent(),
|
||||
trailing: Text(
|
||||
diffTimeFromNowToStr(comment.timeSent),
|
||||
diffTimeFromNowToStr(comment.timeSent)!,
|
||||
style: TextStyle(fontSize: 10.0),
|
||||
),
|
||||
);
|
||||
@ -58,14 +58,14 @@ class CommentTile extends StatelessWidget {
|
||||
// Update comment content
|
||||
PopupMenuItem(
|
||||
enabled: comment.isOwner,
|
||||
child: Text(tr("Update")),
|
||||
child: Text(tr("Update")!),
|
||||
value: _CommentAction.UPDATE,
|
||||
),
|
||||
|
||||
// Delete comment
|
||||
PopupMenuItem(
|
||||
enabled: comment.isOwner,
|
||||
child: Text(tr("Delete")),
|
||||
child: Text(tr("Delete")!),
|
||||
value: _CommentAction.DELETE,
|
||||
),
|
||||
],
|
||||
@ -80,7 +80,7 @@ class CommentTile extends StatelessWidget {
|
||||
Container(
|
||||
child: comment.hasImage
|
||||
? NetworkImageWidget(
|
||||
url: comment.imageURL,
|
||||
url: comment.imageURL!,
|
||||
allowFullScreen: true,
|
||||
height: 100.0,
|
||||
width: null,
|
||||
|
@ -31,12 +31,12 @@ class ConversationMessageTile extends StatelessWidget {
|
||||
final OnRequestMessageDelete onRequestMessageDelete;
|
||||
|
||||
const ConversationMessageTile({
|
||||
Key key,
|
||||
@required this.message,
|
||||
@required this.user,
|
||||
@required this.onRequestMessageStats,
|
||||
@required this.onRequestMessageUpdate,
|
||||
@required this.onRequestMessageDelete,
|
||||
Key? key,
|
||||
required this.message,
|
||||
required this.user,
|
||||
required this.onRequestMessageStats,
|
||||
required this.onRequestMessageUpdate,
|
||||
required this.onRequestMessageDelete,
|
||||
}) : assert(message != null),
|
||||
assert(user != null),
|
||||
assert(onRequestMessageStats != null),
|
||||
@ -66,34 +66,34 @@ class ConversationMessageTile extends StatelessWidget {
|
||||
PopupMenuItem(
|
||||
enabled: (message.message?.content ?? "") != "",
|
||||
value: _MenuChoices.COPY_MESSAGE,
|
||||
child: Text(tr("Copy message")),
|
||||
child: Text(tr("Copy message")!),
|
||||
),
|
||||
|
||||
PopupMenuItem(
|
||||
enabled: message.file != null,
|
||||
value: _MenuChoices.COPY_URL,
|
||||
child: Text(tr("Copy URL")),
|
||||
child: Text(tr("Copy URL")!),
|
||||
),
|
||||
|
||||
PopupMenuItem(
|
||||
value: _MenuChoices.GET_STATS,
|
||||
child: Text(tr("Statistics")),
|
||||
child: Text(tr("Statistics")!),
|
||||
),
|
||||
|
||||
// Update message content
|
||||
PopupMenuItem(
|
||||
enabled: message.isOwner &&
|
||||
message.message != null &&
|
||||
message.message.content.isNotEmpty,
|
||||
message.message.content!.isNotEmpty,
|
||||
value: _MenuChoices.REQUEST_UPDATE_CONTENT,
|
||||
child: Text(tr("Update")),
|
||||
child: Text(tr("Update")!),
|
||||
),
|
||||
|
||||
// Delete the message
|
||||
PopupMenuItem(
|
||||
enabled: message.isOwner,
|
||||
value: _MenuChoices.DELETE,
|
||||
child: Text(tr("Delete")),
|
||||
child: Text(tr("Delete")!),
|
||||
),
|
||||
]..removeWhere((element) => !element.enabled),
|
||||
),
|
||||
@ -113,18 +113,18 @@ class ConversationMessageTile extends StatelessWidget {
|
||||
linksColor: Colors.white,
|
||||
);
|
||||
|
||||
return ConversationFileWidget(messageID: message.id, file: message.file);
|
||||
return ConversationFileWidget(messageID: message.id!, file: message.file!);
|
||||
}
|
||||
|
||||
/// Process menu choice
|
||||
void _menuOptionSelected(BuildContext context, _MenuChoices value) {
|
||||
switch (value) {
|
||||
case _MenuChoices.COPY_MESSAGE:
|
||||
copyToClipboard(context, message.message.content);
|
||||
copyToClipboard(context, message.message.content!);
|
||||
break;
|
||||
|
||||
case _MenuChoices.COPY_URL:
|
||||
copyToClipboard(context, message.file.url);
|
||||
copyToClipboard(context, message.file!.url!);
|
||||
break;
|
||||
|
||||
case _MenuChoices.GET_STATS:
|
||||
|
@ -23,19 +23,19 @@ enum _PopupMenuChoices { UPDATE, LEAVE }
|
||||
class ConversationTile extends StatelessWidget {
|
||||
final Conversation conversation;
|
||||
final UsersList usersList;
|
||||
final GroupsList groupsList;
|
||||
final GroupsList? groupsList;
|
||||
final OpenConversationCallback onOpen;
|
||||
final RequestUpdateConversationCallback onRequestUpdate;
|
||||
final RequestLeaveConversationCallback onRequestLeave;
|
||||
|
||||
const ConversationTile({
|
||||
Key key,
|
||||
@required this.conversation,
|
||||
@required this.usersList,
|
||||
@required this.groupsList,
|
||||
@required this.onOpen,
|
||||
@required this.onRequestUpdate,
|
||||
@required this.onRequestLeave,
|
||||
Key? key,
|
||||
required this.conversation,
|
||||
required this.usersList,
|
||||
required this.groupsList,
|
||||
required this.onOpen,
|
||||
required this.onRequestUpdate,
|
||||
required this.onRequestLeave,
|
||||
}) : assert(conversation != null),
|
||||
assert(usersList != null),
|
||||
assert(onOpen != null),
|
||||
@ -68,7 +68,7 @@ class ConversationTile extends StatelessWidget {
|
||||
ConversationsHelper.getConversationName(
|
||||
conversation,
|
||||
usersList,
|
||||
),
|
||||
)!,
|
||||
style: TextStyle(
|
||||
fontWeight: conversation.sawLastMessage ? null : FontWeight.bold,
|
||||
),
|
||||
@ -87,7 +87,7 @@ class ConversationTile extends StatelessWidget {
|
||||
conversation: conversation,
|
||||
users: usersList,
|
||||
group: conversation.isGroupConversation
|
||||
? groupsList.getGroup(conversation.groupID)
|
||||
? groupsList!.getGroup(conversation.groupID)
|
||||
: null,
|
||||
),
|
||||
|
||||
@ -97,24 +97,24 @@ class ConversationTile extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
_buildSubInformation(Icons.access_time,
|
||||
diffTimeFromNowToStr(conversation.lastActivity)),
|
||||
diffTimeFromNowToStr(conversation.lastActivity!)!),
|
||||
conversation.isGroupConversation
|
||||
? _buildSubInformation(
|
||||
Icons.link,
|
||||
tr("Group: %group_name%", args: {
|
||||
"group_name":
|
||||
groupsList.getGroup(conversation.groupID).name
|
||||
}))
|
||||
groupsList!.getGroup(conversation.groupID)!.name
|
||||
})!)
|
||||
: _buildSubInformation(
|
||||
Icons.group,
|
||||
conversation.members.length == 1
|
||||
? tr("1 member")
|
||||
conversation.members!.length == 1
|
||||
? tr("1 member")!
|
||||
: tr(
|
||||
"%num% members",
|
||||
args: {
|
||||
"num": conversation.members.length.toString(),
|
||||
"num": conversation.members!.length.toString(),
|
||||
},
|
||||
),
|
||||
)!,
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -125,11 +125,11 @@ class ConversationTile extends StatelessWidget {
|
||||
position: position,
|
||||
items: [
|
||||
PopupMenuItem(
|
||||
child: Text(tr("Update")),
|
||||
child: Text(tr("Update")!),
|
||||
value: _PopupMenuChoices.UPDATE,
|
||||
),
|
||||
PopupMenuItem(
|
||||
child: Text(tr("Leave")),
|
||||
child: Text(tr("Leave")!),
|
||||
value: _PopupMenuChoices.LEAVE,
|
||||
)
|
||||
]).then(_conversationMenuCallback);
|
||||
@ -143,9 +143,9 @@ class ConversationTile extends StatelessWidget {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 20),
|
||||
child: ListTile(
|
||||
onTap: () => MainController.of(context).startCall(conversation.id),
|
||||
onTap: () => MainController.of(context)!.startCall(conversation.id!),
|
||||
dense: true,
|
||||
title: Text(tr("Ongoing call")),
|
||||
title: Text(tr("Ongoing call")!),
|
||||
leading: Icon(Icons.call),
|
||||
tileColor: Colors.yellow.withOpacity(0.2),
|
||||
),
|
||||
@ -153,7 +153,7 @@ class ConversationTile extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// Method called each time an option of the menu is selected
|
||||
void _conversationMenuCallback(_PopupMenuChoices c) {
|
||||
void _conversationMenuCallback(_PopupMenuChoices? c) {
|
||||
switch (c) {
|
||||
case _PopupMenuChoices.UPDATE:
|
||||
onRequestUpdate(conversation);
|
||||
|
@ -6,9 +6,9 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class MenuTile extends StatelessWidget {
|
||||
final String title;
|
||||
final GestureTapCallback onTap;
|
||||
final GestureTapCallback? onTap;
|
||||
|
||||
const MenuTile({@required this.title, this.onTap}) : assert(title != null);
|
||||
const MenuTile({required this.title, this.onTap}) : assert(title != null);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -16,10 +16,10 @@ class PendingFriendTile extends StatelessWidget {
|
||||
final RespondFriendshipRequestCallback onRespond;
|
||||
|
||||
const PendingFriendTile(
|
||||
{Key key,
|
||||
@required this.friend,
|
||||
@required this.user,
|
||||
@required this.onRespond})
|
||||
{Key? key,
|
||||
required this.friend,
|
||||
required this.user,
|
||||
required this.onRespond})
|
||||
: assert(friend != null),
|
||||
assert(user != null),
|
||||
assert(onRespond != null),
|
||||
@ -41,7 +41,7 @@ class PendingFriendTile extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
ElevatedButton(
|
||||
child: Text(
|
||||
tr("Accept").toUpperCase(),
|
||||
tr("Accept")!.toUpperCase(),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
style: ButtonStyle(
|
||||
@ -53,7 +53,7 @@ class PendingFriendTile extends StatelessWidget {
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(
|
||||
tr("Reject").toUpperCase(),
|
||||
tr("Reject")!.toUpperCase(),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
style: ButtonStyle(
|
||||
|
@ -52,13 +52,13 @@ class PostTile extends StatefulWidget {
|
||||
final bool userNamesClickable;
|
||||
|
||||
const PostTile({
|
||||
Key key,
|
||||
@required this.post,
|
||||
@required this.usersInfo,
|
||||
@required this.onDeletedPost,
|
||||
@required this.showPostTarget,
|
||||
@required this.groupsInfo,
|
||||
@required this.userNamesClickable,
|
||||
Key? key,
|
||||
required this.post,
|
||||
required this.usersInfo,
|
||||
required this.onDeletedPost,
|
||||
required this.showPostTarget,
|
||||
required this.groupsInfo,
|
||||
required this.userNamesClickable,
|
||||
}) : assert(post != null),
|
||||
assert(usersInfo != null),
|
||||
assert(onDeletedPost != null),
|
||||
@ -78,7 +78,7 @@ class _PostTileState extends State<PostTile> {
|
||||
|
||||
// Class members
|
||||
TextEditingController _commentController = TextEditingController();
|
||||
BytesFile _commentImage;
|
||||
BytesFile? _commentImage;
|
||||
bool _submitting = false;
|
||||
int _maxNumberOfCommentToShow = 10;
|
||||
|
||||
@ -99,7 +99,7 @@ class _PostTileState extends State<PostTile> {
|
||||
|
||||
return " > " +
|
||||
(widget.post.isGroupPost
|
||||
? widget.groupsInfo[widget.post.groupID].displayName
|
||||
? widget.groupsInfo[widget.post.groupID]!.displayName
|
||||
: widget.usersInfo.getUser(widget.post.userPageID).displayName);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ class _PostTileState extends State<PostTile> {
|
||||
child: AccountImageWidget(user: _user),
|
||||
onTap: widget.userNamesClickable
|
||||
? () => openUserPage(
|
||||
userID: _user.id,
|
||||
userID: _user.id!,
|
||||
context: context,
|
||||
)
|
||||
: null,
|
||||
@ -130,7 +130,7 @@ class _PostTileState extends State<PostTile> {
|
||||
_user.displayName + _getPostTarget(),
|
||||
style: _userNameStyle,
|
||||
),
|
||||
Text(diffTimeFromNowToStr(widget.post.timeSent)),
|
||||
Text(diffTimeFromNowToStr(widget.post.timeSent)!),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -147,14 +147,14 @@ class _PostTileState extends State<PostTile> {
|
||||
itemBuilder: (c) => [
|
||||
// Update post content
|
||||
PopupMenuItem(
|
||||
child: Text(tr("Update content")),
|
||||
child: Text(tr("Update content")!),
|
||||
value: _PostActions.UPDATE_CONTENT,
|
||||
enabled: widget.post.canUpdate,
|
||||
),
|
||||
|
||||
// Delete post
|
||||
PopupMenuItem(
|
||||
child: Text(tr("Delete")),
|
||||
child: Text(tr("Delete")!),
|
||||
value: _PostActions.DELETE,
|
||||
enabled: widget.post.canDelete,
|
||||
),
|
||||
@ -166,7 +166,7 @@ class _PostTileState extends State<PostTile> {
|
||||
}
|
||||
|
||||
Widget _buildContentRow() {
|
||||
Widget postContent;
|
||||
Widget? postContent;
|
||||
switch (widget.post.kind) {
|
||||
case PostKind.IMAGE:
|
||||
postContent = _buildPostImage();
|
||||
@ -258,7 +258,7 @@ class _PostTileState extends State<PostTile> {
|
||||
|
||||
Widget _buildPostImage() {
|
||||
return NetworkImageWidget(
|
||||
url: widget.post.fileURL,
|
||||
url: widget.post.fileURL!,
|
||||
allowFullScreen: true,
|
||||
roundedEdges: false,
|
||||
loadingHeight: 150,
|
||||
@ -273,11 +273,11 @@ class _PostTileState extends State<PostTile> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(Icons.ondemand_video),
|
||||
Text(tr("YouTube movie"))
|
||||
Text(tr("YouTube movie")!)
|
||||
],
|
||||
),
|
||||
onPressed: () =>
|
||||
launch("https://youtube.com/watch/?v=" + widget.post.filePath),
|
||||
launch("https://youtube.com/watch/?v=" + widget.post.filePath!),
|
||||
);
|
||||
}
|
||||
|
||||
@ -286,14 +286,14 @@ class _PostTileState extends State<PostTile> {
|
||||
color:
|
||||
darkTheme() ? darkerAccentColor : Color.fromRGBO(0xf7, 0xf7, 0xf7, 1),
|
||||
child: InkWell(
|
||||
onTap: () => launch(widget.post.linkURL),
|
||||
onTap: () => launch(widget.post.linkURL!),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: widget.post.hasLinkImage
|
||||
? NetworkImageWidget(
|
||||
url: widget.post.linkImage,
|
||||
url: widget.post.linkImage!,
|
||||
width: 70,
|
||||
roundedEdges: false,
|
||||
)
|
||||
@ -309,7 +309,7 @@ class _PostTileState extends State<PostTile> {
|
||||
Text(htmlDecodeCharacters(widget.post.linkTitle),
|
||||
style: TextStyle(fontSize: 20.0)),
|
||||
Text(
|
||||
widget.post.linkURL,
|
||||
widget.post.linkURL!,
|
||||
maxLines: 3,
|
||||
),
|
||||
Text(htmlDecodeCharacters(widget.post.linkDescription))
|
||||
@ -325,24 +325,24 @@ class _PostTileState extends State<PostTile> {
|
||||
Widget _buildPostPDF() {
|
||||
return ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
launch(widget.post.fileURL);
|
||||
launch(widget.post.fileURL!);
|
||||
},
|
||||
icon: Icon(Icons.picture_as_pdf),
|
||||
label: Text(tr("PDF")),
|
||||
label: Text(tr("PDF")!),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCountDownTimer() {
|
||||
return CountdownWidget(
|
||||
startTime: widget.post.timeSent,
|
||||
endTime: widget.post.timeEnd,
|
||||
endTime: widget.post.timeEnd!,
|
||||
);
|
||||
}
|
||||
|
||||
/// Build post survey
|
||||
Widget _buildPostSurvey() {
|
||||
return SurveyWidget(
|
||||
survey: widget.post.survey,
|
||||
survey: widget.post.survey!,
|
||||
onUpdated: (s) => setState(() => widget.post.survey = s),
|
||||
);
|
||||
}
|
||||
@ -352,11 +352,11 @@ class _PostTileState extends State<PostTile> {
|
||||
assert(widget.post.hasComments);
|
||||
|
||||
final comments = List<Widget>.generate(
|
||||
min(widget.post.comments.length, _maxNumberOfCommentToShow),
|
||||
min(widget.post.comments!.length, _maxNumberOfCommentToShow),
|
||||
(num) {
|
||||
final index = num +
|
||||
max(0, widget.post.comments.length - _maxNumberOfCommentToShow);
|
||||
final comment = widget.post.comments[index];
|
||||
max(0, widget.post.comments!.length - _maxNumberOfCommentToShow);
|
||||
final comment = widget.post.comments![index as int];
|
||||
return CommentTile(
|
||||
comment: comment,
|
||||
user: widget.usersInfo.getUser(comment.userID),
|
||||
@ -374,7 +374,7 @@ class _PostTileState extends State<PostTile> {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
|
||||
child: Column(
|
||||
children: (widget.post.comments.length > _maxNumberOfCommentToShow
|
||||
children: (widget.post.comments!.length > _maxNumberOfCommentToShow
|
||||
? [_buildShowMoreCommentsButton()]
|
||||
: [])
|
||||
..addAll(comments),
|
||||
@ -389,7 +389,7 @@ class _PostTileState extends State<PostTile> {
|
||||
onTap: () => setState(() => _maxNumberOfCommentToShow += 10),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(tr("Show more comments").toUpperCase()),
|
||||
child: Text(tr("Show more comments")!.toUpperCase()),
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -400,7 +400,7 @@ class _PostTileState extends State<PostTile> {
|
||||
padding: EdgeInsets.only(
|
||||
left: 8.0,
|
||||
right: 8.0,
|
||||
top: (widget.post.comments.length > 0 ? 8.0 : 0)),
|
||||
top: (widget.post.comments!.length > 0 ? 8.0 : 0)),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
// Comment input
|
||||
@ -502,7 +502,7 @@ class _PostTileState extends State<PostTile> {
|
||||
});
|
||||
} catch (e, s) {
|
||||
logError(e, s);
|
||||
snack(context, tr("Failed to choose an image!"));
|
||||
snack(context, tr("Failed to choose an image!")!);
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ class _PostTileState extends State<PostTile> {
|
||||
postID: widget.post.id,
|
||||
content: _commentController.text,
|
||||
image: _commentImage,
|
||||
));
|
||||
)) ;
|
||||
|
||||
_sendingComment = false;
|
||||
|
||||
@ -524,7 +524,7 @@ class _PostTileState extends State<PostTile> {
|
||||
clearCommentForm();
|
||||
} catch (e) {
|
||||
print(e);
|
||||
showSimpleSnack(context, tr("Could not create comment!"));
|
||||
showSimpleSnack(context, tr("Could not create comment!")!);
|
||||
}
|
||||
}
|
||||
|
||||
@ -532,14 +532,14 @@ class _PostTileState extends State<PostTile> {
|
||||
Future<void> _updateCommentContent(Comment comment) async {
|
||||
final newContent = await askUserString(
|
||||
context: context,
|
||||
title: tr("Update comment content"),
|
||||
message: tr("New content:"),
|
||||
defaultValue: comment.content.isNull ? "" : comment.content.content,
|
||||
hint: tr("New content..."),
|
||||
title: tr("Update comment content")!,
|
||||
message: tr("New content:")!,
|
||||
defaultValue: comment.content.isNull ? "" : comment.content.content!,
|
||||
hint: tr("New content...")!,
|
||||
);
|
||||
|
||||
if (!(await _commentsHelper.updateContent(comment.id, newContent)))
|
||||
return showSimpleSnack(context, tr("Could not update comment content!"));
|
||||
return showSimpleSnack(context, tr("Could not update comment content!")!);
|
||||
}
|
||||
|
||||
/// Process the deletion of a user
|
||||
@ -550,7 +550,7 @@ class _PostTileState extends State<PostTile> {
|
||||
title: tr("Delete comment"))) return;
|
||||
|
||||
if (!await _commentsHelper.delete(comment.id)) {
|
||||
showSimpleSnack(context, tr("Could not delete the comment!"));
|
||||
showSimpleSnack(context, tr("Could not delete the comment!")!);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -582,7 +582,7 @@ class _PostTileState extends State<PostTile> {
|
||||
|
||||
// Update post visibility
|
||||
if (!await _postsHelper.setVisibility(widget.post.id, newLevel)) {
|
||||
showSimpleSnack(context, tr("Could not update post visibility!"));
|
||||
showSimpleSnack(context, tr("Could not update post visibility!")!);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -593,17 +593,17 @@ class _PostTileState extends State<PostTile> {
|
||||
Future<void> updateContent() async {
|
||||
final newContent = await askUserString(
|
||||
context: context,
|
||||
title: tr("Update post content"),
|
||||
message: tr("Please enter message content: "),
|
||||
title: tr("Update post content")!,
|
||||
message: tr("Please enter message content: ")!,
|
||||
defaultValue:
|
||||
widget.post.content.isNull ? "" : widget.post.content.content,
|
||||
hint: tr("Post content"),
|
||||
widget.post.content.isNull ? "" : widget.post.content.content!,
|
||||
hint: tr("Post content")!,
|
||||
);
|
||||
|
||||
if (newContent == null) return;
|
||||
|
||||
if (!await _postsHelper.updateContent(widget.post.id, newContent)) {
|
||||
showSimpleSnack(context, tr("Could not update post content!"));
|
||||
showSimpleSnack(context, tr("Could not update post content!")!);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -620,7 +620,7 @@ class _PostTileState extends State<PostTile> {
|
||||
)) return;
|
||||
|
||||
if (!await _postsHelper.delete(widget.post.id)) {
|
||||
showSimpleSnack(context, tr("Could not delete the post!"));
|
||||
showSimpleSnack(context, tr("Could not delete the post!")!);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -12,10 +12,10 @@ class PostVisibilityLevelTile extends StatelessWidget {
|
||||
final bool visible;
|
||||
|
||||
const PostVisibilityLevelTile({
|
||||
Key key,
|
||||
@required this.level,
|
||||
@required this.title,
|
||||
@required this.onSelect,
|
||||
Key? key,
|
||||
required this.level,
|
||||
required this.title,
|
||||
required this.onSelect,
|
||||
this.visible = true,
|
||||
}) : assert(level != null),
|
||||
assert(title != null),
|
||||
|
@ -11,9 +11,9 @@ class ServerConversationMessageTile extends StatelessWidget {
|
||||
final UsersList users;
|
||||
|
||||
const ServerConversationMessageTile({
|
||||
Key key,
|
||||
@required this.message,
|
||||
@required this.users,
|
||||
Key? key,
|
||||
required this.message,
|
||||
required this.users,
|
||||
}) : assert(message != null),
|
||||
assert(users != null),
|
||||
super(key: key);
|
||||
@ -22,7 +22,7 @@ class ServerConversationMessageTile extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Text(
|
||||
message.getText(users),
|
||||
message.getText(users)!,
|
||||
style: TextStyle(
|
||||
fontStyle: FontStyle.italic,
|
||||
fontSize: 12,
|
||||
|
@ -12,13 +12,13 @@ typedef OnUserTap = void Function(User);
|
||||
|
||||
class SimpleUserTile extends StatelessWidget {
|
||||
final User user;
|
||||
final OnUserTap onTap;
|
||||
final Widget trailing;
|
||||
final String subtitle;
|
||||
final OnUserTap? onTap;
|
||||
final Widget? trailing;
|
||||
final String? subtitle;
|
||||
|
||||
const SimpleUserTile({
|
||||
Key key,
|
||||
this.user,
|
||||
Key? key,
|
||||
required this.user,
|
||||
this.onTap,
|
||||
this.trailing,
|
||||
this.subtitle,
|
||||
@ -28,12 +28,12 @@ class SimpleUserTile extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
onTap: onTap == null ? null : () => onTap(user),
|
||||
onTap: onTap == null ? null : () => onTap!(user),
|
||||
leading: AccountImageWidget(
|
||||
user: user,
|
||||
),
|
||||
title: Text(user.fullName),
|
||||
subtitle: subtitle == null ? null : Text(subtitle),
|
||||
subtitle: subtitle == null ? null : Text(subtitle!),
|
||||
trailing: trailing,
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user