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

ChangeNotifierの実装(トークルームページ) #22

Merged
merged 6 commits into from
Jul 22, 2020

Conversation

PictoMki
Copy link

issue

#13

やったこと

・room_controllerの作成
・既存のroom.dartをcontrollerで置き換え
・textFieldの切り分け

懸念点

・TextEditingControllerをControllerに書き出して、controller経由でTextFieldを実装していますが、
このあたり自信ないので、もし意見あったらください!

Copy link
Collaborator

@thoth000 thoth000 left a 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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

textControllerは変化する値ではない?と思ったので、TextFieldのあるクラスにおいていいと思います。
(textControllerに対して行われる関数は.clearだけなので…)

@@ -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';
Copy link
Collaborator

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';
ここの部分、使われていないので削除していいと思います!

Comment on lines 37 to 41
void sendMessage() {
/// TODO Firebaseへの処理に置き換える
textController.clear();
notifyListeners();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

textControllerをここのクラスに置かないのならば、
textController.textで文字列を受け取って、Firebaseでの処理のみにしたらいいと思います!

Copy link
Collaborator

@thoth000 thoth000 left a 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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここはFutureなのでasyncつけた方が良いと思います!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実装時に必要になるので、firebaseの実装時につけるでもいいですか?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OKです!

@thoth000
Copy link
Collaborator

自分のPR(#16 )のミスのせいなんですが、pages/mainというディレクトリがありますよね。
ここにroomが入ってるのはおかしくて、mainはbottomNavigationで移動できるページをまとめたものなので、
main外にroomディレクトリを移してほしいです!

@PictoMki
Copy link
Author

ディレクトリを移動するissueを作成して、ログ残すためにもまとめて整理した方がいい気がします!

@thoth000 thoth000 merged commit a860c6a into master Jul 22, 2020
@thoth000 thoth000 deleted the feature/13/room_page branch July 22, 2020 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants