feat:增加闪灵上传图片功能
This commit is contained in:
@@ -98,26 +98,64 @@ Widget _buildFlispContent(Flisp flisp) {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFlispImage(Flisp flisp) {
|
||||
Widget _buildDeleteImage(VoidCallback? onDelete) {
|
||||
return Positioned(
|
||||
top: -8,
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: onDelete,
|
||||
child: Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withAlpha(10),
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Icon(Icons.close, color: Colors.white, size: 16),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildFlispImage({
|
||||
required Flisp flisp,
|
||||
bool showDelete = false,
|
||||
VoidCallback? onDelete,
|
||||
}) {
|
||||
return Container(
|
||||
height: 150,
|
||||
height: 200,
|
||||
margin: const EdgeInsets.only(bottom: 8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(flisp.imageUrl),
|
||||
fit: BoxFit.cover,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
color: Colors.black.withAlpha(10),
|
||||
),
|
||||
alignment: Alignment.topRight,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(6.0),
|
||||
child: Icon(Icons.image, color: Colors.white, size: 20),
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(6.0),
|
||||
child: Icon(Icons.image, color: Colors.white, size: 20),
|
||||
),
|
||||
),
|
||||
if (showDelete) _buildDeleteImage(onDelete),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -253,7 +291,7 @@ Widget _buildFlispItem({
|
||||
children: [
|
||||
_buildFlispContent(flisp),
|
||||
const SizedBox(height: 8),
|
||||
if (hasImage) _buildFlispImage(flisp),
|
||||
if (hasImage) buildFlispImage(flisp: flisp, showDelete: false),
|
||||
const SizedBox(height: 4),
|
||||
if (hasVideo) _buildFlispVideo(flisp),
|
||||
const SizedBox(height: 4),
|
||||
|
||||
Reference in New Issue
Block a user