mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-09 02:36:31 +01:00
Padding should be handled by children
This commit is contained in:
parent
658e808fcd
commit
b446f229d0
2 changed files with 89 additions and 86 deletions
|
@ -16,52 +16,55 @@ class PhotoListImage extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
build(BuildContext context) {
|
build(BuildContext context) {
|
||||||
return FittedBox(
|
return Padding(
|
||||||
clipBehavior: Clip.hardEdge,
|
padding: const EdgeInsets.all(2),
|
||||||
fit: BoxFit.cover,
|
child: FittedBox(
|
||||||
child: Stack(
|
clipBehavior: Clip.hardEdge,
|
||||||
children: [
|
fit: BoxFit.cover,
|
||||||
Container(
|
child: Stack(
|
||||||
// arbitrary size here
|
children: [
|
||||||
constraints: BoxConstraints.tight(const Size(128, 128)),
|
|
||||||
color: AppTheme.getListItemBackgroundColor(context),
|
|
||||||
child: CachedNetworkImage(
|
|
||||||
imageUrl: previewUrl,
|
|
||||||
httpHeaders: {
|
|
||||||
"Authorization": Api.getAuthorizationHeaderValue(account),
|
|
||||||
},
|
|
||||||
fadeInDuration: const Duration(),
|
|
||||||
filterQuality: FilterQuality.high,
|
|
||||||
errorWidget: (context, url, error) {
|
|
||||||
// won't work on web because the image is downloaded by the cache
|
|
||||||
// manager instead
|
|
||||||
// where's the preview???
|
|
||||||
return Container(
|
|
||||||
child: Center(
|
|
||||||
child: Icon(
|
|
||||||
Icons.image_not_supported,
|
|
||||||
size: 64,
|
|
||||||
color: Colors.white.withOpacity(.8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (isGif)
|
|
||||||
Container(
|
Container(
|
||||||
// arbitrary size here
|
// arbitrary size here
|
||||||
constraints: BoxConstraints.tight(const Size(128, 128)),
|
constraints: BoxConstraints.tight(const Size(128, 128)),
|
||||||
alignment: AlignmentDirectional.topEnd,
|
color: AppTheme.getListItemBackgroundColor(context),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 2),
|
child: CachedNetworkImage(
|
||||||
child: const Icon(
|
imageUrl: previewUrl,
|
||||||
Icons.gif,
|
httpHeaders: {
|
||||||
size: 36,
|
"Authorization": Api.getAuthorizationHeaderValue(account),
|
||||||
color: Colors.white,
|
},
|
||||||
|
fadeInDuration: const Duration(),
|
||||||
|
filterQuality: FilterQuality.high,
|
||||||
|
errorWidget: (context, url, error) {
|
||||||
|
// won't work on web because the image is downloaded by the cache
|
||||||
|
// manager instead
|
||||||
|
// where's the preview???
|
||||||
|
return Container(
|
||||||
|
child: Center(
|
||||||
|
child: Icon(
|
||||||
|
Icons.image_not_supported,
|
||||||
|
size: 64,
|
||||||
|
color: Colors.white.withOpacity(.8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
if (isGif)
|
||||||
|
Container(
|
||||||
|
// arbitrary size here
|
||||||
|
constraints: BoxConstraints.tight(const Size(128, 128)),
|
||||||
|
alignment: AlignmentDirectional.topEnd,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 2),
|
||||||
|
child: const Icon(
|
||||||
|
Icons.gif,
|
||||||
|
size: 36,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -80,50 +83,53 @@ class PhotoListVideo extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
build(BuildContext context) {
|
build(BuildContext context) {
|
||||||
return FittedBox(
|
return Padding(
|
||||||
clipBehavior: Clip.hardEdge,
|
padding: const EdgeInsets.all(2),
|
||||||
fit: BoxFit.cover,
|
child: FittedBox(
|
||||||
child: Stack(
|
clipBehavior: Clip.hardEdge,
|
||||||
children: [
|
fit: BoxFit.cover,
|
||||||
Container(
|
child: Stack(
|
||||||
// arbitrary size here
|
children: [
|
||||||
constraints: BoxConstraints.tight(const Size(128, 128)),
|
Container(
|
||||||
color: AppTheme.getListItemBackgroundColor(context),
|
// arbitrary size here
|
||||||
child: CachedNetworkImage(
|
constraints: BoxConstraints.tight(const Size(128, 128)),
|
||||||
imageUrl: previewUrl,
|
color: AppTheme.getListItemBackgroundColor(context),
|
||||||
httpHeaders: {
|
child: CachedNetworkImage(
|
||||||
"Authorization": Api.getAuthorizationHeaderValue(account),
|
imageUrl: previewUrl,
|
||||||
},
|
httpHeaders: {
|
||||||
fadeInDuration: const Duration(),
|
"Authorization": Api.getAuthorizationHeaderValue(account),
|
||||||
filterQuality: FilterQuality.high,
|
},
|
||||||
errorWidget: (context, url, error) {
|
fadeInDuration: const Duration(),
|
||||||
// no preview for this video. Normal since video preview is disabled
|
filterQuality: FilterQuality.high,
|
||||||
// by default
|
errorWidget: (context, url, error) {
|
||||||
return Container(
|
// no preview for this video. Normal since video preview is disabled
|
||||||
child: Center(
|
// by default
|
||||||
child: Icon(
|
return Container(
|
||||||
Icons.image_not_supported,
|
child: Center(
|
||||||
size: 64,
|
child: Icon(
|
||||||
color: Colors.white.withOpacity(.8),
|
Icons.image_not_supported,
|
||||||
|
size: 64,
|
||||||
|
color: Colors.white.withOpacity(.8),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
|
||||||
imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet,
|
),
|
||||||
),
|
),
|
||||||
),
|
Container(
|
||||||
Container(
|
// arbitrary size here
|
||||||
// arbitrary size here
|
constraints: BoxConstraints.tight(const Size(128, 128)),
|
||||||
constraints: BoxConstraints.tight(const Size(128, 128)),
|
alignment: AlignmentDirectional.topEnd,
|
||||||
alignment: AlignmentDirectional.topEnd,
|
padding: const EdgeInsets.all(8),
|
||||||
padding: const EdgeInsets.all(8),
|
child: const Icon(
|
||||||
child: const Icon(
|
Icons.play_circle_outlined,
|
||||||
Icons.play_circle_outlined,
|
size: 24,
|
||||||
size: 24,
|
color: Colors.white,
|
||||||
color: Colors.white,
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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),
|
||||||
|
|
Loading…
Reference in a new issue