-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest_components.dart
57 lines (53 loc) · 1.65 KB
/
test_components.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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,
),
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),
),
),
),
);
},
);
},
);
}
}