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 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, Key? key,
required this.conv, required this.conv,
required this.message, required this.message,
}) : assert(conv != null), }) : super(key: key);
assert(message != null),
super(key: key);
@override @override
_ConversationMessageStatsRouteState createState() => _ConversationMessageStatsRouteState createState() =>

View File

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

View File

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

View File

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

View File

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

View File

@ -31,8 +31,5 @@ class PageInfo {
this.id, this.id,
this.hideNavBar = false, this.hideNavBar = false,
this.canShowAsDialog = 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({ const PasswordResetRoute({
Key? key, Key? key,
required this.token, required this.token,
}) : assert(token != null), }) : super(key: key);
super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -39,8 +38,7 @@ class _PasswordResetBody extends StatefulWidget {
final String token; final String token;
const _PasswordResetBody({Key? key, required this.token}) const _PasswordResetBody({Key? key, required this.token})
: assert(token != null), : super(key: key);
super(key: key);
@override @override
__PasswordResetBodyState createState() => __PasswordResetBodyState(); __PasswordResetBodyState createState() => __PasswordResetBodyState();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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