1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-24 22:09:21 +00:00

Fix a few notices

This commit is contained in:
Pierre HUBERT 2022-03-11 16:40:56 +01:00
parent 45e8f34c81
commit adbc036c16
35 changed files with 73 additions and 159 deletions

View File

@ -13,10 +13,6 @@ Future<PostVisibilityLevel> showPostVisibilityPickerDialog({
required PostVisibilityLevel initialLevel,
required bool isGroup,
}) async {
assert(context != null);
assert(initialLevel != null);
assert(isGroup != null);
final newLevel = await showDialog<PostVisibilityLevel>(
context: context,
builder: (c) => _PostVisibilityPickerWidget(

View File

@ -86,9 +86,7 @@ class _SearchScreenState extends State<SearchScreen> {
class _SearchResultUser extends StatelessWidget {
final User user;
const _SearchResultUser({Key? key, required this.user})
: assert(user != null),
super(key: key);
const _SearchResultUser({Key? key, required this.user}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -105,9 +103,7 @@ class _SearchResultUser extends StatelessWidget {
class _SearchResultGroup extends StatelessWidget {
final Group group;
const _SearchResultGroup({Key? key, required this.group})
: assert(group != null),
super(key: key);
const _SearchResultGroup({Key? key, required this.group}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -54,7 +54,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
String get _conversationColor => _colorController.text;
Color? get _color {
if (_conversationColor == null || _conversationColor.isEmpty) return null;
if (_conversationColor.isEmpty) return null;
try {
return HexColor(_conversationColor);
@ -237,8 +237,6 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
/// An option of the members menu has been selected
void _membersMenuItemSelected(User user, _MembersMenuChoices choice) {
if (choice == null) return;
switch (choice) {
case _MembersMenuChoices.REMOVE:
_removeMember(user);
@ -307,7 +305,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
members: _members.map((element) => element.id).toList(),
follow: _followConversation,
canEveryoneAddMembers: _canEveryoneAddMembers!,
color: _color)) ;
color: _color));
MainController.of(context)!.popPage();
MainController.of(context)!.openConversationById(conversationID);

View File

@ -18,8 +18,7 @@ class UserAccessDeniedScreen extends StatefulWidget {
final int userID;
const UserAccessDeniedScreen({Key? key, required this.userID})
: assert(userID != null),
super(key: key);
: super(key: key);
@override
_UserAccessDeniedScreenState createState() => _UserAccessDeniedScreenState();

View File

@ -21,8 +21,7 @@ class AboutUserSection extends StatefulWidget {
const AboutUserSection({
Key? key,
required this.user,
}) : assert(user != null),
super(key: key);
}) : super(key: key);
@override
_AboutUserSectionState createState() => _AboutUserSectionState();

View File

@ -17,8 +17,7 @@ class UserPageHeader extends StatelessWidget {
Key? key,
required this.user,
required this.bgColor,
}) : assert(user != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) => Container(

View File

@ -15,8 +15,7 @@ class UserPostsSection extends StatefulWidget {
const UserPostsSection({
Key? key,
required this.user,
}) : assert(user != null),
super(key: key);
}) : super(key: key);
@override
_UserPostsSectionState createState() => _UserPostsSectionState();

View File

@ -30,12 +30,7 @@ class AcceptedFriendTile extends StatelessWidget {
required this.onRequestDelete,
required this.onSetFollowing,
required this.onOpenPrivateConversation,
}) : assert(friend != null),
assert(user != null),
assert(onRequestDelete != null),
assert(onSetFollowing != null),
assert(onOpenPrivateConversation != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -55,32 +50,32 @@ class AcceptedFriendTile extends StatelessWidget {
),
trailing: PopupMenuButton<_FriendMenuChoices>(
itemBuilder: (c) => [
//Open a private conversation
PopupMenuItem(
child: Text(tr("Private conversation")!),
value: _FriendMenuChoices.PRIVATE_CONVERSATION,
),
//Open a private conversation
PopupMenuItem(
child: Text(tr("Private conversation")!),
value: _FriendMenuChoices.PRIVATE_CONVERSATION,
),
// Update following status
PopupMenuItem(
child: Row(
children: <Widget>[
Icon(friend.following
? Icons.check_box
: Icons.check_box_outline_blank),
Container(width: 10.0),
Text(friend.following ? tr("Following")! : tr("Follow")!),
],
),
value: _FriendMenuChoices.TOGGLE_FOLLOWING,
),
// Update following status
PopupMenuItem(
child: Row(
children: <Widget>[
Icon(friend.following
? Icons.check_box
: Icons.check_box_outline_blank),
Container(width: 10.0),
Text(friend.following ? tr("Following")! : tr("Follow")!),
],
),
value: _FriendMenuChoices.TOGGLE_FOLLOWING,
),
// Remove the friend from the list
PopupMenuItem(
child: Text(tr("Remove")!),
value: _FriendMenuChoices.REMOVE,
),
],
// Remove the friend from the list
PopupMenuItem(
child: Text(tr("Remove")!),
value: _FriendMenuChoices.REMOVE,
),
],
onSelected: _selectedMenuOption,
),
);

View File

@ -27,11 +27,7 @@ class CommentTile extends StatelessWidget {
required this.user,
required this.onUpdateComment,
required this.onDeleteComment,
}) : assert(comment != null),
assert(user != null),
assert(onUpdateComment != null),
assert(onDeleteComment != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -37,12 +37,7 @@ class ConversationMessageTile extends StatelessWidget {
required this.onRequestMessageStats,
required this.onRequestMessageUpdate,
required this.onRequestMessageDelete,
}) : assert(message != null),
assert(user != null),
assert(onRequestMessageStats != null),
assert(onRequestMessageUpdate != null),
assert(onRequestMessageDelete != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) => Column(
@ -83,7 +78,7 @@ class ConversationMessageTile extends StatelessWidget {
// Update message content
PopupMenuItem(
enabled: message.isOwner &&
message.message != null &&
!message.message.isNull &&
message.message.content!.isNotEmpty,
value: _MenuChoices.REQUEST_UPDATE_CONTENT,
child: Text(tr("Update")!),

View File

@ -36,12 +36,7 @@ class ConversationTile extends StatelessWidget {
required this.onOpen,
required this.onRequestUpdate,
required this.onRequestLeave,
}) : assert(conversation != null),
assert(usersList != null),
assert(onOpen != null),
assert(onRequestUpdate != null),
assert(onRequestLeave != null),
super(key: key);
}) : super(key: key);
_buildSubInformation(IconData icon, String content) {
return Row(

View File

@ -20,10 +20,7 @@ class PendingFriendTile extends StatelessWidget {
required this.friend,
required this.user,
required this.onRespond})
: assert(friend != null),
assert(user != null),
assert(onRespond != null),
super(key: key);
: super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -59,13 +59,7 @@ class PostTile extends StatefulWidget {
required this.showPostTarget,
required this.groupsInfo,
required this.userNamesClickable,
}) : assert(post != null),
assert(usersInfo != null),
assert(onDeletedPost != null),
assert(showPostTarget != null),
assert(groupsInfo != null),
assert(userNamesClickable != null),
super(key: key);
}) : super(key: key);
@override
State<StatefulWidget> createState() => _PostTileState();
@ -515,7 +509,7 @@ class _PostTileState extends State<PostTile> {
postID: widget.post.id,
content: _commentController.text,
image: _commentImage,
)) ;
));
_sendingComment = false;
@ -578,7 +572,7 @@ class _PostTileState extends State<PostTile> {
isGroup: widget.post.isGroupPost,
);
if (newLevel == null || newLevel == widget.post.visibilityLevel) return;
if (newLevel == widget.post.visibilityLevel) return;
// Update post visibility
if (!await _postsHelper.setVisibility(widget.post.id, newLevel)) {

View File

@ -17,11 +17,7 @@ class PostVisibilityLevelTile extends StatelessWidget {
required this.title,
required this.onSelect,
this.visible = true,
}) : assert(level != null),
assert(title != null),
assert(onSelect != null),
assert(visible != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -14,9 +14,7 @@ class ServerConversationMessageTile extends StatelessWidget {
Key? key,
required this.message,
required this.users,
}) : assert(message != null),
assert(users != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -22,8 +22,7 @@ class SimpleUserTile extends StatelessWidget {
this.onTap,
this.trailing,
this.subtitle,
}) : assert(user != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -18,9 +18,7 @@ class FriendshipStatusWidget extends StatefulWidget {
Key? key,
required this.status,
required this.onFriendshipUpdated,
}) : assert(status != null),
assert(onFriendshipUpdated != null),
super(key: key);
}) : super(key: key);
@override
_FriendshipStatusWidgetState createState() => _FriendshipStatusWidgetState();

