File tree Expand file tree Collapse file tree 4 files changed +57
-2
lines changed
Expand file tree Collapse file tree 4 files changed +57
-2
lines changed Original file line number Diff line number Diff line change 4040- Deprecate [ #531 ] ( https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/pull/531 ) -
4141 Update deprecated ` ShowCaseWidget ` removal version.
4242- Improvement [ #505 ] ( https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/pull/505 ) -
43- Fixed example app to run in flutter version ` v3.32.5 ` .
43+ Fixed example app to run in flutter version ` v3.32.5 ` .
44+ - Fixed [ #564 ] ( https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/564 ) -
45+ Apply textScaler to tooltip widgets.
4446
4547## [ 4.0.1]
4648- Fixed [ #493 ] ( https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/493 ) - ShowCase.withWidget not showing issue
Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+
3+ /// Container for captured inherited widget data from showcase's context.
4+ class FlutterInheritedData {
5+ const FlutterInheritedData ({
6+ required this .mediaQuery,
7+ required this .textDirection,
8+ required this .capturedThemes,
9+ required this .textStyle,
10+ });
11+
12+ factory FlutterInheritedData .fromContext (BuildContext context) {
13+ return FlutterInheritedData (
14+ mediaQuery: MediaQuery .of (context),
15+ capturedThemes: InheritedTheme .capture (
16+ from: context,
17+ to: Navigator .maybeOf (context)? .context,
18+ ),
19+ textDirection: Directionality .of (context),
20+ textStyle: DefaultTextStyle .of (context).style,
21+ );
22+ }
23+
24+ final MediaQueryData mediaQuery;
25+ final CapturedThemes capturedThemes;
26+ final TextDirection textDirection;
27+ final TextStyle textStyle;
28+ }
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import 'dart:math';
2424import 'package:flutter/foundation.dart' ;
2525import 'package:flutter/widgets.dart' ;
2626
27+ import '../models/flutter_inherited_data.dart' ;
2728import '../models/linked_showcase_data_model.dart' ;
2829import '../models/tooltip_action_config.dart' ;
2930import '../tooltip/tooltip.dart' ;
@@ -98,6 +99,10 @@ class ShowcaseController {
9899 /// Global floating action widget to be displayed
99100 FloatingActionWidget ? globalFloatingActionWidget;
100101
102+ /// Captured inherited widget data from showcase context
103+ late final FlutterInheritedData inheritedData =
104+ FlutterInheritedData .fromContext (_context);
105+
101106 /// Returns the Showcase widget configuration.
102107 ///
103108 /// Provides access to all properties and settings of the current showcase
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ class OverlayManager {
177177 child: const Align (),
178178 );
179179
180- return Stack (
180+ final overlayChild = Stack (
181181 // This key is used to force rebuild the overlay when needed.
182182 // this key enables `_overlayEntry?.markNeedsBuild();` to detect that
183183 // output of the builder has changed.
@@ -202,6 +202,26 @@ class OverlayManager {
202202 ...controllers.expand ((object) => object.tooltipWidgets),
203203 ],
204204 );
205+
206+ final inheritedData = firstController.inheritedData;
207+
208+ // Wrap the child with captured themes to maintain the original context's
209+ // theme. Captured themes are used as to cover cases where there are
210+ // multiple themes in the widget tree.
211+ final themedChild = inheritedData.capturedThemes.wrap (overlayChild);
212+
213+ // Wrap with other inherited widgets to maintain showcase's context's
214+ // inherited values.
215+ return Directionality (
216+ textDirection: inheritedData.textDirection,
217+ child: MediaQuery (
218+ data: inheritedData.mediaQuery,
219+ child: DefaultTextStyle (
220+ style: inheritedData.textStyle,
221+ child: themedChild,
222+ ),
223+ ),
224+ );
205225 }
206226
207227 /// Extracts and returns linked showcase data from controllers.
You can’t perform that action at this time.
0 commit comments