Skip to content

Commit 1d118bc

Browse files
author
Peter Bryant
committed
📝 Update sample
1 parent 87d7edd commit 1d118bc

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

sample/src/main/java/com/ptrbrynt/kotlin_bloc/sample/MainActivity.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ import com.ptrbrynt.kotlin_bloc.sample.ui.blocs.CounterBloc
2828
import com.ptrbrynt.kotlin_bloc.sample.ui.blocs.CounterEvent
2929
import com.ptrbrynt.kotlin_bloc.sample.ui.cubits.CounterCubit
3030
import com.ptrbrynt.kotlin_bloc.sample.ui.theme.KotlinBlocTheme
31-
import kotlinx.coroutines.FlowPreview
3231

33-
@FlowPreview
3432
class MainActivity : ComponentActivity() {
3533
override fun onCreate(savedInstanceState: Bundle?) {
3634
super.onCreate(savedInstanceState)
@@ -46,7 +44,7 @@ class MainActivity : ComponentActivity() {
4644
* Creates a Counter based on [CounterBloc]
4745
*/
4846
@Composable
49-
@FlowPreview
47+
5048
fun BlocCounter() {
5149
val bloc = remember { CounterBloc() }
5250
CounterBase(
@@ -61,7 +59,7 @@ fun BlocCounter() {
6159
* Creates a Counter based on [CounterCubit]
6260
*/
6361
@Composable
64-
@FlowPreview
62+
6563
fun CubitCounter() {
6664
val cubit = remember { CounterCubit() }
6765
CounterBase(
@@ -70,7 +68,6 @@ fun CubitCounter() {
7068
)
7169
}
7270

73-
@FlowPreview
7471
@Composable
7572
fun CounterBase(
7673
bloc: BlocBase<Int>,
@@ -104,7 +101,7 @@ fun CounterBase(
104101
/**
105102
* Creates a Counter based on [CounterBloc], using [BlocSelector] to transform each state into a String to display.
106103
*/
107-
@FlowPreview
104+
108105
@Composable
109106
fun BlocSelectorCounter(
110107
scaffoldState: ScaffoldState = rememberScaffoldState(),
@@ -142,7 +139,7 @@ fun BlocSelectorCounter(
142139

143140
@Preview("BlocCounter")
144141
@Composable
145-
@FlowPreview
142+
146143
fun BlocCounterPreview() {
147144
KotlinBlocTheme {
148145
BlocCounter()
@@ -151,7 +148,7 @@ fun BlocCounterPreview() {
151148

152149
@Preview("CubitCounter")
153150
@Composable
154-
@FlowPreview
151+
155152
fun CubitCounterPreview() {
156153
KotlinBlocTheme {
157154
CubitCounter()
@@ -160,7 +157,7 @@ fun CubitCounterPreview() {
160157

161158
@Preview("BlocSelectorCounter")
162159
@Composable
163-
@FlowPreview
160+
164161
fun BlocSelectorCounterPreview() {
165162
KotlinBlocTheme {
166163
BlocSelectorCounter()

sample/src/main/java/com/ptrbrynt/kotlin_bloc/sample/ui/blocs/CounterBloc.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package com.ptrbrynt.kotlin_bloc.sample.ui.blocs
22

33
import com.ptrbrynt.kotlin_bloc.core.Bloc
4-
import kotlinx.coroutines.FlowPreview
54

65
enum class CounterEvent { Increment, Decrement }
76

8-
@FlowPreview
97
class CounterBloc : Bloc<CounterEvent, Int>(0) {
108
override suspend fun mapEventToState(event: CounterEvent) {
119
when (event) {
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package com.ptrbrynt.kotlin_bloc.sample.ui.cubits
22

33
import com.ptrbrynt.kotlin_bloc.core.Cubit
4-
import kotlinx.coroutines.FlowPreview
54
import kotlinx.coroutines.launch
65

7-
@FlowPreview
86
class CounterCubit : Cubit<Int>(0) {
97
fun increment() = blocScope.launch { emit(state + 1) }
108
}

0 commit comments

Comments
 (0)