Created
September 18, 2017 15:32
-
-
Save PanJ/90e4f1ea815c6767601d9e87711a9bb2 to your computer and use it in GitHub Desktop.
Sample Flutter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @override | |
| class ChatMessage extends StatelessWidget { | |
| ChatMessage({this.snapshot, this.animation}); | |
| final DataSnapshot snapshot; | |
| final Animation animation; | |
| Widget build(BuildContext context) { | |
| return new SizeTransition( | |
| sizeFactor: new CurvedAnimation( | |
| parent: animation, curve: Curves.easeOut), | |
| axisAlignment: 0.0, | |
| child: new Container( | |
| margin: const EdgeInsets.symmetric(vertical: 10.0), | |
| child: new Row( | |
| crossAxisAlignment: CrossAxisAlignment.start, | |
| children: <Widget>[ | |
| new Container( | |
| margin: const EdgeInsets.only(right: 16.0), | |
| child: new CircleAvatar(backgroundImage: new NetworkImage(snapshot.value['senderPhotoUrl'])), | |
| ), | |
| new Column( | |
| crossAxisAlignment: CrossAxisAlignment.start, | |
| children: <Widget>[ | |
| new Text( | |
| snapshot.value['senderName'], | |
| style: Theme.of(context).textTheme.subhead), | |
| new Container( | |
| margin: const EdgeInsets.only(top: 5.0), | |
| child: snapshot.value['imageUrl'] != null ? | |
| new Image.network( | |
| snapshot.value['imageUrl'], | |
| width: 250.0, | |
| ) : | |
| new Text(snapshot.value['text']), | |
| ), | |
| ], | |
| ), | |
| ], | |
| ), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment