From f324e43be364407fc186219461f30d3342424daa Mon Sep 17 00:00:00 2001 From: zoe Date: Mon, 26 Sep 2022 11:50:00 +0200 Subject: [PATCH] clean up media attachment update --- lib/dialogues/makepost.dart | 11 +++++------ lib/i18n/en_US.json | 13 ++++++++++++- lib/themes/themes.dart | 13 ++++++------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/lib/dialogues/makepost.dart b/lib/dialogues/makepost.dart index eda31e3..22f5857 100644 --- a/lib/dialogues/makepost.dart +++ b/lib/dialogues/makepost.dart @@ -64,7 +64,6 @@ class _MakePostState extends State { 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 { // upload the media attachments List 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 diff --git a/lib/i18n/en_US.json b/lib/i18n/en_US.json index 048d15a..67e8be5 100644 --- a/lib/i18n/en_US.json +++ b/lib/i18n/en_US.json @@ -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" } \ No newline at end of file diff --git a/lib/themes/themes.dart b/lib/themes/themes.dart index 35f554b..75b6e11 100644 --- a/lib/themes/themes.dart +++ b/lib/themes/themes.dart @@ -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(