mirror of
https://gitlab.com/mysocialportal/relatica
synced 2024-10-18 13:33:32 +00:00
Add Connection (as in other network person) data class
This commit is contained in:
parent
2c3800de14
commit
b61b840e13
1 changed files with 46 additions and 0 deletions
46
lib/models/connection.dart
Normal file
46
lib/models/connection.dart
Normal file
|
@ -0,0 +1,46 @@
|
|||
class Connection {
|
||||
final ConnectionStatus status;
|
||||
|
||||
final String name;
|
||||
|
||||
final String id;
|
||||
|
||||
final Uri profileUrl;
|
||||
|
||||
final String network;
|
||||
|
||||
Connection(
|
||||
{this.status = ConnectionStatus.none,
|
||||
this.name = '',
|
||||
this.id = '',
|
||||
profileUrl,
|
||||
this.network = ''})
|
||||
: profileUrl = profileUrl ?? Uri();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Connection{status: $status, name: $name, id: $id, profileUrl: $profileUrl, network: $network}';
|
||||
}
|
||||
}
|
||||
|
||||
enum ConnectionStatus {
|
||||
youFollowThem,
|
||||
theyFollowYou,
|
||||
mutual,
|
||||
none,
|
||||
}
|
||||
|
||||
extension FriendStatusWriter on ConnectionStatus {
|
||||
String name() {
|
||||
switch (this) {
|
||||
case ConnectionStatus.youFollowThem:
|
||||
return "You Follow Them";
|
||||
case ConnectionStatus.theyFollowYou:
|
||||
return "They Follow You";
|
||||
case ConnectionStatus.mutual:
|
||||
return "Follow each other";
|
||||
case ConnectionStatus.none:
|
||||
return "Not connected";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue