mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-25 04:18:51 +00:00
Fix a few notices
This commit is contained in:
parent
0f9a59b4a7
commit
41446f0e5b
@ -58,22 +58,13 @@ class Post implements LikeElement {
|
||||
required this.access,
|
||||
required this.comments,
|
||||
required this.survey})
|
||||
: assert(id != null),
|
||||
assert(userID != null),
|
||||
assert(userPageID != 0 || groupID != 0),
|
||||
assert(timeSent != null),
|
||||
assert(kind != PostKind.TEXT || content != null),
|
||||
assert(visibilityLevel != null),
|
||||
assert(kind != null),
|
||||
: assert(userPageID != 0 || groupID != 0),
|
||||
assert(kind != PostKind.COUNTDOWN || timeEnd != null),
|
||||
assert(kind != PostKind.SURVEY || survey != null),
|
||||
assert(likes != null),
|
||||
assert(userLike != null),
|
||||
assert(access != null);
|
||||
assert(kind != PostKind.SURVEY || survey != null);
|
||||
|
||||
bool get isGroupPost => groupID != null && groupID! > 0;
|
||||
|
||||
bool get hasContent => content != null && !content.isNull;
|
||||
bool get hasContent => !content.isNull && !content.isEmpty;
|
||||
|
||||
bool get hasComments => comments != null;
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/// Check password reset token result
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
@ -13,7 +11,5 @@ class ResCheckPasswordToken {
|
||||
required this.firstName,
|
||||
required this.lastName,
|
||||
required this.email,
|
||||
}) : assert(firstName != null),
|
||||
assert(lastName != null),
|
||||
assert(email != null);
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/// Single search result
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
@ -13,6 +11,5 @@ class SearchResult {
|
||||
SearchResult({
|
||||
required this.id,
|
||||
required this.kind,
|
||||
}) : assert(id != null),
|
||||
assert(kind != null);
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/// Security settings of the user
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
@ -15,8 +13,5 @@ class SecuritySettings {
|
||||
required this.securityAnswer1,
|
||||
required this.securityQuestion2,
|
||||
required this.securityAnswer2,
|
||||
}) : assert(securityQuestion1 != null),
|
||||
assert(securityAnswer1 != null),
|
||||
assert(securityQuestion2 != null),
|
||||
assert(securityAnswer2 != null);
|
||||
});
|
||||
}
|
||||
|
@ -35,14 +35,7 @@ class PasswordPolicy {
|
||||
required this.minNumberDigits,
|
||||
required this.minNumberSpecialCharacters,
|
||||
required this.minCategoriesPresence,
|
||||
}) : assert(allowMailInPassword != null),
|
||||
assert(allowNameInPassword != null),
|
||||
assert(minPasswordLength != null),
|
||||
assert(minNumberUpperCaseLetters != null),
|
||||
assert(minNumberLowerCaseLetters != null),
|
||||
assert(minNumberDigits != null),
|
||||
assert(minNumberSpecialCharacters != null),
|
||||
assert(minCategoriesPresence != null);
|
||||
});
|
||||
}
|
||||
|
||||
class ServerDataConservationPolicy {
|
||||
@ -60,12 +53,7 @@ class ServerDataConservationPolicy {
|
||||
required this.minPostsLifetime,
|
||||
required this.minConversationMessagesLifetime,
|
||||
required this.minLikesLifetime,
|
||||
}) : assert(minInactiveAccountLifetime != null),
|
||||
assert(minNotificationLifetime != null),
|
||||
assert(minCommentsLifetime != null),
|
||||
assert(minPostsLifetime != null),
|
||||
assert(minConversationMessagesLifetime != null),
|
||||
assert(minLikesLifetime != null);
|
||||
});
|
||||
}
|
||||
|
||||
class ConversationsPolicy {
|
||||
@ -97,19 +85,7 @@ class ConversationsPolicy {
|
||||
required this.maxThumbnailHeight,
|
||||
required this.maxLogoWidth,
|
||||
required this.maxLogoHeight,
|
||||
}) : assert(maxConversationNameLen != null),
|
||||
assert(minMessageLen != null),
|
||||
assert(maxMessageLen != null),
|
||||
assert(allowedFilesType != null),
|
||||
assert(filesMaxSize != null),
|
||||
assert(writingEventInterval != null),
|
||||
assert(writingEventLifetime != null),
|
||||
assert(maxMessageImageWidth != null),
|
||||
assert(maxMessageImageHeight != null),
|
||||
assert(maxThumbnailWidth != null),
|
||||
assert(maxThumbnailHeight != null),
|
||||
assert(maxLogoWidth != null),
|
||||
assert(maxLogoHeight != null);
|
||||
});
|
||||
}
|
||||
|
||||
class AccountInformationPolicy {
|
||||
@ -125,11 +101,7 @@ class AccountInformationPolicy {
|
||||
required this.minLastNameLength,
|
||||
required this.maxLastNameLength,
|
||||
required this.maxLocationLength,
|
||||
}) : assert(minFirstNameLength != null),
|
||||
assert(maxFirstNameLength != null),
|
||||
assert(minLastNameLength != null),
|
||||
assert(maxLastNameLength != null),
|
||||
assert(maxLocationLength != null);
|
||||
});
|
||||
}
|
||||
|
||||
enum BannerNature { Information, Warning, Success }
|
||||
@ -161,9 +133,7 @@ class Banner {
|
||||
required this.nature,
|
||||
required this.message,
|
||||
required this.link,
|
||||
}) : assert(enabled != null),
|
||||
assert(nature != null),
|
||||
assert(message != null);
|
||||
});
|
||||
|
||||
bool get visible => enabled && (expire == null || expire! > time());
|
||||
}
|
||||
@ -195,15 +165,5 @@ class ServerConfig {
|
||||
required this.dataConservationPolicy,
|
||||
required this.conversationsPolicy,
|
||||
required this.accountInformationPolicy,
|
||||
}) : assert(minSupportedMobileVersion != null),
|
||||
assert(termsURL != null),
|
||||
assert(privacyPolicyURL != null),
|
||||
assert(contactEmail != null),
|
||||
assert(playStoreURL != null),
|
||||
assert(androidDirectDownloadURL != null),
|
||||
assert(notificationsPolicy != null),
|
||||
assert(passwordPolicy != null),
|
||||
assert(dataConservationPolicy != null),
|
||||
assert(conversationsPolicy != null),
|
||||
assert(accountInformationPolicy != null);
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/// Single survey choice
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
@ -13,7 +11,5 @@ class SurveyChoice {
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.responses,
|
||||
}) : assert(id != null),
|
||||
assert(name != null),
|
||||
assert(responses != null);
|
||||
});
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ class UnreadConversation {
|
||||
const UnreadConversation({
|
||||
required this.conv,
|
||||
required this.message,
|
||||
}) : assert(conv != null),
|
||||
assert(message != null);
|
||||
});
|
||||
}
|
||||
|
@ -13,9 +13,7 @@ class WsMessage {
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.data,
|
||||
}) : assert(id != null),
|
||||
assert(title != null),
|
||||
assert(title.length > 0);
|
||||
}) : assert(title.length > 0);
|
||||
|
||||
/// Construct a message from a JSON document (messages coming from the server)
|
||||
static WsMessage fromJSON(final Map<dynamic, dynamic> m) {
|
||||
@ -23,12 +21,11 @@ class WsMessage {
|
||||
}
|
||||
|
||||
/// Turn a message into a JSON object to send it to the API
|
||||
String toJSON() =>
|
||||
jsonEncode({
|
||||
String toJSON() => jsonEncode({
|
||||
"id": id,
|
||||
"title": title,
|
||||
"data": data,
|
||||
});
|
||||
|
||||
bool get hasId => this.id != null && this.id.isNotEmpty;
|
||||
bool get hasId => this.id.isNotEmpty;
|
||||
}
|
||||
|
@ -11,9 +11,7 @@ Future<void> alert(BuildContext context, String? msg) async {
|
||||
class _AlertDialog extends StatelessWidget {
|
||||
final String msg;
|
||||
|
||||
const _AlertDialog({Key? key, required this.msg})
|
||||
: assert(msg != null),
|
||||
super(key: key);
|
||||
const _AlertDialog({Key? key, required this.msg}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -19,8 +19,7 @@ class _AudioPlayerDialog extends StatefulWidget {
|
||||
const _AudioPlayerDialog({
|
||||
Key? key,
|
||||
required this.url,
|
||||
}) : assert(url != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
__AudioPlayerDialogState createState() => __AudioPlayerDialogState();
|
||||
|
@ -12,8 +12,6 @@ Future<String?> showInputNewPassword({
|
||||
required BuildContext context,
|
||||
required UserInfoForPassword userInfo,
|
||||
}) async {
|
||||
assert(context != null);
|
||||
assert(userInfo != null);
|
||||
return await showDialog(
|
||||
context: context,
|
||||
builder: (c) => _InputNewPasswordDialog(
|
||||
@ -27,8 +25,7 @@ class _InputNewPasswordDialog extends StatefulWidget {
|
||||
const _InputNewPasswordDialog({
|
||||
Key? key,
|
||||
required this.userInfo,
|
||||
}) : assert(userInfo != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
__InputNewPasswordDialogState createState() =>
|
||||
@ -45,7 +42,8 @@ class __InputNewPasswordDialogState extends State<_InputNewPasswordDialog> {
|
||||
bool get _input1Valid =>
|
||||
_controller1.currentState != null && _controller1.currentState!.valid;
|
||||
|
||||
bool get _input2Valid => _controller1.currentState!.value == _controller2.text;
|
||||
bool get _input2Valid =>
|
||||
_controller1.currentState!.value == _controller2.text;
|
||||
|
||||
bool get _isValid => _input1Valid && _input2Valid;
|
||||
|
||||
|
@ -51,9 +51,7 @@ class _MultiChoicesEntryDialog<T> extends StatefulWidget {
|
||||
required this.title,
|
||||
required this.defaultChoice,
|
||||
required this.choices,
|
||||
}) : assert(title != null),
|
||||
assert(defaultChoice != null),
|
||||
assert(choices != null),
|
||||
}) : assert(defaultChoice != null),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
|
@ -39,10 +39,7 @@ class _PickFileOption {
|
||||
required this.label,
|
||||
required this.icon,
|
||||
required this.canEnable,
|
||||
}) : assert(value != null),
|
||||
assert(label != null),
|
||||
assert(icon != null),
|
||||
assert(canEnable != null);
|
||||
});
|
||||
}
|
||||
|
||||
List<_PickFileOption> get _optionsList => [
|
||||
@ -94,8 +91,6 @@ Future<BytesFile?> showPickFileDialog({
|
||||
int? imageMaxHeight,
|
||||
CropAspectRatio? aspectRatio,
|
||||
}) async {
|
||||
assert(allowedMimeTypes != null);
|
||||
|
||||
// Get the list of allowed extension
|
||||
final allowedExtensions = <String>[];
|
||||
for (var mime in allowedExtensions) {
|
||||
@ -196,9 +191,7 @@ class _BottomSheetPickOption extends StatelessWidget {
|
||||
|
||||
const _BottomSheetPickOption(
|
||||
{Key? key, required this.options, required this.onOptionSelected})
|
||||
: assert(options != null),
|
||||
assert(onOptionSelected != null),
|
||||
super(key: key);
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container(
|
||||
|
@ -266,9 +266,7 @@ class _RecordAction extends StatelessWidget {
|
||||
required this.icon,
|
||||
required this.onTap,
|
||||
this.color,
|
||||
}) : assert(visible != null),
|
||||
assert(icon != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -287,9 +285,7 @@ class _ActionButton extends StatelessWidget {
|
||||
required this.visible,
|
||||
required this.text,
|
||||
this.onPressed,
|
||||
}) : assert(visible != null),
|
||||
assert(text != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -27,12 +27,7 @@ class SingleInputDialog extends StatefulWidget {
|
||||
this.canBeEmpty = false,
|
||||
this.maxLines = 1,
|
||||
this.maxLength,
|
||||
}) : assert(title != null),
|
||||
assert(label != null),
|
||||
assert(checkInput != null),
|
||||
assert(errorMessage != null),
|
||||
assert(maxLines != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
__InputURLDialogState createState() => __InputURLDialogState();
|
||||
|
@ -18,11 +18,6 @@ Future<String?> showVirtualDirectoryDialog({
|
||||
required int id,
|
||||
required VirtualDirectoryTargetType type,
|
||||
}) async {
|
||||
assert(context != null);
|
||||
assert(initialDirectory != null);
|
||||
assert(id != null);
|
||||
assert(type != null);
|
||||
|
||||
return await showDialog<String>(
|
||||
context: context,
|
||||
builder: (c) => _VirtualDirectoryPicker(
|
||||
@ -39,10 +34,7 @@ class _VirtualDirectoryPicker extends StatefulWidget {
|
||||
required this.initialDirectory,
|
||||
required this.id,
|
||||
required this.type,
|
||||
}) : assert(initialDirectory != null),
|
||||
assert(id != null),
|
||||
assert(type != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
__VirtualDirectoryPickerState createState() =>
|
||||
|
@ -246,9 +246,7 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
|
||||
class _Spacer extends StatelessWidget {
|
||||
final bool visible;
|
||||
|
||||
const _Spacer({Key? key, this.visible = true})
|
||||
: assert(visible != null),
|
||||
super(key: key);
|
||||
const _Spacer({Key? key, this.visible = true}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -50,8 +50,9 @@ abstract class MainController extends State<MainRoute> {
|
||||
int get numberOfPages => _pagesStack.length;
|
||||
|
||||
/// Get current instance of Home controller
|
||||
///
|
||||
/// A future implementation might need context again, that is why it is required
|
||||
static MainController? of(BuildContext context) {
|
||||
assert(context != null); // A future implementation might need context again
|
||||
return mainControllerKey.currentState;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ class PushNotificationsConfigurationWidgetState
|
||||
available: srvConfig!.notificationsPolicy.hasFirebase,
|
||||
onChanged: (s) {
|
||||
setState(() => currStatus = s);
|
||||
if (widget.onChanged != null) widget.onChanged();
|
||||
widget.onChanged();
|
||||
},
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
|
@ -129,8 +129,7 @@ class _NewCustomEmojiDialog extends StatefulWidget {
|
||||
const _NewCustomEmojiDialog({
|
||||
Key? key,
|
||||
required this.currentList,
|
||||
}) : assert(currentList != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NewCustomEmojiDialogState createState() => _NewCustomEmojiDialogState();
|
||||
|
@ -35,8 +35,7 @@ class GroupSettingsScreen extends StatefulWidget {
|
||||
final int groupID;
|
||||
|
||||
const GroupSettingsScreen({Key? key, required this.groupID})
|
||||
: assert(groupID != null),
|
||||
super(key: key);
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_GroupSettingsScreenState createState() => _GroupSettingsScreenState();
|
||||
|
@ -8,7 +8,7 @@ class MenuTile extends StatelessWidget {
|
||||
final String title;
|
||||
final GestureTapCallback? onTap;
|
||||
|
||||
const MenuTile({required this.title, this.onTap}) : assert(title != null);
|
||||
const MenuTile({required this.title, this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
Loading…
Reference in New Issue
Block a user