1
0
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:
Pierre HUBERT 2022-03-11 17:02:06 +01:00
parent f0f7096c94
commit 0f9a59b4a7
27 changed files with 45 additions and 97 deletions

View File

@ -21,9 +21,7 @@ class ConversationMessageStatsRoute extends StatefulWidget {
Key? key,
required this.conv,
required this.message,
}) : assert(conv != null),
assert(message != null),
super(key: key);
}) : super(key: key);
@override
_ConversationMessageStatsRouteState createState() =>

View File

@ -21,8 +21,7 @@ class ConversationRoute extends StatefulWidget {
const ConversationRoute({
Key? key,
required this.conversationID,
}) : assert(conversationID != null),
super(key: key);
}) : super(key: key);
@override
State<StatefulWidget> createState() => _ConversationRouteState();
@ -69,7 +68,7 @@ class _ConversationRouteState extends SafeState<ConversationRoute> {
Widget _buildRouteBody() {
//Handle errors
if (_error != null && _error)
if (_error)
return buildErrorCard(
tr("Could not get conversation information!"),
actions: <Widget>[

View File

@ -26,8 +26,7 @@ class PresenceSettings extends StatefulWidget {
const PresenceSettings({
Key? key,
required this.groupID,
}) : assert(groupID != null),
super(key: key);
}) : super(key: key);
@override
_PresenceSettingsState createState() => _PresenceSettingsState();

View File

@ -82,8 +82,6 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
case _SelectedOption.SECURITY_QUESTIONS:
return _buildSecurityQuestionsScreen();
}
throw Exception("Unreachable statement!");
}
Widget _buildEnterEmailAddressScreen() {
@ -120,7 +118,7 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
_setLoading(true);
// Check if email address exists or not
if (!await AccountHelper.existsMailAccount(_inputEmail) ) {
if (!await AccountHelper.existsMailAccount(_inputEmail)) {
_setLoading(false);
showSimpleSnack(context, tr("Specified email address was not found!")!);
return;
@ -169,7 +167,8 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
context: context,
builder: (c) => AlertDialog(
title: Text("Contact us"),
content: Text(tr("You can reach us at contact@communiquons.org")!),
content:
Text(tr("You can reach us at contact@communiquons.org")!),
actions: <Widget>[CancelDialogButton()],
));
}

View File

@ -11,7 +11,7 @@ import 'package:url_launcher/url_launcher.dart';
class FullScreenImageRoute extends StatefulWidget {
final String url;
FullScreenImageRoute(this.url) : assert(url != null);
FullScreenImageRoute(this.url);
@override
_FullScreenImageRouteState createState() => _FullScreenImageRouteState();

View File

@ -31,8 +31,5 @@ class PageInfo {
this.id,
this.hideNavBar = false,
this.canShowAsDialog = false,
}) : assert(type != null),
assert(child != null),
assert(hideNavBar != null),
assert(canShowAsDialog != null);
});
}

View File

@ -19,8 +19,7 @@ class PasswordResetRoute extends StatelessWidget {
const PasswordResetRoute({
Key? key,
required this.token,
}) : assert(token != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -39,8 +38,7 @@ class _PasswordResetBody extends StatefulWidget {
final String token;
const _PasswordResetBody({Key? key, required this.token})
: assert(token != null),
super(key: key);
: super(key: key);
@override
__PasswordResetBodyState createState() => __PasswordResetBodyState();

View File

@ -140,7 +140,7 @@ class PushNotificationsConfigurationWidgetState
srvConfig!.notificationsPolicy.hasIndependent && isAndroid,
onChanged: (s) {
setState(() => currStatus = s);
if (widget.onChanged != null) widget.onChanged();
widget.onChanged();
},
),
SizedBox(height: 5),
@ -151,7 +151,7 @@ class PushNotificationsConfigurationWidgetState
available: true,
onChanged: (s) {
setState(() => currStatus = s);
if (widget.onChanged != null) widget.onChanged();
widget.onChanged();
},
),
],
@ -195,12 +195,7 @@ class _NotificationOption extends StatelessWidget {
required this.current,
required this.available,
required this.onChanged,
}) : assert(title != null),
assert(option != null),
assert(current != null),
assert(available != null),
assert(onChanged != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) => !available

View File

