😆 The number of visits to the homepage
最近文章
对Kotlin或KMP感兴趣的同学可以进 Q群 101786950
如果开源库对您有帮助的话
可以扫码请我喝瓶饮料或咖啡(如果对什么比较感兴趣可以在备注里写出来)
Compose Multiplatform views, in to Android, Web, Desktop, iOS: Pager, Banner, Indicator, Refresh Layout, Flow Layout, Menu Floating Action Button, Pull To Refresh, Chain Scrollable Component, Scrollable App Bar(Nested Scroll View),Date Selector(Time Selector Date Picker), Swipe To Dismiss, Image viewer, ZoomLayout, Star Bar and more
Home Page: https://sakurajimamaii.github.io/ComposeViewsDocs/
License: Apache License 2.0
当内容比较少的时候就居中现在,内容超过的时候就滚动显示
androidx.compose.runtime.snapshots.StateListIterator.validateModification (SnapshotStateList.kt:295)
kotlin.collections.CollectionsKt___CollectionsJvmKt.reverse (CollectionsKt___CollectionsJvm.kt:43)
com.lt.compose_views.compose_pager.ComposePagerKt.initContentList (ComposePager.kt:399)
com.lt.compose_views.compose_pager.ComposePagerKt.access$initContentList (ComposePager.kt:1)
com.lt.compose_views.compose_pager.ComposePagerKt.ComposePager (ComposePager.kt:115)
com.lt.compose_views.banner.BannerKt$Banner$4.invoke (Banner.kt:99)
com.lt.compose_views.banner.BannerKt$Banner$4.invoke (Banner.kt:97)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke (ComposableLambda.jvm.kt:107)
androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider (CompositionLocal.kt:228)
不知道算不算bug? 为什么每滚动一次 占用内存一直不停的加,就5张图的轮播,初始191MB 能占用到300MB左右 然后突然触发Android的内存回收机制回到180MB 特别是ImageBanner 使用Coil 加载图片后 内存占用200-400MB
@Parcelize
@Serializable
data class BannerItemModel(
@SerialName("AID")
var aID: String = "",
@SerialName("NewTitle")
var newTitle: String = "",
@SerialName("PicUrl")
var picUrl: String = "",
@SerialName("Time")
var time: Long = 0,
@SerialName("Title")
var title: String = ""
) : Parcelable
@Composable
fun MyBanner(
list: List<BannerItemModel>
) {
val orientation = rememberMutableStateOf(Orientation.Horizontal)
val bannerState = rememberBannerState()
val itemIndex by remember { bannerState.createCurrSelectIndexFlow() }
.collectAsState(initial = 0)
Banner(
pageCount = list.size,
content = {
Column(
modifier = Modifier
.fillMaxWidth()
.wrapContentWidth(Alignment.CenterHorizontally)
.padding(8.dp)
.clickable {
logDebug("aid: ${list[index].aID}")
},
horizontalAlignment = Alignment.CenterHorizontally
) {
Box(modifier = M.fillMaxSize()) {
CoilImage(
imageModel = {
list[index].picUrl.url
}, // loading a network image or local resource using an URL.
imageOptions = ImageOptions(
contentScale = ContentScale.Crop,
alignment = Alignment.Center
)
)
Card(
modifier = M
.fillMaxWidth()
.align(Alignment.BottomEnd),
shape = MaterialTheme.shapes.small,
colors = CardDefaults.cardColors(
containerColor = Color(0X66000000)
)
) {
Text(
modifier = M.padding(10.dp),
text = list[index].title,
color = Color.White
)
}
}
}
},
/*
indicatorItem = {
Spacer(
modifier = M
.size(6.dp, 6.dp)
.background(Color.Gray, CircleShape)
)
},
selectIndicatorItem = {
Spacer(
modifier = M
.size(12.dp, 6.dp)
.background(Color(72, 199, 108), CircleShape)
)
},
*/
modifier = M
.fillMaxWidth()
.height(200.dp),
bannerState = bannerState,
autoScrollTime = 3000,
orientation = orientation.value,
)
}
使用 pagerState.setPageIndex(it) TextPagerIndicator 不会自动翻页 是我写法的问题吗 虽然选中了但是不翻页。。。
ComposePager 的滚动翻页正常
如设置items count 为2,向上折叠时,上面有空白,代码
@OptIn(ExperimentalFoundationApi::class)
@composable
fun ColumnScope.AppBar() {
val lazyListState = rememberLazyListState()
ScrollableAppBar(
title = "toolbar",
background = resourcePainter("top_bar_bk"),
maxScrollPosition = maxDp,
modifier = Modifier
.weight(1f)
.fillMaxWidth(),
//onScrollStop = scrollStop(lazyListState)
) {
LazyColumn(
contentPadding = PaddingValues(top = maxDp),
modifier = Modifier.fillMaxSize(),
state = lazyListState,
) {
items(2) { index ->
Text(
"I'm item $index", modifier = Modifier.padding(16.dp)
)
}
}
}
}
有啥好的解决办法吗?
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
moduleName = "composeApp"
browser {
commonWebpackConfig {
outputFileName = "composeApp.js"
devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
static = (static ?: mutableListOf()).apply {
// Serve sources to debug inside browser
add(project.projectDir.path)
add(project.projectDir.path + "/commonMain/")
add(project.projectDir.path + "/wasmJsMain/")
}
}
}
}
binaries.executable()
}
when i enable WebAssembly, an exception is thrown, and it cannot match non-JVM dependencies.
Could not resolve all dependencies for configuration ':composeApp:wasmJsCompileClasspath'.
> Could not resolve io.github.ltttttttttttt:ComposeViews:1.6.0.1.
Required by:
project :composeApp
> No matching variant of io.github.ltttttttttttt:ComposeViews:1.6.0.1 was found. The consumer was configured to find a library for use during 'kotlin-api', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm', attribute 'org.jetbrains.kotlin.wasm.target' with value 'js' but:
- Variant 'debugApiElements-published' capability io.github.ltttttttttttt:ComposeViews:1.6.0.1 declares a library for use during compile-time:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
- Variant 'debugRuntimeElements-published' capability io.github.ltttttttttttt:ComposeViews:1.6.0.1 declares a library for use during runtime:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
- Variant 'debugSourcesElements-published' capability io.github.ltttttttttttt:ComposeViews:1.6.0.1 declares a component for use during runtime:
- Incompatible because this component declares documentation, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
- Variant 'desktopApiElements-published' capability io.github.ltttttttttttt:ComposeViews:1.6.0.1 declares a library for use during compile-time:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
- Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')
现在滑动lazyrow时如果到头了,会直接继续滑动到下一页,view中的viewpager是横向列表滑动到头了就停止,再滑动才会到下一页。请教下这个能够开发个设置的api吗?非常感谢!
Missing resource with path: drawable-xxhdpi/compose_views_refresh_layout_loading.png
在Android手机上使用DateSelector,设置isLoop为true的时候,数组越界,直接crash
无论我给false或true 加载更多依然有效,亦或者我理解错了这个字段的用途,我的理解是true表示加载更多没有下一页数据了,但是我手动写死无论是false或者true都还会触发回调
Target (Android,):
ComposeViews versions: 2024.01.00
Sample code
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/foundation/OverscrollConfigurationKt; at com.lt.compose_views.value_selector.ValueSelectorCompositionLocalProvider_androidKt.ValueSelectorCompositionLocalProvider(ValueSelectorCompositionLocalProvider.android.kt:28) at com.lt.compose_views.value_selector.ValueSelectorKt.ValueSelector-l5lsQBU(ValueSelector.kt:145) at com.lt.compose_views.value_selector.date_selector.DateSelectorKt.DateSelector-eRCXkDE(DateSelector.kt:76) at com.rms.field_operation.ui.schedule.YardScheduleDialog$DateSelect$2$1.invoke(YardScheduleDialog.kt:270) at com.rms.field_operation.ui.schedule.YardScheduleDialog$DateSelect$2$1.invoke(YardScheduleDialog.kt:252) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.material3.CardKt$Card$1.invoke(Card.kt:806) at androidx.compose.material3.CardKt$Card$1.invoke(Card.kt:92) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:132) at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:114) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228) at androidx.compose.material3.SurfaceKt.Surface-T9BRK9s(Surface.kt:111) at androidx.compose.material3.CardKt.Card(Card.kt:84) at com.rms.field_operation.ui.schedule.YardScheduleDialog$DateSelect$2.invoke(YardScheduleDialog.kt:247) at com.rms.field_operation.ui.schedule.YardScheduleDialog$DateSelect$2.invoke(YardScheduleDialog.kt:246) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.ui.window.AndroidDialog_androidKt$Dialog$dialog$1$1$1$2.invoke(AndroidDialog.android.kt:177) at androidx.compose.ui.window.AndroidDialog_androidKt$Dialog$dialog$1$1$1$2.invoke(AndroidDialog.android.kt:176) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.ui.window.AndroidDialog_androidKt.DialogLayout(AndroidDialog.android.kt:505) at androidx.compose.ui.window.AndroidDialog_androidKt.access$DialogLayout(AndroidDialog.android.kt:1) at androidx.compose.ui.window.AndroidDialog_androidKt$Dialog$dialog$1$1$1.invoke(AndroidDialog.android.kt:174) at androidx.compose.ui.window.AndroidDialog_androidKt$Dialog$dialog$1$1$1.invoke(AndroidDialog.android.kt:171) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.ui.window.DialogLayout.Content(AndroidDialog.android.kt:270) at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:252) at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:251) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228) at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:186) 09:09:14.593 2554-2554 CrashReport com.rms.field_operation E at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:119) at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:118) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228) at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:110) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:139) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:138) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:248) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:138) at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:123) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35) at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:90) at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3302) at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3235) at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:723) at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:1071) at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3599) at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3599) at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3599) at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:631) at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:617) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:123) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:114) at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:1289) at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:114) at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:164) at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:314) at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.kt:192) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:121) at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:114) at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:1364) at android.view.View.dispatchAttachedToWindow(View.java:21472) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3532) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3539) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3539) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3539) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3539) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3130) 09:09:14.593 2554-2554 CrashReport com.rms.field_operation E at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2622) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9644) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1494) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1502) at android.view.Choreographer.doCallbacks(Choreographer.java:1117) at android.view.Choreographer.doFrame(Choreographer.java:1034) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1470) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:211) at android.os.Looper.loop(Looper.java:300) at android.app.ActivityThread.main(ActivityThread.java:8432) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:560) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954) Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.compose.foundation.OverscrollConfigurationKt" on path: DexPathList[[dex file "InMemoryDexFile[cookie=[0, -5476376660925206080]]", dex file "/data/data/com.rms.field_operation/code_cache/.overlay/base.apk/classes18.dex", zip file "/data/app/~~XCMRt4Ayv2G0-QTl8DqZpg==/com.rms.field_operation-zJhtto2h-Z9WubkLTonJqA==/base.apk"],nativeLibraryDirectories=[/data/app/~~XCMRt4Ayv2G0-QTl8DqZpg==/com.rms.field_operation-zJhtto2h-Z9WubkLTonJqA==/lib/arm64, /data/app/~~XCMRt4Ayv2G0-QTl8DqZpg==/com.rms.field_operation-zJhtto2h-Z9WubkLTonJqA==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) ... 96 more
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.