-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: divide group member role (#559)
- Loading branch information
1 parent
86cac58
commit 553ac9a
Showing
7 changed files
with
77 additions
and
29 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
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,39 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:ziggle/gen/strings.g.dart'; | ||
|
||
@JsonEnum(alwaysCreate: true) | ||
enum GroupMemberRole { | ||
@JsonValue('admin') | ||
admin, | ||
|
||
@JsonValue('manager') | ||
manager, | ||
|
||
@JsonValue('member') | ||
member; | ||
|
||
int toInt() { | ||
switch (this) { | ||
case GroupMemberRole.admin: | ||
return 1; | ||
case GroupMemberRole.manager: | ||
return 2; | ||
case GroupMemberRole.member: | ||
return 3; | ||
} | ||
} | ||
} | ||
|
||
extension GroupMemberRoleX on GroupMemberRole { | ||
String toLocalizedString(BuildContext context) { | ||
switch (this) { | ||
case GroupMemberRole.admin: | ||
return context.t.group.memberCard.role.admin; | ||
case GroupMemberRole.manager: | ||
return context.t.group.memberCard.role.manager; | ||
case GroupMemberRole.member: | ||
return context.t.group.memberCard.role.member; | ||
} | ||
} | ||
} |
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
18 changes: 1 addition & 17 deletions
18
lib/app/modules/groups/presentation/widgets/group_member_card.dart
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