-
Notifications
You must be signed in to change notification settings - Fork 1
/
local_history.patch
234 lines (231 loc) · 7.09 KB
/
local_history.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
Index: lib/screens/chat_screen.dart
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart
--- a/lib/screens/chat_screen.dart
+++ b/lib/screens/chat_screen.dart (date 1653372662749)
@@ -1,13 +1,7 @@
-import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flash_chat_flutter_firebase/constants.dart';
-<<<<<<< HEAD
-final _firestore = FirebaseFirestore.instance;
-=======
-
->>>>>>> d8848ffa07177017f260f9b091cdde8f2874885c
class ChatScreen extends StatefulWidget {
static const String id = 'chat_screen';
@override
@@ -15,15 +9,8 @@
}
class _ChatScreenState extends State<ChatScreen> {
-
-<<<<<<< HEAD
- final messageTextController = TextEditingController();
-=======
- final _firestore = FirebaseFirestore.instance;
->>>>>>> d8848ffa07177017f260f9b091cdde8f2874885c
final _auth = FirebaseAuth.instance;
User? loggedInUser;
- String? messageText;
void getCurrentUser() async {
try {
@@ -37,22 +24,6 @@
print(e);
}
}
-
- // void getMessages() async{
- // final messages = await _firestore.collection('messages').get();
- // for(var message in messages.docs){
- // print(message.data());
- // }
- // }
- void getMessages() async {
- await for (var snapshot in _firestore.collection('messages').snapshots()) {
- for (var messages in snapshot.docs) {
- print(messages.data());
- }
- }
- }
-
-
@override
void initState() {
super.initState();
@@ -68,9 +39,7 @@
IconButton(
icon: Icon(Icons.close),
onPressed: () {
- // _auth.signOut();
- // Navigator.pop(context);
- getMessages();
+ //Implement logout functionality
}),
],
title: Text('⚡️Chat'),
@@ -81,38 +50,6 @@
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
-<<<<<<< HEAD
- MessagesStream(),
-=======
- StreamBuilder<QuerySnapshot<Map<String, dynamic>>>(
- stream: _firestore.collection('messages').snapshots(),
- builder: (context, snapshot) {
- if (!snapshot.hasData) {
- return const Center(
- child: CircularProgressIndicator(
- backgroundColor: Colors.lightBlueAccent,
- ),
- );
- }
- final messages = snapshot.data!.docs;
- List<MessageBubble> messageWidgets = [];
- for (var message in messages) {
- final messageText = message.data()['text'];
- final messageSender = message.data()['sender'];
-
- final messageWidget = MessageBubble(text: messageText,sender: messageSender);
-
- messageWidgets.add(messageWidget);
- }
- return Expanded(
- child: ListView(
- padding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
- children:messageWidgets,
- )
- );
- },
- ),
->>>>>>> d8848ffa07177017f260f9b091cdde8f2874885c
Container(
decoration: kMessageContainerDecoration,
child: Row(
@@ -120,26 +57,15 @@
children: <Widget>[
Expanded(
child: TextField(
- controller: messageTextController,
onChanged: (value) {
- messageText = value;
-
+ //Do something with the user input.
},
decoration: kMessageTextFieldDecoration,
),
),
FlatButton(
onPressed: () {
- //messageText + loggedInUser
-<<<<<<< HEAD
- messageTextController.clear();
-=======
->>>>>>> d8848ffa07177017f260f9b091cdde8f2874885c
- _firestore.collection('messages').add({
- 'text' : messageText,
- 'sender': loggedInUser?.email,
-
- });
+ //Implement send functionality.
},
child: Text(
'Send',
@@ -155,93 +81,3 @@
);
}
}
-
-<<<<<<< HEAD
-class MessagesStream extends StatelessWidget {
- const MessagesStream({Key? key}) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- return StreamBuilder<QuerySnapshot<Map<String, dynamic>>>(
- stream: _firestore.collection('messages').snapshots(),
- builder: (context, snapshot) {
- if (!snapshot.hasData) {
- return const Center(
- child: CircularProgressIndicator(
- backgroundColor: Colors.lightBlueAccent,
- ),
- );
- }
- final messages = snapshot.data!.docs;
- List<MessageBubble> messageWidgets = [];
- for (var message in messages) {
- final messageText = message.data()['text'];
- final messageSender = message.data()['sender'];
-
- final messageWidget = MessageBubble(text: messageText,sender: messageSender);
-
- messageWidgets.add(messageWidget);
- }
- return Expanded(
- child: ListView(
- padding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
- children:messageWidgets,
- )
- );
- },
- );
- }
-}
-
-
-=======
->>>>>>> d8848ffa07177017f260f9b091cdde8f2874885c
-class MessageBubble extends StatefulWidget {
- final String? sender;
- final String? text;
- const MessageBubble({Key? key, this.text,this.sender}) : super(key: key);
-
- @override
- State<MessageBubble> createState() => _MessageBubbleState();
-}
-
-class _MessageBubbleState extends State<MessageBubble> {
-
-
- @override
- Widget build(BuildContext context) {
- return Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
-<<<<<<< HEAD
- crossAxisAlignment: CrossAxisAlignment.end,
- children: <Widget>[
- Text('${widget.sender}',
- style: const TextStyle(
- fontSize: 12.0,
- color: Colors.black54,
- ),),
-=======
- children: <Widget>[
- Text('${widget.sender}'),
->>>>>>> d8848ffa07177017f260f9b091cdde8f2874885c
- Material(
- borderRadius: BorderRadius.circular(50.0),
- elevation:5.0, //Drop Shadow to each text
- color: Colors.lightBlueAccent,
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
- child: Text(
- '${widget.text}',
- style: TextStyle(
- color: Colors.white,
- fontSize: 15.0,
- ),
- ),
- ),
- ),
- ],
- ),
- );
- }
-}