@ -180,9 +180,7 @@ class DataConservationPolicyTile extends SettingsTile {
required this.title,
required this.onChange,
required this.minValue,
}) : assert(title != null),
assert(onChange != null),
assert(minValue != null);
});
@override
Widget build(BuildContext context) {

View File

@ -140,8 +140,7 @@ class _SecurityQuestionsDialog extends StatefulWidget {
final SecuritySettings settings;
const _SecurityQuestionsDialog({Key? key, required this.settings})
: assert(settings != null),
super(key: key);
: super(key: key);
@override
__SecurityQuestionsDialogState createState() =>

View File

@ -31,10 +31,7 @@ class _SettingsSection {
required this.subtitle,
required this.icon,
required this.onBuild,
}) : assert(title != null),
assert(subtitle != null),
assert(icon != null),
assert(onBuild != null);
});
}
class AccountSettingsRoute extends StatelessWidget {

View File

@ -14,8 +14,7 @@ class SinglePostRoute extends StatelessWidget {
const SinglePostRoute({
Key? key,
required this.postID,
}) : assert(postID != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -34,8 +33,7 @@ class _SinglePostRouteBody extends StatefulWidget {
const _SinglePostRouteBody({
Key? key,
required this.postID,
}) : assert(postID != null),
super(key: key);
}) : super(key: key);
@override
__SinglePostRouteBodyState createState() => __SinglePostRouteBodyState();

View File

@ -9,8 +9,7 @@ class UpdateConversationRoute extends StatefulWidget {
final int conversationID;
const UpdateConversationRoute({Key? key, required this.conversationID})
: assert(conversationID != null),
super(key: key);
: super(key: key);
@override
State<StatefulWidget> createState() => _UpdateConversationRoute();

View File

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

View File

@ -35,9 +35,7 @@ class AuthorizedGroupPageScreen extends StatefulWidget {
required this.advancedGroupInfo,
required this.conversationID,
required this.needRefresh,
}) : assert(advancedGroupInfo != null),
assert(needRefresh != null),
super(key: key);
}) : super(key: key);
@override
_AuthorizedGroupPageScreenState createState() =>
@ -210,9 +208,7 @@ class _GroupPageTab {
required this.widget,
this.visible = true,
required this.label,
}) : assert(widget != null),
assert(visible != null),
assert(label != null);
});
Tab get tab => Tab(text: label);
}

View File

@ -46,9 +46,7 @@ class CallScreen extends StatefulWidget {
this.floatingButtons = true,
this.buildCustomAppBar,
this.onClose,
}) : assert(convID != null),
assert(convID > 0),
assert(floatingButtons != null),
}) : assert(convID > 0),
super(key: key);
@override
@ -694,10 +692,7 @@ class _FooterButton extends StatelessWidget {
this.width = 45,
this.bgColor = Colors.black,
required this.roundedButtons,
}) : assert(icon != null),
assert(visible != null),
assert(roundedButtons != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) {

View File

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

View File

@ -43,8 +43,7 @@ class ConversationScreen extends StatefulWidget {
final int conversationID;
const ConversationScreen({Key? key, required this.conversationID})
: assert(conversationID != null),
super(key: key);
: super(key: key);
@override
State<StatefulWidget> createState() => _ConversationScreenState();
@ -667,7 +666,9 @@ class _ConversationScreenState extends SafeState<ConversationScreen> {
? _buildLoadingOlderMessage()
: null,
),
_messages!.length == 0 ? _buildNoMessagesNotice() : _buildMessagesList(),
_messages!.length == 0
? _buildNoMessagesNotice()
: _buildMessagesList(),
UserWritingInConvNotifier(convID: _conversation.id!),
_sendCancel != null ? _buildSendingWidget() : _buildSendMessageForm(),
_showEmojiPicker ? _buildEmojiContainer() : Container(),

View File

@ -27,8 +27,7 @@ class ConversationsListScreen extends StatefulWidget {
Key? key,
this.useSmallFAB = false,
this.onOpen,
}) : assert(useSmallFAB != null),
super(key: key);
}) : super(key: key);
@override
State<StatefulWidget> createState() => _ConversationScreenState();
@ -74,7 +73,6 @@ class _ConversationScreenState extends SafeState<ConversationsListScreen> {
ConversationsList list = cached
? await _conversationsHelper.getCachedList()
: await _conversationsHelper.downloadList();
assert(list != null);
// Get information about the members of the conversations
_users = await _usersHelper.getList(list.allUsersID);
@ -145,7 +143,7 @@ class _ConversationScreenState extends SafeState<ConversationsListScreen> {
"Do you really want to leave this conversation ? As you are its last admin, it will be completely deleted!")
: tr("Do you really want to leave this conversation ?"));
if (result == null || !result) return;
if (!result) return;
// Request the conversation to be deleted now
try {

View File

@ -19,9 +19,7 @@ class GroupAccessDeniedScreen extends StatefulWidget {
Key? key,
required this.groupID,
required this.onMembershipAcquired,
}) : assert(groupID != null),
assert(onMembershipAcquired != null),
super(key: key);
}) : super(key: key);
@override
_GroupAccessDeniedScreenState createState() =>

