@@ -32,6 +32,7 @@ class InfiniteScrollTabView extends StatelessWidget {
32
32
this .indicatorHeight,
33
33
this .tabHeight = 44.0 ,
34
34
this .tabPadding = 12.0 ,
35
+ this .size,
35
36
}) : super (key: key);
36
37
37
38
/// A length of tabs and pages.
@@ -104,31 +105,38 @@ class InfiniteScrollTabView extends StatelessWidget {
104
105
/// the tabs will have padding as `EdgeInsets.symmetric(horizontal: 12.0)` .
105
106
final double tabPadding;
106
107
108
+ /// The size constraint of this widget.
109
+ ///
110
+ /// If this is null, then `MediaQuery.of(context).size` is used as default.
111
+ /// This value should specify only in some rare case, testing or something
112
+ /// like that.
113
+ /// Internally this is only used for get page width, but this value determines
114
+ /// entire widget's width.
115
+ final Size ? size;
116
+
107
117
@override
108
118
Widget build (BuildContext context) {
109
119
if (indicatorHeight != null ) {
110
120
assert (indicatorHeight! >= 1.0 );
111
121
}
112
122
113
- return LayoutBuilder (
114
- builder: (context, constraint) => InnerInfiniteScrollTabView (
115
- size: constraint.biggest,
116
- contentLength: contentLength,
117
- tabBuilder: tabBuilder,
118
- pageBuilder: pageBuilder,
119
- onTabTap: onTabTap,
120
- separator: separator,
121
- textScaleFactor: MediaQuery .of (context).textScaleFactor,
122
- defaultTextStyle: DefaultTextStyle .of (context).style,
123
- textDirection: Directionality .of (context),
124
- backgroundColor: backgroundColor,
125
- onPageChanged: onPageChanged,
126
- indicatorColor: indicatorColor,
127
- indicatorHeight: indicatorHeight,
128
- defaultLocale: Localizations .localeOf (context),
129
- tabHeight: tabHeight,
130
- tabPadding: tabPadding,
131
- ),
123
+ return InnerInfiniteScrollTabView (
124
+ size: MediaQuery .of (context).size,
125
+ contentLength: contentLength,
126
+ tabBuilder: tabBuilder,
127
+ pageBuilder: pageBuilder,
128
+ onTabTap: onTabTap,
129
+ separator: separator,
130
+ textScaleFactor: MediaQuery .of (context).textScaleFactor,
131
+ defaultTextStyle: DefaultTextStyle .of (context).style,
132
+ textDirection: Directionality .of (context),
133
+ backgroundColor: backgroundColor,
134
+ onPageChanged: onPageChanged,
135
+ indicatorColor: indicatorColor,
136
+ indicatorHeight: indicatorHeight,
137
+ defaultLocale: Localizations .localeOf (context),
138
+ tabHeight: tabHeight,
139
+ tabPadding: tabPadding,
132
140
);
133
141
}
134
142
}
0 commit comments