View File

@ -16,8 +16,7 @@ class AccountImageWidget extends StatelessWidget {
Key? key,
required this.user,
this.width = 35.0,
}) : assert(user != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -46,11 +46,7 @@ class AsyncScreenWidget extends StatefulWidget {
this.showOldDataWhileUpdating = false,
this.loadingWidget,
this.errorWidget,
}) : assert(onReload != null),
assert(onBuild != null),
assert(errorMessage != null),
assert(showOldDataWhileUpdating != null),
super(key: key);
}) : super(key: key);
@override
AsyncScreenWidgetState createState() => AsyncScreenWidgetState();

View File

@ -22,9 +22,7 @@ class ConversationFileWidget extends StatefulWidget {
Key? key,
required this.messageID,
required this.file,
}) : assert(messageID != null),
assert(file != null),
super(key: key);
}) : super(key: key);
@override
_ConversationFileWidgetState createState() => _ConversationFileWidgetState();
@ -101,7 +99,6 @@ class _ConversationFileWidgetState extends State<ConversationFileWidget> {
),
),
);
break;
}
}

View File

@ -83,9 +83,7 @@ class MultipleAccountImagesWidget extends StatelessWidget {
Key? key,
required this.users,
required this.size,
}) : assert(users != null),
assert(size != null),
assert(size > 0),
}) : assert(size > 0),
super(key: key);
@override

View File

@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
class CopyIcon extends StatelessWidget {
final String value;
const CopyIcon(this.value) : assert(value != null);
const CopyIcon(this.value);
@override
Widget build(BuildContext context) {
@ -18,7 +18,8 @@ class CopyIcon extends StatelessWidget {
icon: Icon(Icons.content_copy),
onPressed: () {
FlutterClipboard.copy(value);
snack(context, tr("'%c%' was copied to clipboard", args: {"c": value})!);
snack(
context, tr("'%c%' was copied to clipboard", args: {"c": value})!);
},
);
}

View File

@ -16,9 +16,7 @@ class CountdownWidget extends StatefulWidget {
Key? key,
required this.startTime,
required this.endTime,
}) : assert(startTime != null),
assert(endTime != null),
super(key: key);
}) : super(key: key);
@override
_CountdownWidgetState createState() => _CountdownWidgetState();

View File

@ -107,7 +107,8 @@ class _CreateAccountWidgetState extends State<CreateAccountWidget> {
label: tr("Last name")!,
onEdited: _updateUI,
icon: Icon(Icons.perm_identity),
maxLength: srvConfig!.accountInformationPolicy.maxLastNameLength,
maxLength:
srvConfig!.accountInformationPolicy.maxLastNameLength,
error: _showErrors && !_isLastNameValid
? tr("Invalid last name!")
: null,
@ -267,11 +268,7 @@ class _InputEntry extends StatelessWidget {
this.icon,
this.keyboard,
this.maxLength,
}) : assert(controller != null),
assert(label != null),
assert(onEdited != null),
assert(isPassword != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -41,10 +41,7 @@ class CustomListTile extends StatelessWidget {
this.onLongPressWithInfo,
this.onLongPressOpenMenu,
this.tileColor,
}) : assert(isThreeLine != null),
assert(enabled != null),
assert(selected != null),
assert(!isThreeLine || subtitle != null),
}) : assert(!isThreeLine || subtitle != null),
super(key: key);
@override

View File

