Padding should be handled by children

This commit is contained in:
Ming Ming 2021-08-23 02:05:31 +08:00
parent 658e808fcd
commit b446f229d0
2 changed files with 89 additions and 86 deletions

View file

@ -16,7 +16,9 @@ class PhotoListImage extends StatelessWidget {
@override @override
build(BuildContext context) { build(BuildContext context) {
return FittedBox( return Padding(
padding: const EdgeInsets.all(2),
child: FittedBox(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
fit: BoxFit.cover, fit: BoxFit.cover,
child: Stack( child: Stack(
@ -63,6 +65,7 @@ class PhotoListImage extends StatelessWidget {
), ),
], ],
), ),
),
); );
} }
@ -80,7 +83,9 @@ class PhotoListVideo extends StatelessWidget {
@override @override
build(BuildContext context) { build(BuildContext context) {
return FittedBox( return Padding(
padding: const EdgeInsets.all(2),
child: FittedBox(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
fit: BoxFit.cover, fit: BoxFit.cover,
child: Stack( child: Stack(
@ -125,6 +130,7 @@ class PhotoListVideo extends StatelessWidget {
), ),
], ],
), ),
),
); );
} }

View file

@ -104,10 +104,7 @@ mixin SelectableItemStreamListMixin<T extends StatefulWidget> on State<T> {
Widget _buildItem(BuildContext context, int index) { Widget _buildItem(BuildContext context, int index) {
final item = _items[index]; final item = _items[index];
final content = Padding( final content = item.buildWidget(context);
padding: const EdgeInsets.all(2),
child: item.buildWidget(context),
);
if (item.isSelectable) { if (item.isSelectable) {
return Selectable( return Selectable(
isSelected: _selectedItems.contains(item), isSelected: _selectedItems.contains(item),