🎨 Use Gap instead of empty SizedBox

This commit is contained in:
2024-09-07 17:45:44 +08:00
parent 9c451f485a
commit 85f97521e5
35 changed files with 115 additions and 78 deletions

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:solian/exts.dart';
import 'package:solian/models/attachment.dart';
@ -74,7 +75,7 @@ class _AttachmentAttrEditorDialogState
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: const LinearProgressIndicator().animate().scaleX(),
),
const SizedBox(height: 18),
const Gap(18),
TextField(
controller: _altController,
decoration: InputDecoration(
@ -86,7 +87,7 @@ class _AttachmentAttrEditorDialogState
onTapOutside: (_) =>
FocusManager.instance.primaryFocus?.unfocus(),
),
const SizedBox(height: 8),
const Gap(8),
CheckboxListTile(
contentPadding: const EdgeInsets.only(left: 4, right: 18),
shape: const RoundedRectangleBorder(

View File

@ -7,6 +7,7 @@ import 'package:dismissible_page/dismissible_page.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:image_picker/image_picker.dart';
@ -144,7 +145,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
mainAxisSize: MainAxisSize.min,
children: [
Text('attachmentAddLinkHint'.tr, textAlign: TextAlign.left),
const SizedBox(height: 18),
const Gap(18),
TextField(
controller: controller,
decoration: InputDecoration(
@ -353,7 +354,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
);
},
),
const SizedBox(width: 6),
const Gap(6),
if (element.progress != null)
Text(
'${(element.progress! * 100).toStringAsFixed(2)}%',
@ -614,7 +615,7 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const SizedBox(width: 10),
const Gap(10),
Obx(() {
if (_uploadController.isUploading.value) {
return SizedBox(
@ -635,9 +636,9 @@ class _AttachmentEditorPopupState extends State<AttachmentEditorPopup> {
],
),
),
const SizedBox(width: 20),
const Gap(20),
Text('attachmentAutoUpload'.tr),
const SizedBox(width: 8),
const Gap(8),
Switch(
value: _isAutoUpload,
onChanged: (bool? value) {

View File

@ -6,6 +6,7 @@ import 'package:dismissible_page/dismissible_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:gal/gal.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:solian/exts.dart';
import 'package:solian/models/attachment.dart';
@ -198,7 +199,7 @@ class _AttachmentFullScreenState extends State<AttachmentFullScreen> {
radius: 19,
),
),
const IgnorePointer(child: SizedBox(width: 8)),
const IgnorePointer(child: Gap(8)),
Expanded(
child: IgnorePointer(
child: Column(
@ -240,7 +241,7 @@ class _AttachmentFullScreenState extends State<AttachmentFullScreen> {
),
],
),
const IgnorePointer(child: SizedBox(height: 4)),
const IgnorePointer(child: Gap(4)),
IgnorePointer(
child: Text(
widget.item.alt,
@ -252,7 +253,7 @@ class _AttachmentFullScreenState extends State<AttachmentFullScreen> {
),
),
),
const IgnorePointer(child: SizedBox(height: 2)),
const IgnorePointer(child: Gap(2)),
IgnorePointer(
child: Wrap(
spacing: 6,

View File

@ -1,6 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:media_kit/media_kit.dart';
import 'package:media_kit_video/media_kit_video.dart';
@ -65,7 +66,7 @@ class _AttachmentItemState extends State<AttachmentItem> {
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.file_present, size: 32),
const SizedBox(height: 6),
const Gap(6),
Text(
widget.item.mimetype,
style: TextStyle(
@ -74,13 +75,13 @@ class _AttachmentItemState extends State<AttachmentItem> {
),
textAlign: TextAlign.center,
),
const SizedBox(height: 2),
const Gap(2),
Text(
widget.item.alt,
style: const TextStyle(fontSize: 13),
textAlign: TextAlign.center,
),
const SizedBox(height: 12),
const Gap(12),
TextButton.icon(
icon: const Icon(Icons.launch),
label: Text('openInBrowser'.tr),
@ -282,7 +283,7 @@ class _AttachmentItemVideoState extends State<_AttachmentItemVideo> {
color: Colors.white,
size: 32,
),
const SizedBox(height: 8),
const Gap(8),
Text(
'attachmentUnload'.tr,
style: const TextStyle(

View File

@ -5,6 +5,7 @@ import 'package:carousel_slider/carousel_slider.dart';
import 'package:dismissible_page/dismissible_page.dart';
import 'package:flutter/material.dart' hide CarouselController;
import 'package:flutter_animate/flutter_animate.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:solian/models/attachment.dart';
import 'package:solian/widgets/attachments/attachment_item.dart';
@ -359,7 +360,7 @@ class AttachmentListEntry extends StatelessWidget {
color: Colors.white,
size: 32,
),
if (!isDense) const SizedBox(height: 8),
if (!isDense) const Gap(8),
if (!isDense)
Text(
'matureContent'.tr,