Last active
January 13, 2019 13:29
-
-
Save amsokol/a90ec702bdcd7cfb1ba8a6b265dfd62f to your computer and use it in GitHub Desktop.
flutter-grpc-tutorial.flutter_client.lib.chat_message.dart
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
import 'package:flutter/material.dart'; | |
import 'package:uuid/uuid.dart'; | |
/// Message is class defining message data (id and text) | |
class Message { | |
/// _uuid is unique ID generator | |
static var _uuid = Uuid(); | |
/// id is unique ID of message | |
String id; | |
/// text is content of message | |
String text; | |
/// Class constructor | |
Message(this.text, [this.id]) { | |
if (id == null) { | |
id = _uuid.v4(); | |
} | |
} | |
} | |
/// ChatMessage is base abstract class for outgoing and incoming message widgets | |
abstract class ChatMessage extends Widget { | |
/// Message content | |
Message get message; | |
/// Controller of animation for message widget | |
AnimationController get animationController; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment