treewide: Container -> SizedBox.shrink()
This helps performance without any user-facing changes, since SizedBox is constant while Container isn't
This commit is contained in:
parent
f88837232b
commit
ab0b7cb6b9
21 changed files with 31 additions and 31 deletions
|
|
@ -17,7 +17,7 @@ class ChatAppBarTitle extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final room = controller.room;
|
||||
if (room == null) {
|
||||
return Container();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
if (controller.selectedEvents.isNotEmpty) {
|
||||
return Text(controller.selectedEvents.length.toString());
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class ChatEventList extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
// The message at this index:
|
||||
|
|
@ -127,7 +127,7 @@ class ChatEventList extends StatelessWidget {
|
|||
? controller.timeline!.events[i]
|
||||
: null,
|
||||
)
|
||||
: Container(),
|
||||
: const SizedBox.shrink(),
|
||||
);
|
||||
},
|
||||
childCount: controller.timeline!.events.length + 2,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class ChatInputRow extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
if (controller.showEmojiPicker &&
|
||||
controller.emojiPickerType == EmojiPickerType.reaction) {
|
||||
return Container();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
|
|
@ -72,7 +72,7 @@ class ChatInputRow extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
: const SizedBox.shrink(),
|
||||
]
|
||||
: <Widget>[
|
||||
KeyBoardShortcuts(
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class Message extends StatelessWidget {
|
|||
EventTypes.CallInvite
|
||||
}.contains(event.type)) {
|
||||
if (event.type.startsWith('m.call.')) {
|
||||
return Container();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return StateMessage(event);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ class InputBar extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
void insertSuggestion(_, Map<String, String?> suggestion) {
|
||||
|
|
@ -458,11 +458,11 @@ class InputBar extends StatelessWidget {
|
|||
buildSuggestion(c, s, Matrix.of(context).client),
|
||||
onSuggestionSelected: (Map<String, String?> suggestion) =>
|
||||
insertSuggestion(context, suggestion),
|
||||
errorBuilder: (BuildContext context, Object? error) => Container(),
|
||||
loadingBuilder: (BuildContext context) => Container(),
|
||||
errorBuilder: (BuildContext context, Object? error) => const SizedBox.shrink(),
|
||||
loadingBuilder: (BuildContext context) => const SizedBox.shrink(),
|
||||
// fix loading briefly flickering a dark box
|
||||
noItemsFoundBuilder: (BuildContext context) =>
|
||||
Container(), // fix loading briefly showing no suggestions
|
||||
const SizedBox.shrink(), // fix loading briefly showing no suggestions
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class PinnedEvents extends StatelessWidget {
|
|||
final pinnedEventIds = controller.room!.pinnedEventIds;
|
||||
|
||||
if (pinnedEventIds.isEmpty) {
|
||||
return Container();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final completers = pinnedEventIds.map<Completer<Event?>>((e) {
|
||||
final completer = Completer<Event?>();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class ReactionsPicker extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (controller.showEmojiPicker) return Container();
|
||||
if (controller.showEmojiPicker) return const SizedBox.shrink();
|
||||
final display = controller.editEvent == null &&
|
||||
controller.replyEvent == null &&
|
||||
controller.room!.canSendDefaultMessages &&
|
||||
|
|
@ -29,7 +29,7 @@ class ReactionsPicker extends StatelessWidget {
|
|||
child: Builder(
|
||||
builder: (context) {
|
||||
if (!display) {
|
||||
return Container();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final proposals = proposeEmojis(
|
||||
controller.selectedEvents.first.plaintextBody,
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class _EditContent extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final event = this.event;
|
||||
if (event == null) {
|
||||
return Container();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
|
|||
final imageKeys =
|
||||
filteredImagePackImageEntried.map((e) => e.key).toList();
|
||||
if (imageKeys.isEmpty) {
|
||||
return Container();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final packName = pack.pack.displayName ?? packSlugs[packIndex];
|
||||
return Column(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class TombstoneDisplay extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (controller.room!.getState(EventTypes.RoomTombstone) == null) {
|
||||
return Container();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return SizedBox(
|
||||
height: 72,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue