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

Fix all warnings

This commit is contained in:
Pierre HUBERT 2022-03-11 16:21:35 +01:00
parent 820491b09a
commit 5398970868
18 changed files with 27 additions and 22 deletions

View File

@ -30,7 +30,7 @@ class User implements SerializableElement<User> {
}) : assert(id > 0); }) : assert(id > 0);
/// Get user full name /// Get user full name
String get fullName => firstName! + " " + lastName!; String get fullName => firstName + " " + lastName;
/// Get user display name /// Get user display name
String get displayName => htmlDecodeCharacters(fullName); String get displayName => htmlDecodeCharacters(fullName);

View File

@ -51,7 +51,7 @@ class _PushNotificationsConfigurationRouteState
), ),
Spacer(), Spacer(),
OutlinedButton( OutlinedButton(
onPressed: _key?.currentState?.canSubmit ?? false onPressed: _key.currentState?.canSubmit ?? false
? _key.currentState!.submit ? _key.currentState!.submit
: null, : null,
child: Text(tr("Configure")!.toUpperCase()), child: Text(tr("Configure")!.toUpperCase()),

View File

@ -123,7 +123,7 @@ class TourRouteState extends State<TourRoute> {
..removeWhere((pane) { ..removeWhere((pane) {
if (pane is PresentationPane) { if (pane is PresentationPane) {
PresentationPane p = pane; PresentationPane p = pane;
return !(p.visible ?? true); return !(p.visible);
} }
return false; return false;
}); });
@ -222,7 +222,7 @@ class __RouteBodyState extends State<_RouteBody> {
_controller!.animateTo(_controller!.index + 1); _controller!.animateTo(_controller!.index + 1);
} else { } else {
(await PreferencesHelper.getInstance())! (await PreferencesHelper.getInstance())
.setBool(PreferencesKeyList.IS_TOUR_SEEN, true); .setBool(PreferencesKeyList.IS_TOUR_SEEN, true);
Navigator.of(context).pop(); Navigator.of(context).pop();
} }

View File

@ -316,6 +316,9 @@ class _NotificationTile extends StatelessWidget {
case _PopupMenuActions.DELETE: case _PopupMenuActions.DELETE:
onDelete(notification); onDelete(notification);
break; break;
default:
break;
} }
} }

View File

@ -88,7 +88,7 @@ class _OtherUserFriendsListScreenState
user: _usersInfo!.getUser(_friendsList.elementAt(i)), user: _usersInfo!.getUser(_friendsList.elementAt(i)),
onTap: (u) => openUserPage( onTap: (u) => openUserPage(
context: context, context: context,
userID: u.id!, userID: u.id,
), ),
), ),
), ),

View File

@ -97,7 +97,7 @@ class _SearchResultUser extends StatelessWidget {
user: user, user: user,
), ),
title: Text(user.displayName), title: Text(user.displayName),
onTap: () => MainController.of(context)!.openUserPage(user.id!), onTap: () => MainController.of(context)!.openUserPage(user.id),
); );
} }
} }

View File

