Skip to content

Commit 746377e

Browse files
Use text.rich for the "Kommentar" fields to wrap around the whole row
1 parent 5a8b94f commit 746377e

9 files changed

Lines changed: 324 additions & 306 deletions

File tree

school_data_hub_flutter/lib/features/_attendance/presentation/widgets/missed_class_card.dart

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,29 @@ class MissedSchooldayCard extends StatelessWidget {
117117
],
118118
),
119119
const Gap(5),
120-
Row(
121-
mainAxisAlignment: MainAxisAlignment.start,
122-
children: [
123-
const Text('Kommentar:'),
124-
const Gap(5),
125-
Expanded(
126-
child: Text(
127-
missedSchoolday.comment ?? 'kein Eintrag',
128-
style: const TextStyle(fontWeight: FontWeight.bold),
129-
overflow: TextOverflow.visible,
130-
softWrap: true,
120+
Padding(
121+
padding: const EdgeInsets.only(left: 10),
122+
child: Align(
123+
alignment: Alignment.centerLeft,
124+
child: Text.rich(
125+
textAlign: TextAlign.left,
126+
TextSpan(
127+
children: [
128+
const TextSpan(
129+
text: ' Kommentar: ',
130+
style: TextStyle(
131+
fontSize: 16,
132+
fontWeight: FontWeight.bold,
133+
),
134+
),
135+
TextSpan(
136+
text: missedSchoolday.comment ?? 'kein Eintrag',
137+
),
138+
],
131139
),
140+
softWrap: true,
132141
),
133-
134-
],
142+
),
135143
),
136144
if (missedSchoolday.modifiedBy != null) ...[
137145
const Gap(5),

school_data_hub_flutter/lib/features/_authorizations/presentation/authorization_pupils_page/widgets/authorization_pupil_card.dart

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:flutter_it/flutter_it.dart';
55
import 'package:gap/gap.dart';
66
import 'package:school_data_hub_client/school_data_hub_client.dart';
77
import 'package:school_data_hub_flutter/app_utils/create_and_crop_image_file.dart';
8-
import 'package:school_data_hub_flutter/common/theme/app_colors.dart';
98
import 'package:school_data_hub_flutter/common/widgets/buttons_switches/custom_checkbox_either_or.dart';
109
import 'package:school_data_hub_flutter/common/widgets/dialogs/confirmation_dialog.dart';
1110
import 'package:school_data_hub_flutter/common/widgets/dialogs/long_textfield_dialog.dart';
@@ -196,56 +195,54 @@ class AuthorizationPupilCard extends WatchingWidget {
196195
),
197196
],
198197
),
199-
const Row(
200-
crossAxisAlignment: CrossAxisAlignment.start,
201-
children: [
202-
Gap(10),
203-
Text(
204-
'Kommentar: ',
205-
style: TextStyle(fontWeight: FontWeight.bold),
206-
),
207-
Gap(5),
208-
],
209-
),
210-
Row(
211-
crossAxisAlignment: CrossAxisAlignment.start,
212-
mainAxisAlignment: MainAxisAlignment.start,
213-
children: [
214-
const Gap(10),
215-
Expanded(
216-
child: InkWell(
217-
onTap: () async {
218-
final result = await longTextFieldDialog(
219-
title: 'Kommentar ändern',
220-
labelText: 'Kommentar',
221-
initialValue: pupilAuthorization.comment,
222-
parentContext: context,
223-
);
224-
if (result == null ||
225-
result.value == pupilAuthorization.comment ||
226-
result.value == '') {
227-
return;
228-
}
198+
InkWell(
199+
onTap: () async {
200+
final result = await longTextFieldDialog(
201+
title: 'Kommentar ändern',
202+
labelText: 'Kommentar',
203+
initialValue: pupilAuthorization.comment,
204+
parentContext: context,
205+
);
206+
if (result == null ||
207+
result.value == pupilAuthorization.comment ||
208+
result.value == '') {
209+
return;
210+
}
229211

230-
await di<AuthorizationManager>().updatePupilAuthorization(
231-
pupilId: pupil.pupilId,
232-
authorizationId: authorization.id!,
233-
status: null,
234-
comment: result.value,
235-
);
236-
},
237-
child: Text(
238-
pupilAuthorization.comment != null
239-
? pupilAuthorization.comment!
240-
: 'kein Kommentar',
241-
style: TextStyle(color: AppColors.backgroundColor),
242-
textAlign: TextAlign.left,
243-
maxLines: 3,
244-
softWrap: true,
212+
await di<AuthorizationManager>().updatePupilAuthorization(
213+
pupilId: pupil.pupilId,
214+
authorizationId: authorization.id!,
215+
status: null,
216+
comment: result.value,
217+
);
218+
},
219+
child: Padding(
220+
padding: const EdgeInsets.only(left: 10),
221+
child: Align(
222+
alignment: Alignment.centerLeft,
223+
child: Text.rich(
224+
textAlign: TextAlign.left,
225+
TextSpan(
226+
children: [
227+
const TextSpan(
228+
text: ' Kommentar: ',
229+
style: TextStyle(
230+
fontSize: 16,
231+
fontWeight: FontWeight.bold,
232+
),
233+
),
234+
TextSpan(
235+
text: (pupilAuthorization.comment == null ||
236+
pupilAuthorization.comment!.isEmpty)
237+
? 'Kein Kommentar'
238+
: pupilAuthorization.comment!,
239+
),
240+
],
245241
),
242+
softWrap: true,
246243
),
247244
),
248-
],
245+
),
249246
),
250247
const Gap(10),
251248
],

school_data_hub_flutter/lib/features/_pupil/presentation/pupil_profile_page/widgets/pupil_profile_page_content/authorization_content/pupil_content_authorization_entry_card.dart

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -213,39 +213,52 @@ class PupilContentAuthorizationEntryCard extends WatchingWidget {
213213
],
214214
),
215215
const Gap(5),
216-
Row(
217-
children: [
218-
Flexible(
219-
child: InkWell(
220-
onTap: () async {
221-
final result = await longTextFieldDialog(
222-
title: 'Kommentar',
223-
labelText: 'Kommentar eintragen',
224-
initialValue: pupilAuthorization.comment ?? '',
225-
parentContext: context,
226-
);
227-
if (result == null ||
228-
result.value == pupilAuthorization.comment) {
229-
return;
230-
}
231-
await di<AuthorizationManager>()
232-
.updatePupilAuthorization(
233-
pupilId: pupil.pupilId,
234-
authorizationId: authorization.id!,
235-
comment: result.value,
236-
);
237-
},
238-
child: Text(
239-
pupilAuthorization.comment ?? 'kein Kommentar',
240-
style: TextStyle(
241-
fontSize: 15,
242-
fontWeight: FontWeight.bold,
243-
color: AppColors.interactiveColor,
244-
),
216+
InkWell(
217+
onTap: () async {
218+
final result = await longTextFieldDialog(
219+
title: 'Kommentar',
220+
labelText: 'Kommentar eintragen',
221+
initialValue: pupilAuthorization.comment ?? '',
222+
parentContext: context,
223+
);
224+
if (result == null ||
225+
result.value == pupilAuthorization.comment) {
226+
return;
227+
}
228+
await di<AuthorizationManager>()
229+
.updatePupilAuthorization(
230+
pupilId: pupil.pupilId,
231+
authorizationId: authorization.id!,
232+
comment: result.value,
233+
);
234+
},
235+
child: Padding(
236+
padding: const EdgeInsets.only(left: 10),
237+
child: Align(
238+
alignment: Alignment.centerLeft,
239+
child: Text.rich(
240+
textAlign: TextAlign.left,
241+
TextSpan(
242+
children: [
243+
const TextSpan(
244+
text: ' Kommentar: ',
245+
style: TextStyle(
246+
fontSize: 16,
247+
fontWeight: FontWeight.bold,
248+
),
249+
),
250+
TextSpan(
251+
text: (pupilAuthorization.comment == null ||
252+
pupilAuthorization.comment!.isEmpty)
253+
? 'Kein Kommentar'
254+
: pupilAuthorization.comment!,
255+
),
256+
],
245257
),
258+
softWrap: true,
246259
),
247260
),
248-
],
261+
),
249262
),
250263
const Gap(5),
251264
],

school_data_hub_flutter/lib/features/_pupil/presentation/pupil_profile_page/widgets/pupil_profile_page_content/school_list_content/widgets/pupil_profile_school_list_pupil_entry_card.dart

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -148,55 +148,50 @@ class _PupilProfileSchoolListEntryContent extends WatchingWidget {
148148
],
149149
),
150150
const Gap(5),
151-
Row(
152-
crossAxisAlignment: CrossAxisAlignment.start,
153-
children: [
154-
const Text(
155-
'Kommentar',
156-
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
157-
),
158-
const Spacer(),
159-
Text(
160-
pupilListEntry.entryBy ?? '',
161-
style: const TextStyle(
162-
fontWeight: FontWeight.bold,
163-
fontSize: 15,
164-
),
165-
),
166-
],
167-
),
168-
const Gap(5),
169-
Row(
170-
children: [
171-
Flexible(
172-
child: InkWell(
173-
onTap: () async {
174-
final result = await longTextFieldDialog(
175-
title: 'Kommentar',
176-
initialValue: pupilListEntry.comment ?? '',
177-
labelText: 'Kommentar eintragen',
178-
parentContext: context,
179-
);
180-
if (result == null ||
181-
result.value == pupilListEntry.comment) {
182-
return;
183-
}
184-
await schoolListManager.updatePupilListEntry(
185-
entry: pupilListEntry,
186-
comment: (value: result.value),
187-
);
188-
},
189-
child: Text(
190-
pupilListEntry.comment ?? 'kein Kommentar',
191-
style: TextStyle(
192-
fontSize: 15,
193-
fontWeight: FontWeight.bold,
194-
color: AppColors.interactiveColor,
195-
),
151+
InkWell(
152+
onTap: () async {
153+
final result = await longTextFieldDialog(
154+
title: 'Kommentar',
155+
initialValue: pupilListEntry.comment ?? '',
156+
labelText: 'Kommentar eintragen',
157+
parentContext: context,
158+
);
159+
if (result == null ||
160+
result.value == pupilListEntry.comment) {
161+
return;
162+
}
163+
await schoolListManager.updatePupilListEntry(
164+
entry: pupilListEntry,
165+
comment: (value: result.value),
166+
);
167+
},
168+
child: Padding(
169+
padding: const EdgeInsets.only(left: 10),
170+
child: Align(
171+
alignment: Alignment.centerLeft,
172+
child: Text.rich(
173+
textAlign: TextAlign.left,
174+
TextSpan(
175+
children: [
176+
const TextSpan(
177+
text: ' Kommentar: ',
178+
style: TextStyle(
179+
fontSize: 16,
180+
fontWeight: FontWeight.bold,
181+
),
182+
),
183+
TextSpan(
184+
text: (pupilListEntry.comment == null ||
185+
pupilListEntry.comment!.isEmpty)
186+
? 'Kein Kommentar'
187+
: pupilListEntry.comment!,
188+
),
189+
],
196190
),
191+
softWrap: true,
197192
),
198193
),
199-
],
194+
),
200195
),
201196
],
202197
),

school_data_hub_flutter/lib/features/_school_lists/presentation/school_list_pupil_entries_page/widgets/school_list_pupil_entry_card.dart

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'package:flutter_it/flutter_it.dart';
33
import 'package:gap/gap.dart';
44
import 'package:school_data_hub_client/school_data_hub_client.dart';
55
import 'package:school_data_hub_flutter/common/services/notification_service.dart';
6-
import 'package:school_data_hub_flutter/common/theme/app_colors.dart';
76
import 'package:school_data_hub_flutter/common/widgets/buttons_switches/custom_checkbox_either_or.dart';
87
import 'package:school_data_hub_flutter/common/widgets/dialogs/confirmation_dialog.dart';
98
import 'package:school_data_hub_flutter/common/widgets/dialogs/information_dialog.dart';
@@ -167,12 +166,32 @@ class _EntryComment extends WatchingWidget {
167166
comment: (value: null),
168167
);
169168
},
170-
child: Text(
171-
pupilEntry.comment != null && pupilEntry.comment != ''
172-
? pupilEntry.comment!
173-
: 'kein Kommentar',
174-
textAlign: TextAlign.left,
175-
style: TextStyle(fontSize: 16, color: AppColors.backgroundColor),
169+
child: Padding(
170+
padding: const EdgeInsets.only(left: 10),
171+
child: Align(
172+
alignment: Alignment.centerLeft,
173+
child: Text.rich(
174+
textAlign: TextAlign.left,
175+
TextSpan(
176+
children: [
177+
const TextSpan(
178+
text: ' Kommentar: ',
179+
style: TextStyle(
180+
fontSize: 16,
181+
fontWeight: FontWeight.bold,
182+
),
183+
),
184+
TextSpan(
185+
text: (pupilEntry.comment == null ||
186+
pupilEntry.comment!.isEmpty)
187+
? 'Kein Kommentar'
188+
: pupilEntry.comment!,
189+
),
190+
],
191+
),
192+
softWrap: true,
193+
),
194+
),
176195
),
177196
);
178197
}

0 commit comments

Comments
 (0)