Skip to content

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

Open
wants to merge 6 commits into
base: development
Choose a base branch
from
Open

Conversation

zaelgohary
Copy link
Contributor

@zaelgohary zaelgohary commented Jun 1, 2025

Changes

  • Add contracts screen & include it in wallet bottom nav
  • Handle no contracts
  • Handle slow & no internet

Related Issues

Tested Scenarios

Navigate to contracts

@zaelgohary zaelgohary changed the title Add contracts screen & include it in wallet bottom nav Add contracts screen Jun 1, 2025
@zaelgohary zaelgohary marked this pull request as ready for review June 2, 2025 10:12
Widget build(BuildContext context) {
try {
List<Widget> detailRows = [];
final contractDetails = extractContractDetails(contract);
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@zaelgohary zaelgohary requested a review from AlaaElattar June 22, 2025 09:09
}
}

Map<String, String> extractContractDetails(ContractInfo contract) {
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

@zaelgohary zaelgohary requested a review from AlaaElattar June 22, 2025 12:42
import 'package:intl/intl.dart';
import 'package:threebotlogin/main.dart';

String formatStatus(String text) {
Copy link
Contributor

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants