@@ -60,11 +60,15 @@ fun CatsScreen(viewModel: CatsViewModel, selectedCat: CatModel?, onCatSelected:
6060 Scaffold (
6161 topBar = {
6262 TopAppBar (
63- navigationIcon = { Icon (Icons .Outlined .Pets , contentDescription = null ,
64- Modifier
65- .size(48 .dp)
66- .rotate(45f )
67- .padding(12 .dp)) },
63+ navigationIcon = {
64+ Icon (
65+ Icons .Outlined .Pets , contentDescription = null ,
66+ Modifier
67+ .size(48 .dp)
68+ .rotate(45f )
69+ .padding(12 .dp)
70+ )
71+ },
6872 title = { Text (stringResource(R .string.app_name)) },
6973 )
7074 },
@@ -87,20 +91,23 @@ fun CatsStateDispatcher(uiState: CatsScreenState, selectedCat: CatModel?, onCatS
8791
8892@Composable
8993fun LoadingCatsContent () {
90- Box (Modifier .fillMaxWidth().fillMaxHeight(.6f ),
91- contentAlignment = Alignment .Center ) {
94+ Box (
95+ Modifier .fillMaxWidth().fillMaxHeight(.6f ),
96+ contentAlignment = Alignment .Center
97+ ) {
9298 CircularProgressIndicator (Modifier .align(Alignment .Center ))
9399 }
94100}
95101
96102@Composable
97103fun ErrorCatsContent (cause : Exception ) {
98- Box (Modifier
104+ Box (
105+ Modifier
99106 .fillMaxWidth()
100107 .fillMaxHeight(.6f )
101- .padding(8 .dp)
102- ,
103- contentAlignment = Alignment . Center ) {
108+ .padding(8 .dp),
109+ contentAlignment = Alignment . Center
110+ ) {
104111 Text (
105112 stringResource(R .string.cats_list_error, cause.message ? : " " ),
106113 color = MaterialTheme .colors.error,
@@ -111,8 +118,10 @@ fun ErrorCatsContent(cause: Exception) {
111118
112119@Composable
113120fun EmptyCatsContent () {
114- Box (Modifier .fillMaxWidth().fillMaxHeight(.6f ),
115- contentAlignment = Alignment .Center ) {
121+ Box (
122+ Modifier .fillMaxWidth().fillMaxHeight(.6f ),
123+ contentAlignment = Alignment .Center
124+ ) {
116125 Text (
117126 stringResource(R .string.cats_list_empty),
118127 style = typography.body1,
@@ -131,10 +140,11 @@ fun LoadedCatsContent(cats: List<CatModel>, selectedCat: CatModel?, onCatSelecte
131140
132141@Composable
133142fun CatView (cat : CatModel , isSelected : Boolean , onCatSelected : (CatModel ) -> Unit ) {
134- Row (modifier = Modifier
135- .clickable { onCatSelected(cat) }
136- .background(if (isSelected) MaterialTheme .colors.secondary.copy(alpha = .2f ) else Color .Transparent )
137- .padding(8 .dp)
143+ Row (
144+ modifier = Modifier
145+ .clickable { onCatSelected(cat) }
146+ .background(if (isSelected) MaterialTheme .colors.secondary.copy(alpha = .2f ) else Color .Transparent )
147+ .padding(8 .dp)
138148 ) {
139149 CatPictureView (cat.pictureUrl, compact = true )
140150 Column (
@@ -149,8 +159,7 @@ fun CatView(cat: CatModel, isSelected: Boolean, onCatSelected: (CatModel) -> Uni
149159 stringResource(cat.gender.stringRes),
150160 Modifier
151161 .padding(start = 8 .dp)
152- .size(24 .dp)
153- ,
162+ .size(24 .dp),
154163 cat.gender.color,
155164 )
156165 }
0 commit comments