View File

@ -18,8 +18,7 @@ class GroupPageScreen extends StatefulWidget {
Key? key,
required this.groupID,
this.conversationID,
}) : assert(groupID != null),
super(key: key);
}) : super(key: key);
@override
_GroupPageScreenState createState() => _GroupPageScreenState();

View File

@ -15,8 +15,7 @@ class AboutGroupSection extends StatelessWidget {
const AboutGroupSection({
Key? key,
required this.group,
}) : assert(group != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) => ListView(
@ -51,8 +50,8 @@ class AboutGroupSection extends StatelessWidget {
ListTile(
leading: Icon(Icons.group),
title: Text(tr("Members")!),
subtitle: Text(
tr("%1% members", args: {"1": group.numberMembers.toString()})!),
subtitle: Text(tr("%1% members",
args: {"1": group.numberMembers.toString()})!),
),
// Who can create posts
@ -92,8 +91,8 @@ class AboutGroupSection extends StatelessWidget {
ListTile(
leading: Icon(Icons.remove_red_eye),
title: Text(tr("Members list visibility")!),
subtitle:
Text(group.isMembersListPublic! ? tr("Public")! : tr("Private")!),
subtitle: Text(
group.isMembersListPublic! ? tr("Public")! : tr("Private")!),
),
group.isForezGroup

View File

@ -18,8 +18,7 @@ class ForezPresenceSection extends StatefulWidget {
const ForezPresenceSection({
Key? key,
required this.groupID,
}) : assert(groupID != null),
super(key: key);
}) : super(key: key);
@override
_ForezPresenceSectionState createState() => _ForezPresenceSectionState();

View File

@ -14,8 +14,7 @@ class GroupConversationSection extends StatelessWidget {
const GroupConversationSection({
Key? key,
required this.conv,
}) : assert(conv != null),
super(key: key);
}) : super(key: key);
@override
Widget build(BuildContext context) => Stack(

View File

@ -22,8 +22,7 @@ class GroupMembersSection extends StatefulWidget {
final int groupID;
const GroupMembersSection({Key? key, required this.groupID})
: assert(groupID != null),
super(key: key);
: super(key: key);
@override
_GroupMembersSectionState createState() => _GroupMembersSectionState();
@ -143,11 +142,7 @@ class _GroupMembershipTile extends StatefulWidget {
required this.membership,
required this.user,
required this.onUpdated,
}) : assert(group != null),
assert(membership != null),
assert(user != null),
assert(onUpdated != null),
super(key: key);
}) : super(key: key);
@override
__GroupMembershipTileState createState() => __GroupMembershipTileState();
@ -182,15 +177,12 @@ class __GroupMembershipTileState extends State<_GroupMembershipTile> {
case GroupMembershipLevel.MODERATOR:
case GroupMembershipLevel.MEMBER:
return _buildMemberCase();
break;
case GroupMembershipLevel.INVITED:
return _buildInvitedCase();
break;
case GroupMembershipLevel.PENDING:
return _buildRequestedCase();
break;
case GroupMembershipLevel.VISITOR:
// This case should never happen

View File

@ -14,8 +14,7 @@ class GroupPostsSection extends StatefulWidget {
const GroupPostsSection({
Key? key,
required this.group,
}) : assert(group != null),
super(key: key);
}) : super(key: key);
@override
_GroupPostsSectionState createState() => _GroupPostsSectionState();

View File

@ -30,8 +30,7 @@ class NotificationsScreen extends StatefulWidget {
const NotificationsScreen({
Key? key,
this.useSmallDeleteButton = false,
}) : assert(useSmallDeleteButton != null),
super(key: key);
}) : super(key: key);
@override
_NotificationsScreenState createState() => _NotificationsScreenState();