@@ -2,11 +2,8 @@ package de.hbch.traewelling.ui.composables
2
2
3
3
import androidx.compose.foundation.background
4
4
import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.Arrangement
6
- import androidx.compose.foundation.layout.Box
7
- import androidx.compose.foundation.layout.Row
8
- import androidx.compose.foundation.layout.padding
9
- import androidx.compose.foundation.layout.widthIn
5
+ import androidx.compose.foundation.layout.*
6
+ import androidx.compose.foundation.shape.CircleShape
10
7
import androidx.compose.foundation.shape.RoundedCornerShape
11
8
import androidx.compose.material3.Text
12
9
import androidx.compose.runtime.Composable
@@ -56,6 +53,7 @@ fun LineIcon(
56
53
}
57
54
58
55
val shape: Shape = when (lineIcon?.shape) {
56
+ LineIconShape .circle -> CircleShape
59
57
LineIconShape .hexagon -> HexagonShape ()
60
58
LineIconShape .pill -> RoundedCornerShape (percent = 50 )
61
59
LineIconShape .rectangle_rounded_corner -> RoundedCornerShape (percent = 20 )
@@ -79,14 +77,26 @@ fun LineIcon(
79
77
) {
80
78
if (lineIcon != null ) {
81
79
Box (
82
- modifier = Modifier
83
- .widthIn(48 .dp, 144 .dp)
84
- .background(
85
- color = lineIcon.getBackgroundColor(),
86
- shape = shape
87
- )
88
- .border(2 .dp, borderColor, shape)
89
- .padding(2 .dp)
80
+ modifier = when (lineIcon.shape) {
81
+ LineIconShape .circle -> Modifier
82
+ .width(32 .dp)
83
+ .aspectRatio(1f )
84
+ .background(
85
+ color = lineIcon.getBackgroundColor(),
86
+ shape = shape
87
+ )
88
+ .border(2 .dp, borderColor, shape)
89
+ .padding(2 .dp)
90
+
91
+ else -> Modifier
92
+ .widthIn(48 .dp, 144 .dp)
93
+ .background(
94
+ color = lineIcon.getBackgroundColor(),
95
+ shape = shape
96
+ )
97
+ .border(2 .dp, borderColor, shape)
98
+ .padding(2 .dp)
99
+ }
90
100
) {
91
101
Text (
92
102
text = displayedName,
@@ -96,7 +106,7 @@ fun LineIcon(
96
106
fontWeight = FontWeight .Bold
97
107
)
98
108
}
99
- } else if (switzerlandString?.first != null ) {
109
+ } else if (switzerlandString?.first != null ) {
100
110
Box (
101
111
modifier = Modifier
102
112
.widthIn(48 .dp, 144 .dp)
@@ -125,7 +135,8 @@ fun LineIcon(
125
135
if (displayJourneyNumber
126
136
&& displayJourneyNumberSetting
127
137
&& ! displayedName.contains(journeyNumber.toString())
128
- && journeyNumber != null && journeyNumber != 0 ) {
138
+ && journeyNumber != null && journeyNumber != 0
139
+ ) {
129
140
Text (
130
141
text = " ($journeyNumber )" ,
131
142
style = LocalFont .current.bodySmall
@@ -150,8 +161,11 @@ fun LineIconView(
150
161
}
151
162
152
163
val shape: Shape = when (lineIcon?.shape) {
164
+ LineIconShape .circle -> CircleShape
165
+ LineIconShape .hexagon -> HexagonShape ()
153
166
LineIconShape .pill -> RoundedCornerShape (percent = 50 )
154
167
LineIconShape .rectangle_rounded_corner -> RoundedCornerShape (percent = 20 )
168
+ LineIconShape .trapezoid -> TrapezoidShape ()
155
169
else -> RectangleShape
156
170
}
157
171
val borderColor: Color = lineIcon?.getBorderColor() ? : Color .Transparent
@@ -188,7 +202,7 @@ fun LineIconView(
188
202
fontWeight = FontWeight .Bold
189
203
)
190
204
}
191
- } else if (switzerlandString?.first != null ) {
205
+ } else if (switzerlandString?.first != null ) {
192
206
Box (
193
207
modifier = Modifier
194
208
.widthIn(48 .dp, 144 .dp)
0 commit comments