@@ -52,7 +52,20 @@ class ResponsiveWrapper extends StatefulWidget {
52
52
final String defaultName;
53
53
final bool defaultScale;
54
54
final double defaultScaleFactor;
55
+
56
+ /// An optional background widget to insert behind
57
+ /// the responsive content. The background widget
58
+ /// expands to fill the entire space of the wrapper and
59
+ /// is not resized.
60
+ /// Can be used to set a background image, pattern,
61
+ /// or solid fill.
55
62
final Widget background;
63
+
64
+ /// First frame initialization default background color.
65
+ /// Because layout initialization is delayed by 1 frame,
66
+ /// a solid background color is displayed instead.
67
+ /// Default white.
68
+ final Color backgroundColor;
56
69
final MediaQueryData mediaQueryData;
57
70
final bool shrinkWrap;
58
71
final bool debugLog;
@@ -68,6 +81,7 @@ class ResponsiveWrapper extends StatefulWidget {
68
81
this .defaultScale = false ,
69
82
this .defaultScaleFactor = 1 ,
70
83
this .background,
84
+ this .backgroundColor,
71
85
this .mediaQueryData,
72
86
this .shrinkWrap = true ,
73
87
this .debugLog = false ,
@@ -88,6 +102,7 @@ class ResponsiveWrapper extends StatefulWidget {
88
102
bool defaultScale = false ,
89
103
double defaultScaleFactor = 1 ,
90
104
Widget background,
105
+ Color backgroundColor,
91
106
MediaQueryData mediaQueryData,
92
107
bool debugLog = false ,
93
108
}) {
@@ -100,6 +115,7 @@ class ResponsiveWrapper extends StatefulWidget {
100
115
defaultScale: defaultScale,
101
116
defaultScaleFactor: defaultScaleFactor,
102
117
background: background,
118
+ backgroundColor: backgroundColor,
103
119
mediaQueryData: mediaQueryData,
104
120
shrinkWrap: false ,
105
121
debugLog: debugLog,
@@ -349,7 +365,10 @@ class _ResponsiveWrapperState extends State<ResponsiveWrapper>
349
365
Widget build (BuildContext context) {
350
366
return (screenWidth ==
351
367
0 ) // Initialization check. Window measurements not available until postFrameCallback.
352
- ? Container (color: Color (0x00FFFFFF ))
368
+ ? (widget.backgroundColor ??
369
+ Container (
370
+ color: Color (
371
+ 0xFFFFFFFF ))) // First frame empty background color or default white.
353
372
: InheritedResponsiveWrapper (
354
373
data: ResponsiveWrapperData .fromResponsiveWrapper (this ),
355
374
child: Stack (
0 commit comments