Skip to content

Commit

Permalink
Better management of event section header on dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
kumarpalsinh25 committed Nov 13, 2024
1 parent 40739b4 commit d58b54d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
12 changes: 10 additions & 2 deletions app/lib/features/events/widgets/event_list_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class EventListWidget extends ConsumerWidget {
final int? limit;
final bool showSectionHeader;
final VoidCallback? onClickSectionHeader;
final String? sectionHeaderTitle;
final bool? isShowSeeAllButton;
final bool showSectionBg;
final bool shrinkWrap;
final bool isShowSpaceName;
final Widget Function()? emptyStateBuilder;
Expand All @@ -26,6 +29,9 @@ class EventListWidget extends ConsumerWidget {
required this.listProvider,
this.showSectionHeader = false,
this.onClickSectionHeader,
this.sectionHeaderTitle,
this.isShowSeeAllButton,
this.showSectionBg = true,
this.shrinkWrap = true,
this.emptyStateBuilder,
});
Expand Down Expand Up @@ -75,8 +81,10 @@ class EventListWidget extends ConsumerWidget {
mainAxisSize: MainAxisSize.min,
children: [
SectionHeader(
title: L10n.of(context).events,
isShowSeeAllButton: count < eventList.length,
title: sectionHeaderTitle ?? L10n.of(context).events,
isShowSeeAllButton:
isShowSeeAllButton ?? count < eventList.length,
showSectionBg: showSectionBg,
onTapSeeAll: () => onClickSectionHeader == null
? null
: onClickSectionHeader!(),
Expand Down
22 changes: 8 additions & 14 deletions app/lib/features/home/widgets/my_events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,14 @@ class MyEventsSection extends ConsumerWidget {
_ => lang.myUpcomingEvents,
};

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SectionHeader(
title: sectionTitle,
showSectionBg: false,
isShowSeeAllButton: true,
onTapSeeAll: () => context.pushNamed(Routes.calendarEvents.name),
),
EventListWidget(
limit: limit,
listProvider: eventListProvider,
),
],
return EventListWidget(
showSectionHeader: true,
sectionHeaderTitle: sectionTitle,
showSectionBg: false,
isShowSeeAllButton: true,
limit: limit,
listProvider: eventListProvider,
onClickSectionHeader: () => context.pushNamed(Routes.calendarEvents.name),
);
}
}

0 comments on commit d58b54d

Please sign in to comment.