utils.dart 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. import 'package:electronic_assistant/popup/agenda_time_popup.dart';
  2. import 'package:electronic_assistant/resource/string.gen.dart';
  3. import 'package:electronic_assistant/utils/expand.dart';
  4. import 'package:get/get.dart';
  5. String getAgendaFilterTxt(AgendaTimeType type,
  6. {String? startTime, String? endTime}) {
  7. String filterTxt;
  8. switch (type) {
  9. case AgendaTimeType.nearlyAWeek:
  10. filterTxt = StringName.popupAgendaFilterTxt.tr
  11. .replacePlaceholders([StringName.popupNearlyAWeek.tr]);
  12. break;
  13. case AgendaTimeType.nearlyTwoWeek:
  14. filterTxt = StringName.popupAgendaFilterTxt.tr
  15. .replacePlaceholders([StringName.popupNearlyTwoWeek.tr]);
  16. break;
  17. case AgendaTimeType.nearlyAMonth:
  18. filterTxt = StringName.popupAgendaFilterTxt.tr
  19. .replacePlaceholders([StringName.popupNearlyAMonth.tr]);
  20. break;
  21. case AgendaTimeType.customTime:
  22. if (startTime == null || endTime == null) {
  23. filterTxt = StringName.popupAgendaFilterTxt.tr
  24. .replacePlaceholders([StringName.popupCustomTime.tr]);
  25. } else {
  26. filterTxt = StringName.popupAgendaFilterTxt.tr.replacePlaceholders(
  27. ['${StringName.popupCustomTime.tr} $startTime-$endTime']);
  28. }
  29. break;
  30. }
  31. return filterTxt;
  32. }