parent
8fe24d6540
commit
b8594cb902
@ -0,0 +1,21 @@
|
||||
package sae.android.sae_2a.VM
|
||||
|
||||
import android.text.Spannable.Factory
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import sae.android.sae_2a.data.Game
|
||||
|
||||
class GameViewModel : ViewModel() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package sae.android.sae_2a.data
|
||||
|
||||
data class Game(
|
||||
val name: String
|
||||
)
|
@ -0,0 +1,76 @@
|
||||
package sae.android.sae_2a.view
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.paddingFrom
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
import androidx.compose.foundation.layout.wrapContentWidth
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.AlignmentLine
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import sae.android.sae_2a.data.Game
|
||||
import sae.android.sae_2a.data.Vocabulary
|
||||
import sae.android.sae_2a.game.DisplayLists
|
||||
|
||||
@Composable
|
||||
fun GameScreen(NavigateToApp: () -> Unit ){
|
||||
val game = listOf(
|
||||
Game("Quizz"),
|
||||
Game("Memory"),
|
||||
Game("Asteroid"),
|
||||
Game("Flashcard"),
|
||||
)
|
||||
|
||||
|
||||
Surface(modifier = Modifier
|
||||
.wrapContentWidth(align = Alignment.CenterHorizontally)
|
||||
.wrapContentHeight(align = Alignment.CenterVertically)
|
||||
.fillMaxSize(),) {
|
||||
Column( modifier = Modifier
|
||||
.background(color = Color.LightGray)
|
||||
.wrapContentWidth(align = Alignment.CenterHorizontally)) {
|
||||
|
||||
Text(text = "Games", fontSize = 32.sp ,modifier = Modifier
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.padding(vertical = 100.dp)
|
||||
)
|
||||
|
||||
ListGame(games =game )
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ListGame(games : List<Game>){
|
||||
LazyColumn(){
|
||||
items( games.size ){
|
||||
DisplayGame(games[it])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DisplayGame(game :Game){
|
||||
Button(onClick = { },modifier = Modifier
|
||||
.padding(15.dp)
|
||||
.width(150.dp)
|
||||
.height(80.dp)) {
|
||||
Text(text = game.name, fontSize = 20.sp)
|
||||
}
|
||||
}
|
Loading…
Reference in new issue