Add artifact details hz mode
This commit is contained in:
parent
773865fe44
commit
90bf9df397
@ -22,6 +22,7 @@ class _ArtifactDetailsScreenState extends State<ArtifactDetailsScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
bool hzMode = context.isLandscape;
|
||||||
return ColoredBox(
|
return ColoredBox(
|
||||||
color: $styles.colors.greyStrong,
|
color: $styles.colors.greyStrong,
|
||||||
child: FutureBuilder<ArtifactData?>(
|
child: FutureBuilder<ArtifactData?>(
|
||||||
@ -30,31 +31,16 @@ class _ArtifactDetailsScreenState extends State<ArtifactDetailsScreen> {
|
|||||||
final data = snapshot.data;
|
final data = snapshot.data;
|
||||||
late Widget content;
|
late Widget content;
|
||||||
if (snapshot.hasError || (snapshot.hasData && data == null)) {
|
if (snapshot.hasError || (snapshot.hasData && data == null)) {
|
||||||
content = Column(
|
content = _buildError();
|
||||||
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();
|
|
||||||
} else if (!snapshot.hasData) {
|
} else if (!snapshot.hasData) {
|
||||||
content = Center(child: AppLoadingIndicator());
|
content = Center(child: AppLoadingIndicator());
|
||||||
} else {
|
} 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: [
|
slivers: [
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
pinned: true,
|
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) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: $styles.insets.lg),
|
padding: EdgeInsets.symmetric(horizontal: $styles.insets.lg),
|
||||||
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Gap($styles.insets.xl),
|
Gap($styles.insets.xl),
|
||||||
if (data.culture.isNotEmpty) ...[
|
if (data.culture.isNotEmpty) ...[
|
||||||
@ -59,6 +61,7 @@ class _Content extends StatelessWidget {
|
|||||||
Gap($styles.insets.offset),
|
Gap($styles.insets.offset),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user