Skip to content

Commit e2b868e

Browse files
:fix: update CHANGELOG.md (#225)
- Provide support for older versions of flutter as well. Co-authored-by: Parth Baraiya <[email protected]>
1 parent 1272613 commit e2b868e

7 files changed

+48
-9
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ ios/Frameworks/
6060
ios/Runner.xcworkspace/xcshareddata/
6161
example/ios/Flutter/flutter_export_environment.sh
6262
flutter_showcaseview.iml
63-
pubspec.lock
63+
pubspec.lock

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
- Fixed [#62](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/62) - While using ShowCase widget, not scrolling to respective widget when its not visible.
44
- Fixed [#131](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/131) - Support of other gestures onTargetLongPress and onTargetDoubleTap
55
- Fixed [#140](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/140) - disableAnimation at ShowcaseWidget level
6+
- Fixed [#71](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/71) - Highlight Not working when widget is not visible on screen
7+
- Add flutter 3.0 support.
68

79
## [1.1.5] - March 4, 2022
810

example/.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,9 @@ windows/flutter/generated_plugins.cmake
7979
# Linux Project
8080
linux/flutter/generated_plugin_registrant.cc
8181
linux/flutter/generated_plugin_registrant.h
82-
linux/flutter/generated_plugins.cmake
82+
linux/flutter/generated_plugins.cmake
83+
84+
# macOS Project
85+
macos/Flutter/ephemeral/Flutter-Generated.xcconfig
86+
macos/Flutter/ephemeral/flutter_export_environment.sh
87+
macos/Flutter/GeneratedPluginRegistrant.swift

lib/src/extension.dart

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) 2021 Simform Solutions
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be
12+
* included in all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
23+
// TODO: remove this function if we remove support for flutter 2.x
24+
T? ambiguate<T>(T? object) => object;

lib/src/layout_overlays.dart

+9-5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import 'package:flutter/material.dart';
2424

25+
import 'extension.dart';
2526
import 'showcase_widget.dart';
2627

2728
/// Displays an overlay Widget anchored directly above the center of this
@@ -124,20 +125,23 @@ class _OverlayBuilderState extends State<OverlayBuilder> {
124125
super.initState();
125126

126127
if (widget.showOverlay) {
127-
WidgetsBinding.instance.addPostFrameCallback((_) => showOverlay());
128+
ambiguate(WidgetsBinding.instance)
129+
?.addPostFrameCallback((_) => showOverlay());
128130
}
129131
}
130132

131133
@override
132134
void didUpdateWidget(OverlayBuilder oldWidget) {
133135
super.didUpdateWidget(oldWidget);
134-
WidgetsBinding.instance.addPostFrameCallback((_) => syncWidgetAndOverlay());
136+
ambiguate(WidgetsBinding.instance)
137+
?.addPostFrameCallback((_) => syncWidgetAndOverlay());
135138
}
136139

137140
@override
138141
void reassemble() {
139142
super.reassemble();
140-
WidgetsBinding.instance.addPostFrameCallback((_) => syncWidgetAndOverlay());
143+
ambiguate(WidgetsBinding.instance)
144+
?.addPostFrameCallback((_) => syncWidgetAndOverlay());
141145
}
142146

143147
@override
@@ -193,8 +197,8 @@ class _OverlayBuilderState extends State<OverlayBuilder> {
193197
}
194198

195199
void buildOverlay() async {
196-
WidgetsBinding.instance
197-
.addPostFrameCallback((_) => _overlayEntry?.markNeedsBuild());
200+
ambiguate(WidgetsBinding.instance)
201+
?.addPostFrameCallback((_) => _overlayEntry?.markNeedsBuild());
198202
}
199203

200204
@override

lib/src/measure_size.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import 'package:flutter/material.dart';
2424
import 'package:flutter/scheduler.dart';
2525

26+
import 'extension.dart';
27+
2628
typedef OnWidgetSizeChange = void Function(Size? size);
2729

2830
class MeasureSize extends StatefulWidget {
@@ -41,7 +43,8 @@ class MeasureSize extends StatefulWidget {
4143
class _MeasureSizeState extends State<MeasureSize> {
4244
@override
4345
Widget build(BuildContext context) {
44-
SchedulerBinding.instance.addPostFrameCallback(postFrameCallback);
46+
ambiguate(SchedulerBinding.instance)
47+
?.addPostFrameCallback(postFrameCallback);
4548
return Container(
4649
key: widgetKey,
4750
child: widget.child,

lib/src/showcase.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import 'dart:ui';
2626
import 'package:flutter/foundation.dart';
2727
import 'package:flutter/material.dart';
2828

29+
import 'extension.dart';
2930
import 'get_position.dart';
3031
import 'layout_overlays.dart';
3132
import 'shape_clipper.dart';
@@ -187,7 +188,7 @@ class _ShowcaseState extends State<Showcase> {
187188
}
188189

189190
void _scrollIntoView() {
190-
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
191+
ambiguate(WidgetsBinding.instance)?.addPostFrameCallback((timeStamp) async {
191192
setState(() {
192193
_isScrollRunning = true;
193194
});

0 commit comments

Comments
 (0)