-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jan Czizikow
committed
Apr 14, 2020
1 parent
65a3eb1
commit c3868ee
Showing
14 changed files
with
687 additions
and
92 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:flutter/foundation.dart'; | ||
|
||
@immutable | ||
class Invite { | ||
final String id; | ||
final String email; | ||
final String groupId; | ||
final DateTime createdAt; | ||
final DateTime updatedAt; | ||
|
||
Invite({ | ||
@required this.id, | ||
@required this.email, | ||
@required this.groupId, | ||
@required this.createdAt, | ||
this.updatedAt, | ||
}); | ||
|
||
factory Invite.fromJson(Map<String, dynamic> json) { | ||
return Invite( | ||
id: json['id'], | ||
email: json['email'], | ||
groupId: json['groupId'], | ||
createdAt: DateTime.parse(json['createdAt']), | ||
updatedAt: | ||
json['updatedAt'] != null ? DateTime.parse(json['updatedAt']) : null, | ||
); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import 'package:flutter/foundation.dart'; | ||
|
||
class Member { | ||
final String id; | ||
final String userId; | ||
final String groupId; | ||
final String firstName; | ||
final String lastName; | ||
final String avatar; | ||
int balance; | ||
|
||
Member({ | ||
@required this.id, | ||
@required this.userId, | ||
@required this.groupId, | ||
@required this.firstName, | ||
@required this.lastName, | ||
this.avatar, | ||
this.balance = 0, | ||
}); | ||
|
||
factory Member.fromJson(Map<String, dynamic> json) { | ||
return Member( | ||
id: json['user']['id'], | ||
userId: json['user']['id'], | ||
groupId: json['groupId'], | ||
firstName: json['user']['firstName'], | ||
lastName: json['user']['lastName'], | ||
avatar: json['user']['avatar'], | ||
balance: json['balance'], | ||
); | ||
} | ||
|
||
get fullName => lastName.isNotEmpty ? "$firstName $lastName" : firstName; | ||
|
||
get initials => RegExp(r'\S+').allMatches(fullName).fold('', | ||
(acc, match) => acc + fullName.substring(match.start, match.start + 1)); | ||
} |
This file contains 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
Oops, something went wrong.