質問編集履歴

2

追記

2023/04/02 03:31

投稿

Jedda
Jedda

スコア80

test CHANGED
File without changes
test CHANGED
@@ -192,3 +192,10 @@
192
192
  [✓] Connected device (3 available)
193
193
  [✓] HTTP Host Availability
194
194
 
195
+ ### 参考にしたページ・動画
196
+ pageListの使い方で参考にした動画
197
+ https://www.udemy.com/course/flutter-firebase-sns/learn/lecture/28160742#content
198
+
199
+ bodyが複数ある場合の実装方法に使用したページ
200
+ https://www.choge-blog.com/programming/flutterscaffold-bodymultiplewidget/
201
+

1

追記

2023/04/02 03:25

投稿

Jedda
Jedda

スコア80

test CHANGED
File without changes
test CHANGED
@@ -53,92 +53,100 @@
53
53
  ),
54
54
  ],
55
55
  ),
56
+ body: Column(
57
+ children: [
56
- body: StreamBuilder<QuerySnapshot>(
58
+ StreamBuilder<QuerySnapshot>(
57
- stream: RoomFireStore.joinedRoomSnapshot,
59
+ stream: RoomFireStore.joinedRoomSnapshot,
58
- builder: (context, streamSnapshot) {
60
+ builder: (context, streamSnapshot) {
59
- if (streamSnapshot.hasData) {
61
+ if (streamSnapshot.hasData) {
60
- return FutureBuilder<List<TalkRoom>?>(
62
+ return FutureBuilder<List<TalkRoom>?>(
63
+ future:
61
- future: RoomFireStore.fetchJoinedRooms(streamSnapshot.data!),
64
+ RoomFireStore.fetchJoinedRooms(streamSnapshot.data!),
62
- builder: (context, futureSnapshot) {
65
+ builder: (context, futureSnapshot) {
63
- if (futureSnapshot.connectionState ==
66
+ if (futureSnapshot.connectionState ==
64
- ConnectionState.waiting) {
67
+ ConnectionState.waiting) {
65
- return const Center(
68
+ return const Center(
66
- child: CircularProgressIndicator(),
69
+ child: CircularProgressIndicator(),
67
- );
70
+ );
68
- } else {
71
+ } else {
69
- if (futureSnapshot.hasData) {
72
+ if (futureSnapshot.hasData) {
70
- List<TalkRoom> talkRooms = futureSnapshot.data!;
73
+ List<TalkRoom> talkRooms = futureSnapshot.data!;
71
- return ListView.builder(
74
+ return ListView.builder(
72
- itemCount: talkRooms.length,
75
+ itemCount: talkRooms.length,
73
- itemBuilder: (context, index) {
76
+ itemBuilder: (context, index) {
74
- return InkWell(
77
+ return InkWell(
75
- onTap: () {
78
+ onTap: () {
76
- Navigator.push(
79
+ Navigator.push(
77
- context,
80
+ context,
78
- MaterialPageRoute(
81
+ MaterialPageRoute(
79
- builder: (context) => TalkRoomPage(
82
+ builder: (context) => TalkRoomPage(
80
- talkRoom: talkRooms[index],
83
+ talkRoom: talkRooms[index],
84
+ ),
85
+ ),
86
+ );
87
+ },
88
+ child: SizedBox(
89
+ height: 70,
90
+ child: Row(
91
+ children: [
92
+ Padding(
93
+ padding: const EdgeInsets.symmetric(
94
+ horizontal: 8.0),
95
+ child: CircleAvatar(
96
+ radius: 30,
97
+ backgroundImage: talkRooms[index]
98
+ .talkUser
99
+ .imagePath ==
100
+ null
101
+ ? null
102
+ : NetworkImage(
103
+ talkRooms[index]
104
+ .talkUser
105
+ .imagePath!),
106
+ ),
107
+ ),
108
+ Column(
109
+ crossAxisAlignment:
110
+ CrossAxisAlignment.start,
111
+ mainAxisAlignment:
112
+ MainAxisAlignment.center,
113
+ children: [
114
+ Text(
115
+ talkRooms[index].talkUser.name,
116
+ style: const TextStyle(
117
+ fontWeight: FontWeight.bold,
118
+ ),
119
+ ),
120
+ Text(
121
+ talkRooms[index].lastMessage ??
122
+ "",
123
+ style: const TextStyle(
124
+ color: Colors.grey,
125
+ ),
126
+ ),
127
+ ],
128
+ ),
129
+ ],
81
130
  ),
82
131
  ),
83
132
  );
133
+ });
134
+ } else {
135
+ return const Center(
136
+ child: Text("FAILED"),
137
+ );
138
+ }
139
+ }
140
+ });
141
+ } else {
142
+ return const Center(
143
+ child: CircularProgressIndicator(),
144
+ );
145
+ }
84
- },
146
+ }),
85
- child: SizedBox(
86
- height: 70,
87
- child: Row(
88
- children: [
89
- Padding(
90
- padding: const EdgeInsets.symmetric(
91
- horizontal: 8.0),
92
- child: CircleAvatar(
93
- radius: 30,
94
- backgroundImage: talkRooms[index]
95
- .talkUser
96
- .imagePath ==
97
- null
98
- ? null
99
- : NetworkImage(talkRooms[index]
147
+ pageList[selectedIndex],
100
- .talkUser
101
- .imagePath!),
148
+ ],
102
- ),
149
+ ),
103
- ),
104
- Column(
105
- crossAxisAlignment:
106
- CrossAxisAlignment.start,
107
- mainAxisAlignment:
108
- MainAxisAlignment.center,
109
- children: [
110
- Text(
111
- talkRooms[index].talkUser.name,
112
- style: const TextStyle(
113
- fontWeight: FontWeight.bold,
114
- ),
115
- ),
116
- Text(
117
- talkRooms[index].lastMessage ?? "",
118
- style: const TextStyle(
119
- color: Colors.grey,
120
- ),
121
- ),
122
- ],
123
- ),
124
- ],
125
- ),
126
- ),
127
- );
128
- });
129
- } else {
130
- return const Center(
131
- child: Text("FAILED"),
132
- );
133
- }
134
- }
135
- });
136
- } else {
137
- return const Center(
138
- child: CircularProgressIndicator(),
139
- );
140
- }
141
- }),
142
150
  bottomNavigationBar: BottomNavigationBar(
143
151
  items: const [
144
152
  BottomNavigationBarItem(
@@ -160,6 +168,7 @@
160
168
  );
161
169
  }
162
170
  }
171
+
163
172
 
164
173
  ```
165
174