Home

Awesome

Showcaes View - Simform LLC.

ShowCaseView

Build showcaseview

A Flutter package allows you to Showcase/Highlight your widgets step by step.

Preview

The example app running in Android

Migration guide for release 3.0.0

Removed builder widget from ShowCaseWidget and replaced it with builder function

Before:

ShowCaseWidget(
  builder: Builder(
    builder : (context) => Somewidget()
  ),
),

After:

ShowCaseWidget(
  builder : (context) => Somewidget(),
),

Installing

  1. Add dependency to pubspec.yaml

    Get the latest version in the 'Installing' tab on pub.dev

dependencies:
    showcaseview: <latest-version>
  1. Import the package
import 'package:showcaseview/showcaseview.dart';
  1. Adding a ShowCaseWidget widget.
ShowCaseWidget(
  builder: Builder(
    builder : (context)=> Somewidget()
  ),
),
  1. Adding a Showcase widget.
GlobalKey _one = GlobalKey();
GlobalKey _two = GlobalKey();
GlobalKey _three = GlobalKey();

...

Showcase(
  key: _one,
  title: 'Menu',
  description: 'Click here to see menu options',
  child: Icon(
    Icons.menu,
    color: Colors.black45,
  ),
),

Showcase.withWidget(
  key: _three,
  height: 80,
  width: 140,
  targetShapeBorder: CircleBorder(),
  container: Column(
    crossAxisAlignment: CrossAxisAlignment.start,
    children: <Widget>[
      ...
    ],
  ),
  child: ...,
),
  1. Starting the ShowCase
someEvent(){
    ShowCaseWidget.of(context).startShowCase([_one, _two, _three]);
}

If you want to start the ShowCaseView as soon as your UI built up then use below code.

WidgetsBinding.instance.addPostFrameCallback((_) =>
  ShowCaseWidget.of(context).startShowCase([_one, _two, _three])
);

Functions of ShowCaseWidget.of(context):

Function NameDescription
startShowCase(List<GlobalKey> widgetIds)Starting the showcase
next()Starts next showcase
previous()Starts previous showcase
dismiss()Dismisses all showcases

Properties of ShowCaseWidget:

NameTypeDefault BehaviourDescription
builderBuilder
blurValuedouble0Provides blur effect on overlay
autoPlayboolfalseAutomatically display Next showcase
autoPlayDelayDurationDuration(milliseconds: 2000)Visibility time of showcase when autoplay is enabled
enableAutoPlayLockboolfalseBlock the user interaction on overlay when autoPlay is enabled.
enableAutoScrollboolfalseAllows to auto scroll to next showcase so as to make the given target visible.
scrollDurationDurationDuration(milliseconds: 300)Time duration for auto scrolling
disableBarrierInteractionboolfalseDisable barrier interaction
disableScaleAnimationboolfalseDisable scale transition for all showcases
disableMovingAnimationboolfalseDisable bouncing/moving transition for all showcases
onStartFunction(int?, GlobalKey)?Triggered on start of each showcase.
onCompleteFunction(int?, GlobalKey)?Triggered on completion of each showcase.
onFinishVoidCallback?Triggered when all the showcases are completed
enableShowcasebooltrueEnable or disable showcase globally.

Properties of Showcase and Showcase.withWidget:

NameTypeDefault BehaviourDescriptionShowcaseShowCaseWidget
keyGlobalKeyUnique Global key for each showcase.
childWidgetThe Target widget that you want to be showcased
titleString?Title of default tooltip
descriptionString?Description of default tooltip
containerWidget?Allows to create custom tooltip widget.
heightdouble?Height of custom tooltip widget
widthdouble?Width of custom tooltip widget
titleTextStyleTextStyle?Text Style of title
descTextStyleTextStyle?Text Style of description
titleAlignmentTextAlignTextAlign.startAlignment of title
descriptionAlignmentTextAlignTextAlign.startAlignment of description
targetShapeBorderShapeBorderIf targetBorderRadius param is not provided then it applies shape border to target widget
targetBorderRadiusBorderRadius?Border radius of target widget
tooltipBorderRadiusBorderRadius?BorderRadius.circular(8.0)Border radius of tooltip
blurValuedouble?ShowCaseWidget.blurValueGaussian blur effect on overlay
tooltipPaddingEdgeInsetsEdgeInsets.symmetric(vertical: 8, horizontal: 8)Padding to tooltip content
targetPaddingEdgeInsetsEdgeInsets.zeroPadding to target widget
overlayOpacitydouble0.75Opacity of overlay layer
overlayColorColorColors.black45Color of overlay layer
tooltipBackgroundColorColorColors.whiteBackground Color of default tooltip
textColorColorColors.blackColor of tooltip text
scrollLoadingWidgetWidgetLoading widget on overlay until active showcase is visible to viewport when autoScroll is enable
movingAnimationDurationDurationDuration(milliseconds: 2000)Duration of time this moving animation should last.
showArrowbooltrueShows tooltip with arrow
disableDefaultTargetGesturesboolfalsedisable default gestures of target widget
disposeOnTapbool?falseDismiss all showcases on target/tooltip tap
disableMovingAnimationbool?ShowCaseWidget.disableMovingAnimationDisable bouncing/moving transition
disableScaleAnimationbool?ShowCaseWidget.disableScaleAnimationDisable initial scale transition when showcase is being started and completed
scaleAnimationDurationDurationDuration(milliseconds: 300)Duration of time scale animation should last.
scaleAnimationCurveCurveCurves.easeInCurve to use in scale animation.
scaleAnimationAlignmentAlignment?Origin of the coordinate in which the scale takes place, relative to the size of the box.
onToolTipClickVoidCallback?Triggers when tooltip is being clicked.
onTargetClickVoidCallback?Triggers when target widget is being clicked
onTargetDoubleTapVoidCallback?Triggers when target widget is being double clicked
onTargetLongPressVoidCallback?Triggers when target widget is being long pressed
onBarrierClickVoidCallback?Triggers when barrier is clicked
tooltipPositionTooltipPosition?Defines vertical position of tooltip respective to Target widget
titlePaddingEdgeInsets?EdgeInsets.zeroPadding to title
descriptionPaddingEdgeInsets?EdgeInsets.zeroPadding to description
titleTextDirectionTextDirection?Give textDirection to title
descriptionTextDirectionTextDirection?Give textDirection to description
descriptionTextDirectionTextDirection?Give textDirection to description
disableBarrierInteractionboolfalseDisables barrier interaction for a particular showCase
toolTipSlideEndDistancedouble7Defines motion range for tooltip slide animation

How to use

Check out the example app in the example directory or the 'Example' tab on pub.dartlang.org for a more complete example.

Scrolling to active showcase

Auto Scrolling to active showcase feature will not work properly in scroll views that renders widgets on demand(ex, ListView, GridView).

In order to scroll to a widget it needs to be attached with widget tree. So, If you are using a scrollview that renders widgets on demand, it is possible that the widget on which showcase is applied is not attached in widget tree. So, flutter won't be able to scroll to that widget.

So, If you want to make a scroll view that contains less number of children widget then prefer to use SingleChildScrollView.

If using SingleChildScrollView is not an option, then you can assign a ScrollController to that scrollview and manually scroll to the position where showcase widget gets rendered. You can add that code in onStart method of ShowCaseWidget.

Example,

// This controller will be assigned to respected sctollview.
final _controller = ScrollController();

ShowCaseWidget(
  onStart: (index, key) {
    if(index == 0) {
      WidgetsBinding.instance.addPostFrameCallback((_) {
       // If showcase widget is at offset 1000 in the listview.
       // If you don't know the exact position of the showcase widget,
       // You can provide nearest possible location.
       // 
       // In this case providing 990 instead of 1000 will work as well.
        _controller.jumpTo(1000);
      });
    }
  },
);

Main Contributors

<table> <tr> <td align="center"><a href="https://github.com/birjuvachhani"><img src="https://avatars.githubusercontent.com/u/20423471?s=100" width="100px;" alt=""/><br /><sub><b>Birju Vachhani</b></sub></a></td> <td align="center"><a href="https://github.com/DevarshRanpara"><img src="https://avatars.githubusercontent.com/u/26064415?s=100" width="100px;" alt=""/><br /><sub><b>Devarsh Ranpara</b></sub></a></td> <td align="center"><a href="https://github.com/AnkitPanchal10"><img src="https://avatars.githubusercontent.com/u/38405884?s=100" width="100px;" alt=""/><br /><sub><b>Ankit Panchal</b></sub></a></td> <td align="center"><a href="https://github.com/Kashifalaliwala"><img src="https://avatars.githubusercontent.com/u/30998350?s=100" width="100px;" alt=""/><br /><sub><b>Kashifa Laliwala</b></sub></a></td> <td align="center"><a href="https://github.com/vatsaltanna"><img src="https://avatars.githubusercontent.com/u/25323183?s=100" width="100px;" alt=""/><br /><sub><b>Vatsal Tanna</b></sub></a></td> <td align="center"><a href="https://github.com/sanket-simform"><img src="https://avatars.githubusercontent.com/u/65167856?v=4" width="100px;" alt=""/><br /><sub><b>Sanket Kachhela</b></sub></a></td> <td align="center"><a href="https://github.com/ParthBaraiya"><img src="https://avatars.githubusercontent.com/u/36261739?v=4" width="100px;" alt=""/><br /><sub><b>Parth Baraiya</b></sub></a></td> <td align="center"><a href="https://github.com/ShwetaChauhan18"><img src="https://avatars.githubusercontent.com/u/34509457" width="80px;" alt=""/><br /><sub><b>Shweta Chauhan</b></sub></a></td> <td align="center"><a href="https://github.com/DhavalRKansara"><img src="https://avatars.githubusercontent.com/u/44993081?v=4" width="100px;" alt=""/><br /><sub><b>Dhaval Kansara</b></sub></a></td> <td align="center"><a href="https://github.com/HappyMakadiyaS"><img src="https://avatars.githubusercontent.com/u/97177197?v=4" width="100px;" alt=""/><br /><sub><b>Happy Makadiya</b></sub></a></td> <td align="center"><a href="https://github.com/Ujas-Majithiya"><img src="https://avatars.githubusercontent.com/u/56400956?v=4" width="100px;" alt=""/><br /><sub><b>Ujas Majithiya</b></sub></a></td> <td align="center"><a href="https://github.com/aditya-chavda"><img src="https://avatars.githubusercontent.com/u/41247722?v=4" width="100px;" alt=""/><br /><sub><b>Aditya Chavda</b></sub></a></td> <td align="center"><a href="https://github.com/Flamingloon"><img src="https://avatars.githubusercontent.com/u/81063988?v=4" width="100px;" alt=""/><br /><sub><b>Sahil Totala</b></sub></a></td> </tr> </table>

License

MIT License

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.