Skip to content

Commit

Permalink
Updated reference card widget
Browse files Browse the repository at this point in the history
  • Loading branch information
reza00farjam committed Oct 1, 2023
1 parent 1649d43 commit 30ff28c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 28 deletions.
2 changes: 1 addition & 1 deletion lib/app/utils/reference_cards_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Widget referenceCardsBuilder({

return GridView.count(
// TODO: Card height is hard coded
childAspectRatio: context.responsiveCardWidth / 246,
childAspectRatio: context.responsiveCardWidth / 128,
shrinkWrap: true,
clipBehavior: Clip.none,
mainAxisSpacing: kSizeDefault,
Expand Down
63 changes: 36 additions & 27 deletions lib/app/widgets/reference_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,45 @@ class ArchiveReferenceCard extends StatelessWidget {
padding: const EdgeInsets.all(kSizeDefault),
onPressed: () =>
context.go('${ArchiveRoutes.references}/${reference.uuid}'),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: double.infinity,
child: Text(
reference.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.bodyLarge,
),
),
const Gap.vertical(kSizeDefault / 2),
SizedBox(
width: double.infinity,
child: Text(
reference.writers.join(', '),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.bodySmall.copyWith(
color: context.secondaryColor.withOpacity(0.8),
),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: double.infinity,
child: Text(
reference.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: context.bodyLarge,
),
),
const Gap.vertical(kSizeDefault / 2),
SizedBox(
width: double.infinity,
child: Text(
reference.writers.isEmpty
? '—'
: reference.writers.join(', '),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.bodySmall.copyWith(
color: context.secondaryColor.withOpacity(0.8),
),
),
),
],
),
),
const Gap.vertical(kSizeDefault),
const Gap.horizontal(kSizeDefault),
Container(
width: double.infinity,
height: kSizeCardWidth / 2,
width: 6 * kSizeDefault,
height: 6 * kSizeDefault,
decoration: BoxDecoration(
image: (reference.image != null)
? DecorationImage(
Expand All @@ -72,7 +81,7 @@ class ArchiveReferenceCard extends StatelessWidget {
: Center(
child: Icon(
ArchiveIcons.photoOff,
size: 3 * kSizeDefault,
size: 2 * kSizeDefault,
color: context.secondaryColor,
),
),
Expand Down

0 comments on commit 30ff28c

Please sign in to comment.