-
Notifications
You must be signed in to change notification settings - Fork 6
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
Issue 173 ページング機能のエラー発生時の復帰処理を実装 #209
base: main
Are you sure you want to change the base?
Conversation
Ready for review 🚀 |
Visit the preview URL for this PR (updated for commit d09e747): https://flutter-mobile-project-template-catalog--pr209-issue-1-j5t2jn9g.web.app (expires Mon, 24 Jun 2024 08:14:17 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 9ea56735a63d07a7cfe62eb204b0528284c37c23 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コメントしましたが、Flutter/Dartからしばらく離れているので、他の方のレビューもいただけるといいかなという状態です 🙇
愚問で申し訳ござませんが、CIが Switch式を切り出す以前のテスト(c82f97a)は成功していましたが、Switch式の切り出し等のリファクタリングを行った結果、CIからエラーが出力されるようになりました。(1a3cf4c),(bc7299b) そこでテストが失敗している原因の究明のためにローカルで実行した結果、以下の出力が得られました。
お忙しいところ恐縮ですが、回答の方お待ちしております。 |
このファイルのフォーマットが必要みたいですよ 🙆♂️ |
@K9i-0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
レビューが遅れて申し訳ないです
全体的な動きは問題なく、UX が向上していると感じました 👍
細かい点をいくつかコメントしているので、確認いただけるとありがたいです!
@@ -29,16 +34,17 @@ extension AsyncValueExtension<T> on AsyncValue<T> { | |||
bool skipErrorOnHasValue = false, | |||
}) { | |||
if (skipErrorOnHasValue) { | |||
logger.shout(isLoading); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d2b6a70にて修正いたしました!
@@ -64,6 +64,40 @@ class CommonPagingView<N extends PagingAsyncNotifier<D, T>, | |||
|
|||
final void Function(AppException e) _onError; | |||
|
|||
Widget _endItem( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
01fc576にて修正いたしました!
); | ||
} | ||
|
||
if (!hasError) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@warahiko
ご指摘ありがとうございます!
ちなみL.98に入らないのであれば、if(!hasError)
を取り払っても問題ないですか?
そのようにすれば返り値にnullの可能性が消失するのでそちらの方が良いのかなと考えましたが意見を賜りたいです!
ちなみに上でご指摘いただいた「なにも表示しない」を明確化するにはSizedBox.shrink();
等の空のWidgetを返すのではなく基本的にはnullで返したほうが良いのでしょうか?
今後の開発の参考にさせて頂きたいのでご回答いただけますと幸いです!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L.98に入らないのであれば、if(!hasError)を取り払っても問題ないですか?
はい、自分は問題ないと思います!
「なにも表示しない」を明確化するにはSizedBox.shrink();等の空のWidgetを返すのではなく基本的にはnullで返したほうが良いのでしょうか?
今回のケースであれば、この API 自体が null で返す仕様になっているのでそうしたほうがよさそうですね
一般的にも、たとえサイズゼロの要素でも処理が必要ですし、 min(Height|Width) があればそれが適用されたりする(しますよね......?ちゃんと調べられてはないですが......)ので、できるのであればそもそも要素として入れない、というのは優先すべきじゃないかなと思いました
一方で普通の StatelessWidget#build() などは non-null な Widget を返す必要があるので、こういうときには仕方ないかな、くらいかなと
(などと書いていますが初心者の一意見なので、もっと使い慣れている人に聞いたほうがよさそうです)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
返信ありがとうございます!
確かにこの API 自体が null で返す仕様になっているので、null
として要素を存在させない方が自然な感じはありますね!ありがとうございます!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
65e8d62にて修正いたしました!
return const Center( | ||
child: Padding( | ||
padding: EdgeInsets.all(16), | ||
child: CircularProgressIndicator(), | ||
), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
605536dにて修正いたしました!
// Displays EndItem to detect scroll end | ||
// if more data is available and no errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
018eb9fにて修正いたしました!
@@ -64,6 +64,40 @@ class CommonPagingView<N extends PagingAsyncNotifier<D, T>, | |||
|
|||
final void Function(AppException e) _onError; | |||
|
|||
Widget _endItem( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
概要
レビュー観点
@akatsuki174 さんのお陰で解決しました!ありがとうございました!
common_paging_view.dart
において、2ページ目以降の読み込み、表示、再読み込みの3つについての条件分岐が複雑であり、三項演算子では可読性に乏しくなると考えました。そこで無理矢理ですが、可読性の観点からswitch
文を用いました。こちらについてさらに良い方法がございましたら、ご教授いただけますと幸いですレビューレベル
レビュー優先度
画像 / 動画
CircularProgressIndicator
が表示されるようにしました。2024-05-21.18.15.24.mov
2024-05-21.17.34.39.mov
動作確認手順
備考