-
Notifications
You must be signed in to change notification settings - Fork 5
Add contracts screen #1079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Add contracts screen #1079
Conversation
…contract details, fix name contract type err
Widget build(BuildContext context) { | ||
try { | ||
List<Widget> detailRows = []; | ||
final contractDetails = extractContractDetails(contract); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the function returned an empty map ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExtractContractDetails can't return an empty map as it always populates the first 5 fields.
threefold_connect/app/lib/helpers/contract_helpers.dart
Lines 54 to 58 in 4649597
result['Contract ID'] = contract.contract_id.toString(); | |
result['Type'] = contract.type; | |
result['Status'] = contract.state; | |
result['Twin ID'] = contract.twin_id.toString(); | |
result['Created'] = formatDate(contract.created_at); |
import 'package:intl/intl.dart'; | ||
import 'package:threebotlogin/main.dart'; | ||
|
||
String capitalizeFirstLetter(String text) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The renaming is misleading, it's not actually capitalizing the first letter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
} | ||
} | ||
|
||
Map<String, String> extractContractDetails(ContractInfo contract) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ContractInfo
, the data already extracted based on the contract type.
What is the point of this function ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mapped over the data to make it iterable in the build widget. Removed extractContractDetails and showed data directly.
import 'package:intl/intl.dart'; | ||
import 'package:threebotlogin/main.dart'; | ||
|
||
String formatStatus(String text) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest implementing smth like that
const statusDisplayNames = {
'created': 'Created',
'graceperiod': 'Grace Period',
};
What do u think ?
Changes
Related Issues
Tested Scenarios
Navigate to contracts