1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 04:49: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 PostVisibilityLevel initialLevel,
required bool isGroup, required bool isGroup,
}) async { }) async {
assert(context != null);
assert(initialLevel != null);
assert(isGroup != null);
final newLevel = await showDialog<PostVisibilityLevel>( final newLevel = await showDialog<PostVisibilityLevel>(
context: context, context: context,
builder: (c) => _PostVisibilityPickerWidget( builder: (c) => _PostVisibilityPickerWidget(

View File

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

View File

@ -54,7 +54,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
String get _conversationColor => _colorController.text; String get _conversationColor => _colorController.text;
Color? get _color { Color? get _color {
if (_conversationColor == null || _conversationColor.isEmpty) return null; if (_conversationColor.isEmpty) return null;
try { try {
return HexColor(_conversationColor); return HexColor(_conversationColor);
@ -237,8 +237,6 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
/// An option of the members menu has been selected /// An option of the members menu has been selected
void _membersMenuItemSelected(User user, _MembersMenuChoices choice) { void _membersMenuItemSelected(User user, _MembersMenuChoices choice) {
if (choice == null) return;
switch (choice) { switch (choice) {
case _MembersMenuChoices.REMOVE: case _MembersMenuChoices.REMOVE:
_removeMember(user); _removeMember(user);

View File

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

View File

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

View File

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

View File

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

View File

@ -30,12 +30,7 @@ class AcceptedFriendTile extends StatelessWidget {
required this.onRequestDelete, required this.onRequestDelete,
required this.onSetFollowing, required this.onSetFollowing,
required this.onOpenPrivateConversation, required this.onOpenPrivateConversation,
}) : assert(friend != null), }) : super(key: key);
assert(user != null),
assert(onRequestDelete != null),
assert(onSetFollowing != null),
assert(onOpenPrivateConversation != null),
super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,9 +22,7 @@ class ConversationFileWidget extends StatefulWidget {
Key? key, Key? key,
required this.messageID, required this.messageID,
required this.file, required this.file,
}) : assert(messageID != null), }) : super(key: key);
assert(file != null),
super(key: key);
@override @override
_ConversationFileWidgetState createState() => _ConversationFileWidgetState(); _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, Key? key,
required this.users, required this.users,
required this.size, required this.size,
}) : assert(users != null), }) : assert(size > 0),
assert(size != null),
assert(size > 0),
super(key: key); super(key: key);
@override @override

View File

@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
class CopyIcon extends StatelessWidget { class CopyIcon extends StatelessWidget {
final String value; final String value;
const CopyIcon(this.value) : assert(value != null); const CopyIcon(this.value);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -18,7 +18,8 @@ class CopyIcon extends StatelessWidget {
icon: Icon(Icons.content_copy), icon: Icon(Icons.content_copy),
onPressed: () { onPressed: () {
FlutterClipboard.copy(value); 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, Key? key,
required this.startTime, required this.startTime,
required this.endTime, required this.endTime,
}) : assert(startTime != null), }) : super(key: key);
assert(endTime != null),
super(key: key);
@override @override
_CountdownWidgetState createState() => _CountdownWidgetState(); _CountdownWidgetState createState() => _CountdownWidgetState();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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