@@ -3,16 +3,26 @@ package xyz.teamgravity.multilinehinttextfield
33import android.os.Bundle
44import androidx.activity.ComponentActivity
55import androidx.activity.compose.setContent
6+ import androidx.compose.foundation.background
7+ import androidx.compose.foundation.layout.Column
68import androidx.compose.foundation.layout.fillMaxSize
9+ import androidx.compose.foundation.layout.fillMaxWidth
10+ import androidx.compose.foundation.layout.padding
11+ import androidx.compose.foundation.shape.RoundedCornerShape
712import androidx.compose.material3.MaterialTheme
813import androidx.compose.material3.Surface
9- import androidx.compose.material3.Text
10- import androidx.compose.runtime.Composable
14+ import androidx.compose.runtime.getValue
15+ import androidx.compose.runtime.mutableStateOf
16+ import androidx.compose.runtime.remember
17+ import androidx.compose.runtime.setValue
1118import androidx.compose.ui.Modifier
12- import androidx.compose.ui.tooling.preview.Preview
19+ import androidx.compose.ui.draw.clip
20+ import androidx.compose.ui.graphics.Color
21+ import androidx.compose.ui.unit.dp
1322import xyz.teamgravity.multilinehinttextfield.ui.theme.MultiLineHintTextFieldTheme
1423
1524class MainActivity : ComponentActivity () {
25+
1626 override fun onCreate (savedInstanceState : Bundle ? ) {
1727 super .onCreate(savedInstanceState)
1828 setContent {
@@ -21,6 +31,25 @@ class MainActivity : ComponentActivity() {
2131 modifier = Modifier .fillMaxSize(),
2232 color = MaterialTheme .colorScheme.background
2333 ) {
34+ var text by remember { mutableStateOf(" " ) }
35+
36+ Column (
37+ modifier = Modifier
38+ .fillMaxSize()
39+ .padding(16 .dp)
40+ ) {
41+ MultiLineHintTextField (
42+ value = text,
43+ onValueChanged = { text = it },
44+ hint = " 1st line of hint\n 2nd line of hint\n 3rd line of hint" ,
45+ maxLines = 4 ,
46+ modifier = Modifier
47+ .fillMaxWidth()
48+ .clip(RoundedCornerShape (5 .dp))
49+ .background(Color .LightGray )
50+ .padding(16 .dp)
51+ )
52+ }
2453 }
2554 }
2655 }
0 commit comments