From eac409db4c389f194844a8f66df0ee45bc0287eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?o=C4=9Fuzhan?= <34514370+ocetin00@users.noreply.github.com> Date: Wed, 8 Feb 2023 12:55:00 +0300 Subject: [PATCH] Create README.md --- README.md | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1a85b45 --- /dev/null +++ b/README.md @@ -0,0 +1,130 @@ +

Page-Indicator


+

+
+ License + API +


+ +

+ +

+ +## How to Use + +### Gradle +Add the dependency below to your **module**'s `build.gradle` file: + +```gradle +dependencies { + implementation "com.github.ocetin00:ToggleTab:1.0.0" +} +``` + + + + +### Create Page-Indicator + + +```kotlin + @Preview + @Composable + fun ToggleTabPreview1() { + Row( + horizontalArrangement = Arrangement.Center, + modifier = Modifier + .padding(top = 10.dp) + .fillMaxWidth() + ) { + ToggleTab(modifier = Modifier.fillMaxWidth(0.6f),titleList = listOf("Male", "Famele"), onTabSelected = {}) + } + } +``` + + + +### Create ToggleTab +You can create toggle-tab with selected color,container color and text style + + + +
+ Keep reading for more details + +```kotlin + @Preview +@Composable +fun ToggleTabPreview2() { + var selectedPageIndex by remember { + mutableStateOf(1) + } + + Column( + modifier = Modifier + .fillMaxSize() + .background(Color.White) + ) { + Row( + modifier = Modifier + .padding(vertical = 20.dp) + .fillMaxWidth() + .background(Color.White), horizontalArrangement = Arrangement.Center + ) { + ToggleTab( + modifier = Modifier + .fillMaxWidth(fraction = 0.9f) + .clip(ShapeDefaults.ExtraLarge), + onTabSelected = { index -> + selectedPageIndex = index + }, + titleList = listOf("First", "Second", "Third"), + tabItemTextStyle = TextStyle.Default.copy( + fontSize = 12.sp, + fontWeight = FontWeight.Bold + ) + ) + } + var backgroundColor: Color = when (selectedPageIndex) { + 0 -> Color.Green + 1 -> Color.Magenta + 2 -> Color.Cyan + else -> { + Color.Green + } + } + Column( + modifier = Modifier + .padding(20.dp) + .fillMaxSize() + .background(backgroundColor) + ) { + + } + } +} +``` + + +
+ + + +## Find this library useful? :heart: +__[follow me](https://github.com/ocetin00)__ on GitHub for my next creations! + +# License +```xml +Copyright 2019 ocetin00 (Oğuzhan Çetin) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +```