@@ -8,6 +8,8 @@ import 'package:flutter_ui_challenges/core/presentation/res/assets.dart'
88import 'package:cached_network_image/cached_network_image.dart' ;
99import 'dart:math' ;
1010
11+ import 'chatui.dart' ;
12+
1113class ChatTwoPage extends StatefulWidget {
1214 static final String path = "lib/src/pages/misc/chat2.dart" ;
1315 @override
@@ -22,11 +24,12 @@ class _ChatTwoPageState extends State<ChatTwoPage> {
2224 assets.avatars[4 ],
2325 ];
2426 final List <Message > messages = [
25- Message (0 , "But I may not go if the weather is bad." ),
27+ Message (0 ,
28+ "But I may not go if the weather is bad. So lets see the weather condition 😀" ),
2629 Message (0 , "I suppose I am." ),
2730 Message (1 , "Are you going to market today?" ),
2831 Message (0 , "I am good too" ),
29- Message (1 , "I am fine, thank you. How are you?" ),
32+ Message (1 , "I am fine, thank you. How are you? " ),
3033 Message (1 , "Hi," ),
3134 Message (0 , "How are you today?" ),
3235 Message (0 , "Hello," ),
@@ -135,18 +138,74 @@ class _ChatTwoPageState extends State<ChatTwoPage> {
135138 ),
136139 const SizedBox (width: 5.0 ),
137140 ],
141+
142+ ///Chat bubbles
138143 Container (
139- padding: const EdgeInsets .symmetric (
140- vertical : 8.0 ,
141- horizontal : 16.0 ,
144+ padding: EdgeInsets .only (
145+ bottom : 5 ,
146+ right : 5 ,
142147 ),
143- decoration: BoxDecoration (
144- color: current ? Theme .of (context).primaryColor : Colors .white,
145- borderRadius: BorderRadius .circular (10.0 )),
146- child: Text (
147- message.description,
148- style: TextStyle (
149- color: current ? Colors .white : Colors .black, fontSize: 18.0 ),
148+ child: Column (
149+ crossAxisAlignment:
150+ current ? CrossAxisAlignment .end : CrossAxisAlignment .start,
151+ children: < Widget > [
152+ Container (
153+ constraints: BoxConstraints (
154+ minHeight: 40 ,
155+ maxHeight: 250 ,
156+ maxWidth: MediaQuery .of (context).size.width * 0.7 ,
157+ minWidth: MediaQuery .of (context).size.width * 0.1 ,
158+ ),
159+ decoration: BoxDecoration (
160+ color: current ? Colors .red : Colors .white,
161+ borderRadius: current
162+ ? BorderRadius .only (
163+ topLeft: Radius .circular (20 ),
164+ bottomLeft: Radius .circular (20 ),
165+ topRight: Radius .circular (20 ),
166+ )
167+ : BorderRadius .only (
168+ topLeft: Radius .circular (20 ),
169+ bottomRight: Radius .circular (20 ),
170+ topRight: Radius .circular (20 ),
171+ ),
172+ ),
173+ child: Padding (
174+ padding: const EdgeInsets .only (
175+ left: 15 , top: 10 , bottom: 5 , right: 5 ),
176+ child: Column (
177+ mainAxisSize: MainAxisSize .min,
178+ crossAxisAlignment: current
179+ ? CrossAxisAlignment .end
180+ : CrossAxisAlignment .start,
181+ children: < Widget > [
182+ Padding (
183+ padding: const EdgeInsets .only (right: 10 ),
184+ child: Text (
185+ message.description,
186+ style: TextStyle (
187+ color: current ? Colors .white : Colors .black,
188+ ),
189+ ),
190+ ),
191+ Icon (
192+ Icons .done_all,
193+ color: Colors .white,
194+ size: 14 ,
195+ )
196+ ],
197+ ),
198+ ),
199+ ),
200+ SizedBox (
201+ height: 2 ,
202+ ),
203+ Text (
204+ "2:02" ,
205+ style: TextStyle (
206+ fontSize: 12 , color: Colors .black.withOpacity (0.5 )),
207+ )
208+ ],
150209 ),
151210 ),
152211 if (current) ...[
0 commit comments