chore: normalize text for all languages option in course selection dropdowns (#4485)

This commit is contained in:
ggurdin 2025-10-21 16:20:56 -04:00 committed by GitHub
parent f53b010105
commit 288aee68eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 139 additions and 133 deletions

View file

@ -25,7 +25,6 @@ class CourseLanguageFilter extends StatelessWidget {
displayname: (v) => v.getDisplayName(context) ?? v.displayName,
enableSearch: true,
defaultName: L10n.of(context).targetLanguageLabel,
shortName: L10n.of(context).allLanguages,
);
}
}

View file

@ -10,7 +10,6 @@ class CoursePlanFilter<T> extends StatefulWidget {
final void Function(T?) onChanged;
final String defaultName;
final String? shortName;
final String Function(T) displayname;
final bool enableSearch;
@ -23,7 +22,6 @@ class CoursePlanFilter<T> extends StatefulWidget {
required this.defaultName,
required this.displayname,
this.enableSearch = false,
this.shortName,
});
@override
@ -75,7 +73,7 @@ class CoursePlanFilterState<T> extends State<CoursePlanFilter<T>> {
child: DropdownTextButton(
text: item != null
? widget.displayname(item)
: widget.shortName ?? widget.defaultName,
: widget.defaultName,
isSelected: item == widget.value,
),
),

View file

@ -151,65 +151,69 @@ class NewCoursePageState extends State<NewCoursePage>
itemBuilder: (context, index) {
final course = courseEntries[index].value;
final courseId = courseEntries[index].key;
return InkWell(
onTap: () => context.go(
spaceId != null
? '/rooms/spaces/$spaceId/addcourse/$courseId'
: '/${widget.route}/course/own/$courseId',
),
borderRadius: BorderRadius.circular(12.0),
child: Container(
padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
border: Border.all(
color: theme.colorScheme.primary,
),
return Material(
type: MaterialType.transparency,
child: InkWell(
onTap: () => context.go(
spaceId != null
? '/rooms/spaces/$spaceId/addcourse/$courseId'
: '/${widget.route}/course/own/$courseId',
),
child: Column(
spacing: 4.0,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
spacing: 8.0,
children: [
ImageByUrl(
imageUrl: course.imageUrl,
width: 58.0,
borderRadius:
BorderRadius.circular(10.0),
replacement: Container(
height: 58.0,
borderRadius: BorderRadius.circular(12.0),
child: Container(
padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
border: Border.all(
color: theme.colorScheme.primary,
),
),
child: Column(
spacing: 4.0,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
spacing: 8.0,
children: [
ImageByUrl(
imageUrl: course.imageUrl,
width: 58.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(10.0),
color: theme
.colorScheme.surfaceContainer,
borderRadius:
BorderRadius.circular(10.0),
replacement: Container(
height: 58.0,
width: 58.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(10.0),
color: theme.colorScheme
.surfaceContainer,
),
),
),
),
Flexible(
child: Text(
course.title,
style: theme.textTheme.bodyLarge,
maxLines: 2,
overflow: TextOverflow.ellipsis,
Flexible(
child: Text(
course.title,
style: theme.textTheme.bodyLarge,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
),
],
),
CourseInfoChips(
courseId,
iconSize: 12.0,
fontSize: 12.0,
),
Text(
course.description,
style: theme.textTheme.bodyMedium,
),
],
],
),
CourseInfoChips(
courseId,
iconSize: 12.0,
fontSize: 12.0,
),
Text(
course.description,
style: theme.textTheme.bodyMedium,
),
],
),
),
),
);

View file

@ -256,90 +256,95 @@ class PublicCoursesPageState extends State<PublicCoursesPage> {
roomChunk.canonicalAlias ??
L10n.of(context).emptyChat;
return InkWell(
onTap: () => context.go(
'/${widget.route}/course/public/$courseId',
extra: roomChunk,
),
borderRadius: BorderRadius.circular(12.0),
child: Container(
padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
border: Border.all(
color: theme.colorScheme.primary,
),
return Material(
type: MaterialType.transparency,
child: InkWell(
onTap: () => context.go(
'/${widget.route}/course/public/$courseId',
extra: roomChunk,
),
child: Column(
spacing: 4.0,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
spacing: 8.0,
children: [
ImageByUrl(
imageUrl: roomChunk.avatarUrl?.toString(),
width: 58.0,
borderRadius: BorderRadius.circular(10.0),
replacement: Container(
height: 58.0,
borderRadius: BorderRadius.circular(12.0),
child: Container(
padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
border: Border.all(
color: theme.colorScheme.primary,
),
),
child: Column(
spacing: 4.0,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
spacing: 8.0,
children: [
ImageByUrl(
imageUrl:
roomChunk.avatarUrl?.toString(),
width: 58.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(10.0),
color: theme
.colorScheme.surfaceContainer,
borderRadius:
BorderRadius.circular(10.0),
replacement: Container(
height: 58.0,
width: 58.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(10.0),
color: theme
.colorScheme.surfaceContainer,
),
),
),
),
Flexible(
child: Column(
spacing: 0.0,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
displayname,
style: theme.textTheme.bodyLarge,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Row(
spacing: 4.0,
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.group,
size: 16.0,
),
Text(
L10n.of(context)
.countParticipants(
roomChunk.numJoinedMembers,
Flexible(
child: Column(
spacing: 0.0,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
displayname,
style: theme.textTheme.bodyLarge,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Row(
spacing: 4.0,
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.group,
size: 16.0,
),
style:
theme.textTheme.bodyMedium,
),
],
),
],
Text(
L10n.of(context)
.countParticipants(
roomChunk.numJoinedMembers,
),
style: theme
.textTheme.bodyMedium,
),
],
),
],
),
),
],
),
if (course != null) ...[
CourseInfoChips(
courseId,
iconSize: 12.0,
fontSize: 12.0,
),
Text(
course.description,
style: theme.textTheme.bodyMedium,
),
],
),
if (course != null) ...[
CourseInfoChips(
courseId,
iconSize: 12.0,
fontSize: 12.0,
),
Text(
course.description,
style: theme.textTheme.bodyMedium,
),
],
],
),
),
),
);