![](https://private-user-images.githubusercontent.com/86337946/334459688-c89a7662-bd69-4142-b22f-42189db940bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NTgzMDAsIm5iZiI6MTczODk1ODAwMCwicGF0aCI6Ii84NjMzNzk0Ni8zMzQ0NTk2ODgtYzg5YTc2NjItYmQ2OS00MTQyLWIyMmYtNDIxODlkYjk0MGJmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDE5NTMyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE4NDRkYWU5YjYwNmQzNjRiMTEzM2Q2YjBkMjJjZWM3NjdkMGEwMGY2NWZhNmE3ODlhOTk2MmZkNTFjM2FjOTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.sDPZACNGZDEeTKCTq-2coFpmgI_r9ntEh0BCY0VPPwQ)
![](https://private-user-images.githubusercontent.com/86337946/321686776-a1360d2a-e071-40aa-a6f4-3d4412b97c3d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NTgzMDAsIm5iZiI6MTczODk1ODAwMCwicGF0aCI6Ii84NjMzNzk0Ni8zMjE2ODY3NzYtYTEzNjBkMmEtZTA3MS00MGFhLWE2ZjQtM2Q0NDEyYjk3YzNkLnBuZz9YLUFtei1BbGd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ob3N0In0.29Szm128BIHG_BarfTwftYOgjvT6Y8iVnJ-AIE1Es-4)
What exactly we need to do?
=> From today to a year back, we have to display transactions done of every day.
Data Structure to be used
=> I can have a list of transaction object, containting the time of transaction, id, and amount spend. while building widgets for each day showing transaction I can pass a list of transactions objects of that day in widgets, to view details per day with onClick.
Dealing with UI
=> for UI, I can use simple approach to put the first week to last week of whole year, inside row(List(columns)) pattern.
I will have to make sure that there are empty widgets or spaces in the start of first week and end of last week as per required.
Building Week lable UI
I can provided 4 options as configure parameter of with main widget, to display none of the labels, to display all labels and even or odd indexed day.
Building Month Label UI
I can display all the month, starting from the month of starte date object to all values in list.
For displaying color and each day transaction spent, we can have a Map<DateTime, List<Transaction>> object which will store transaction of each day.
Use TransactionGraph widget, and pass your data. Here data has to be in form of Map<DateTime,List>>.
Detail of Transaction object is present inside domain folder.
TransactionGraph(
transactionData: yourData,
)
Currently in the code base, I have genreated List of Transaction objects then converted it to Map key value pare as per above.
- Start date and End date
if nothing is passed it will conside end date as today and start date as one year back.
TransactionGraph(
transactionData: yourData,
startDate: DateTime,
endDate: DateTime
)
- You can also configure how week label and month labels are displayed
TransactionGraph(
transactionData: yourData,
weekLableVisiblityType: WeekLableVisiblityType.oddDays,
monthLabelVisiblityType: MonthLabelVisiblityType.short
)
-
a few other thing you con configure is
size => size of the box representing each day fontSize margin => margin of the box representing each day baseColor => Color that will be used for muiltple shades of each day noTransactionColor => color of the day if no transaction there
I used flutter 3.19.3, you can use other version with suitable sdk versions.
flutter pub get
flutter run -d macos
flutter run