Skip to content

Commit

Permalink
feat: polish ui padding
Browse files Browse the repository at this point in the history
  • Loading branch information
realth000 committed Jan 5, 2025
1 parent 139abcd commit 3271420
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 55 deletions.
4 changes: 0 additions & 4 deletions lib/constants/layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ const edgeInsetsL12T4R12B4 = EdgeInsets.only(
/// An [EdgeInsets] with 12 at left and 12 at right.
const edgeInsetsL12R12 = EdgeInsets.only(left: 12, right: 12);

/// An [EdgeInsets] with 10 at left, 5 at top, 10 at right and 20 at bottom.
const edgeInsetsL12T4R12B24 =
EdgeInsets.only(left: 12, top: 4, right: 12, bottom: 24);

/// An [EdgeInsets] with 60 at left and 12 at bottom.
const edgeInsetsL60B12 = EdgeInsets.only(left: 60, bottom: 12);

Expand Down
6 changes: 3 additions & 3 deletions lib/features/forum/view/forum_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class _ForumPageState extends State<ForumPage>
if (state.rulesElement == null) {
content = ListView.separated(
controller: _pinnedScrollController,
padding: edgeInsetsL12T4R12B24,
padding: edgeInsetsL12T4R12,
itemCount: state.stickThreadList.length,
itemBuilder: (context, index) =>
NormalThreadCard(state.stickThreadList[index]),
Expand All @@ -234,7 +234,7 @@ class _ForumPageState extends State<ForumPage>
} else {
content = ListView.separated(
controller: _pinnedScrollController,
padding: edgeInsetsL12T4R12B24,
padding: edgeInsetsL12T4R12,
itemCount: state.stickThreadList.length + 1,
itemBuilder: (context, index) {
// TODO: Do NOT add leading rules card by checking index value.
Expand Down Expand Up @@ -416,7 +416,7 @@ class _ForumPageState extends State<ForumPage>
},
child: ListView.separated(
controller: _subredditScrollController,
padding: edgeInsetsL12T4R12B24,
padding: edgeInsetsL12T4R12,
itemCount: subredditList.length,
itemBuilder: (context, index) => ForumCard(subredditList[index]),
separatorBuilder: (context, index) => sizedBoxW4H4,
Expand Down
2 changes: 1 addition & 1 deletion lib/features/homepage/view/homepage_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class _HomepagePageState extends State<HomepagePage> {
childBuilder: (context, physics) => ListView(
physics: physics,
controller: _scrollController,
padding: edgeInsetsL12T4R12B24,
padding: edgeInsetsL12T4R12B4,
children: [
WelcomeSection(
forumStatus: state.forumStatus,
Expand Down
46 changes: 22 additions & 24 deletions lib/features/latest_thread/view/latest_thread_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,29 @@ class _LatestThreadPageState extends State<LatestThreadPage> {
..finishRefresh()
..finishLoad();

return Padding(
padding: edgeInsetsL12T4R12B24,
child: EasyRefresh(
controller: _refreshController,
header: const MaterialHeader(),
footer: const MaterialFooter(),
onRefresh: () async {
context
.read<LatestThreadBloc>()
.add(LatestThreadRefreshRequested(widget.url));
return EasyRefresh(
controller: _refreshController,
header: const MaterialHeader(),
footer: const MaterialFooter(),
onRefresh: () async {
context
.read<LatestThreadBloc>()
.add(LatestThreadRefreshRequested(widget.url));
},
onLoad: () async {
if (state.nextPageUrl == null) {
_refreshController.finishLoad(IndicatorResult.noMore);
return;
}
context.read<LatestThreadBloc>().add(LatestThreadLoadMoreRequested());
},
child: ListView.separated(
padding: edgeInsetsL12T4R12,
itemCount: state.threadList.length,
itemBuilder: (context, index) {
return LatestThreadCard(state.threadList[index]);
},
onLoad: () async {
if (state.nextPageUrl == null) {
_refreshController.finishLoad(IndicatorResult.noMore);
return;
}
context.read<LatestThreadBloc>().add(LatestThreadLoadMoreRequested());
},
child: ListView.separated(
itemCount: state.threadList.length,
itemBuilder: (context, index) {
return LatestThreadCard(state.threadList[index]);
},
separatorBuilder: (context, index) => sizedBoxW4H4,
),
separatorBuilder: (context, index) => sizedBoxW4H4,
),
);
}
Expand Down
38 changes: 18 additions & 20 deletions lib/features/my_thread/view/my_thread_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class _MyThreadPageState extends State<MyThreadPage>
);
} else {
child = ListView.separated(
padding: edgeInsetsL12T4R12,
itemCount: state.replyList.length,
itemBuilder: (context, index) {
return MyThreadCard(state.replyList[index]);
Expand All @@ -98,26 +99,23 @@ class _MyThreadPageState extends State<MyThreadPage>
);
}

return Padding(
padding: edgeInsetsL12T4R12B24,
child: EasyRefresh(
controller: _replyRefreshController,
header: const MaterialHeader(),
footer: const MaterialFooter(),
onRefresh: () async {
context.read<MyThreadBloc>().add(MyThreadRefreshReplyRequested());
},
onLoad: () async {
if (state.nextReplyPageUrl == null) {
_replyRefreshController.finishLoad(IndicatorResult.noMore);
return;
}
context
.read<MyThreadBloc>()
.add(const MyThreadLoadMoreReplyRequested());
},
child: child,
),
return EasyRefresh(
controller: _replyRefreshController,
header: const MaterialHeader(),
footer: const MaterialFooter(),
onRefresh: () async {
context.read<MyThreadBloc>().add(MyThreadRefreshReplyRequested());
},
onLoad: () async {
if (state.nextReplyPageUrl == null) {
_replyRefreshController.finishLoad(IndicatorResult.noMore);
return;
}
context
.read<MyThreadBloc>()
.add(const MyThreadLoadMoreReplyRequested());
},
child: child,
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/features/packet/view/packet_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class _PacketDetailPageState extends State<PacketDetailPage> {
child: Row(
children: [
SizedBox(
width: 20,
width: 30,
child: Text(
'${dataSorted[index].id}',
style: Theme.of(context)
Expand Down
1 change: 1 addition & 0 deletions lib/features/rate/view/rate_post_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class _RatePostPageState extends State<RatePostPage> with LoggerMixin {
children: scoreWidgetList,
),
),
sizedBoxW8H8,
Row(
children: [
sizedBoxW12H12,
Expand Down
2 changes: 1 addition & 1 deletion lib/features/search/view/search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ class _SearchPageState extends State<SearchPage> with LoggerMixin {

Widget _buildBody(BuildContext context, SearchState state) {
return Padding(
padding: edgeInsetsL12T4R12B24,
padding: edgeInsetsL12T4R12,
child: Column(
children: [
if (expandForm) _buildSearchForm(context, state),
Expand Down
2 changes: 1 addition & 1 deletion lib/features/topics/view/topics_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class _TopicsPageState extends State<TopicsPage>
final groupTabBodyList = forumGroupList
.map(
(e) => ListView.separated(
padding: edgeInsetsL12T4R12B24,
padding: edgeInsetsL12T4R12,
itemCount: e.forumList.length,
itemBuilder: (context, index) => ForumCard(e.forumList[index]),
separatorBuilder: (context, index) => sizedBoxW4H4,
Expand Down

0 comments on commit 3271420

Please sign in to comment.