-
Notifications
You must be signed in to change notification settings - Fork 0
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
ChangeNotifierの実装(トークルームページ) #22
Conversation
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.
何か所か修正箇所をレビューしました!
getMessageList(); | ||
} | ||
List<Message> messageList; | ||
TextEditingController textController = TextEditingController(); |
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.
textControllerは変化する値ではない?と思ったので、TextFieldのあるクラスにおいていいと思います。
(textControllerに対して行われる関数は.clearだけなので…)
lib/ui/molecules/message/list.dart
Outdated
@@ -1,69 +1,34 @@ | |||
import 'package:chat_flutter/ui/molecules/message/list_item.dart'; | |||
import 'package:chat_flutter/ui/pages/main/room/room_controller.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:chat_flutter/model/message.dart'; |
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.
import 'package:chat_flutter/model/message.dart';
ここの部分、使われていないので削除していいと思います!
void sendMessage() { | ||
/// TODO Firebaseへの処理に置き換える | ||
textController.clear(); | ||
notifyListeners(); | ||
} |
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.
textControllerをここのクラスに置かないのならば、
textController.textで文字列を受け取って、Firebaseでの処理のみにしたらいいと思います!
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.
実装部分はこれで問題ないと思います!
notifyListeners(); | ||
} | ||
|
||
Future<void> sendMessage(String message) { |
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.
ここはFutureなのでasyncつけた方が良いと思います!
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.
実装時に必要になるので、firebaseの実装時につけるでもいいですか?
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.
OKです!
自分のPR(#16 )のミスのせいなんですが、pages/mainというディレクトリがありますよね。 |
ディレクトリを移動するissueを作成して、ログ残すためにもまとめて整理した方がいい気がします! |
issue
#13
やったこと
・room_controllerの作成
・既存のroom.dartをcontrollerで置き換え
・textFieldの切り分け
懸念点
・TextEditingControllerをControllerに書き出して、controller経由でTextFieldを実装していますが、
このあたり自信ないので、もし意見あったらください!