@@ -24,7 +24,7 @@ import 'dart:math';
24
24
import 'package:flutter/foundation.dart' ;
25
25
import 'package:flutter/widgets.dart' ;
26
26
27
- import '../models/linked_showcase_data .dart' ;
27
+ import '../models/linked_showcase_data_model .dart' ;
28
28
import '../models/tooltip_action_config.dart' ;
29
29
import '../tooltip/tooltip.dart' ;
30
30
import '../utils/overlay_manager.dart' ;
@@ -134,20 +134,23 @@ class ShowcaseController {
134
134
///
135
135
/// This method is typically called internally by the showcase system but
136
136
/// can also be called manually to force a recalculation of showcase elements.
137
- void startShowcase () {
137
+ void startShowcase ({ bool shouldUpdateOverlay = true } ) {
138
138
if (! showcaseView.enableShowcase || ! _mounted) return ;
139
139
140
- recalculateRootWidgetSize (_context);
140
+ recalculateRootWidgetSize (
141
+ _context,
142
+ shouldUpdateOverlay: shouldUpdateOverlay,
143
+ );
141
144
globalFloatingActionWidget = showcaseView
142
145
.getFloatingActionWidget (config.showcaseKey)
143
146
? .call (_context);
144
- final size = rootWidgetSize ?? MediaQuery .sizeOf (_context);
145
- position ?? = TargetPositionService (
146
- rootRenderObject: rootRenderObject,
147
- screenSize: size,
148
- renderBox: _context.findRenderObject () as RenderBox ? ,
149
- padding: config.targetPadding,
150
- );
147
+ // final size = rootWidgetSize ?? MediaQuery.sizeOf(_context);
148
+ // position ??= TargetPositionService(
149
+ // rootRenderObject: rootRenderObject,
150
+ // screenSize: size,
151
+ // renderBox: _context.findRenderObject() as RenderBox?,
152
+ // padding: config.targetPadding,
153
+ // );
151
154
}
152
155
153
156
/// Used to scroll the target into view.
@@ -165,32 +168,32 @@ class ShowcaseController {
165
168
///
166
169
/// Returns a Future that completes when scrolling is finished. If the widget
167
170
/// is unmounted during scrolling, the operation will be canceled safely.
168
- Future <void > scrollIntoView () async {
171
+ Future <void > scrollIntoView ({ bool shouldUpdateOverlay = true } ) async {
169
172
if (! _mounted) {
170
173
assert (_mounted, 'Widget has been unmounted' );
171
174
return ;
172
175
}
173
176
174
177
isScrollRunning = true ;
175
- updateControllerData ();
176
- startShowcase ();
177
- OverlayManager .instance.update (
178
- show: showcaseView.isShowcaseRunning,
179
- scope: showcaseView.scope,
180
- );
178
+ // updateControllerData();
179
+ startShowcase (shouldUpdateOverlay : shouldUpdateOverlay );
180
+ // OverlayManager.instance.update(
181
+ // show: showcaseView.isShowcaseRunning,
182
+ // scope: showcaseView.scope,
183
+ // );
181
184
await Scrollable .ensureVisible (
182
185
_context,
183
186
duration: showcaseView.scrollDuration,
184
187
alignment: config.scrollAlignment,
185
188
);
186
189
187
190
isScrollRunning = false ;
188
- updateControllerData ();
189
- startShowcase ();
190
- OverlayManager .instance.update (
191
- show: showcaseView.isShowcaseRunning,
192
- scope: showcaseView.scope,
193
- );
191
+ // updateControllerData();
192
+ startShowcase (shouldUpdateOverlay : shouldUpdateOverlay );
193
+ // OverlayManager.instance.update(
194
+ // show: showcaseView.isShowcaseRunning,
195
+ // scope: showcaseView.scope,
196
+ // );
194
197
}
195
198
196
199
/// Handles tap on barrier area.
@@ -214,20 +217,28 @@ class ShowcaseController {
214
217
///
215
218
/// Parameter:
216
219
/// * [context] The BuildContext of the [Showcase] widget.
217
- void recalculateRootWidgetSize (BuildContext context) {
220
+ void recalculateRootWidgetSize (
221
+ BuildContext context, {
222
+ bool shouldUpdateOverlay = true ,
223
+ }) {
224
+ if (! showcaseView.enableShowcase || ! showcaseView.isShowcaseRunning) return ;
218
225
WidgetsBinding .instance.addPostFrameCallback ((_) {
219
- if (! context.mounted) return ;
226
+ if (! context.mounted ||
227
+ ! showcaseView.enableShowcase ||
228
+ ! showcaseView.isShowcaseRunning) {
229
+ return ;
230
+ }
220
231
221
232
_initRootWidget ();
222
- if (! showcaseView.enableShowcase) return ;
223
233
224
234
updateControllerData ();
225
- if (! showcaseView.isShowcaseRunning) return ;
226
235
227
- OverlayManager .instance.update (
228
- show: showcaseView.isShowcaseRunning,
229
- scope: showcaseView.scope,
230
- );
236
+ if (shouldUpdateOverlay) {
237
+ OverlayManager .instance.update (
238
+ show: showcaseView.isShowcaseRunning,
239
+ scope: showcaseView.scope,
240
+ );
241
+ }
231
242
});
232
243
}
233
244
0 commit comments