🎨 Use SizedBox.shrink instead of empty SizedBox for placeholder
This commit is contained in:
		| @@ -109,7 +109,7 @@ class SolianApp extends StatelessWidget { | |||||||
|             return SystemShell( |             return SystemShell( | ||||||
|               child: ScaffoldMessenger( |               child: ScaffoldMessenger( | ||||||
|                 child: BootstrapperShell( |                 child: BootstrapperShell( | ||||||
|                   child: child ?? const SizedBox(), |                   child: child ?? const SizedBox.shrink(), | ||||||
|                 ), |                 ), | ||||||
|               ), |               ), | ||||||
|             ); |             ); | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ class AboutScreen extends StatelessWidget { | |||||||
|               future: PackageInfo.fromPlatform(), |               future: PackageInfo.fromPlatform(), | ||||||
|               builder: (context, snapshot) { |               builder: (context, snapshot) { | ||||||
|                 if (!snapshot.hasData) { |                 if (!snapshot.hasData) { | ||||||
|                   return const SizedBox(); |                   return const SizedBox.shrink(); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 return Text( |                 return Text( | ||||||
|   | |||||||
| @@ -84,7 +84,7 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin { | |||||||
|                     participant: call.focusTrack.value!, |                     participant: call.focusTrack.value!, | ||||||
|                     onTap: () {}, |                     onTap: () {}, | ||||||
|                   ) |                   ) | ||||||
|                 : const SizedBox(), |                 : const SizedBox.shrink(), | ||||||
|           ), |           ), | ||||||
|           Positioned( |           Positioned( | ||||||
|             left: 0, |             left: 0, | ||||||
|   | |||||||
| @@ -222,7 +222,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> | |||||||
|         actions: [ |         actions: [ | ||||||
|           const BackgroundStateWidget(), |           const BackgroundStateWidget(), | ||||||
|           Builder(builder: (context) { |           Builder(builder: (context) { | ||||||
|             if (_isBusy || _channel == null) return const SizedBox(); |             if (_isBusy || _channel == null) return const SizedBox.shrink(); | ||||||
|  |  | ||||||
|             return ChatCallButton( |             return ChatCallButton( | ||||||
|               realm: _channel!.realm, |               realm: _channel!.realm, | ||||||
| @@ -299,7 +299,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> | |||||||
|                     if (_chatController.isLoading.isTrue) { |                     if (_chatController.isLoading.isTrue) { | ||||||
|                       return const LinearProgressIndicator().animate().slideY(); |                       return const LinearProgressIndicator().animate().slideY(); | ||||||
|                     } else { |                     } else { | ||||||
|                       return const SizedBox(); |                       return const SizedBox.shrink(); | ||||||
|                     } |                     } | ||||||
|                   }), |                   }), | ||||||
|                   ClipRect( |                   ClipRect( | ||||||
| @@ -350,7 +350,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> | |||||||
|                   ]), |                   ]), | ||||||
|                 ); |                 ); | ||||||
|               } |               } | ||||||
|               return const SizedBox(); |               return const SizedBox.shrink(); | ||||||
|             }), |             }), | ||||||
|           ], |           ], | ||||||
|         ); |         ); | ||||||
|   | |||||||
| @@ -112,7 +112,7 @@ class _ChatScreenState extends State<ChatScreen> { | |||||||
|             children: [ |             children: [ | ||||||
|               Obx(() { |               Obx(() { | ||||||
|                 if (_channels.isLoading.isFalse) { |                 if (_channels.isLoading.isFalse) { | ||||||
|                   return const SizedBox(); |                   return const SizedBox.shrink(); | ||||||
|                 } else { |                 } else { | ||||||
|                   return const LinearProgressIndicator(); |                   return const LinearProgressIndicator(); | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -190,7 +190,7 @@ class _DashboardScreenState extends State<DashboardScreen> { | |||||||
|                         icon: const Icon(Icons.local_fire_department), |                         icon: const Icon(Icons.local_fire_department), | ||||||
|                         onPressed: _signingDaily ? null : _signDaily, |                         onPressed: _signingDaily ? null : _signDaily, | ||||||
|                       ) |                       ) | ||||||
|                     : const SizedBox(), |                     : const SizedBox.shrink(), | ||||||
|               ), |               ), | ||||||
|             ), |             ), | ||||||
|           ).paddingSymmetric(horizontal: 8), |           ).paddingSymmetric(horizontal: 8), | ||||||
|   | |||||||
| @@ -155,7 +155,7 @@ class PostCreatePopup extends StatelessWidget { | |||||||
|     final AuthProvider auth = Get.find(); |     final AuthProvider auth = Get.find(); | ||||||
|  |  | ||||||
|     if (auth.isAuthorized.isFalse) { |     if (auth.isAuthorized.isFalse) { | ||||||
|       return const SizedBox(); |       return const SizedBox.shrink(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     final List<dynamic> actionList = [ |     final List<dynamic> actionList = [ | ||||||
|   | |||||||
| @@ -45,7 +45,7 @@ class _AccountBadgeWidgetState extends State<AccountBadgeWidget> { | |||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     final spec = badges[widget.item.type]; |     final spec = badges[widget.item.type]; | ||||||
|  |  | ||||||
|     if (spec == null) return const SizedBox(); |     if (spec == null) return const SizedBox.shrink(); | ||||||
|  |  | ||||||
|     return Tooltip( |     return Tooltip( | ||||||
|       richMessage: TextSpan( |       richMessage: TextSpan( | ||||||
|   | |||||||
| @@ -71,7 +71,7 @@ class AccountHeadingWidget extends StatelessWidget { | |||||||
|                             content: banner, |                             content: banner, | ||||||
|                             fit: BoxFit.cover, |                             fit: BoxFit.cover, | ||||||
|                           ) |                           ) | ||||||
|                         : const SizedBox(), |                         : const SizedBox.shrink(), | ||||||
|                   ), |                   ), | ||||||
|                 ), |                 ), | ||||||
|               ).paddingSymmetric(horizontal: 16), |               ).paddingSymmetric(horizontal: 16), | ||||||
|   | |||||||
| @@ -22,7 +22,7 @@ class AppBarLeadingButton extends StatelessWidget { | |||||||
|         onPressed: () => rootScaffoldKey.currentState!.openDrawer(), |         onPressed: () => rootScaffoldKey.currentState!.openDrawer(), | ||||||
|       ); |       ); | ||||||
|     } else { |     } else { | ||||||
|       return const SizedBox(); |       return const SizedBox.shrink(); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -347,7 +347,8 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> { | |||||||
|                             FutureBuilder( |                             FutureBuilder( | ||||||
|                               future: element.file.length(), |                               future: element.file.length(), | ||||||
|                               builder: (context, snapshot) { |                               builder: (context, snapshot) { | ||||||
|                                 if (!snapshot.hasData) return const SizedBox(); |                                 if (!snapshot.hasData) | ||||||
|  |                                   return const SizedBox.shrink(); | ||||||
|                                 return Text( |                                 return Text( | ||||||
|                                   _formatBytes(snapshot.data!), |                                   _formatBytes(snapshot.data!), | ||||||
|                                   style: Theme.of(context).textTheme.bodySmall, |                                   style: Theme.of(context).textTheme.bodySmall, | ||||||
| @@ -628,7 +629,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> { | |||||||
|                                   ), |                                   ), | ||||||
|                                 ); |                                 ); | ||||||
|                               } |                               } | ||||||
|                               return const SizedBox(); |                               return const SizedBox.shrink(); | ||||||
|                             }), |                             }), | ||||||
|                           ], |                           ], | ||||||
|                         ), |                         ), | ||||||
| @@ -667,7 +668,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> { | |||||||
|                               ), |                               ), | ||||||
|                               Obx(() { |                               Obx(() { | ||||||
|                                 if (_uploadController.isUploading.value) { |                                 if (_uploadController.isUploading.value) { | ||||||
|                                   return const SizedBox(); |                                   return const SizedBox.shrink(); | ||||||
|                                 } |                                 } | ||||||
|                                 return TextButton( |                                 return TextButton( | ||||||
|                                   child: Text('attachmentUploadQueueStart'.tr), |                                   child: Text('attachmentUploadQueueStart'.tr), | ||||||
| @@ -681,7 +682,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> { | |||||||
|                         ), |                         ), | ||||||
|                       ); |                       ); | ||||||
|                     } |                     } | ||||||
|                     return const SliverToBoxAdapter(child: SizedBox()); |                     return const SliverToBoxAdapter(child: SizedBox.shrink()); | ||||||
|                   }), |                   }), | ||||||
|                   Obx(() { |                   Obx(() { | ||||||
|                     if (_uploadController.queueOfUpload.isNotEmpty) { |                     if (_uploadController.queueOfUpload.isNotEmpty) { | ||||||
| @@ -697,7 +698,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> { | |||||||
|                         ), |                         ), | ||||||
|                       ); |                       ); | ||||||
|                     } |                     } | ||||||
|                     return const SliverToBoxAdapter(child: SizedBox()); |                     return const SliverToBoxAdapter(child: SizedBox.shrink()); | ||||||
|                   }), |                   }), | ||||||
|                   if (_attachments.isNotEmpty) |                   if (_attachments.isNotEmpty) | ||||||
|                     SliverPadding( |                     SliverPadding( | ||||||
|   | |||||||
| @@ -139,7 +139,7 @@ class _AttachmentListState extends State<AttachmentList> { | |||||||
|   @override |   @override | ||||||
|   Widget build(BuildContext context) { |   Widget build(BuildContext context) { | ||||||
|     if (widget.attachmentsId.isEmpty) { |     if (widget.attachmentsId.isEmpty) { | ||||||
|       return const SizedBox(); |       return const SizedBox.shrink(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (_isLoading) { |     if (_isLoading) { | ||||||
| @@ -172,7 +172,7 @@ class _AttachmentListState extends State<AttachmentList> { | |||||||
|         children: widget.attachmentsId.map((x) { |         children: widget.attachmentsId.map((x) { | ||||||
|           final element = _attachmentsMeta[idx]; |           final element = _attachmentsMeta[idx]; | ||||||
|           idx++; |           idx++; | ||||||
|           if (element == null) return const SizedBox(); |           if (element == null) return const SizedBox.shrink(); | ||||||
|           double ratio = element.metadata?['ratio']?.toDouble() ?? 16 / 9; |           double ratio = element.metadata?['ratio']?.toDouble() ?? 16 / 9; | ||||||
|           return Container( |           return Container( | ||||||
|             decoration: BoxDecoration( |             decoration: BoxDecoration( | ||||||
|   | |||||||
| @@ -64,7 +64,7 @@ class ChannelCallIndicator extends StatelessWidget { | |||||||
|           const Gap(6), |           const Gap(6), | ||||||
|           Obx(() { |           Obx(() { | ||||||
|             if (call.isInitialized.value) { |             if (call.isInitialized.value) { | ||||||
|               return const SizedBox(); |               return const SizedBox.shrink(); | ||||||
|             } |             } | ||||||
|             if (ongoingCall.participants.isNotEmpty) { |             if (ongoingCall.participants.isNotEmpty) { | ||||||
|               return Container( |               return Container( | ||||||
| @@ -84,7 +84,7 @@ class ChannelCallIndicator extends StatelessWidget { | |||||||
|                 ), |                 ), | ||||||
|               ); |               ); | ||||||
|             } |             } | ||||||
|             return const SizedBox(); |             return const SizedBox.shrink(); | ||||||
|           }) |           }) | ||||||
|         ], |         ], | ||||||
|       ), |       ), | ||||||
| @@ -113,7 +113,7 @@ class ChannelCallIndicator extends StatelessWidget { | |||||||
|               child: Text('callJoin'.tr), |               child: Text('callJoin'.tr), | ||||||
|             ); |             ); | ||||||
|           } |           } | ||||||
|           return const SizedBox(); |           return const SizedBox.shrink(); | ||||||
|         }) |         }) | ||||||
|       ], |       ], | ||||||
|     ); |     ); | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ class ChatCallCurrentIndicator extends StatelessWidget { | |||||||
|  |  | ||||||
|     return Obx(() { |     return Obx(() { | ||||||
|       if (call.current.value == null || call.channel.value == null) { |       if (call.current.value == null || call.channel.value == null) { | ||||||
|         return const SizedBox(); |         return const SizedBox.shrink(); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       return ListTile( |       return ListTile( | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ class ChatEvent extends StatelessWidget { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   Widget _buildLinkExpansion() { |   Widget _buildLinkExpansion() { | ||||||
|     if (item.body['text'] == null) return const SizedBox(); |     if (item.body['text'] == null) return const SizedBox.shrink(); | ||||||
|     return LinkExpansion(content: item.body['text']); |     return LinkExpansion(content: item.body['text']); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -49,7 +49,7 @@ class ChatEvent extends StatelessWidget { | |||||||
|         ? List<String>.from(item.body['attachments']?.whereType<String>()) |         ? List<String>.from(item.body['attachments']?.whereType<String>()) | ||||||
|         : List<String>.empty(); |         : List<String>.empty(); | ||||||
|  |  | ||||||
|     if (attachments.isEmpty) return const SizedBox(); |     if (attachments.isEmpty) return const SizedBox.shrink(); | ||||||
|  |  | ||||||
|     if (isMinimal) { |     if (isMinimal) { | ||||||
|       final unFocusColor = |       final unFocusColor = | ||||||
| @@ -94,7 +94,7 @@ class ChatEvent extends StatelessWidget { | |||||||
|       ), |       ), | ||||||
|       builder: (context, snapshot) { |       builder: (context, snapshot) { | ||||||
|         if (!snapshot.hasData || snapshot.data == null) { |         if (!snapshot.hasData || snapshot.data == null) { | ||||||
|           return const SizedBox(); |           return const SizedBox.shrink(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return Container( |         return Container( | ||||||
|   | |||||||
| @@ -96,7 +96,7 @@ class ChatEventList extends StatelessWidget { | |||||||
|               chatController.totalEvents - chatController.currentEvents.length; |               chatController.totalEvents - chatController.currentEvents.length; | ||||||
|  |  | ||||||
|           if (amount.value <= 0 || chatController.isLoading.isTrue) { |           if (amount.value <= 0 || chatController.isLoading.isTrue) { | ||||||
|             return const SliverToBoxAdapter(child: SizedBox()); |             return const SliverToBoxAdapter(child: SizedBox.shrink()); | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           return SliverToBoxAdapter( |           return SliverToBoxAdapter( | ||||||
|   | |||||||
| @@ -57,7 +57,7 @@ class LinkExpansion extends StatelessWidget { | |||||||
|     ); |     ); | ||||||
|     final matches = linkRegex.allMatches(content); |     final matches = linkRegex.allMatches(content); | ||||||
|     if (matches.isEmpty) { |     if (matches.isEmpty) { | ||||||
|       return const SizedBox(); |       return const SizedBox.shrink(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     final LinkExpandProvider expandController = Get.find(); |     final LinkExpandProvider expandController = Get.find(); | ||||||
| @@ -72,7 +72,7 @@ class LinkExpansion extends StatelessWidget { | |||||||
|             future: expandController.expandLink(x.group(0)!), |             future: expandController.expandLink(x.group(0)!), | ||||||
|             builder: (context, snapshot) { |             builder: (context, snapshot) { | ||||||
|               if (!snapshot.hasData) { |               if (!snapshot.hasData) { | ||||||
|                 return const SizedBox(); |                 return const SizedBox.shrink(); | ||||||
|               } |               } | ||||||
|  |  | ||||||
|               final isRichDescription = [ |               final isRichDescription = [ | ||||||
|   | |||||||
| @@ -59,7 +59,7 @@ class PostEditorVisibilityDialog extends StatelessWidget { | |||||||
|                 controller.visibility.value == 3) { |                 controller.visibility.value == 3) { | ||||||
|               return const Gap(8); |               return const Gap(8); | ||||||
|             } |             } | ||||||
|             return const SizedBox(); |             return const SizedBox.shrink(); | ||||||
|           }), |           }), | ||||||
|           Obx(() { |           Obx(() { | ||||||
|             if (controller.visibility.value == 2) { |             if (controller.visibility.value == 2) { | ||||||
| @@ -86,7 +86,7 @@ class PostEditorVisibilityDialog extends StatelessWidget { | |||||||
|                 }, |                 }, | ||||||
|               ); |               ); | ||||||
|             } |             } | ||||||
|             return const SizedBox(); |             return const SizedBox.shrink(); | ||||||
|           }), |           }), | ||||||
|           Obx(() { |           Obx(() { | ||||||
|             if (controller.visibility.value == 3) { |             if (controller.visibility.value == 3) { | ||||||
| @@ -113,7 +113,7 @@ class PostEditorVisibilityDialog extends StatelessWidget { | |||||||
|                 }, |                 }, | ||||||
|               ); |               ); | ||||||
|             } |             } | ||||||
|             return const SizedBox(); |             return const SizedBox.shrink(); | ||||||
|           }), |           }), | ||||||
|         ], |         ], | ||||||
|       ), |       ), | ||||||
|   | |||||||
| @@ -79,7 +79,7 @@ class _PostItemState extends State<PostItem> { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   Widget _buildThumbnail() { |   Widget _buildThumbnail() { | ||||||
|     if (widget.item.body['thumbnail'] == null) return const SizedBox(); |     if (widget.item.body['thumbnail'] == null) return const SizedBox.shrink(); | ||||||
|     final border = BorderSide( |     final border = BorderSide( | ||||||
|       color: Theme.of(context).dividerColor, |       color: Theme.of(context).dividerColor, | ||||||
|       width: 0.3, |       width: 0.3, | ||||||
| @@ -148,7 +148,7 @@ class _PostItemState extends State<PostItem> { | |||||||
|         vertical: 8, |         vertical: 8, | ||||||
|       ); |       ); | ||||||
|     } |     } | ||||||
|     return const SizedBox(); |     return const SizedBox.shrink(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   Widget _buildFooter() { |   Widget _buildFooter() { | ||||||
| @@ -187,7 +187,7 @@ class _PostItemState extends State<PostItem> { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (widgets.isEmpty) { |     if (widgets.isEmpty) { | ||||||
|       return const SizedBox(); |       return const SizedBox.shrink(); | ||||||
|     } else { |     } else { | ||||||
|       return Column( |       return Column( | ||||||
|         crossAxisAlignment: CrossAxisAlignment.start, |         crossAxisAlignment: CrossAxisAlignment.start, | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ class PostWarpedListWidget extends StatelessWidget { | |||||||
|       builderDelegate: PagedChildBuilderDelegate<Post>( |       builderDelegate: PagedChildBuilderDelegate<Post>( | ||||||
|         itemBuilder: (context, item, index) { |         itemBuilder: (context, item, index) { | ||||||
|           if (item.pinnedAt != null && !isPinned) { |           if (item.pinnedAt != null && !isPinned) { | ||||||
|             return const SizedBox(); |             return const SizedBox.shrink(); | ||||||
|           } |           } | ||||||
|           return PostListEntryWidget( |           return PostListEntryWidget( | ||||||
|             renderOrder: index, |             renderOrder: index, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user