Skip to content

Commit

Permalink
:fix: update CHANGELOG.md (#225)
Browse files Browse the repository at this point in the history
- Provide support for older versions of flutter as well.

Co-authored-by: Parth Baraiya <[email protected]>
  • Loading branch information
ParthBaraiya and PRBaraiya authored Jun 17, 2022
1 parent 1272613 commit e2b868e
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ ios/Frameworks/
ios/Runner.xcworkspace/xcshareddata/
example/ios/Flutter/flutter_export_environment.sh
flutter_showcaseview.iml
pubspec.lock
pubspec.lock
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- Fixed [#62](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/62) - While using ShowCase widget, not scrolling to respective widget when its not visible.
- Fixed [#131](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/131) - Support of other gestures onTargetLongPress and onTargetDoubleTap
- Fixed [#140](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/140) - disableAnimation at ShowcaseWidget level
- Fixed [#71](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/71) - Highlight Not working when widget is not visible on screen
- Add flutter 3.0 support.

## [1.1.5] - March 4, 2022

Expand Down
7 changes: 6 additions & 1 deletion example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,9 @@ windows/flutter/generated_plugins.cmake
# Linux Project
linux/flutter/generated_plugin_registrant.cc
linux/flutter/generated_plugin_registrant.h
linux/flutter/generated_plugins.cmake
linux/flutter/generated_plugins.cmake

# macOS Project
macos/Flutter/ephemeral/Flutter-Generated.xcconfig
macos/Flutter/ephemeral/flutter_export_environment.sh
macos/Flutter/GeneratedPluginRegistrant.swift
24 changes: 24 additions & 0 deletions lib/src/extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2021 Simform Solutions
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

// TODO: remove this function if we remove support for flutter 2.x
T? ambiguate<T>(T? object) => object;
14 changes: 9 additions & 5 deletions lib/src/layout_overlays.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import 'package:flutter/material.dart';

import 'extension.dart';
import 'showcase_widget.dart';

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

if (widget.showOverlay) {
WidgetsBinding.instance.addPostFrameCallback((_) => showOverlay());
ambiguate(WidgetsBinding.instance)
?.addPostFrameCallback((_) => showOverlay());
}
}

@override
void didUpdateWidget(OverlayBuilder oldWidget) {
super.didUpdateWidget(oldWidget);
WidgetsBinding.instance.addPostFrameCallback((_) => syncWidgetAndOverlay());
ambiguate(WidgetsBinding.instance)
?.addPostFrameCallback((_) => syncWidgetAndOverlay());
}

@override
void reassemble() {
super.reassemble();
WidgetsBinding.instance.addPostFrameCallback((_) => syncWidgetAndOverlay());
ambiguate(WidgetsBinding.instance)
?.addPostFrameCallback((_) => syncWidgetAndOverlay());
}

@override
Expand Down Expand Up @@ -193,8 +197,8 @@ class _OverlayBuilderState extends State<OverlayBuilder> {
}

void buildOverlay() async {
WidgetsBinding.instance
.addPostFrameCallback((_) => _overlayEntry?.markNeedsBuild());
ambiguate(WidgetsBinding.instance)
?.addPostFrameCallback((_) => _overlayEntry?.markNeedsBuild());
}

@override
Expand Down
5 changes: 4 additions & 1 deletion lib/src/measure_size.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';

import 'extension.dart';

typedef OnWidgetSizeChange = void Function(Size? size);

class MeasureSize extends StatefulWidget {
Expand All @@ -41,7 +43,8 @@ class MeasureSize extends StatefulWidget {
class _MeasureSizeState extends State<MeasureSize> {
@override
Widget build(BuildContext context) {
SchedulerBinding.instance.addPostFrameCallback(postFrameCallback);
ambiguate(SchedulerBinding.instance)
?.addPostFrameCallback(postFrameCallback);
return Container(
key: widgetKey,
child: widget.child,
Expand Down
3 changes: 2 additions & 1 deletion lib/src/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import 'extension.dart';
import 'get_position.dart';
import 'layout_overlays.dart';
import 'shape_clipper.dart';
Expand Down Expand Up @@ -187,7 +188,7 @@ class _ShowcaseState extends State<Showcase> {
}

void _scrollIntoView() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
ambiguate(WidgetsBinding.instance)?.addPostFrameCallback((timeStamp) async {
setState(() {
_isScrollRunning = true;
});
Expand Down

0 comments on commit e2b868e

Please sign in to comment.