1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-25 04:18:51 +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);
/// Get user full name
String get fullName => firstName! + " " + lastName!;
String get fullName => firstName + " " + lastName;
/// Get user display name
String get displayName => htmlDecodeCharacters(fullName);

View File

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

View File

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

View File

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

View File

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

View File

@ -97,7 +97,7 @@ class _SearchResultUser extends StatelessWidget {
user: user,
),
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)
: null,
),
title: Text(ConversationsHelper.getConversationName(conv.conv, _users)!),
title: Text(ConversationsHelper.getConversationName(conv.conv, _users)),
subtitle: RichText(
text: TextSpan(style: Theme.of(context).textTheme.bodyText2, children: [
TextSpan(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -169,7 +169,7 @@ class _SearchResultsWidget extends StatelessWidget {
leading: AccountImageWidget(user: user),
title: Text(user.displayName),
onTap: () {
MainController.of(context)!.openUserPage(user.id!);
MainController.of(context)!.openUserPage(user.id);
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:
return _buildConversationMembership(membership);
}
throw Exception("Unreachable statement!");
}
// TODO : add private messages icon support
@ -156,7 +154,7 @@ class _MembershipsPanelState extends SafeState<MembershipsPanel> {
leading: AccountImageWidget(user: user, width: _MembershipIconsWidth),
title: Text(user.displayName),
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),
Expanded(
child: Text(ConversationsHelper.getConversationName(
conversation, _usersList)!),
conversation, _usersList)),
),
],
),

View File

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

View File

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