-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
c960d46
commit bd14b5e
Showing
9 changed files
with
261 additions
and
19 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
80 changes: 80 additions & 0 deletions
80
lib/app/resources/home/views/cloud_notes/models/user_model.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import 'package:hive/hive.dart'; | ||
|
||
part 'user_model.g.dart'; | ||
|
||
@HiveType(typeId: 2) | ||
class UserModel { | ||
@HiveField(1) | ||
final int? id; | ||
|
||
@HiveField(2) | ||
final String? uuid; | ||
|
||
@HiveField(3) | ||
final String? firstName; | ||
|
||
@HiveField(4) | ||
final String? lastName; | ||
|
||
@HiveField(5) | ||
final String? userName; | ||
|
||
@HiveField(6) | ||
final String? email; | ||
|
||
@HiveField(7) | ||
final String? emailVerified; | ||
|
||
@HiveField(8) | ||
final int? hasSubscription; | ||
|
||
@HiveField(9) | ||
final int? hasExceedTier; | ||
|
||
@HiveField(10) | ||
final String? planDuration; | ||
|
||
@HiveField(11) | ||
final String? planSubDate; | ||
|
||
@HiveField(12) | ||
final String? accessToken; | ||
|
||
UserModel({ | ||
this.id, | ||
this.uuid, | ||
this.firstName, | ||
this.lastName, | ||
this.userName, | ||
this.email, | ||
this.emailVerified, | ||
this.hasSubscription, | ||
this.hasExceedTier, | ||
this.planDuration, | ||
this.planSubDate, | ||
this.accessToken, | ||
}); | ||
|
||
|
||
factory UserModel.fromJsonLocalToken(responseData) { | ||
return UserModel( | ||
accessToken: responseData, | ||
); | ||
} | ||
|
||
factory UserModel.fromJsonUserDetails(responseData) { | ||
return UserModel( | ||
id: responseData['data']['id'], | ||
uuid: responseData['data']['uuid'], | ||
firstName: responseData['data']['first_name'], | ||
lastName: responseData['data']['last_name'], | ||
userName: responseData['data']['username'], | ||
email: responseData['data']['email'], | ||
emailVerified: responseData['data']['email_verified_at'], | ||
hasSubscription: responseData['data']['has_subscription'], | ||
hasExceedTier: responseData['data']['has_exceed_tier'], | ||
planDuration: responseData['data']['plan_duration'], | ||
planSubDate: responseData['data']['plan_sub_date'], | ||
); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
lib/app/resources/home/views/cloud_notes/models/user_model.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,48 @@ | ||
import 'package:flashy_flushbar/flashy_flushbar.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
void showError(String errorMsg) { | ||
FlashyFlushbar( | ||
leadingWidget: const Icon( | ||
Icons.error_outline, | ||
color: Colors.orange, | ||
size: 24, | ||
), | ||
message: errorMsg, | ||
duration: const Duration(seconds: 5), | ||
trailingWidget: IconButton( | ||
icon: const Icon( | ||
Icons.close, | ||
color: Colors.black, | ||
size: 24, | ||
), | ||
onPressed: () { | ||
FlashyFlushbar.cancel(); | ||
}, | ||
), | ||
isDismissible: true, | ||
).show(); | ||
} | ||
|
||
void showSuccess(String msg) { | ||
FlashyFlushbar( | ||
leadingWidget: const Icon( | ||
Icons.check_circle_outline_outlined, | ||
color: Colors.green, | ||
size: 24, | ||
), | ||
message: msg, | ||
duration: const Duration(seconds: 5), | ||
trailingWidget: IconButton( | ||
icon: const Icon( | ||
Icons.close, | ||
color: Colors.black, | ||
size: 24, | ||
), | ||
onPressed: () { | ||
FlashyFlushbar.cancel(); | ||
}, | ||
), | ||
isDismissible: true, | ||
).show(); | ||
} |
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