@ -102,7 +102,7 @@ class _UnreadConversationsScreenState
? _groups!.getGroup(conv.conv.groupID) ? _groups!.getGroup(conv.conv.groupID)
: null, : null,
), ),
title: Text(ConversationsHelper.getConversationName(conv.conv, _users)!), title: Text(ConversationsHelper.getConversationName(conv.conv, _users)),
subtitle: RichText( subtitle: RichText(
text: TextSpan(style: Theme.of(context).textTheme.bodyText2, children: [ text: TextSpan(style: Theme.of(context).textTheme.bodyText2, children: [
TextSpan( TextSpan(

View File

@ -282,7 +282,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
void _toggleAdminStatus(User user) async { void _toggleAdminStatus(User user) async {
try { try {
final setAdmin = !_admins.contains(user.id); final setAdmin = !_admins.contains(user.id);
await ConversationsHelper.setAdmin(_conversation.id!, user.id!, setAdmin); await ConversationsHelper.setAdmin(_conversation.id!, user.id, setAdmin);
setState(() { setState(() {
if (!setAdmin) if (!setAdmin)

View File

@ -40,7 +40,7 @@ class AcceptedFriendTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListTile( return ListTile(
onTap: () => openUserPage(context: context, userID: user.id!), onTap: () => openUserPage(context: context, userID: user.id),
leading: AccountImageWidget(user: user), leading: AccountImageWidget(user: user),
title: Text(user.displayName), title: Text(user.displayName),
subtitle: friend.isConnected subtitle: friend.isConnected

View File

@ -64,7 +64,7 @@ class ConversationMessageTile extends StatelessWidget {
onSelected: (v) => _menuOptionSelected(context, v), onSelected: (v) => _menuOptionSelected(context, v),
itemBuilder: (c) => <PopupMenuItem<_MenuChoices>>[ itemBuilder: (c) => <PopupMenuItem<_MenuChoices>>[
PopupMenuItem( PopupMenuItem(
enabled: (message.message?.content ?? "") != "", enabled: (message.message.content ?? "") != "",
value: _MenuChoices.COPY_MESSAGE, value: _MenuChoices.COPY_MESSAGE,
child: Text(tr("Copy message")!), child: Text(tr("Copy message")!),
), ),

View File

@ -68,7 +68,7 @@ class ConversationTile extends StatelessWidget {
ConversationsHelper.getConversationName( ConversationsHelper.getConversationName(
conversation, conversation,
usersList, usersList,
)!, ),
style: TextStyle( style: TextStyle(
fontWeight: conversation.sawLastMessage ? null : FontWeight.bold, fontWeight: conversation.sawLastMessage ? null : FontWeight.bold,
), ),
@ -162,6 +162,9 @@ class ConversationTile extends StatelessWidget {
case _PopupMenuChoices.LEAVE: case _PopupMenuChoices.LEAVE:
onRequestLeave(conversation); onRequestLeave(conversation);
break; break;
default:
break;
} }
} }
} }

View File

@ -114,7 +114,7 @@ class _PostTileState extends State<PostTile> {
child: AccountImageWidget(user: _user), child: AccountImageWidget(user: _user),
onTap: widget.userNamesClickable onTap: widget.userNamesClickable
? () => openUserPage( ? () => openUserPage(
userID: _user.id!, userID: _user.id,
context: context, context: context,
) )
: null, : null,

View File

@ -23,7 +23,7 @@ class AccountImageWidget extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: user.accountImageURL!, imageUrl: user.accountImageURL,
width: width, width: width,
height: width, height: width,
fit: BoxFit.cover, fit: BoxFit.cover,

View File

@ -217,6 +217,8 @@ class _ComunicMobileAppBarState extends SafeState<ComunicMobileAppBar> {
case BarCallbackActions.ACTION_LOGOUT: case BarCallbackActions.ACTION_LOGOUT:
controller!.requestLogout(); controller!.requestLogout();
break; break;
default:
break;
} }
} }
} }

View File

@ -169,7 +169,7 @@ class _SearchResultsWidget extends StatelessWidget {
leading: AccountImageWidget(user: user), leading: AccountImageWidget(user: user),
title: Text(user.displayName), title: Text(user.displayName),
onTap: () { onTap: () {
MainController.of(context)!.openUserPage(user.id!); MainController.of(context)!.openUserPage(user.id);
onTap(); onTap();
}, },
); );
@ -185,6 +185,5 @@ class _SearchResultsWidget extends StatelessWidget {
}, },
); );
} }
throw Exception("Unreachable statement!");
} }
} }

View File

@ -105,8 +105,6 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
case MembershipType.CONVERSATION: case MembershipType.CONVERSATION:
return _buildConversationMembership(membership); return _buildConversationMembership(membership);
} }
throw Exception("Unreachable statement!");
} }
// TODO : add private messages icon support // TODO : add private messages icon support
@ -156,7 +154,7 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
leading: AccountImageWidget(user: user, width: _MembershipIconsWidth), leading: AccountImageWidget(user: user, width: _MembershipIconsWidth),
title: Text(user.displayName), title: Text(user.displayName),
subtitle: subtitle, subtitle: subtitle,
onTap: () => MainController.of(context)!.openUserPage(user.id!), onTap: () => MainController.of(context)!.openUserPage(user.id),
), ),
); );
} }
@ -237,7 +235,7 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
SizedBox(width: 5), SizedBox(width: 5),
Expanded( Expanded(
child: Text(ConversationsHelper.getConversationName( child: Text(ConversationsHelper.getConversationName(
conversation, _usersList)!), conversation, _usersList)),
), ),
], ],
), ),

View File

@ -27,7 +27,7 @@ class TourNotificationsPane extends PresentationPane {
onConfigured: onConfigured, onConfigured: onConfigured,
onChanged: onChanged, onChanged: onChanged,
), ),
canGoNext: pushNotificationsKey?.currentState?.canSubmit ?? false, canGoNext: pushNotificationsKey.currentState?.canSubmit ?? false,
onTapNext: (c) => pushNotificationsKey.currentState!.submit(), onTapNext: (c) => pushNotificationsKey.currentState!.submit(),
visible: visible, visible: visible,
); );

View File

@ -58,9 +58,9 @@ class BBCodeParsedWidget extends StatelessWidget {
int? lastBeginPos = pos; int? lastBeginPos = pos;
int childNumber = 0; int childNumber = 0;
bool stop = false; bool stop = false;
while (!stop && pos! < text.length) { while (!stop && pos < text.length) {
//Go to next stop //Go to next stop
while (!stop && pos! < text.length) { while (!stop && pos < text.length) {
if (text[pos] == '[') break; if (text[pos] == '[') break;
pos++; pos++;
} }