Skip to content

Commit

Permalink
Refactor/redesign group tiles (#271)
Browse files Browse the repository at this point in the history
* refactor: redesign group tiles

* fix: add missing description to RequestItemGroupDVO

* refactor: display requestItemGroup according to design

* refactor: add trailing comma and remove unnecessary container widget

* refactor: add backgroundColor to RequestItemRenderer

* refactor: don't limit description to two lines and fix trailing comma

* refactor: use correct styling for texts

* fix: use title correctly

* refactor: use correct title

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Siolto <simon.coen@js-soft.com>
Co-authored-by: Julian König <julian.koenig@js-soft.com>
  • Loading branch information
4 people authored Oct 1, 2024
1 parent e9a945f commit 135c815
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class RequestItemGroupDVO extends RequestItemDVO {
required super.isDecidable,
required this.items,
this.title,
super.description,
this.response,
}) : super(id: 'n/a', name: 'n/a', type: 'RequestItemGroupDVO');

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,30 @@ class RequestItemGroupRenderer extends StatelessWidget {
expandFileReference: expandFileReference,
chooseFile: chooseFile,
openFileDetails: openFileDetails,
backgroundColor: Theme.of(context).colorScheme.surface,
);
}).toList();

final title = requestItemGroup.title != null
? Text(requestItemGroup.title ?? '', style: Theme.of(context).textTheme.bodyLarge!.copyWith(color: Theme.of(context).colorScheme.onSurface))
: null;

final subtitle = requestItemGroup.description != null
? Text(
requestItemGroup.description!,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant),
)
: null;

return ExpansionTile(
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
collapsedBackgroundColor: Theme.of(context).colorScheme.surfaceContainer,
maintainState: true,
initiallyExpanded: true,
// TODO: render anything else than empty string when title is not defined
title: Text(requestItemGroup.title ?? ''),
subtitle: requestItemGroup.description != null ? Text(requestItemGroup.description!) : null,
shape: const LinearBorder(side: BorderSide.none),
title: title ?? subtitle ?? const Text(''),
subtitle: title != null ? subtitle : null,
iconColor: Theme.of(context).colorScheme.onSurfaceVariant,
children: requestItems,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class RequestItemRenderer extends StatelessWidget {
final Future<FileDVO?> Function() chooseFile;
final void Function(FileDVO) openFileDetails;

final Color? backgroundColor;

const RequestItemRenderer({
super.key,
required this.currentAddress,
Expand All @@ -33,11 +35,13 @@ class RequestItemRenderer extends StatelessWidget {
required this.expandFileReference,
required this.chooseFile,
required this.openFileDetails,
this.backgroundColor,
});

@override
Widget build(BuildContext context) {
return Padding(
return Container(
color: backgroundColor,
padding: const EdgeInsets.symmetric(vertical: 12),
child: switch (item) {
final DecidableReadAttributeRequestItemDVO dvo => DecidableReadAttributeRequestItemRenderer(
Expand Down

0 comments on commit 135c815

Please sign in to comment.