Проработано диалоговое окно сценария
Этот коммит содержится в:
родитель
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
|
||||
|
||||
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.ExtendedFloatingActionButton
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.NavigationBar
|
||||
@ -25,7 +19,6 @@ import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
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_dashboard_24
|
||||
import cit_is_bot.composeapp.generated.resources.baseline_edit_calendar_24
|
||||
@ -75,18 +68,10 @@ fun App() {
|
||||
val snackbarHostState = remember {
|
||||
SnackbarHostState()
|
||||
}
|
||||
val floatingActionButtonVisibleState = remember {
|
||||
mutableStateOf(false)
|
||||
}
|
||||
val floatingActionButtonOnClickState = remember {
|
||||
mutableStateOf<(() -> Unit)?>(null)
|
||||
}
|
||||
val createRuleDialogOpeningState = remember {
|
||||
mutableStateOf(false)
|
||||
}
|
||||
val floatingActionButtonExpandedState = remember {
|
||||
mutableStateOf(true)
|
||||
val floatingActionButtonState = remember {
|
||||
mutableStateOf<(@Composable () -> Unit)?>(null)
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
@ -124,6 +109,7 @@ fun App() {
|
||||
it.route == screen.route
|
||||
} == true,
|
||||
onClick = {
|
||||
floatingActionButtonState.value = null
|
||||
navController.navigate(screen.route)
|
||||
},
|
||||
)
|
||||
@ -143,26 +129,8 @@ fun App() {
|
||||
}
|
||||
},
|
||||
floatingActionButton = {
|
||||
AnimatedVisibility(
|
||||
visible = floatingActionButtonVisibleState.value,
|
||||
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,
|
||||
)
|
||||
floatingActionButtonState.value?.let {
|
||||
it()
|
||||
}
|
||||
},
|
||||
) {
|
||||
@ -171,24 +139,19 @@ fun App() {
|
||||
startDestination = Screen.Dashboard.route,
|
||||
) {
|
||||
composable(Screen.Dashboard.route) {
|
||||
floatingActionButtonVisibleState.value = false
|
||||
DashboardScreen(navController, paddingValues)
|
||||
}
|
||||
composable(Screen.Scenarios.route) {
|
||||
floatingActionButtonVisibleState.value = true
|
||||
ScenariosScreen(
|
||||
navController,
|
||||
paddingValues,
|
||||
floatingActionButtonOnClickState,
|
||||
floatingActionButtonExpandedState,
|
||||
floatingActionButtonState,
|
||||
)
|
||||
}
|
||||
composable(Screen.Chats.route) {
|
||||
floatingActionButtonVisibleState.value = false
|
||||
ChatsScreen(navController, paddingValues)
|
||||
}
|
||||
composable(Screen.Users.route) {
|
||||
floatingActionButtonVisibleState.value = false
|
||||
UsersScreen(navController, paddingValues)
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,23 @@
|
||||
package ru.csasq.cit_is_bot.ui.dialogs
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
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.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExposedDropdownMenuBox
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
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.DialogProperties
|
||||
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_date_range_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 ru.csasq.cit_is_bot.ui.screens.Scenario
|
||||
|
||||
@ -147,7 +155,117 @@ fun ScenarioDialog(
|
||||
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.rememberScrollState
|
||||
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.MutableState
|
||||
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.text.buildAnnotatedString
|
||||
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.dialogs.ScenarioDialog
|
||||
|
||||
@ -39,8 +45,7 @@ val scenarioList = listOf(
|
||||
fun ScenariosScreen(
|
||||
navController: NavController,
|
||||
paddingValues: PaddingValues,
|
||||
floatingActionButtonOnClickState: MutableState<(() -> Unit)?>,
|
||||
floatingActionButtonExpandedState: MutableState<Boolean>,
|
||||
floatingActionButtonState: MutableState<(@Composable () -> Unit)?>,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@ -55,13 +60,32 @@ fun ScenariosScreen(
|
||||
val scenarioDialogState = remember {
|
||||
mutableStateOf<Scenario?>(null)
|
||||
}
|
||||
floatingActionButtonOnClickState.value = {
|
||||
scenarioDialogState.value = Scenario(
|
||||
name = "",
|
||||
daysOfWeek = "",
|
||||
time = "",
|
||||
messageNumber = "",
|
||||
isEnabled = true,
|
||||
val floatingActionButtonExpandedState = remember {
|
||||
mutableStateOf(true)
|
||||
}
|
||||
floatingActionButtonState.value = @Composable {
|
||||
ExtendedFloatingActionButton(
|
||||
text = {
|
||||
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 {
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user