Skip to content

Commit bf113a2

Browse files
DevarshRanparasimform-solutions
authored andcommitted
Added on finish method (SimformSolutionsPvtLtd#21)
Added on finish method
1 parent d841f32 commit bf113a2

File tree

8 files changed

+288
-259
lines changed

8 files changed

+288
-259
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
## [0.1.4] - Added onFinish method [#17](https://github.com/simformsolutions/flutter_showcaseview/issues/17).
2+
13
## [0.1.3] - Added feature
24

3-
# Updated syntax to pass new context to ShowCaseWidget
4-
# Added onTargetTap callback feature [#10](https://github.com/simformsolutions/flutter_showcaseview/issues/10).
5+
Updated syntax to pass new context to ShowCaseWidget
6+
Added onTargetTap callback feature [#10](https://github.com/simformsolutions/flutter_showcaseview/issues/10).
57

68
## [0.1.2] - Fixed issue [#6](https://github.com/simformsolutions/flutter_showcaseview/issues/6).
79

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ someEvent(){
9292
}
9393
```
9494

95+
7. onFinish method for `ShowCase`
96+
```dart
97+
ShowCaseWidget(
98+
onFinish: () {
99+
// Your code goes here
100+
},
101+
builder: Builder(
102+
builder : (context) ()=> Somewidget()
103+
),
104+
),
105+
```
106+
95107
If you want to start the `ShowCaseView` as soon as your UI built up then use below code.
96108
```dart
97109
WidgetsBinding.instance.addPostFrameCallback((_) =>

example/lib/detailscreen.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class _DetailState extends State<Detail> {
1313

1414
@override
1515
void initState() {
16-
// TODO: implement initState
1716
super.initState();
1817
WidgetsBinding.instance.addPostFrameCallback(
1918
(_) {

example/lib/main.dart

Lines changed: 262 additions & 242 deletions
Large diffs are not rendered by default.

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ packages:
8787
path: ".."
8888
relative: true
8989
source: path
90-
version: "0.1.4"
90+
version: "0.1.3"
9191
sky_engine:
9292
dependency: transitive
9393
description: flutter

lib/showcase_widget.dart

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import 'package:flutter/material.dart';
22

33
class ShowCaseWidget extends StatefulWidget {
44
final Builder builder;
5+
final VoidCallback onFinish;
56

6-
const ShowCaseWidget({@required this.builder});
7+
const ShowCaseWidget({@required this.builder, this.onFinish});
78

89
static activeTargetWidget(BuildContext context) {
910
return (context.inheritFromWidgetOfExactType(_InheritedShowCaseView)
@@ -12,11 +13,11 @@ class ShowCaseWidget extends StatefulWidget {
1213
}
1314

1415
static ShowCaseWidgetState of(BuildContext context) {
15-
ShowCaseWidgetState state = context.ancestorStateOfType(
16-
const TypeMatcher<ShowCaseWidgetState>());
16+
ShowCaseWidgetState state =
17+
context.ancestorStateOfType(const TypeMatcher<ShowCaseWidgetState>());
1718
if (state != null) {
18-
return context.ancestorStateOfType(
19-
const TypeMatcher<ShowCaseWidgetState>());
19+
return context
20+
.ancestorStateOfType(const TypeMatcher<ShowCaseWidgetState>());
2021
} else {
2122
throw Exception('Please provide ShowCaseView context');
2223
}
@@ -44,9 +45,8 @@ class ShowCaseWidgetState extends State<ShowCaseWidget> {
4445

4546
if (activeWidgetId >= ids.length) {
4647
_cleanupAfterSteps();
47-
if (ShowCaseOnFinish._onShowCaseFinish != null) {
48-
ShowCaseOnFinish._onShowCaseFinish();
49-
ShowCaseOnFinish._onShowCaseFinish = null;
48+
if (widget.onFinish != null) {
49+
widget.onFinish();
5050
}
5151
}
5252
});
@@ -85,7 +85,3 @@ class _InheritedShowCaseView extends InheritedWidget {
8585
bool updateShouldNotify(_InheritedShowCaseView oldWidget) =>
8686
oldWidget.activeWidgetIds != activeWidgetIds;
8787
}
88-
89-
class ShowCaseOnFinish {
90-
static VoidCallback _onShowCaseFinish;
91-
}

preview/showcaseview.gif

-731 KB
Loading

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: showcaseview
22
description: A Flutter package to Showcase/Highlight widgets step by step.
3-
version: 0.1.3
3+
version: 0.1.4
44
author: Simform solutions <developer@simform.com>
55
homepage: https://github.com/simformsolutions/flutter_showcaseview
66
issue_tracker: https://github.com/simformsolutions/flutter_showcaseview/issues

0 commit comments

Comments
 (0)