Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mobile Computing Group 5
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Hannes Raschke
Mobile Computing Group 5
Commits
b48a7364
Commit
b48a7364
authored
Jun 19, 2023
by
Florian Schindler
Browse files
Options
Downloads
Patches
Plain Diff
Update home_view.dart
extensive additions to home view: balance, chart timespans, transactions
parent
e7f46654
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
trackeroo/lib/frontend/views/home_view.dart
+154
-54
154 additions, 54 deletions
trackeroo/lib/frontend/views/home_view.dart
with
154 additions
and
54 deletions
trackeroo/lib/frontend/views/home_view.dart
+
154
−
54
View file @
b48a7364
import
'package:flutter/material.dart'
;
import
'package:fl_chart/fl_chart.dart'
;
import
'package:trackeroo/frontend/utils/transaction_listtile.dart'
;
import
'package:trackeroo/logic/models/category.dart'
;
import
'package:trackeroo/logic/models/transaction.dart'
;
class
HomeView
extends
StatelessWidget
{
enum
Timespan
{
daily
,
weekly
,
monthly
,
yearly
,
all
}
class
HomeView
extends
StatefulWidget
{
const
HomeView
({
super
.
key
});
@override
State
<
HomeView
>
createState
()
=
>
_HomeViewState
();
}
class
_HomeViewState
extends
State
<
HomeView
>
{
Transaction
trn
=
Transaction
(
title:
"Bus Ticket VVS"
,
amount:
-
5.32
,
category:
Category
(
title:
"ÖPNV"
,
icon:
Icons
.
directions_bus
,
color:
Colors
.
yellow
),
dueDate:
DateTime
.
now
());
Transaction
trp
=
Transaction
(
title:
"Gehalt"
,
amount:
1300
,
category:
Category
(
title:
"Arbeitgeber"
,
icon:
Icons
.
apartment_rounded
,
color:
Colors
.
green
),
dueDate:
DateTime
.
now
());
Timespan
timespanView
=
Timespan
.
monthly
;
@override
Widget
build
(
BuildContext
context
)
{
return
Padding
(
return
SingleChildScrollView
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
16.0
),
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
const
Text
(
'Balance'
,
style:
TextStyle
(
fontSize:
14.0
,
fontWeight:
FontWeight
.
bold
),
),
const
SizedBox
(
height:
5.0
),
const
Text
(
'4932.32 €'
,
style:
TextStyle
(
fontSize:
40.0
,
fontWeight:
FontWeight
.
w300
),
),
const
SizedBox
(
height:
10.0
),
const
Text
(
'Overview'
,
style:
TextStyle
(
fontSize:
14.0
,
fontWeight:
FontWeight
.
bold
),
),
const
SizedBox
(
height:
5.0
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
...
...
@@ -34,11 +75,11 @@ class HomeView extends StatelessWidget {
PieChartData
(
centerSpaceRadius:
50.0
,
sections:
[
PieChartSection
Data
(
value:
1245.4
2
),
PieChartSection
Data
(
value:
734.53
),
PieChartSection
Data
(
value:
67.4
),
PieChartSection
Data
(
value:
1.0
),
PieChartSection
Data
(
value:
850.4
)
build
PieChartSection
(
context
,
93.30
2
),
build
PieChartSection
(
context
,
43.302
),
build
PieChartSection
(
context
,
104.302
),
build
PieChartSection
(
context
,
120.302
),
build
PieChartSection
(
context
,
110.302
)
]
)
),
...
...
@@ -58,12 +99,71 @@ class HomeView extends StatelessWidget {
),
],
),
Text
(
'Home Page'
,
style:
Theme
.
of
(
context
)
.
textTheme
.
headlineMedium
,
const
SizedBox
(
height:
10.0
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
FilterChip
(
onSelected:
(
value
)
=
>
setState
(()
{
timespanView
=
Timespan
.
daily
;
}),
label:
const
Text
(
'Daily'
),
selected:
timespanView
==
Timespan
.
daily
),
FilterChip
(
onSelected:
(
value
)
=
>
setState
(()
{
timespanView
=
Timespan
.
weekly
;
}),
label:
const
Text
(
'Weekly'
),
selected:
timespanView
==
Timespan
.
weekly
),
FilterChip
(
onSelected:
(
value
)
=
>
setState
(()
{
timespanView
=
Timespan
.
monthly
;
}),
label:
const
Text
(
'Montly'
),
selected:
timespanView
==
Timespan
.
monthly
),
FilterChip
(
onSelected:
(
value
)
=
>
setState
(()
{
timespanView
=
Timespan
.
yearly
;
}),
label:
const
Text
(
'Yearly'
),
selected:
timespanView
==
Timespan
.
yearly
,
),
FilterChip
(
onSelected:
(
value
)
=
>
setState
(()
{
timespanView
=
Timespan
.
all
;
}),
label:
const
Text
(
'All'
),
selected:
timespanView
==
Timespan
.
all
)
],
),
const
SizedBox
(
height:
20.0
),
const
Text
(
'Transactions'
,
style:
TextStyle
(
fontSize:
14.0
,
fontWeight:
FontWeight
.
bold
),
),
const
SizedBox
(
height:
5.0
),
TransactionListtile
(
transaction:
trn
),
TransactionListtile
(
transaction:
trn
),
TransactionListtile
(
transaction:
trn
),
TransactionListtile
(
transaction:
trp
),
TransactionListtile
(
transaction:
trn
)
],
),
),
);
}
PieChartSectionData
buildPieChartSection
(
BuildContext
context
,
double
value
)
{
return
PieChartSectionData
(
value:
value
,
color:
Theme
.
of
(
context
)
.
colorScheme
.
secondaryContainer
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment