Skip to content

Commit

Permalink
#112 モバイルアプリでの作品詳細表示の実装
Browse files Browse the repository at this point in the history
  • Loading branch information
FltSv committed Aug 23, 2024
1 parent 01ff3c2 commit a89cab8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions mobile/lib/infra/fake/fake_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ class FakeRepo implements DataRepoBase {
products: [
Product(
id: "10043286-3072-49b8-a04a-83b9b1f790f5",
title: "ねこ",
detail: "ねこ説明",
image:
"9887707f-ac43-43bd-9015-2f112df57576.png?alt=media&token=10b319a5-8349-4fb1-959e-4d50d05cfb6f",
),
Product(
id: "4eb84461-3664-480c-b89d-77dc401bb0e5",
title: "",
detail: "",
image:
"b6f6a0a2-7f23-4f66-9959-9c9ee7d8f521.png?alt=media&token=6760976d-be3a-4da3-a0a8-15e1adf596b9",
),
Expand Down Expand Up @@ -51,11 +55,15 @@ class FakeRepo implements DataRepoBase {
products: [
Product(
id: "43a0e71b-9761-4800-9e88-1a57a3a4ed53",
title: "",
detail: "",
image:
"46ff0e7f-b781-4694-bb0d-cf94ce3aa2fa.png?alt=media&token=f2f8f802-c85b-464e-8de8-8a29468c74c8",
),
Product(
id: "d94c32a0-e82e-41b8-af6e-4c61ce4a065b",
title: "",
detail: "",
image:
"9ee21a8a-ff5c-4d1b-aaf5-25cc81905331.png?alt=media&token=4d143a04-e267-47de-b38e-4ad2ad318439",
),
Expand Down
2 changes: 2 additions & 0 deletions mobile/lib/infra/firebase/firebase_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class FirebaseRepo implements DataRepoBase {
products: products
.map((product) => Product(
id: product["id"],
title: product["title"] ?? "",
detail: product["detail"] ?? "",
image: product["image"],
))
.toList(),
Expand Down
8 changes: 8 additions & 0 deletions mobile/lib/models/product.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ import 'package:mobile/providers/data_provider.dart';
class Product {
Product({
required this.id,
required this.title,
required this.detail,
required this.image,
});

final String id;

/// 作品名
final String title;

/// 作品詳細、他
final String detail;

/// 作品のサムネイル画像のファイル名+トークン
final String image;
String get imageUrl => DataProvider().getImageUrl(creator.id, image);
Expand Down
5 changes: 4 additions & 1 deletion mobile/lib/screens/product_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ class _ProductDetailScreenState extends State<ProductDetailScreen> {
final product = widget.product;

return Scaffold(
appBar: AppBar(),
appBar: AppBar(
title: Text(product.title),
),
body: ListView(
padding: const EdgeInsets.all(16),
children: [
Image.network(product.imageUrl),
const Gap(8),
Text(product.detail),
].intersperse(const Gap(8)).toList(),
),
);
Expand Down

0 comments on commit a89cab8

Please sign in to comment.