clean up media attachment update

This commit is contained in:
zoe 2022-09-26 11:50:00 +02:00
parent 55fb99d9d9
commit f324e43be3
3 changed files with 23 additions and 14 deletions

View File

@ -64,7 +64,6 @@ class _MakePostState extends State<MakePost> {
final index = files.indexOf(file);
final newIndex = (index + (up ? -1 : 1)) % files.length;
print(newIndex);
files.remove(file);
setState(() {
@ -247,25 +246,25 @@ class _MakePostState extends State<MakePost> {
// upload the media attachments
List<String> mediaIds = [];
for (var file in files) {
print("blip");
if (mounted) {
setState(() {
status =
"${"sending-file".i18n()}${mediaIds.length + 1}/${files.length}";
"${"sending-file".i18n()} ${mediaIds.length + 1}/${files.length}";
});
}
final response = await file.upload(accountid);
if (response.key == 200 || response.key == 202) {
mediaIds.add(response.value);
break;
}
if (mounted) {
} else if (mounted) {
setState(() {
status = response.value;
sending = false;
return;
});
return;
}
}
print(mediaIds);
// send the final post

View File

@ -73,6 +73,17 @@
"instances": "instances",
"instance": "instace",
"post-found-on": "found post on",
"show-in-full": "show in full"
"show-in-full": "show in full",
"block": "banish",
"unblock": "unbanish",
"add-files": "add files",
"remaining": "remaining",
"move-down": "move down",
"move-up": "move up",
"remove-attached-file": "remove attachment",
"file-description": "file description",
"loading...": "loading",
"failed-to-send": "failed to send!",
"sending-file": "sending file"
}

View File

@ -75,13 +75,12 @@ ThemeData getTheme(CustomColors colors) {
color: colors.colorScheme.onSurface,
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: colors.colorScheme.onPrimary,
textStyle: const TextStyle(
fontFamily: 'Atkinson',
fontSize: 18,
fontWeight: FontWeight.w700,
),
style: ButtonStyle(
textStyle: MaterialStateProperty.resolveWith((states) =>
const TextStyle(
fontSize: 18,
fontFamily: "atkinson",
fontWeight: FontWeight.w700)),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(