build: Update packages and flutter super.key refactoring

This commit is contained in:
krille-chan 2023-10-28 13:03:16 +02:00
commit eca4825c70
No known key found for this signature in database
129 changed files with 294 additions and 324 deletions

View file

@ -61,10 +61,10 @@ class ChatList extends StatefulWidget {
final String? activeChat;
const ChatList({
Key? key,
super.key,
this.displayNavigationRail = false,
required this.activeChat,
}) : super(key: key);
});
@override
ChatListController createState() => ChatListController();

View file

@ -25,7 +25,7 @@ import 'chat_list_header.dart';
class ChatListViewBody extends StatelessWidget {
final ChatListController controller;
const ChatListViewBody(this.controller, {Key? key}) : super(key: key);
const ChatListViewBody(this.controller, {super.key});
@override
Widget build(BuildContext context) {
@ -313,8 +313,7 @@ class _SearchItem extends StatelessWidget {
required this.title,
this.avatar,
required this.onPressed,
Key? key,
}) : super(key: key);
});
@override
Widget build(BuildContext context) => InkWell(

View file

@ -10,7 +10,7 @@ import '../../widgets/matrix.dart';
class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
final ChatListController controller;
const ChatListHeader({Key? key, required this.controller}) : super(key: key);
const ChatListHeader({super.key, required this.controller});
@override
Widget build(BuildContext context) {

View file

@ -30,8 +30,8 @@ class ChatListItem extends StatelessWidget {
this.selected = false,
this.onTap,
this.onLongPress,
Key? key,
}) : super(key: key);
super.key,
});
void clickAction(BuildContext context) async {
if (onTap != null) return onTap!();

View file

@ -20,7 +20,7 @@ import 'start_chat_fab.dart';
class ChatListView extends StatelessWidget {
final ChatListController controller;
const ChatListView(this.controller, {Key? key}) : super(key: key);
const ChatListView(this.controller, {super.key});
List<NavigationDestination> getNavigationDestinations(BuildContext context) {
final badgePosition = BadgePosition.topEnd(top: -12, end: -8);

View file

@ -15,7 +15,7 @@ import 'chat_list.dart';
class ClientChooserButton extends StatelessWidget {
final ChatListController controller;
const ClientChooserButton(this.controller, {Key? key}) : super(key: key);
const ClientChooserButton(this.controller, {super.key});
List<PopupMenuEntry<Object>> _bundleMenuItems(BuildContext context) {
final matrix = Matrix.of(context);
@ -112,48 +112,45 @@ class ClientChooserButton extends StatelessWidget {
],
),
),
...matrix.accountBundles[bundle]!
.map(
(client) => PopupMenuItem(
value: client,
child: FutureBuilder<Profile?>(
// analyzer does not understand this type cast for error
// handling
//
// ignore: unnecessary_cast
future: (client!.fetchOwnProfile() as Future<Profile?>)
.onError((e, s) => null),
builder: (context, snapshot) => Row(
children: [
Avatar(
mxContent: snapshot.data?.avatarUrl,
name: snapshot.data?.displayName ??
client.userID!.localpart,
size: 32,
fontSize: 12,
),
const SizedBox(width: 12),
Expanded(
child: Text(
snapshot.data?.displayName ??
client.userID!.localpart!,
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 12),
IconButton(
icon: const Icon(Icons.edit_outlined),
onPressed: () => controller.editBundlesForAccount(
client.userID,
bundle,
),
),
],
...matrix.accountBundles[bundle]!.map(
(client) => PopupMenuItem(
value: client,
child: FutureBuilder<Profile?>(
// analyzer does not understand this type cast for error
// handling
//
// ignore: unnecessary_cast
future: (client!.fetchOwnProfile() as Future<Profile?>)
.onError((e, s) => null),
builder: (context, snapshot) => Row(
children: [
Avatar(
mxContent: snapshot.data?.avatarUrl,
name:
snapshot.data?.displayName ?? client.userID!.localpart,
size: 32,
fontSize: 12,
),
),
const SizedBox(width: 12),
Expanded(
child: Text(
snapshot.data?.displayName ?? client.userID!.localpart!,
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 12),
IconButton(
icon: const Icon(Icons.edit_outlined),
onPressed: () => controller.editBundlesForAccount(
client.userID,
bundle,
),
),
],
),
)
.toList(),
),
),
),
],
PopupMenuItem(
value: SettingsAction.addAccount,

View file

@ -16,8 +16,8 @@ class NaviRailItem extends StatefulWidget {
required this.onTap,
required this.icon,
this.selectedIcon,
Key? key,
}) : super(key: key);
super.key,
});
@override
State<NaviRailItem> createState() => _NaviRailItemState();

View file

@ -13,8 +13,8 @@ class SearchTitle extends StatelessWidget {
this.trailing,
this.onTap,
this.color,
Key? key,
}) : super(key: key);
super.key,
});
@override
Widget build(BuildContext context) => Material(

View file

@ -21,9 +21,9 @@ class SpaceView extends StatefulWidget {
final ScrollController scrollController;
const SpaceView(
this.controller, {
Key? key,
super.key,
required this.scrollController,
}) : super(key: key);
});
@override
State<SpaceView> createState() => _SpaceViewState();

View file

@ -12,11 +12,11 @@ class StartChatFloatingActionButton extends StatelessWidget {
final bool roomsIsEmpty;
const StartChatFloatingActionButton({
Key? key,
super.key,
required this.activeFilter,
required this.scrolledToTop,
required this.roomsIsEmpty,
}) : super(key: key);
});
void _onPressed(BuildContext context) {
switch (activeFilter) {

View file

@ -23,7 +23,7 @@ enum ContextualRoomAction {
class StoriesHeader extends StatelessWidget {
final String filter;
const StoriesHeader({required this.filter, Key? key}) : super(key: key);
const StoriesHeader({required this.filter, super.key});
void _addToStoryAction(BuildContext context) =>
context.go('/rooms/stories/create');
@ -186,8 +186,7 @@ class _StoryButton extends StatefulWidget {
this.hasPosts = true,
this.unread = false,
this.onLongPressed,
Key? key,
}) : super(key: key);
});
@override
State<_StoryButton> createState() => _StoryButtonState();