-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added theme support for Widgetbook. This had been casuing issues wher…
…e the theme mode was not rendering the correct widgets. This also lead to the discovery of theme issues on checkbox and avatar, which have been fixed.
- Loading branch information
1 parent
2560be2
commit 4e14f7b
Showing
16 changed files
with
336 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,33 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
class WidgetbookTestWidget extends StatelessWidget { | ||
final Size? screenSize; | ||
final Widget widget; | ||
final ThemeMode? themeMode; | ||
final bool removeBody; | ||
|
||
const WidgetbookTestWidget({ | ||
required this.widget, | ||
this.screenSize, | ||
super.key, | ||
this.themeMode, | ||
this.removeBody = false, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final size = screenSize ?? const Size(1280, 720); | ||
|
||
return ZetaProvider( | ||
initialThemeMode: themeMode ?? ThemeMode.system, | ||
builder: (context, theme, __) { | ||
return Builder( | ||
builder: (context) { | ||
return MaterialApp( | ||
debugShowCheckedModeBanner: false, | ||
theme: ThemeData( | ||
fontFamily: theme.fontFamily, | ||
colorScheme: theme.colorsLight.toScheme(), | ||
textTheme: zetaTextTheme, | ||
return Scaffold( | ||
backgroundColor: Colors.transparent, | ||
body: removeBody | ||
? widget | ||
: SizedBox( | ||
width: size.width, | ||
height: size.height, | ||
child: MediaQuery( | ||
data: MediaQueryData(size: Size(size.width, size.height)), | ||
child: SingleChildScrollView(child: widget), | ||
), | ||
darkTheme: ThemeData( | ||
fontFamily: theme.fontFamily, | ||
colorScheme: theme.colorsDark.toScheme(), | ||
textTheme: zetaTextTheme, | ||
), | ||
home: Scaffold( | ||
body: removeBody | ||
? widget | ||
: SizedBox( | ||
width: size.width, | ||
height: size.height, | ||
child: MediaQuery( | ||
data: MediaQueryData(size: Size(size.width, size.height)), | ||
child: SingleChildScrollView(child: widget), | ||
), | ||
), | ||
), | ||
); | ||
}, | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.