Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #99

Merged
merged 3 commits into from
Jul 31, 2023
Merged
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
5 changes: 4 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Issue

<!-- #100 のように issue 番号を記載してください(複数ある場合は複数書いてください) -->
<!-- 下記に "close #100" のように issue 番号を記載してください(複数ある場合は複数書いてください) -->

close #n

Expand All @@ -10,6 +10,8 @@ close #n

PR > Files からのソースコードへのコメントも有効なので、活用してください。

途中経過を見てほしい場合は PR のタイトルの冒頭に WIP と書いてください(Work in Progress の意味)。

## UI

UI の変更がある(重要な)場合は、スクリーンショットや画面収録を貼り付けてください。
Expand All @@ -25,3 +27,4 @@ UI の変更がある(重要な)場合は、スクリーンショットや
- [ ] PR の冒頭に関連する Issue 番号を記載しましたか?
- [ ] 本 PR の変更に関して、エディタや IDE で意図しない警告は増えていませんか?(lint 警告やタイポなど)
- [ ] Issue の完了の定義は満たせていますか?
- [ ] 当該 Issue のスレッドで、レビュワーにレビュー依頼をしましたか?
64 changes: 57 additions & 7 deletions packages/dart_flutter_common/lib/src/widgets/generic_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class GenericImage extends StatelessWidget {
height = null,
width = null;

/// 長方形
/// 長方形の画像を表示する
const GenericImage.rectangle({
required this.imageUrl,
this.onTap,
Expand Down Expand Up @@ -112,20 +112,70 @@ class GenericImage extends StatelessWidget {
MaterialPageRoute<void>(
builder: (context) => _ImageDetailView(
tag: tag,
image: _image(),
child: _GenericCachedNetworkImage(
imageUrl: imageUrl,
imageShape: imageShape,
size: size,
width: width,
height: height,
borderRadius: borderRadius,
loadingWidget: loadingWidget,
),
),
),
);
}
},
child: Hero(
tag: tag,
child: _image(),
child: _GenericCachedNetworkImage(
imageUrl: imageUrl,
imageShape: imageShape,
size: size,
width: width,
height: height,
borderRadius: borderRadius,
loadingWidget: loadingWidget,
),
),
);
}
}

CachedNetworkImage _image() {
class _GenericCachedNetworkImage extends StatelessWidget {
const _GenericCachedNetworkImage({
required this.imageUrl,
required this.imageShape,
required this.size,
required this.width,
required this.height,
required this.borderRadius,
required this.loadingWidget,
});

/// 表示する画像の URL 文字列。
final String imageUrl;

/// 表示する画像の形状。
final ImageShape imageShape;

/// 円形・正方形で指定する画像のサイズ(直径、一辺の長さ)。
final double? size;

/// 長方形で指定する画像の横幅。
final double? width;

/// 長方形で指定する画像の高さ。
final double? height;

/// 角丸の半径。
final double? borderRadius;

/// 読み込み中に表示するウィジェット。
final Widget? loadingWidget;

@override
Widget build(BuildContext context) {
return CachedNetworkImage(
imageUrl: imageUrl,
imageBuilder: (context, imageProvider) {
Expand Down Expand Up @@ -252,11 +302,11 @@ class _Image extends StatelessWidget {
class _ImageDetailView extends StatelessWidget {
const _ImageDetailView({
required this.tag,
required this.image,
required this.child,
});

final String tag;
final CachedNetworkImage image;
final Widget child;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -284,7 +334,7 @@ class _ImageDetailView extends StatelessWidget {
clipBehavior: Clip.none,
child: Hero(
tag: tag,
child: image,
child: child,
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion packages/mottai_flutter_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: e5e57377bd5fff00d6d1c5fa3559e4346fd8c03e

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1