Skip to content

Commit

Permalink
wall profile loading fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dinaraparanid committed Jan 13, 2025
1 parent 384f08c commit e53e03d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/feature/wall/presentation/wall_screen.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:poster/core/presentation/post/post_paging_list.dart';
import 'package:poster/core/presentation/theme/app.dart';
import 'package:poster/feature/wall/presentation/bloc/mod.dart';
import 'package:poster/feature/wall/presentation/widget/profile/profile_container.dart';
import 'package:poster/feature/wall/presentation/widget/profile_posts.dart';

final class WallScreen extends StatelessWidget {
final WallBloc bloc;
Expand All @@ -27,9 +27,9 @@ final class WallScreen extends StatelessWidget {
children: [
const ProfileContainer(),
Expanded(
child: PostPagingList(
child: ProfilePosts(
pager: bloc.pager,
onPostLike: (id) => bloc.add(Like(postId: id)),
onEvent: bloc.add,
),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class ProfileContainer extends StatelessWidget {
alignment: Alignment.bottomCenter,
child: Padding(
padding: EdgeInsets.only(top: theme.dimensions.padding.enormous),
child: ProfileInfo(),
child: const ProfileInfo(),
),
),

Expand Down
33 changes: 33 additions & 0 deletions lib/feature/wall/presentation/widget/profile_posts.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:poster/core/domain/post/entity/post.dart';
import 'package:poster/core/presentation/foundation/ui_state.dart';
import 'package:poster/core/presentation/post/post_paging_list.dart';
import 'package:poster/feature/wall/presentation/bloc/mod.dart';
import 'package:super_paging/super_paging.dart';

final class ProfilePosts extends StatelessWidget {
final Pager<int, Post> pager;
final void Function(WallEvent) onEvent;

const ProfilePosts({
super.key,
required this.pager,
required this.onEvent,
});

@override
Widget build(BuildContext context) =>
BlocBuilder<WallBloc, WallState>(
builder: (context, state) {
if (state.profileState.isEvaluating) {
return const Text('TODO: Shimmers');
}

return PostPagingList(
pager: pager,
onPostLike: (id) => onEvent(Like(postId: id)),
);
},
);
}

0 comments on commit e53e03d

Please sign in to comment.