From f56bfb16f06451241624f7e5c24375208f7d4368 Mon Sep 17 00:00:00 2001 From: Vitalij Vascenko Date: Wed, 7 Feb 2024 15:29:59 +0100 Subject: [PATCH] feat: Change background to white --- .../example/lib/router_aware_stories.dart | 3 ++- .../lib/src/plugins/contents/contents.dart | 1 + .../lib/src/plugins/device_frame.dart | 1 + .../storybook_flutter/lib/src/plugins/knobs.dart | 1 + .../lib/src/plugins/plugin_panel.dart | 1 + packages/storybook_flutter/lib/src/storybook.dart | 14 ++++++++------ 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/storybook_flutter/example/lib/router_aware_stories.dart b/packages/storybook_flutter/example/lib/router_aware_stories.dart index ae8642ff..0430e3b4 100644 --- a/packages/storybook_flutter/example/lib/router_aware_stories.dart +++ b/packages/storybook_flutter/example/lib/router_aware_stories.dart @@ -51,7 +51,8 @@ class RouterAwareStory extends Story { name: name, wrapperBuilder: (context, child) => child as Widget, builder: (context) => MaterialApp.router( - theme: ThemeData.light(), + theme: ThemeData.light() + .copyWith(scaffoldBackgroundColor: Colors.white), darkTheme: ThemeData.dark(), debugShowCheckedModeBanner: false, routerDelegate: router.delegate(initialRoutes: initialRoutes), diff --git a/packages/storybook_flutter/lib/src/plugins/contents/contents.dart b/packages/storybook_flutter/lib/src/plugins/contents/contents.dart index 353a3777..29094318 100644 --- a/packages/storybook_flutter/lib/src/plugins/contents/contents.dart +++ b/packages/storybook_flutter/lib/src/plugins/contents/contents.dart @@ -41,6 +41,7 @@ Widget _buildWrapper(BuildContext context, Widget? child) => child: Row( children: [ Material( + color: Colors.transparent, child: DecoratedBox( decoration: const BoxDecoration( border: Border(right: BorderSide(color: Colors.black12)), diff --git a/packages/storybook_flutter/lib/src/plugins/device_frame.dart b/packages/storybook_flutter/lib/src/plugins/device_frame.dart index fad30d4a..7a9811bc 100644 --- a/packages/storybook_flutter/lib/src/plugins/device_frame.dart +++ b/packages/storybook_flutter/lib/src/plugins/device_frame.dart @@ -32,6 +32,7 @@ Widget _buildStoryWrapper(BuildContext context, Widget? child) { : SizedBox( width: double.infinity, child: Material( + color: Colors.transparent, child: SafeArea( bottom: false, child: Padding( diff --git a/packages/storybook_flutter/lib/src/plugins/knobs.dart b/packages/storybook_flutter/lib/src/plugins/knobs.dart index a8d79a7c..3f38e4db 100644 --- a/packages/storybook_flutter/lib/src/plugins/knobs.dart +++ b/packages/storybook_flutter/lib/src/plugins/knobs.dart @@ -52,6 +52,7 @@ Widget _buildWrapper(BuildContext context, Widget? child) => Expanded(child: child ?? const SizedBox.shrink()), RepaintBoundary( child: Material( + color: Colors.transparent, child: DecoratedBox( decoration: const BoxDecoration( border: Border( diff --git a/packages/storybook_flutter/lib/src/plugins/plugin_panel.dart b/packages/storybook_flutter/lib/src/plugins/plugin_panel.dart index 302a352f..70183471 100644 --- a/packages/storybook_flutter/lib/src/plugins/plugin_panel.dart +++ b/packages/storybook_flutter/lib/src/plugins/plugin_panel.dart @@ -63,6 +63,7 @@ class _PluginPanelState extends State { onGenerateRoute: (_) => MaterialPageRoute( builder: (context) => PointerInterceptor( child: Material( + color: Colors.transparent, child: childBuilder(context), ), ), diff --git a/packages/storybook_flutter/lib/src/storybook.dart b/packages/storybook_flutter/lib/src/storybook.dart index 2323d810..273ba402 100644 --- a/packages/storybook_flutter/lib/src/storybook.dart +++ b/packages/storybook_flutter/lib/src/storybook.dart @@ -9,7 +9,7 @@ import 'package:storybook_flutter/src/story.dart'; /// Use this wrapper to wrap each story into a [MaterialApp] widget. Widget materialWrapper(BuildContext _, Widget? child) => MaterialApp( - theme: ThemeData.light(), + theme: ThemeData.light().copyWith(scaffoldBackgroundColor: Colors.white), darkTheme: ThemeData.dark(), debugShowCheckedModeBanner: false, home: Scaffold(body: Center(child: child)), @@ -94,9 +94,7 @@ class _StorybookState extends State { ); return GestureDetector( - onTap: () { - FocusManager.instance.primaryFocus?.unfocus(); - }, + onTap: FocusManager.instance.primaryFocus?.unfocus, child: MediaQuery.fromView( view: View.of(context), child: Nested( @@ -106,7 +104,7 @@ class _StorybookState extends State { ...widget.plugins .map((p) => p.wrapperBuilder) .whereType() - .map((builder) => SingleChildBuilder(builder: builder)) + .map((builder) => SingleChildBuilder(builder: builder)), ], child: widget.showPanel ? Stack( @@ -117,6 +115,7 @@ class _StorybookState extends State { Expanded(child: currentStory), RepaintBoundary( child: Material( + color: Colors.transparent, child: SafeArea( top: false, child: CompositedTransformTarget( @@ -167,7 +166,10 @@ class CurrentStory extends StatelessWidget { if (story == null) { return const Directionality( textDirection: TextDirection.ltr, - child: Material(child: Center(child: Text('Select story'))), + child: Material( + color: Colors.transparent, + child: Center(child: Text('Select story')), + ), ); }