1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
package com.pwc.calculatorv2.presentation.screens
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.pwc.calculatorv2.data.viewmodels.CalculatorViewModel
import com.pwc.calculatorv2.presentation.navigation.AppScreens
import com.pwc.calculatorv2.presentation.ui.widgets.BottomNav
import androidx.compose.runtime.getValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.Shadow
import androidx.compose.ui.graphics.drawscope.Fill
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun BottomNavScreen() {
val context = LocalContext.current
val bottomNavController = rememberNavController()
val viewModel by remember { mutableStateOf(CalculatorViewModel(context)) }
LaunchedEffect(Unit) {
viewModel.getFunctionList()
}
Scaffold(
bottomBar = {
BottomNav(bottomNavController)
},
) {
Surface(
modifier = Modifier
.fillMaxSize()
.padding(bottom = it.calculateBottomPadding()),
color = MaterialTheme.colorScheme.background
) {
Column (
modifier = Modifier.fillMaxSize()
) {
Box (
modifier = Modifier
.weight(1f)
.fillMaxWidth(.5f)
){
Canvas(
modifier = Modifier
.fillMaxSize()
) {
val path = Path().apply {
moveTo(0f, 0f) // Top-left corner
lineTo(size.width, 0f) // Top-right corner
lineTo(0f, size.height) // Bottom-left corner
close() // Closes the path to form a triangle
}
drawPath(
path = path,
color = Color(0xFF222222) ,
style = Fill,
)
}
BasicTextField(value = "ACV-1",
onValueChange = {},
readOnly = true, // Makes the field non-writable
modifier = Modifier
.width(300.dp)
.padding(20.dp),
textStyle = TextStyle(
fontSize = 12.sp,
fontWeight = FontWeight.Medium,
color = MaterialTheme.colorScheme.secondary, // Using your theme's color for text
shadow = Shadow(
color = MaterialTheme.colorScheme.secondary.copy(alpha = 0.2f), // White glow with some transparency
blurRadius = 2f // Adjust the blur for the glow effect
)
),
)
}
Spacer(
modifier = Modifier
.fillMaxWidth()
.weight(2f) // Spacer takes the other half of the available height
)
}
NavHost(
navController = bottomNavController,
startDestination = AppScreens.CalculatorScreen.route
) {
composable(AppScreens.CalculatorScreen.route) {
CalculatorScreen(viewModel)
}
composable(AppScreens.FunctionListScreen.route) {
FunctionListScreen(viewModel)
}
composable(AppScreens.WipeScreen.route) {
WipeScreen(viewModel)
}
}
}
}
}
|