Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class _ArtifactScreenState extends State<ArtifactCarouselScreen> {
@override
Widget build(BuildContext context) {
bool shortMode = context.heightPx <= 800;
final double bottomHeight = context.heightPx / 2.75; // Prev 340, dynamic seems to work better
bool overlapMode = context.heightPx <= 450;
final double bottomHeight = context.heightPx / (overlapMode ? 2 : 2.75); // Prev 340, dynamic seems to work better
// Allow objects to become wider as the screen becomes tall, this allows
// them to grow taller as well, filling the available space better.
double itemHeight = (context.heightPx - 200 - bottomHeight).clamp(250, 400);
Expand Down Expand Up @@ -122,6 +123,7 @@ class _ArtifactScreenState extends State<ArtifactCarouselScreen> {
artifact: _artifacts[value],
height: bottomHeight,
shortMode: shortMode,
overlapMode: overlapMode,
state: this,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,30 @@ part of '../artifact_carousel_screen.dart';

class _BottomTextContent extends StatelessWidget {
const _BottomTextContent(
{super.key, required this.artifact, required this.height, required this.state, required this.shortMode});
{super.key,
required this.artifact,
required this.height,
required this.state,
required this.shortMode,
required this.overlapMode});

final HighlightData artifact;
final double height;
final _ArtifactScreenState state;
final bool shortMode;
final bool overlapMode;
int get _currentPage => state._currentPage.value.round();

@override
Widget build(BuildContext context) {
Widget textContent = Text(
artifact.title,
overflow: TextOverflow.ellipsis,
style: $styles.text.h2.copyWith(color: $styles.colors.black, height: 1.2, fontSize: 32),
textAlign: TextAlign.center,
maxLines: 2,
);

return Container(
width: $styles.sizes.maxContentWidth2,
height: height,
Expand Down Expand Up @@ -40,13 +54,15 @@ class _BottomTextContent extends StatelessWidget {
SizedBox(width: double.infinity),
// Stop text from scaling to make layout a little easier, it's already quite large
StaticTextScale(
child: Text(
artifact.title,
overflow: TextOverflow.ellipsis,
style: $styles.text.h2.copyWith(color: $styles.colors.black, height: 1.2, fontSize: 32),
textAlign: TextAlign.center,
maxLines: 2,
),
child: overlapMode
? Container(
padding: EdgeInsets.all($styles.insets.xxs),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular($styles.corners.md),
color: $styles.colors.white.withAlpha(130),
),
child: textContent)
: textContent,
),
if (!shortMode) ...[
Gap($styles.insets.xxs),
Expand All @@ -70,13 +86,13 @@ class _BottomTextContent extends StatelessWidget {
controller: state._pageController!,
semanticPageTitle: $strings.artifactsSemanticArtifact,
),
Gap($styles.insets.md),
if (!shortMode) Gap($styles.insets.md),
AppBtn.from(
text: $strings.artifactsButtonBrowse,
expand: true,
onPressed: state._handleSearchTap,
),
Gap($styles.insets.lg),
if (!shortMode) Gap($styles.insets.lg) else Gap($styles.insets.md),
],
),
],
Expand Down