Add artifact details hz mode
This commit is contained in:
parent
773865fe44
commit
90bf9df397
@ -22,6 +22,7 @@ class _ArtifactDetailsScreenState extends State<ArtifactDetailsScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool hzMode = context.isLandscape;
|
||||
return ColoredBox(
|
||||
color: $styles.colors.greyStrong,
|
||||
child: FutureBuilder<ArtifactData?>(
|
||||
@ -30,31 +31,16 @@ class _ArtifactDetailsScreenState extends State<ArtifactDetailsScreen> {
|
||||
final data = snapshot.data;
|
||||
late Widget content;
|
||||
if (snapshot.hasError || (snapshot.hasData && data == null)) {
|
||||
content = Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Icon(
|
||||
Icons.warning_amber_outlined,
|
||||
color: $styles.colors.accent1,
|
||||
size: $styles.insets.lg,
|
||||
)),
|
||||
Gap($styles.insets.xs),
|
||||
SizedBox(
|
||||
width: $styles.insets.xxl * 3,
|
||||
child: Text(
|
||||
StringUtils.supplant($strings.artifactDetailsErrorNotFound, {'{artifactId}': widget.artifactId}),
|
||||
style: $styles.text.body.copyWith(color: $styles.colors.offWhite),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
).animate().fadeIn();
|
||||
content = _buildError();
|
||||
} else if (!snapshot.hasData) {
|
||||
content = Center(child: AppLoadingIndicator());
|
||||
} else {
|
||||
content = CustomScrollView(
|
||||
content = hzMode
|
||||
? Row(children: [
|
||||
Expanded(child: _Header(data: data!)),
|
||||
Expanded(child: Center(child: SizedBox(width: 600, child: _Content(data: data)))),
|
||||
])
|
||||
: CustomScrollView(
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
@ -77,4 +63,28 @@ class _ArtifactDetailsScreenState extends State<ArtifactDetailsScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Animate _buildError() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Icon(
|
||||
Icons.warning_amber_outlined,
|
||||
color: $styles.colors.accent1,
|
||||
size: $styles.insets.lg,
|
||||
)),
|
||||
Gap($styles.insets.xs),
|
||||
SizedBox(
|
||||
width: $styles.insets.xxl * 3,
|
||||
child: Text(
|
||||
StringUtils.supplant($strings.artifactDetailsErrorNotFound, {'{artifactId}': widget.artifactId}),
|
||||
style: $styles.text.body.copyWith(color: $styles.colors.offWhite),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
).animate().fadeIn();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ class _Content extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: $styles.insets.lg),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Gap($styles.insets.xl),
|
||||
if (data.culture.isNotEmpty) ...[
|
||||
@ -59,6 +61,7 @@ class _Content extends StatelessWidget {
|
||||
Gap($styles.insets.offset),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user