File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,34 +145,6 @@ class _FortuneBarState extends State<FortuneBar> with SingleTickerProviderStateM
145145 // animateFirst is only for initState
146146 }
147147
148- double _getIndicatorWidth (
149- Alignment alignment,
150- double scrollOffset,
151- List <double > itemWidths,
152- double screenWidth,
153- double totalWidth,
154- ) {
155- final centerOffset = screenWidth / 2 ;
156- final P = scrollOffset % totalWidth;
157- final relativeP = P < 0 ? P + totalWidth : P ;
158-
159- final screenX = (alignment.x + 1) / 2 * screenWidth;
160- final distFromCenter = screenX - centerOffset;
161-
162- var stripPos = relativeP + distFromCenter;
163- stripPos %= totalWidth;
164- if (stripPos < 0) stripPos += totalWidth;
165-
166- double currentPos = 0;
167- for (final w in itemWidths) {
168- if (stripPos < currentPos + w) {
169- return w;
170- }
171- currentPos += w;
172- }
173- return itemWidths.isEmpty ? 0 : itemWidths.last;
174- }
175-
176148 @override
177149 Widget build (BuildContext context) {
178150 final theme = Theme .of (context);
@@ -254,15 +226,11 @@ class _FortuneBarState extends State<FortuneBar> with SingleTickerProviderStateM
254226 child: Align (
255227 alignment: it.alignment,
256228 child: SizedBox (
257- width: _getIndicatorWidth (
258- it.alignment.resolve (Directionality .of (context)),
259- scrollOffset,
260- itemWidths,
261- size.width,
262- totalWidth,
263- ),
229+ width: unitWidth,
264230 height: widget.height,
265- child: it.child,
231+ child: Center (
232+ child: it.child,
233+ ),
266234 ),
267235 ),
268236 ),
You can’t perform that action at this time.
0 commit comments