content method

Widget content(
  1. ActivityModel data,
  2. BuildContext context,
  3. WidgetRef ref
)

The content of the page. This is a NestedScrollView with a HeaderImageSliverDelegate for the banner image. Below the banner image Is an EventInfoSummary and a TabBar with a TabBarView below it.

Implementation

Widget content(ActivityModel data, BuildContext context, WidgetRef ref) {
  final double width = min(600, MediaQuery.of(context).size.width);
  return NestedScrollView(
    headerSliverBuilder: (context, innerBoxIsScrolled) {
      return [
        if (data.bannerDownloadURL != null)
          SliverPersistentHeader(
            delegate: HeaderImageSliverDelegate(
              imageUrl: data.bannerDownloadURL!,
              height: data.category == ActivityCategory.europe
                  ? width
                  : width * (9 / 16),
            ),
          ),
      ];
    },
    body: Builder(
      builder: (context) => Column(
        children: [
          ColoredBox(
            color: Theme.of(context).colorScheme.surface,
            child: Padding(
              padding: const EdgeInsets.all(12),
              child: EventInfoSummary(data: data),
            ),
          ),
          activityTabBar(data, ref, context),
          Flexible(child: activityTabBarView(data)),
        ],
      ),
    ),
  );
}