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
23aef3ec
Commit
23aef3ec
authored
Jun 20, 2023
by
Florian Schindler
Browse files
Options
Downloads
Patches
Plain Diff
transaction listtile draws category from category controller
parent
4a2ae97b
No related branches found
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/utils/transaction_listtile.dart
+33
-17
33 additions, 17 deletions
trackeroo/lib/frontend/utils/transaction_listtile.dart
with
33 additions
and
17 deletions
trackeroo/lib/frontend/utils/transaction_listtile.dart
+
33
−
17
View file @
23aef3ec
import
'package:flutter/material.dart'
;
import
'package:trackeroo/logic/models/category.dart'
;
import
'package:trackeroo/logic/models/transaction.dart'
;
import
'package:trackeroo/logic/services/categories_controller.dart'
;
import
'package:trackeroo/logic/services/locator.dart'
;
class
TransactionListtile
extends
State
less
Widget
{
class
TransactionListtile
extends
State
ful
Widget
{
const
TransactionListtile
({
super
.
key
,
required
this
.
transaction
});
final
Transaction
transaction
;
@override
State
<
TransactionListtile
>
createState
()
=
>
_TransactionListtileState
();
}
class
_TransactionListtileState
extends
State
<
TransactionListtile
>
{
late
Category
category
;
final
monthsGer
=
const
[
'Januar'
,
'Februar'
,
'März'
,
'April'
,
'Mai'
,
'Juni'
,
'Juli'
,
'August'
,
'September'
,
'Oktober'
,
'November'
,
'Dezember'
];
@override
void
initState
()
{
category
=
locator
.
get
<
CategoriesController
>()
.
categories
[
widget
.
transaction
.
categoryId
];
super
.
initState
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
GestureDetector
(
...
...
@@ -14,15 +30,15 @@ class TransactionListtile extends StatelessWidget {
showDragHandle:
true
,
context:
context
,
builder:
(
BuildContext
context
)
{
return
buildModalContent
(
transaction
);
return
buildModalContent
(
widget
.
transaction
);
},
),
child:
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
10.0
,
horizontal:
1
5
.0
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
10.0
,
horizontal:
1
2
.0
),
margin:
const
EdgeInsets
.
only
(
bottom:
5.0
),
decoration:
BoxDecoration
(
color:
Theme
.
of
(
context
)
.
colorScheme
.
secondaryContainer
,
borderRadius:
const
BorderRadius
.
all
(
Radius
.
circular
(
8
.0
))
borderRadius:
const
BorderRadius
.
all
(
Radius
.
circular
(
12
.0
))
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
...
...
@@ -30,36 +46,36 @@ class TransactionListtile extends StatelessWidget {
Row
(
children:
[
Container
(
width:
3
0.0
,
height:
3
0.0
,
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
15
.0
)),
color:
Colors
.
whit
e
width:
5
0.0
,
height:
5
0.0
,
decoration:
BoxDecoration
(
borderRadius:
const
BorderRadius
.
all
(
Radius
.
circular
(
8
.0
)),
color:
Theme
.
of
(
context
)
.
colorScheme
.
surfac
e
),
child:
Icon
(
transaction
.
category
.
icon
),
child:
Icon
(
category
.
icon
),
),
const
SizedBox
(
width:
17.0
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
transaction
.
title
,
widget
.
transaction
.
title
,
style:
const
TextStyle
(
fontSize:
18.0
,
fontWeight:
FontWeight
.
bold
),
),
Text
(
"
${
transaction.
category.title}
·
${transaction.createdAt.day}
.
${monthsGer[transaction.createdAt.month]}
·
${transaction.createdAt.hour < 10 ? 0 : ''}${transaction.createdAt.hour}
:
${transaction.createdAt.minute < 10 ? 0 : ''}${transaction.createdAt.minute}
"
"
${category.title}
·
${
widget.
transaction.createdAt.day}
.
${monthsGer[
widget.
transaction.createdAt.month]}
·
${
widget.
transaction.createdAt.hour < 10 ? 0 : ''}${
widget.
transaction.createdAt.hour}
:
${
widget.
transaction.createdAt.minute < 10 ? 0 : ''}${
widget.
transaction.createdAt.minute}
"
)
],
),
],
),
Text
(
'
${transaction.amount.toString()}
€'
,
'
${
widget.
transaction.amount.toString()}
€'
,
style:
TextStyle
(
color:
transaction
.
amount
.
isNegative
?
Colors
.
red
[
700
]
:
Colors
.
green
[
700
]
color:
widget
.
transaction
.
amount
.
isNegative
?
Colors
.
red
[
700
]
:
Colors
.
green
[
700
]
),
),
],
...
...
@@ -113,14 +129,14 @@ class TransactionListtile extends StatelessWidget {
Container
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
15.0
,
vertical:
12.0
),
decoration:
BoxDecoration
(
color:
transaction
.
category
.
color
,
color:
category
.
color
,
borderRadius:
const
BorderRadius
.
all
(
Radius
.
circular
(
8.0
))
),
child:
Row
(
children:
[
Icon
(
transaction
.
category
.
icon
),
Icon
(
category
.
icon
),
const
SizedBox
(
width:
20.0
),
Text
(
transaction
.
category
.
title
)
Text
(
category
.
title
)
],
),
),
...
...
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
sign in
to comment