Проработано диалоговое окно сценария
Этот коммит содержится в:
родитель
a8b7685c9f
Коммит
f0c9f728ff
@ -0,0 +1,5 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||||
|
|
||||||
|
<path android:fillColor="#ffffff" android:pathData="M9,11L7,11v2h2v-2zM13,11h-2v2h2v-2zM17,11h-2v2h2v-2zM19,4h-1L18,2h-2v2L8,4L8,2L6,2v2L5,4c-1.11,0 -1.99,0.9 -1.99,2L3,20c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,6c0,-1.1 -0.9,-2 -2,-2zM19,20L5,20L5,9h14v11z"/>
|
||||||
|
|
||||||
|
</vector>
|
@ -0,0 +1,5 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
|
||||||
|
|
||||||
|
<path android:fillColor="#ffffff" android:pathData="M5,4v3h5.5v12h3V7H19V4z"/>
|
||||||
|
|
||||||
|
</vector>
|
@ -1,12 +1,6 @@
|
|||||||
package ru.csasq.cit_is_bot
|
package ru.csasq.cit_is_bot
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
|
||||||
import androidx.compose.animation.expandHorizontally
|
|
||||||
import androidx.compose.animation.fadeIn
|
|
||||||
import androidx.compose.animation.fadeOut
|
|
||||||
import androidx.compose.animation.shrinkHorizontally
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.ExtendedFloatingActionButton
|
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.NavigationBar
|
import androidx.compose.material3.NavigationBar
|
||||||
@ -25,7 +19,6 @@ import androidx.navigation.compose.composable
|
|||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
import cit_is_bot.composeapp.generated.resources.Res
|
import cit_is_bot.composeapp.generated.resources.Res
|
||||||
import cit_is_bot.composeapp.generated.resources.baseline_add_24
|
|
||||||
import cit_is_bot.composeapp.generated.resources.baseline_chat_24
|
import cit_is_bot.composeapp.generated.resources.baseline_chat_24
|
||||||
import cit_is_bot.composeapp.generated.resources.baseline_dashboard_24
|
import cit_is_bot.composeapp.generated.resources.baseline_dashboard_24
|
||||||
import cit_is_bot.composeapp.generated.resources.baseline_edit_calendar_24
|
import cit_is_bot.composeapp.generated.resources.baseline_edit_calendar_24
|
||||||
@ -75,18 +68,10 @@ fun App() {
|
|||||||
val snackbarHostState = remember {
|
val snackbarHostState = remember {
|
||||||
SnackbarHostState()
|
SnackbarHostState()
|
||||||
}
|
}
|
||||||
val floatingActionButtonVisibleState = remember {
|
val floatingActionButtonState = remember {
|
||||||
mutableStateOf(false)
|
mutableStateOf<(@Composable () -> Unit)?>(null)
|
||||||
}
|
|
||||||
val floatingActionButtonOnClickState = remember {
|
|
||||||
mutableStateOf<(() -> Unit)?>(null)
|
|
||||||
}
|
|
||||||
val createRuleDialogOpeningState = remember {
|
|
||||||
mutableStateOf(false)
|
|
||||||
}
|
|
||||||
val floatingActionButtonExpandedState = remember {
|
|
||||||
mutableStateOf(true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
@ -124,6 +109,7 @@ fun App() {
|
|||||||
it.route == screen.route
|
it.route == screen.route
|
||||||
} == true,
|
} == true,
|
||||||
onClick = {
|
onClick = {
|
||||||
|
floatingActionButtonState.value = null
|
||||||
navController.navigate(screen.route)
|
navController.navigate(screen.route)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -143,26 +129,8 @@ fun App() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
floatingActionButton = {
|
floatingActionButton = {
|
||||||
AnimatedVisibility(
|
floatingActionButtonState.value?.let {
|
||||||
visible = floatingActionButtonVisibleState.value,
|
it()
|
||||||
enter = fadeIn() + expandHorizontally(),
|
|
||||||
exit = fadeOut() + shrinkHorizontally()
|
|
||||||
) {
|
|
||||||
ExtendedFloatingActionButton(
|
|
||||||
text = {
|
|
||||||
Text(
|
|
||||||
text = "Добавить сценарий",
|
|
||||||
)
|
|
||||||
},
|
|
||||||
icon = {
|
|
||||||
Icon(
|
|
||||||
painter = painterResource(Res.drawable.baseline_add_24),
|
|
||||||
contentDescription = null,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
onClick = floatingActionButtonOnClickState.value ?: {},
|
|
||||||
expanded = floatingActionButtonExpandedState.value,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
@ -171,24 +139,19 @@ fun App() {
|
|||||||
startDestination = Screen.Dashboard.route,
|
startDestination = Screen.Dashboard.route,
|
||||||
) {
|
) {
|
||||||
composable(Screen.Dashboard.route) {
|
composable(Screen.Dashboard.route) {
|
||||||
floatingActionButtonVisibleState.value = false
|
|
||||||
DashboardScreen(navController, paddingValues)
|
DashboardScreen(navController, paddingValues)
|
||||||
}
|
}
|
||||||
composable(Screen.Scenarios.route) {
|
composable(Screen.Scenarios.route) {
|
||||||
floatingActionButtonVisibleState.value = true
|
|
||||||
ScenariosScreen(
|
ScenariosScreen(
|
||||||
navController,
|
navController,
|
||||||
paddingValues,
|
paddingValues,
|
||||||
floatingActionButtonOnClickState,
|
floatingActionButtonState,
|
||||||
floatingActionButtonExpandedState,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
composable(Screen.Chats.route) {
|
composable(Screen.Chats.route) {
|
||||||
floatingActionButtonVisibleState.value = false
|
|
||||||
ChatsScreen(navController, paddingValues)
|
ChatsScreen(navController, paddingValues)
|
||||||
}
|
}
|
||||||
composable(Screen.Users.route) {
|
composable(Screen.Users.route) {
|
||||||
floatingActionButtonVisibleState.value = false
|
|
||||||
UsersScreen(navController, paddingValues)
|
UsersScreen(navController, paddingValues)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
package ru.csasq.cit_is_bot.ui.dialogs
|
package ru.csasq.cit_is_bot.ui.dialogs
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.Card
|
||||||
import androidx.compose.material3.DropdownMenu
|
import androidx.compose.material3.DropdownMenu
|
||||||
import androidx.compose.material3.DropdownMenuItem
|
import androidx.compose.material3.DropdownMenuItem
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.ExposedDropdownMenuBox
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.OutlinedTextField
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
@ -24,9 +31,10 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
import androidx.compose.ui.window.DialogProperties
|
import androidx.compose.ui.window.DialogProperties
|
||||||
import cit_is_bot.composeapp.generated.resources.Res
|
import cit_is_bot.composeapp.generated.resources.Res
|
||||||
import cit_is_bot.composeapp.generated.resources.baseline_chat_24
|
|
||||||
import cit_is_bot.composeapp.generated.resources.baseline_close_24
|
import cit_is_bot.composeapp.generated.resources.baseline_close_24
|
||||||
|
import cit_is_bot.composeapp.generated.resources.baseline_date_range_24
|
||||||
import cit_is_bot.composeapp.generated.resources.baseline_more_vert_24
|
import cit_is_bot.composeapp.generated.resources.baseline_more_vert_24
|
||||||
|
import cit_is_bot.composeapp.generated.resources.baseline_title_24
|
||||||
import org.jetbrains.compose.resources.painterResource
|
import org.jetbrains.compose.resources.painterResource
|
||||||
import ru.csasq.cit_is_bot.ui.screens.Scenario
|
import ru.csasq.cit_is_bot.ui.screens.Scenario
|
||||||
|
|
||||||
@ -147,7 +155,117 @@ fun ScenarioDialog(
|
|||||||
horizontal = 16.dp,
|
horizontal = 16.dp,
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = "",
|
||||||
|
onValueChange = {},
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth(),
|
||||||
|
label = {
|
||||||
|
Text(
|
||||||
|
text = "Название",
|
||||||
|
)
|
||||||
|
},
|
||||||
|
leadingIcon = {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(Res.drawable.baseline_title_24),
|
||||||
|
contentDescription = null,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
supportingText = {
|
||||||
|
Text(
|
||||||
|
text = "Отображается в списке опросов",
|
||||||
|
)
|
||||||
|
},
|
||||||
|
isError = false,
|
||||||
|
singleLine = true,
|
||||||
|
)
|
||||||
|
Spacer(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(8.dp),
|
||||||
|
)
|
||||||
|
OutlinedTextField(
|
||||||
|
value = "",
|
||||||
|
onValueChange = {},
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth(),
|
||||||
|
label = {
|
||||||
|
Text(
|
||||||
|
text = "Время запуска",
|
||||||
|
)
|
||||||
|
},
|
||||||
|
leadingIcon = {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(Res.drawable.baseline_date_range_24),
|
||||||
|
contentDescription = null,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
isError = false,
|
||||||
|
singleLine = true,
|
||||||
|
)
|
||||||
|
Spacer(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(32.dp),
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = "Сообщения",
|
||||||
|
style = MaterialTheme.typography.titleLarge,
|
||||||
|
)
|
||||||
|
Spacer(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(16.dp),
|
||||||
|
)
|
||||||
|
Card {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(16.dp),
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "Общее",
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
)
|
||||||
|
Spacer(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(16.dp),
|
||||||
|
)
|
||||||
|
ExposedDropdownMenuBox(
|
||||||
|
expanded = false,
|
||||||
|
onExpandedChange = {},
|
||||||
|
) {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = "Опрос",
|
||||||
|
onValueChange = {},
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.menuAnchor(),
|
||||||
|
label = {
|
||||||
|
Text(
|
||||||
|
text = "Тип",
|
||||||
|
)
|
||||||
|
},
|
||||||
|
readOnly = true,
|
||||||
|
leadingIcon = {},
|
||||||
|
supportingText = {},
|
||||||
|
isError = false,
|
||||||
|
singleLine = true,
|
||||||
|
)
|
||||||
|
ExposedDropdownMenu(
|
||||||
|
expanded = false,
|
||||||
|
onDismissRequest = {},
|
||||||
|
) {
|
||||||
|
// items.forEach {
|
||||||
|
// DropdownMenuItem(
|
||||||
|
// text = {
|
||||||
|
// Text(
|
||||||
|
// text = it.displayName,
|
||||||
|
// )
|
||||||
|
// },
|
||||||
|
// onClick = {},
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,9 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material3.ExtendedFloatingActionButton
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
@ -18,6 +21,9 @@ import androidx.compose.ui.input.nestedscroll.NestedScrollSource
|
|||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.text.buildAnnotatedString
|
import androidx.compose.ui.text.buildAnnotatedString
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
|
import cit_is_bot.composeapp.generated.resources.Res
|
||||||
|
import cit_is_bot.composeapp.generated.resources.baseline_add_24
|
||||||
|
import org.jetbrains.compose.resources.painterResource
|
||||||
import ru.csasq.cit_is_bot.ui.components.SwitchButton
|
import ru.csasq.cit_is_bot.ui.components.SwitchButton
|
||||||
import ru.csasq.cit_is_bot.ui.dialogs.ScenarioDialog
|
import ru.csasq.cit_is_bot.ui.dialogs.ScenarioDialog
|
||||||
|
|
||||||
@ -39,8 +45,7 @@ val scenarioList = listOf(
|
|||||||
fun ScenariosScreen(
|
fun ScenariosScreen(
|
||||||
navController: NavController,
|
navController: NavController,
|
||||||
paddingValues: PaddingValues,
|
paddingValues: PaddingValues,
|
||||||
floatingActionButtonOnClickState: MutableState<(() -> Unit)?>,
|
floatingActionButtonState: MutableState<(@Composable () -> Unit)?>,
|
||||||
floatingActionButtonExpandedState: MutableState<Boolean>,
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -55,13 +60,32 @@ fun ScenariosScreen(
|
|||||||
val scenarioDialogState = remember {
|
val scenarioDialogState = remember {
|
||||||
mutableStateOf<Scenario?>(null)
|
mutableStateOf<Scenario?>(null)
|
||||||
}
|
}
|
||||||
floatingActionButtonOnClickState.value = {
|
val floatingActionButtonExpandedState = remember {
|
||||||
scenarioDialogState.value = Scenario(
|
mutableStateOf(true)
|
||||||
name = "",
|
}
|
||||||
daysOfWeek = "",
|
floatingActionButtonState.value = @Composable {
|
||||||
time = "",
|
ExtendedFloatingActionButton(
|
||||||
messageNumber = "",
|
text = {
|
||||||
isEnabled = true,
|
Text(
|
||||||
|
text = "Добавить сценарий",
|
||||||
|
)
|
||||||
|
},
|
||||||
|
icon = {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(Res.drawable.baseline_add_24),
|
||||||
|
contentDescription = null,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClick = {
|
||||||
|
scenarioDialogState.value = Scenario(
|
||||||
|
name = "",
|
||||||
|
daysOfWeek = "",
|
||||||
|
time = "",
|
||||||
|
messageNumber = "",
|
||||||
|
isEnabled = true,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
expanded = floatingActionButtonExpandedState.value,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
scenarioList.forEach {
|
scenarioList.forEach {
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user