1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 16:25:17 +00:00

Start to fix null safety migration errors

This commit is contained in:
2022-03-10 19:39:57 +01:00
parent ab2c5da0da
commit 3a997cdc56
258 changed files with 2879 additions and 2912 deletions

View File

@ -19,8 +19,8 @@ class AboutUserSection extends StatefulWidget {
final AdvancedUserInfo user;
const AboutUserSection({
Key key,
@required this.user,
Key? key,
required this.user,
}) : assert(user != null),
super(key: key);
@ -29,7 +29,7 @@ class AboutUserSection extends StatefulWidget {
}
class _AboutUserSectionState extends State<AboutUserSection> {
FriendStatus _friendStatus;
late FriendStatus _friendStatus;
final _screenKey = GlobalKey<AsyncScreenWidgetState>();
@ -38,14 +38,14 @@ class _AboutUserSectionState extends State<AboutUserSection> {
_friendStatus = await FriendsHelper().getFriendshipStatus(widget.user.id);
}
void _toggleRefresh() => _screenKey.currentState.refresh();
void _toggleRefresh() => _screenKey.currentState!.refresh();
@override
Widget build(BuildContext context) => AsyncScreenWidget(
key: _screenKey,
onReload: _init,
onBuild: _buildList,
errorMessage: tr("Failed to load user information!"));
errorMessage: tr("Failed to load user information!")!);
Widget _buildList() => ListView(
children: [
@ -58,7 +58,7 @@ class _AboutUserSectionState extends State<AboutUserSection> {
widget.user.hasPersonalWebsite
? ListTile(
leading: Icon(Icons.link),
title: Text(tr("Personal Website")),
title: Text(tr("Personal Website")!),
subtitle: Text(widget.user.personalWebsite),
onTap: () => launch(widget.user.personalWebsite),
)
@ -68,7 +68,7 @@ class _AboutUserSectionState extends State<AboutUserSection> {
widget.user.hasPublicNote
? ListTile(
leading: Icon(Icons.note),
title: Text(tr("Note")),
title: Text(tr("Note")!),
subtitle: TextWidget(
content: DisplayedString(widget.user.publicNote)),
)
@ -78,7 +78,7 @@ class _AboutUserSectionState extends State<AboutUserSection> {
widget.user.hasVirtualDirectory
? ListTile(
leading: Icon(Icons.alternate_email),
title: Text(tr("Virtual directory")),
title: Text(tr("Virtual directory")!),
subtitle: Text("@${widget.user.virtualDirectory}"))
: Container(),
@ -87,10 +87,10 @@ class _AboutUserSectionState extends State<AboutUserSection> {
? Container()
: ListTile(
leading: Icon(Icons.email_outlined),
title: Text(tr("Email address")),
subtitle: Text(widget.user.emailAddress),
title: Text(tr("Email address")!),
subtitle: Text(widget.user.emailAddress!),
onTap: () =>
copyToClipboard(context, widget.user.emailAddress),
copyToClipboard(context, widget.user.emailAddress!),
),
// User location
@ -98,16 +98,16 @@ class _AboutUserSectionState extends State<AboutUserSection> {
? Container()
: ListTile(
leading: Icon(Icons.location_on),
title: Text(tr("Location")),
subtitle: Text(widget.user.location),
onTap: () => copyToClipboard(context, widget.user.location),
title: Text(tr("Location")!),
subtitle: Text(widget.user.location!),
onTap: () => copyToClipboard(context, widget.user.location!),
),
// Number of friends
widget.user.isFriendsListPublic
? ListTile(
leading: Icon(Icons.group),
title: Text(tr("Number of friends")),
title: Text(tr("Number of friends")!),
subtitle: Text(widget.user.numberFriends.toString()),
)
: Container(),
@ -115,20 +115,20 @@ class _AboutUserSectionState extends State<AboutUserSection> {
// Member for
ListTile(
leading: Icon(Icons.access_time_rounded),
title: Text(tr("Member for")),
title: Text(tr("Member for")!),
subtitle:
Text(diffTimeFromNowToStr(widget.user.accountCreationTime)),
Text(diffTimeFromNowToStr(widget.user.accountCreationTime)!),
),
// Account visibility
ListTile(
leading: Icon(Icons.remove_red_eye),
title: Text(tr("Account visibility")),
title: Text(tr("Account visibility")!),
subtitle: Text(widget.user.pageVisibility == UserPageVisibility.OPEN
? tr("Open page")
? tr("Open page")!
: (widget.user.pageVisibility == UserPageVisibility.PUBLIC
? tr("Public page")
: tr("Private page"))),
? tr("Public page")!
: tr("Private page")!)),
),
],
);

View File

@ -14,9 +14,9 @@ class UserPageHeader extends StatelessWidget {
final Color bgColor;
const UserPageHeader({
Key key,
@required this.user,
@required this.bgColor,
Key? key,
required this.user,
required this.bgColor,
}) : assert(user != null),
super(key: key);

View File

@ -13,8 +13,8 @@ class UserPostsSection extends StatefulWidget {
final AdvancedUserInfo user;
const UserPostsSection({
Key key,
@required this.user,
Key? key,
required this.user,
}) : assert(user != null),
super(key: key);
@ -23,7 +23,7 @@ class UserPostsSection extends StatefulWidget {
}
class _UserPostsSectionState extends State<UserPostsSection> {
int get _userID => widget.user.id;
int? get _userID => widget.user.id;
final _postsKey = GlobalKey<PostsListWidgetState>();
@ -34,7 +34,7 @@ class _UserPostsSectionState extends State<UserPostsSection> {
widget.user.canPostTexts
? PostCreateFormWidget(
postTarget: PostTarget.USER_PAGE,
targetID: _userID,
targetID: _userID!,
onCreated: _postCreated,
)
: Container()
@ -45,6 +45,6 @@ class _UserPostsSectionState extends State<UserPostsSection> {
);
void _postCreated() {
_postsKey.currentState.loadPostsList(getOlder: false);
_postsKey.currentState!.loadPostsList(getOlder: false);
}
}