19 lines
785 B
Dart
19 lines
785 B
Dart
import 'package:friendly_map/modules/app/app.dart';
|
|
|
|
/// 명함 항목 이름(key) → 사용자에게 보이는 이름. 명함 틀에서 가져온다.
|
|
Future<Map<String, String>> fieldLabels(FriendlyApp app) async {
|
|
final out = <String, String>{};
|
|
for (final t in await app.layout.templates()) {
|
|
for (final f in t.fields) {
|
|
out.putIfAbsent(f.key, () => f.label);
|
|
}
|
|
}
|
|
return out;
|
|
}
|
|
|
|
/// 값이 있는 항목만 "이름: 값" 줄로. 전화번호는 010 형식으로.
|
|
List<MapEntry<String, String>> filledFields(Map<String, String> fields, Map<String, String> labels) => [
|
|
for (final e in fields.entries)
|
|
if (e.value.trim().isNotEmpty && e.key != 'former') MapEntry(labels[e.key] ?? e.key, e.key == 'phone' ? displayPhone(e.value) : e.value),
|
|
];
|