From 4c2f1d3e05c6cce08a0f97bdf849debbf3ab8b0c Mon Sep 17 00:00:00 2001 From: Simform Date: Fri, 6 Sep 2019 22:12:50 +0530 Subject: [PATCH] Revert "Added feature [#10]" --- example/lib/main.dart | 110 ++++++++++++++---------------- example/pubspec.lock | 153 ++++++++++++++++++++++++++++++++++++++++++ lib/showcase.dart | 75 +++++++-------------- 3 files changed, 228 insertions(+), 110 deletions(-) create mode 100644 example/pubspec.lock diff --git a/example/lib/main.dart b/example/lib/main.dart index 0b3c9968..0b1bd3ca 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,8 +1,8 @@ import 'dart:developer'; +import 'package:example/detailscreen.dart'; import 'package:flutter/material.dart'; import 'package:showcaseview/showcaseview.dart'; -import 'detailscreen.dart'; void main() => runApp(MyApp()); @@ -42,16 +42,12 @@ class _MailPageState extends State { GlobalKey _five = GlobalKey(); @override - void initState() { - super.initState(); + Widget build(BuildContext context) { //Start showcase view after current widget frames are drawn. WidgetsBinding.instance.addPostFrameCallback((_) => ShowCaseWidget.of(context) .startShowCase([_one, _two, _three, _four, _five])); - } - @override - Widget build(BuildContext context) { return Scaffold( body: SafeArea( child: ListView( @@ -76,7 +72,6 @@ class _MailPageState extends State { Showcase( key: _one, description: 'Tap to see menu options', - disableAnimation: true, child: Icon( Icons.menu, color: Colors.black45, @@ -204,68 +199,67 @@ class _MailPageState extends State { child: Container( margin: const EdgeInsets.all(10), child: Container( - width: 45, - height: 45, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.blue[200], - ), - child: Center( - child: Text('S'), - ), + width: 45, + height: 45, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.blue[200], + ), + child: Center( + child: Text('S'), ), ), ), - Padding(padding: EdgeInsets.only(left: 8)), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Slack', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17, - ), + ), + Padding(padding: EdgeInsets.only(left: 8)), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Slack', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17, ), - Text( - 'Flutter Notification', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - ), + ), + Text( + 'Flutter Notification', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, ), - Text( - 'Hi, you have new Notification', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 15, - ), + ), + Text( + 'Hi, you have new Notification', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 15, ), - ], - ) - ], - ), - ), - Column( - children: [ - Text( - '1 Jun', - style: TextStyle( - fontWeight: FontWeight.bold, - ), - ), - Icon( - Icons.star_border, - color: Colors.grey, + ), + ], ) ], - ) - ], - ), + ), + ), + Column( + children: [ + Text( + '1 Jun', + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + Icon( + Icons.star_border, + color: Colors.grey, + ) + ], + ) + ], ), ), ), - ), + )), MailTile( Mail( sender: 'Medium', diff --git a/example/pubspec.lock b/example/pubspec.lock new file mode 100644 index 00000000..872a2131 --- /dev/null +++ b/example/pubspec.lock @@ -0,0 +1,153 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.11" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.5" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.2" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.3" + showcaseview: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "0.1.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.5" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.3" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.5" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" +sdks: + dart: ">=2.2.2 <3.0.0" diff --git a/lib/showcase.dart b/lib/showcase.dart index 0c32d658..d443154c 100644 --- a/lib/showcase.dart +++ b/lib/showcase.dart @@ -1,34 +1,7 @@ -/* - * Copyright © 2020, Simform Solutions - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; -import 'package:showcaseview/custom_paint.dart'; import 'package:showcaseview/showcaseview.dart'; - +import 'package:showcaseview/custom_paint.dart'; import 'get_position.dart'; import 'layout_overlays.dart'; import 'tooltip_widget.dart'; @@ -56,28 +29,28 @@ class Showcase extends StatefulWidget { final bool disposeOnTap; final bool disableAnimation; - const Showcase( - {@required this.key, - @required this.child, - this.title, - @required this.description, - this.shapeBorder, - this.overlayColor = Colors.black, - this.overlayOpacity = 0.75, - this.titleTextStyle, - this.descTextStyle, - this.showcaseBackgroundColor = Colors.white, - this.textColor = Colors.black, - this.showArrow = true, - this.onTargetClick, - this.disposeOnTap, - this.animationDuration = const Duration(milliseconds: 2000), - this.disableAnimation = false, - this.contentPadding = const EdgeInsets.symmetric(vertical: 8)}) - : height = null, + const Showcase({ + @required this.key, + @required this.child, + this.title, + @required this.description, + this.shapeBorder, + this.overlayColor = Colors.black, + this.overlayOpacity = 0.75, + this.titleTextStyle, + this.descTextStyle, + this.showcaseBackgroundColor = Colors.white, + this.textColor = Colors.black, + this.showArrow = true, + this.onTargetClick, + this.disposeOnTap, + this.animationDuration = const Duration(milliseconds: 2000), + this.disableAnimation = false, + this.contentPadding = const EdgeInsets.symmetric(vertical: 8), + this.onToolTipClick, + }) : height = null, width = null, container = null, - this.onToolTipClick = null, assert(overlayOpacity >= 0.0 && overlayOpacity <= 1.0, "overlay opacity should be >= 0.0 and <= 1.0."), assert( @@ -200,9 +173,7 @@ class _ShowcaseState extends State with TickerProviderStateMixin { }); if (activeStep == widget.key) { - if (!widget.disableAnimation) { - _slideAnimationController.forward(); - } + _slideAnimationController.forward(); } } @@ -283,7 +254,7 @@ class _ShowcaseState extends State with TickerProviderStateMixin { _TargetWidget( offset: offset, size: size, - onTap: _getOnTargetTap(), + onTap: _nextIfAny, shapeBorder: widget.shapeBorder, ), ToolTipWidget(