saveTitle method

void saveTitle(
  1. dynamic context,
  2. dynamic ref,
  3. dynamic task,
  4. String newName,
)

Implementation

void saveTitle(
  BuildContext context,
  WidgetRef ref,
  Task task,
  String newName,
) async {
  EasyLoading.show(status: L10n.of(context).updatingTask);
  final updater = task.updateBuilder();
  updater.title(newName);
  try {
    await updater.send();
    EasyLoading.dismiss();
    if (!context.mounted) return;
    Navigator.pop(context);
  } catch (e, s) {
    _log.severe('Failed to change title of task', e, s);
    if (!context.mounted) {
      EasyLoading.dismiss();
      return;
    }
    EasyLoading.showError(
      L10n.of(context).updatingTaskFailed(e),
      duration: const Duration(seconds: 3),
    );
  }
}