Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: PlatformSliverAppBar (SliverAppBar / CupertinoSliverNavigationBar) #425

Open
jhonatn opened this issue Jul 3, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@jhonatn
Copy link

jhonatn commented Jul 3, 2023

Is it possible for us to have a Platform widget for SliverAppBar (material) and CupertinoSliverNavigationBar?

@JaidynBluesky
Copy link

I had to make my own; this was taken from one of the examples in the repo though:

class LargeAppBarWrapper extends StatelessWidget {
  const LargeAppBarWrapper({
    super.key,
    required this.title,
    required this.children,
  });

  final String title;
  final List<Widget> children;

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    return PlatformScaffold(
      iosContentPadding: true,
      body: CustomScrollView(
        slivers: [
          PlatformWidget(
            material: (context, _) => SliverAppBar.medium(
              backgroundColor: theme.appBarTheme.backgroundColor,
              title: Text(
                title,
              ),
            ),
            cupertino: (context, _) => CupertinoSliverNavigationBar(
              largeTitle: Text(
                title,
              ),
            ),
          ),
          SliverSafeArea(
            top: false,
            sliver: SliverList(
              delegate: SliverChildListDelegate(children),
            ),
          ),
        ],
      ),
    );
  }
}

bookshiyi added a commit to bookshiyi/flutter_platform_widgets that referenced this issue Jan 24, 2024
aqwert added a commit that referenced this issue Jan 31, 2024
Add PlatformSliverAppBar class with example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants