2022-12-26 20:26:30 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import '../../models/media_attachment_uploads/media_upload_attachment.dart';
|
|
|
|
import '../padding.dart';
|
|
|
|
|
|
|
|
class MediaUploadEditorControl extends StatefulWidget {
|
|
|
|
final MediaUploadAttachment media;
|
|
|
|
final Function()? onDelete;
|
|
|
|
|
|
|
|
const MediaUploadEditorControl(
|
|
|
|
{super.key, required this.media, this.onDelete});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<MediaUploadEditorControl> createState() =>
|
|
|
|
_MediaUploadEditorControlState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MediaUploadEditorControlState extends State<MediaUploadEditorControl> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-04-17 14:55:36 +00:00
|
|
|
// TODO Replace with scaling size
|
2022-12-26 20:26:30 +00:00
|
|
|
const thumbnailsize = 100.0;
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
width: thumbnailsize,
|
|
|
|
height: thumbnailsize,
|
|
|
|
child: widget.media.getPreviewImage(),
|
|
|
|
),
|
|
|
|
const HorizontalPadding(),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
TextFormField(
|
|
|
|
initialValue: widget.media.remoteFilename,
|
|
|
|
onChanged: (value) => widget.media.remoteFilename = value,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
labelText: 'Filename (optional)',
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
2023-10-31 01:44:16 +00:00
|
|
|
color: Theme.of(context).colorScheme.background,
|
2022-12-26 20:26:30 +00:00
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(5.0),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
IconButton(
|
|
|
|
onPressed: widget.onDelete,
|
2023-10-31 01:44:16 +00:00
|
|
|
icon: const Icon(Icons.cancel),
|
2022-12-26 20:26:30 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
const VerticalPadding(),
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
TextFormField(
|
|
|
|
initialValue: widget.media.description,
|
|
|
|
onChanged: (value) => widget.media.description = value,
|
|
|
|
maxLines: 5,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
labelText: 'Description/ALT Text',
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(
|
2023-10-31 01:44:16 +00:00
|
|
|
color: Theme.of(context).colorScheme.background,
|
2022-12-26 20:26:30 +00:00
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(5.0),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const Divider(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|