Skip to content

Commit dc55844

Browse files
committed
update
1 parent 46de468 commit dc55844

File tree

3 files changed

+40
-50
lines changed

3 files changed

+40
-50
lines changed

.idea/workspace.xml

Lines changed: 30 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/chat.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class ChatScreenState extends State<ChatScreen> {
5555
SharedPreferences prefs;
5656

5757
final TextEditingController textEditingController = new TextEditingController();
58+
final ScrollController listScrollController = new ScrollController();
5859

5960
@override
6061
void initState() {
@@ -110,6 +111,7 @@ class ChatScreenState extends State<ChatScreen> {
110111
},
111112
);
112113
});
114+
listScrollController.animateTo(0.0, duration: Duration(milliseconds: 300), curve: Curves.easeOut);
113115
} else {
114116
Fluttertoast.showToast(msg: 'Nothing to send');
115117
}
@@ -179,6 +181,8 @@ class ChatScreenState extends State<ChatScreen> {
179181
.collection('messages')
180182
.document(groupChatId)
181183
.collection(groupChatId)
184+
.orderBy('timestamp', descending: true)
185+
.limit(20)
182186
.snapshots(),
183187
builder: (context, snapshot) {
184188
if (!snapshot.hasData) {
@@ -188,6 +192,8 @@ class ChatScreenState extends State<ChatScreen> {
188192
padding: EdgeInsets.all(10.0),
189193
itemBuilder: (context, index) => buildItem(context, snapshot.data.documents[index]),
190194
itemCount: snapshot.data.documents.length,
195+
reverse: true,
196+
controller: listScrollController,
191197
);
192198
}
193199
},

lib/main.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ class MainScreenState extends State<MainScreen> {
6868
Icons.cancel,
6969
color: primaryColor,
7070
),
71-
margin: EdgeInsets.only(right: 20.0),
71+
margin: EdgeInsets.only(right: 10.0),
7272
),
7373
Text(
7474
'CANCEL',
75-
style: TextStyle(color: primaryColor),
75+
style: TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
7676
)
7777
],
7878
),
@@ -88,11 +88,11 @@ class MainScreenState extends State<MainScreen> {
8888
Icons.check_circle,
8989
color: primaryColor,
9090
),
91-
margin: EdgeInsets.only(right: 20.0),
91+
margin: EdgeInsets.only(right: 10.0),
9292
),
9393
Text(
9494
'YES',
95-
style: TextStyle(color: primaryColor),
95+
style: TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
9696
)
9797
],
9898
),

0 commit comments

Comments
 (0)