@ -13,8 +13,7 @@ class ConfirmDialogButton<T> extends StatelessWidget {
Key? key,
this.enabled = true,
required this.value,
}) : assert(enabled != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -26,9 +26,7 @@ class PresenceCalendarWidget extends StatefulWidget {
this.onDayClicked,
this.mode = CalendarDisplayMode.SINGLE_USER,
this.selectedDay,
}) : assert(presenceSet != null),
assert(mode != null),
super(key: key);
}) : super(key: key);
@override
_PresenceCalendarWidgetState createState() => _PresenceCalendarWidgetState();
@ -148,8 +146,7 @@ class CellWidget extends StatelessWidget {
this.textColor,
this.circle = true,
this.selected,
}) : assert(text != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -21,9 +21,7 @@ class GroupFollowingWidget extends StatefulWidget {
required this.onUpdated,
this.activeColor,
this.inactiveColor,
}) : assert(group != null),
assert(onUpdated != null),
super(key: key);
}) : super(key: key);
@override
_GroupFollowingWidgetState createState() => _GroupFollowingWidgetState();
@ -46,7 +44,8 @@ class _GroupFollowingWidgetState extends SafeState<GroupFollowingWidget> {
color: _group.following ? widget.activeColor : widget.inactiveColor,
)),
TextSpan(
text: " " + (_group.following ? tr("Following")! : tr("Follow")!)),
text:
" " + (_group.following ? tr("Following")! : tr("Follow")!)),
]),
),
onTap: () => _toggleFollowing(),

View File

@ -13,9 +13,7 @@ class GroupIcon extends StatelessWidget {
Key? key,
required this.group,
this.width = 50,
}) : assert(group != null),
assert(width != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -25,8 +25,7 @@ class LikeWidget extends StatefulWidget {
this.buttonIconSize = 15.0,
this.activeColor,
this.inativeColor})
: assert(likeElement != null),
super(key: key);
: super(key: key);
@override
_LikeWidgetState createState() => _LikeWidgetState();

View File

@ -7,9 +7,7 @@ import 'package:flutter/material.dart';
class PostContainer extends StatelessWidget {
final Widget child;
const PostContainer({Key? key, required this.child})
: assert(child != null),
super(key: key);
const PostContainer({Key? key, required this.child}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -22,10 +22,7 @@ class MultiChoicesSettingsTile<T> extends SettingsTile {
required this.onChanged,
this.leading,
this.trailing,
}) : assert(title != null),
assert(choices != null),
assert(currentValue != null),
assert(onChanged != null);
}) : assert(currentValue != null);
@override
Widget build(BuildContext context) {

View File

@ -17,8 +17,7 @@ class StatusWidget extends StatefulWidget {
const StatusWidget({
Key? key,
required this.child,
}) : assert(child != null),
super(key: key);
}) : super(key: key);
@override
StatusWidgetState createState() => StatusWidgetState();

View File

@ -216,9 +216,7 @@ class _LeftPaneContainer extends StatelessWidget {
class _MainCardSpacer extends StatelessWidget {
final bool visible;
const _MainCardSpacer({this.visible = true, Key? key})
: assert(visible != null),
super(key: key);
const _MainCardSpacer({this.visible = true, Key? key}) : super(key: key);
@override
Widget build(BuildContext context) =>
@ -239,10 +237,7 @@ class _AboutUserEntry extends StatelessWidget {
required this.value,
this.visible = true,
this.parsed = false,
}) : assert(icon != null),
assert(title != null),
assert(visible != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

@ -29,7 +29,6 @@ class PresentationPane extends StatelessWidget {
this.onTapNext,
this.visible = true,
}) : assert(icon != null || iconWidget != null),
assert(title != null),
assert(text != null || child != null),
super(key: key);
@ -41,7 +40,9 @@ class PresentationPane extends StatelessWidget {
return Column(
children: <Widget>[
Spacer(flex: 3),
icon != null ? Icon(icon, color: Colors.white, size: 50) : iconWidget!,
icon != null
? Icon(icon, color: Colors.white, size: 50)
: iconWidget!,
Spacer(flex: 1),
Text(
title,