refactor: Switch to flutter_lints

This commit is contained in:
Krille Fear 2021-10-14 18:09:30 +02:00
commit 13fda9458f
101 changed files with 719 additions and 653 deletions

View file

@ -27,14 +27,17 @@ class ChatListItem extends StatelessWidget {
final Function onTap;
final Function onLongPress;
const ChatListItem(this.room,
{this.activeChat = false,
this.selected = false,
this.onTap,
this.onLongPress,
this.onForget});
const ChatListItem(
this.room, {
this.activeChat = false,
this.selected = false,
this.onTap,
this.onLongPress,
this.onForget,
Key key,
}) : super(key: key);
void clickAction(BuildContext context) async {
dynamic clickAction(BuildContext context) async {
if (onTap != null) return onTap();
if (!activeChat) {
if (room.membership == Membership.invite &&
@ -161,13 +164,13 @@ class ChatListItem extends StatelessWidget {
: Theme.of(context).secondaryHeaderColor,
onLongPress: onLongPress,
leading: selected
? Container(
? SizedBox(
width: Avatar.defaultSize,
height: Avatar.defaultSize,
child: Material(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(Avatar.defaultSize),
child: Icon(Icons.check, color: Colors.white),
child: const Icon(Icons.check, color: Colors.white),
),
)
: Avatar(room.avatar, room.displayname, onTap: onLongPress),
@ -188,8 +191,8 @@ class ChatListItem extends StatelessWidget {
),
),
if (isMuted)
Padding(
padding: const EdgeInsets.only(left: 4.0),
const Padding(
padding: EdgeInsets.only(left: 4.0),
child: Icon(
Icons.notifications_off_outlined,
size: 16,
@ -227,15 +230,15 @@ class ChatListItem extends StatelessWidget {
room.lastEvent.statusIcon,
size: 14,
),
SizedBox(width: 4),
const SizedBox(width: 4),
},
AnimatedContainer(
width: typingText.isEmpty ? 0 : 18,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(),
duration: Duration(milliseconds: 300),
decoration: const BoxDecoration(),
duration: const Duration(milliseconds: 300),
curve: Curves.bounceInOut,
padding: EdgeInsets.only(right: 4),
padding: const EdgeInsets.only(right: 4),
child: Icon(
Icons.edit_outlined,
color: Theme.of(context).colorScheme.secondary,
@ -286,11 +289,11 @@ class ChatListItem extends StatelessWidget {
),
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
AnimatedContainer(
duration: Duration(milliseconds: 300),
duration: const Duration(milliseconds: 300),
curve: Curves.bounceInOut,
padding: EdgeInsets.symmetric(horizontal: 7),
padding: const EdgeInsets.symmetric(horizontal: 7),
height: unreadBubbleSize,
width: room.notificationCount == 0 && !unread
? 0
@ -307,7 +310,7 @@ class ChatListItem extends StatelessWidget {
child: room.notificationCount > 0
? Text(
room.notificationCount.toString(),
style: TextStyle(
style: const TextStyle(
color: Colors.white,
fontSize: 13,
),

View file

@ -8,7 +8,7 @@ import '../../pages/user_bottom_sheet.dart';
class ParticipantListItem extends StatelessWidget {
final User user;
const ParticipantListItem(this.user);
const ParticipantListItem(this.user, {Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -38,8 +38,8 @@ class ParticipantListItem extends StatelessWidget {
permissionBatch.isEmpty
? Container()
: Container(
padding: EdgeInsets.all(4),
margin: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.all(4),
margin: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor,
borderRadius: BorderRadius.circular(8),
@ -49,8 +49,8 @@ class ParticipantListItem extends StatelessWidget {
membershipBatch[user.membership].isEmpty
? Container()
: Container(
padding: EdgeInsets.all(4),
margin: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.all(4),
margin: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor,
borderRadius: BorderRadius.circular(8),

View file

@ -69,13 +69,13 @@ class PermissionsListTile extends StatelessWidget {
leading: CircleAvatar(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
foregroundColor: Colors.grey,
child: Icon(Icons.edit_attributes_outlined),
child: const Icon(Icons.edit_attributes_outlined),
),
title: Text(getLocalizedPowerLevelString(context)),
subtitle: Row(
children: [
Container(
padding: EdgeInsets.all(4),
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor,
borderRadius: BorderRadius.circular(8),
@ -84,7 +84,7 @@ class PermissionsListTile extends StatelessWidget {
child: Text(permission.toString()),
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
Text(permission.toLocalizedPowerLevelString(context)),
],
),

View file

@ -110,7 +110,7 @@ class UserDeviceListItem extends StatelessWidget {
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Spacer(),
const Spacer(),
if (userDevice.lastSeenTs != null)
Text(DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs)
.localizedTimeShort(context)),
@ -120,9 +120,9 @@ class UserDeviceListItem extends StatelessWidget {
children: <Widget>[
Text(
userDevice.deviceId,
style: TextStyle(fontWeight: FontWeight.w300),
style: const TextStyle(fontWeight: FontWeight.w300),
),
Spacer(),
const Spacer(),
if (keys != null)
Text(
keys.blocked