flutter_platform_widgets icon indicating copy to clipboard operation
flutter_platform_widgets copied to clipboard

Feature request: PlatformSliverAppBar (SliverAppBar / CupertinoSliverNavigationBar)

Open jhonatn opened this issue 2 years ago • 1 comments

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

jhonatn avatar Jul 03 '23 03:07 jhonatn

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),
            ),
          ),
        ],
      ),
    );
  }
}

JaidynBluesky avatar Jan 24 '24 07:01 JaidynBluesky