diff --git a/.gitignore b/.gitignore
index 1406e523..f1f9930e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,3 @@
-
-# Created by https://www.gitignore.io/api/flutter
-# Edit at https://www.gitignore.io/?templates=flutter
-
### Flutter ###
# Flutter/Dart/Pub related
**/doc/api/
@@ -56,4 +52,4 @@ build/
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
-# End of https://www.gitignore.io/api/flutter
\ No newline at end of file
+/showcaseview.iml
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
deleted file mode 100644
index 30aa626c..00000000
--- a/.idea/codeStyles/Project.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
deleted file mode 100644
index 8ff1ec09..00000000
--- a/.idea/libraries/Dart_Packages.xml
+++ /dev/null
@@ -1,180 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml
deleted file mode 100644
index 824a5c2e..00000000
--- a/.idea/libraries/Dart_SDK.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml
deleted file mode 100644
index b0f69711..00000000
--- a/.idea/libraries/Flutter_Plugins.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 36188300..00000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/showcaseview.iml b/.idea/showcaseview.iml
deleted file mode 100644
index ef03246b..00000000
--- a/.idea/showcaseview.iml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1ddf..00000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 54645fdb..00000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,230 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- withOpacity
- Target
- Rect
- Offset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1557913126536
-
-
- 1557913126536
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index eed2a2f2..00000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- // Use IntelliSense to learn about possible attributes.
- // Hover to view descriptions of existing attributes.
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
- {
- "name": "Flutter",
- "type": "dart",
- "request": "launch",
- "program": "example/lib/main.dart"
- },
- ]
-}
\ No newline at end of file
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 7f1411ea..ba7d0ef1 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -12,7 +12,6 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.blue,
),
home: ShowCase(child: MailPage()),
-
);
}
}
@@ -28,258 +27,244 @@ class _MailPageState extends State {
GlobalKey _three = GlobalKey();
GlobalKey _four = GlobalKey();
GlobalKey _five = GlobalKey();
+
@override
Widget build(BuildContext context) {
+ //Start showcase view after current widget frames are drawn.
WidgetsBinding.instance.addPostFrameCallback((_) =>
ShowCase.startShowCase(context, [_one, _two, _three, _four, _five]));
+
return Scaffold(
- body: Container(
- child: SafeArea(
- child: ListView(
- children: [
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- padding: EdgeInsets.only(top: 8.0,left: 8.0,right: 8.0),
- child: Card(
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(10.0)),
- elevation: 3.0,
- child: Container(
- padding: EdgeInsets.all(12.0),
+ body: SafeArea(
+ child: ListView(
+ children: [
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Container(
+ padding: const EdgeInsets.only(top: 8, left: 8, right: 8),
+ child: Card(
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ elevation: 3,
+ child: Container(
+ padding: const EdgeInsets.all(12),
+ child: Row(
+ children: [
+ Expanded(
+ child: Row(
+ children: [
+ TargetWidget(
+ key: _one,
+ title: 'Menu',
+ description: 'Click here to see menu options',
+ child: Icon(
+ Icons.menu,
+ color: Colors.black45,
+ ),
+ ),
+ SizedBox(
+ width: 10,
+ ),
+ Text(
+ 'Search email',
+ style: TextStyle(
+ color: Colors.black45,
+ fontSize: 20,
+ ),
+ ),
+ ],
+ ),
+ ),
+ TargetWidget(
+ key: _two,
+ title: 'Profile',
+ description: 'Click here to go to your Profile',
+ shapeBorder: CircleBorder(),
+ child: Container(
+ width: 30,
+ height: 30,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ image: DecorationImage(
+ fit: BoxFit.fill,
+ image: AssetImage('assets/simform.png'),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ SizedBox(
+ height: 7,
+ ),
+ Container(
+ padding: const EdgeInsets.only(left: 16, top: 4),
+ child: Text(
+ 'PRIMARY',
+ style: TextStyle(
+ color: Colors.black54,
+ fontSize: 15,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ ],
+ ),
+ Container(
+ padding: const EdgeInsets.symmetric(vertical: 10),
+ child: TargetWidget(
+ key: _three,
+ title: 'Mail',
+ description: 'Click here to check mail',
+ child: Container(
+ padding: const EdgeInsets.only(left: 6, right: 16),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Expanded(
- child: Row(
+ TargetWidget.withWidget(
+ key: _four,
+ cHeight: 80,
+ cWidth: 140,
+ shapeBorder: CircleBorder(),
+ container: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
children: [
- TargetWidget(
- key: _one,
- title: 'Menu',
- description:
- 'Click here to see menu options',
- child: Icon(
- Icons.menu,
- color: Colors.black45,
+ Container(
+ width: 40,
+ height: 40,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: Colors.blue[200],
+ ),
+ child: Center(
+ child: Text('S'),
),
),
SizedBox(
- width: 10.0,
+ height: 10,
),
Text(
- 'Search email',
- style: TextStyle(
- color: Colors.black45, fontSize: 20.0),
- ),
+ 'Your sender\'s profile ',
+ style: TextStyle(color: Colors.white),
+ )
],
),
- ),
- TargetWidget(
- key: _two,
- title: 'Profile',
- description: 'Click here to go to your Profile',
- shapeBorder: CircleBorder(),
child: Container(
- width: 30.0,
- height: 30.0,
- decoration: new BoxDecoration(
- shape: BoxShape.circle,
- image: new DecorationImage(
- fit: BoxFit.fill,
- image: new AssetImage('assets/simform.png'),
+ margin: const EdgeInsets.all(10),
+ child: Container(
+ width: 40,
+ height: 40,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: Colors.blue[200],
+ ),
+ child: Center(
+ child: Text('S'),
),
),
),
),
- ],
- ),
- ),
- ),
- ),
- SizedBox(
- height: 7.0,
- ),
- Container(
- padding: EdgeInsets.only(left: 13,top : 5),
- child: Text(
- 'PRIMARY',
- style: TextStyle(
- color: Colors.black54,
- fontSize: 15.0,
- fontWeight: FontWeight.bold),
- ),
- ),
- ],
- ),
- Container(
- padding: EdgeInsets.symmetric(vertical: 10.0),
- child: TargetWidget(
- key: _three,
- title: 'Mail',
- description: 'Click here to check mail',
- child: Container(
- padding: EdgeInsets.only(left : 6,right: 16),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child: Row(
+ Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- TargetWidget.withWidget(
- key: _four,
- cHeight: 80,
- cWidht: 140,
- shapeBorder: CircleBorder(),
- showArrow: false,
- container: Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: [
- Container(
- width: 40.0,
- height: 40.0,
- decoration: new BoxDecoration(
- shape: BoxShape.circle,
- color: Colors.blue[200]),
- child: Center(
- child: Text('S'),
- ),
- ),
- SizedBox(
- height: 10,
- ),
- Text(
- 'Your sender\'s profile ',
- style: TextStyle(color: Colors.white),
- )
- ],
+ Text(
+ 'Slack',
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 17,
),
- child: Container(
- margin: EdgeInsets.all(10.0),
- child: Container(
- width: 40.0,
- height: 40.0,
- decoration: new BoxDecoration(
- shape: BoxShape.circle,
- color: Colors.blue[200]),
- child: Center(
- child: Text('S'),
- ),
- ),
+ ),
+ Text(
+ 'Flutter Notification',
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 16,
+ ),
+ ),
+ Text(
+ 'Hi, you have new Notification',
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontSize: 15,
),
),
- Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: [
- Text(
- 'Slack',
- style: TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 17.0),
- ),
- Text(
- 'Flutter Notification',
- style: TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 16.0),
- ),
- Text(
- 'Hi, you have new Notification',
- style: TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 15.0),
- )
- ],
- )
],
+ )
+ ],
+ ),
+ ),
+ Column(
+ children: [
+ Text(
+ '1 Jun',
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
),
),
- Column(
- children: [
- Text(
- '1 Jun',
- style: TextStyle(
- fontWeight: FontWeight.bold,
- ),
- ),
- Icon(
- Icons.star_border,
- color: Colors.grey,
- )
- ],
+ Icon(
+ Icons.star_border,
+ color: Colors.grey,
)
],
- ),
- )
- // MailTile(
- // Mail(
- // sender: 'Slack',
- // sub: 'Flutter Notification',
- // msg: 'Hi, you have new Notification',
- // date: '1 Jun',
- // isUnread: true),
- // ),
- ),
- ),
- Container(
- padding: EdgeInsets.symmetric(vertical: 10.0),
- child: MailTile(
- Mail(
- sender: 'Medium',
- sub: 'Showcase View',
- msg: 'Check new showcase View',
- date: '25 May',
- isUnread: false),
- ),
- ),
- Container(
- padding: EdgeInsets.symmetric(vertical: 10.0),
- child: MailTile(
- Mail(
- sender: 'Quora',
- sub: 'New Question for you',
- msg: 'Hi, There is new question for you',
- date: '22 May',
- isUnread: false),
+ )
+ ],
+ ),
),
),
- Container(
- padding: EdgeInsets.symmetric(vertical: 10.0),
- child: MailTile(
- Mail(
- sender: 'Google',
- sub: 'Flutter 1.5',
- msg: 'We have launched Flutter 1.5',
- date: '20 May',
- isUnread: true),
- ),
+ ),
+ MailTile(
+ Mail(
+ sender: 'Medium',
+ sub: 'Showcase View',
+ msg: 'Check new showcase View',
+ date: '25 May',
+ isUnread: false,
),
- Container(
- padding: EdgeInsets.symmetric(vertical: 10.0),
- child: MailTile(
- Mail(
- sender: 'Simfom',
- sub: 'Credit card Plugin',
- msg: 'Check out our credit card plugin',
- date: '19 May',
- isUnread: true),
- ),
+ ),
+ MailTile(
+ Mail(
+ sender: 'Quora',
+ sub: 'New Question for you',
+ msg: 'Hi, There is new question for you',
+ date: '22 May',
+ isUnread: false,
),
- Container(
- padding: EdgeInsets.symmetric(vertical: 10.0),
- child: MailTile(
- Mail(
- sender: 'Flutter',
- sub: 'Flutter is Future',
- msg: 'Flutter laucnhed for Web',
- date: '18 Jun',
- isUnread: true),
- ),
+ ),
+ MailTile(
+ Mail(
+ sender: 'Google',
+ sub: 'Flutter 1.5',
+ msg: 'We have launched Flutter 1.5',
+ date: '20 May',
+ isUnread: true),
+ ),
+ MailTile(
+ Mail(
+ sender: 'simform',
+ sub: 'Credit card Plugin',
+ msg: 'Check out our credit card plugin',
+ date: '19 May',
+ isUnread: true),
+ ),
+ MailTile(
+ Mail(
+ sender: 'Flutter',
+ sub: 'Flutter is Future',
+ msg: 'Flutter laucnhed for Web',
+ date: '18 Jun',
+ isUnread: true,
),
- ],
- ),
+ ),
+ ],
),
),
floatingActionButton: TargetWidget(
@@ -308,7 +293,14 @@ class Mail {
String msg;
String date;
bool isUnread;
- Mail({this.sender, this.sub, this.msg, this.date, this.isUnread});
+
+ Mail({
+ this.sender,
+ this.sub,
+ this.msg,
+ this.date,
+ this.isUnread,
+ });
}
class MailTile extends StatelessWidget {
@@ -319,7 +311,7 @@ class MailTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
- padding: EdgeInsets.only(left : 6.0,right: 16.0),
+ padding: const EdgeInsets.only(left: 6, right: 16, top: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -328,11 +320,13 @@ class MailTile extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
- margin: EdgeInsets.all(10.0),
- width: 40.0,
- height: 40.0,
- decoration: new BoxDecoration(
- shape: BoxShape.circle, color: Colors.blue[200]),
+ margin: const EdgeInsets.all(10),
+ width: 40,
+ height: 40,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: Colors.blue[200],
+ ),
child: Center(
child: Text(mail.sender[0]),
),
@@ -343,24 +337,27 @@ class MailTile extends StatelessWidget {
Text(
mail.sender,
style: TextStyle(
- fontWeight:
- mail.isUnread ? FontWeight.bold : FontWeight.normal,
- fontSize: 17.0),
+ fontWeight:
+ mail.isUnread ? FontWeight.bold : FontWeight.normal,
+ fontSize: 17,
+ ),
),
Text(
mail.sub,
style: TextStyle(
- fontWeight:
- mail.isUnread ? FontWeight.bold : FontWeight.normal,
- fontSize: 16.0),
+ fontWeight:
+ mail.isUnread ? FontWeight.bold : FontWeight.normal,
+ fontSize: 16,
+ ),
),
Text(
mail.msg,
style: TextStyle(
- fontWeight:
- mail.isUnread ? FontWeight.bold : FontWeight.normal,
- fontSize: 15.0),
- )
+ fontWeight:
+ mail.isUnread ? FontWeight.bold : FontWeight.normal,
+ fontSize: 15,
+ ),
+ ),
],
)
],
@@ -371,15 +368,16 @@ class MailTile extends StatelessWidget {
Text(
mail.date,
style: TextStyle(
- fontWeight: mail.isUnread ? FontWeight.bold : FontWeight.normal,
+ fontWeight:
+ mail.isUnread ? FontWeight.bold : FontWeight.normal,
),
),
Icon(
Icons.star_border,
color: Colors.grey,
- )
+ ),
],
- )
+ ),
],
),
);
diff --git a/example/lib/test_UI.dart b/example/lib/test_UI.dart
deleted file mode 100644
index fa271131..00000000
--- a/example/lib/test_UI.dart
+++ /dev/null
@@ -1,110 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:showcaseview/showcaseview.dart';
-
-class MyHomePage extends StatefulWidget {
- @override
- _MyHomePageState createState() => _MyHomePageState();
-}
-
-class _MyHomePageState extends State {
- int _counter = 0;
-
- GlobalKey _one = GlobalKey();
- GlobalKey _two = GlobalKey();
- GlobalKey _three = GlobalKey();
- GlobalKey _four = GlobalKey();
-
- void _incrementCounter() {
- setState(() {
- _counter++;
- });
- }
-
- @override
- Widget build(BuildContext context) {
- WidgetsBinding.instance.addPostFrameCallback((_) =>
- ShowCase.startShowCase(context, [_two, _one, _three, _four]));
-
- return Scaffold(
- appBar: AppBar(
- title: TargetWidget(
- key: _one,
- title: "Title",
- description: "Hey There! I am title of the screen.",
- child: Text('Showcase Animation'),
- ),
- ),
- body: Container(
- height: MediaQuery.of(context).size.height,
- width: MediaQuery.of(context).size.width,
- child: Stack(
- children: [
- // Align(
- // alignment: Alignment(-0.5, -0.3),
- // child: TargetWidget(
- // title: 'Sample Text',
- // description: 'This is Sample Text',
- // key: _five,
- // container: Text(
- // 'Helloooow',
- // style: TextStyle(
- // color: Colors.white,
- // fontSize: 30,
- // ),
- // ),
- // child: Text(
- // 'Text',
- // style: TextStyle(fontSize: 50),
- // ),
- // ),
- // ),
- Align(
- alignment: Alignment(0.5, 0.6),
- child: TargetWidget.withWidget(
- cHeight: 200,
- cWidht: 200,
- key: _two,
- container: Text(
- 'Helloooow',
- style: TextStyle(
- color: Colors.white,
- fontSize: 30,
- ),
- ),
- // title: 'Title',
- // description: 'Desc',
- child: Text(
- '$_counter',
- style: Theme.of(context).textTheme.display1,
- ),
- ),
- ),
- Align(
- alignment: Alignment.centerLeft,
- child: TargetWidget(
- overlayColor: Colors.black,
- key: _four,
- shapeBorder: CircleBorder(),
- title: 'Title',
- description: 'Temp Fab',
- child: FloatingActionButton(
- onPressed: () {},
- child: Icon(Icons.add),
- )),
- ),
- ],
- )),
- floatingActionButton: TargetWidget(
- key: _three,
- title: "Tap Me!",
- description: "Tap me and counter will increase.",
- shapeBorder: CircleBorder(),
- child: FloatingActionButton(
- onPressed: _incrementCounter,
- tooltip: 'Increment',
- child: Icon(Icons.add),
- ),
- ),
- );
- }
-}
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 1f9727d2..872a2131 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -1,5 +1,5 @@
# Generated by pub
-# See https://www.dartlang.org/tools/pub/glossary#lockfile
+# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
@@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.2.0"
boolean_selector:
dependency: transitive
description:
@@ -73,21 +73,21 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
- version: "1.5.0"
+ version: "1.7.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.2"
+ version: "2.0.3"
showcaseview:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
- version: "0.0.1"
+ version: "0.1.0"
sky_engine:
dependency: transitive
description: flutter
@@ -134,7 +134,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.4"
+ version: "0.2.5"
typed_data:
dependency: transitive
description:
@@ -150,4 +150,4 @@ packages:
source: hosted
version: "2.0.8"
sdks:
- dart: ">=2.2.0 <3.0.0"
+ dart: ">=2.2.2 <3.0.0"
diff --git a/flutter_01.log b/flutter_01.log
deleted file mode 100644
index 682bfabd..00000000
--- a/flutter_01.log
+++ /dev/null
@@ -1,83 +0,0 @@
-Flutter crash report; please file at https://github.com/flutter/flutter/issues.
-
-## command
-
-flutter packages get
-
-## exception
-
-_TypeError: type 'YamlList' is not a subtype of type 'YamlMap'
-
-```
-#0 _validate (package:flutter_tools/src/flutter_manifest.dart:312:30)
-
-#1 FlutterManifest._createFromYaml (package:flutter_tools/src/flutter_manifest.dart:45:40)
-
-#2 FlutterManifest.createFromString (package:flutter_tools/src/flutter_manifest.dart:40:12)
-
-#3 FlutterManifest.createFromPath (package:flutter_tools/src/flutter_manifest.dart:34:12)
-
-#4 FlutterProject._readManifest (package:flutter_tools/src/project.dart:153:60)
-
-#5 FlutterProject.fromDirectory (package:flutter_tools/src/project.dart:44:44)
-
-#6 FlutterProject.fromPath (package:flutter_tools/src/project.dart:59:58)
-#7 PackagesGetCommand.runCommand (package:flutter_tools/src/commands/packages.dart:96:61)
-
-#8 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:559:18)
-#9 _asyncThenWrapperHelper. (dart:async-patch/async_patch.dart:77:64)
-#10 _rootRunUnary (dart:async/zone.dart:1132:38)
-#11 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
-#12 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
-#13 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
-#14 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
-#15 Future._complete (dart:async/future_impl.dart:473:7)
-#16 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
-#17 _AsyncAwaitCompleter.complete. (dart:async-patch/async_patch.dart:33:20)
-#18 _rootRun (dart:async/zone.dart:1124:13)
-#19 _CustomZone.run (dart:async/zone.dart:1021:19)
-#20 _CustomZone.bindCallback. (dart:async/zone.dart:947:23)
-#21 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
-#22 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
-#23 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
-#24 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)
-```
-
-## flutter doctor
-
-```
-[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.3 18D109, locale en-GB)
- • Flutter version 1.5.4-hotfix.2 at /Devarsh/flutter
- • Framework revision 7a4c33425d (4 weeks ago), 2019-04-29 11:05:24 -0700
- • Engine revision 52c7a1e849
- • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
-
-[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
- • Android SDK at /Users/devarsh.ranpara/Library/Android/sdk
- • Android NDK location not configured (optional; useful for native profiling support)
- • Platform android-28, build-tools 28.0.3
- • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
- • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
- • All Android licenses accepted.
-
-[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
- • Xcode at /Applications/Xcode.app/Contents/Developer
- • Xcode 10.2.1, Build version 10E1001
- • ios-deploy 1.9.4
- • CocoaPods version 1.5.3
-
-[✓] Android Studio (version 3.3)
- • Android Studio at /Applications/Android Studio.app/Contents
- • Flutter plugin version 34.0.1
- • Dart plugin version 182.5215
- • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
-
-[✓] VS Code (version 1.34.0)
- • VS Code at /Applications/Visual Studio Code.app/Contents
- • Flutter extension version 3.0.2
-
-[✓] Connected device (1 available)
- • Redmi 6 • 05d212ad7d28 • android-arm • Android 8.1.0 (API 27)
-
-• No issues found!
-```
diff --git a/lib/custom_paint.dart b/lib/custom_paint.dart
index 305f1af1..49b3775e 100644
--- a/lib/custom_paint.dart
+++ b/lib/custom_paint.dart
@@ -5,24 +5,27 @@ class ShapePainter extends CustomPainter {
final ShapeBorder shapeBorder;
final Color color;
final double opacity;
- ShapePainter(
- {@required this.rect, this.color, this.shapeBorder, this.opacity});
+
+ ShapePainter({
+ @required this.rect,
+ this.color,
+ this.shapeBorder,
+ this.opacity,
+ });
+
@override
void paint(Canvas canvas, Size size) {
final paint = Paint();
- double radius = 3.0;
paint.color = color.withOpacity(opacity);
RRect outer =
RRect.fromLTRBR(0, 0, size.width, size.height, Radius.circular(0));
- if (shapeBorder == CircleBorder()) {
- radius = 50;
- }
+
+ double radius = shapeBorder == CircleBorder() ? 50 : 3;
+
RRect inner = RRect.fromRectAndRadius(rect, Radius.circular(radius));
canvas.drawDRRect(outer, inner, paint);
}
@override
- bool shouldRepaint(CustomPainter oldDelegate) {
- return false;
- }
+ bool shouldRepaint(CustomPainter oldDelegate) => false;
}
diff --git a/lib/get_position.dart b/lib/get_position.dart
index 41349fe5..42f0561c 100644
--- a/lib/get_position.dart
+++ b/lib/get_position.dart
@@ -2,30 +2,26 @@ import 'package:flutter/material.dart';
class GetPosition {
final GlobalKey key;
+
GetPosition({this.key});
Rect getRect() {
RenderBox box = key.currentContext.findRenderObject();
+
final topLeft = box.size.topLeft(box.localToGlobal(const Offset(0.0, 0.0)));
final bottomRight =
box.size.bottomRight(box.localToGlobal(const Offset(0.0, 0.0)));
- // double l = topLeft.dx;
- // double t = topLeft.dy;
- // double r = bottomRight.dx;
- // double b = bottomRight.dy;
- double space = 0 ;
- // if (l == 0 || t == 0 || r == 0 || b == 0) {
- // space = 0;
- // }
+
Rect rect = Rect.fromLTRB(
- topLeft.dx - space,
- topLeft.dy - space,
- bottomRight.dx + space,
- bottomRight.dy + space,
+ topLeft.dx,
+ topLeft.dy,
+ bottomRight.dx,
+ bottomRight.dy,
);
return rect;
}
+ ///Get the bottom position of the widget
double getBottom() {
RenderBox box = key.currentContext.findRenderObject();
final bottomRight =
@@ -33,18 +29,21 @@ class GetPosition {
return bottomRight.dy;
}
+ ///Get the top position of the widget
double getTop() {
RenderBox box = key.currentContext.findRenderObject();
final topLeft = box.size.topLeft(box.localToGlobal(const Offset(0.0, 0.0)));
return topLeft.dy;
}
+ ///Get the left position of the widget
double getLeft() {
RenderBox box = key.currentContext.findRenderObject();
final topLeft = box.size.topLeft(box.localToGlobal(const Offset(0.0, 0.0)));
return topLeft.dx;
}
+ ///Get the right position of the widget
double getRight() {
RenderBox box = key.currentContext.findRenderObject();
final bottomRight =
diff --git a/lib/layout_overlays.dart b/lib/layout_overlays.dart
new file mode 100644
index 00000000..49f0052e
--- /dev/null
+++ b/lib/layout_overlays.dart
@@ -0,0 +1,172 @@
+import 'package:flutter/material.dart';
+
+/// Displays an overlay Widget anchored directly above the center of this
+/// [AnchoredOverlay].
+///
+/// The overlay Widget is created by invoking the provided [overlayBuilder].
+///
+/// The [anchor] position is provided to the [overlayBuilder], but the builder
+/// does not have to respect it. In other words, the [overlayBuilder] can
+/// interpret the meaning of "anchor" however it wants - the overlay will not
+/// be forced to be centered about the [anchor].
+///
+/// The overlay built by this [AnchoredOverlay] can be conditionally shown
+/// and hidden by settings the [showOverlay] property to true or false.
+///
+/// The [overlayBuilder] is invoked every time this Widget is rebuilt.
+///
+class AnchoredOverlay extends StatelessWidget {
+ final bool showOverlay;
+ final Widget Function(BuildContext, Rect anchorBounds, Offset anchor)
+ overlayBuilder;
+ final Widget child;
+
+ AnchoredOverlay({
+ key,
+ this.showOverlay = false,
+ this.overlayBuilder,
+ this.child,
+ }) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ return LayoutBuilder(
+ builder: (BuildContext context, BoxConstraints constraints) {
+ return OverlayBuilder(
+ showOverlay: showOverlay,
+ overlayBuilder: (BuildContext overlayContext) {
+ // To calculate the "anchor" point we grab the render box of
+ // our parent Container and then we find the center of that box.
+ RenderBox box = context.findRenderObject() as RenderBox;
+ final topLeft =
+ box.size.topLeft(box.localToGlobal(const Offset(0.0, 0.0)));
+ final bottomRight =
+ box.size.bottomRight(box.localToGlobal(const Offset(0.0, 0.0)));
+ final Rect anchorBounds = Rect.fromLTRB(
+ topLeft.dx,
+ topLeft.dy,
+ bottomRight.dx,
+ bottomRight.dy,
+ );
+ final anchorCenter = box.size.center(topLeft);
+ return overlayBuilder(overlayContext, anchorBounds, anchorCenter);
+ },
+ child: child,
+ );
+ },
+ );
+ }
+}
+
+//
+// Displays an overlay Widget as constructed by the given [overlayBuilder].
+//
+// The overlay built by the [overlayBuilder] can be conditionally shown and hidden by settings the [showOverlay]
+// property to true or false.
+//
+// The [overlayBuilder] is invoked every time this Widget is rebuilt.
+//
+// Implementation note: the reason we rebuild the overlay every time our state changes is because there doesn't seem
+// to be any better way to invalidate the overlay itself than to invalidate this Widget.
+// Remember, overlay Widgets exist in [OverlayEntry]s which are inaccessible to outside Widgets.
+// But if a better approach is found then feel free to use it.
+//
+class OverlayBuilder extends StatefulWidget {
+ final bool showOverlay;
+ final Widget Function(BuildContext) overlayBuilder;
+ final Widget child;
+
+ OverlayBuilder({
+ key,
+ this.showOverlay = false,
+ this.overlayBuilder,
+ this.child,
+ }) : super(key: key);
+
+ @override
+ _OverlayBuilderState createState() => _OverlayBuilderState();
+}
+
+class _OverlayBuilderState extends State {
+ OverlayEntry _overlayEntry;
+
+ @override
+ void initState() {
+ super.initState();
+
+ if (widget.showOverlay) {
+ WidgetsBinding.instance.addPostFrameCallback((_) => showOverlay());
+ }
+ }
+
+ @override
+ void didUpdateWidget(OverlayBuilder oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ WidgetsBinding.instance.addPostFrameCallback((_) => syncWidgetAndOverlay());
+ }
+
+ @override
+ void reassemble() {
+ super.reassemble();
+ WidgetsBinding.instance.addPostFrameCallback((_) => syncWidgetAndOverlay());
+ }
+
+ @override
+ void dispose() {
+ if (isShowingOverlay()) {
+ hideOverlay();
+ }
+
+ super.dispose();
+ }
+
+ bool isShowingOverlay() => _overlayEntry != null;
+
+ void showOverlay() {
+ if (_overlayEntry == null) {
+ // Create the overlay.
+ _overlayEntry = OverlayEntry(
+ builder: widget.overlayBuilder,
+ );
+ addToOverlay(_overlayEntry);
+ } else {
+ // Rebuild overlay.
+ buildOverlay();
+ }
+ }
+
+ void addToOverlay(OverlayEntry overlayEntry) async {
+ Overlay.of(context).insert(overlayEntry);
+ final overlay = Overlay.of(context);
+ if (overlayEntry == null)
+ WidgetsBinding.instance
+ .addPostFrameCallback((_) => overlay.insert(overlayEntry));
+ }
+
+ void hideOverlay() {
+ if (_overlayEntry != null) {
+ _overlayEntry.remove();
+ _overlayEntry = null;
+ }
+ }
+
+ void syncWidgetAndOverlay() {
+ if (isShowingOverlay() && !widget.showOverlay) {
+ hideOverlay();
+ } else if (!isShowingOverlay() && widget.showOverlay) {
+ showOverlay();
+ }
+ }
+
+ void buildOverlay() async {
+ WidgetsBinding.instance
+ .addPostFrameCallback((_) => _overlayEntry?.markNeedsBuild());
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ buildOverlay();
+
+ return widget.child;
+ }
+}
diff --git a/lib/showcase.dart b/lib/showcase.dart
index 42ed2efc..976f5675 100644
--- a/lib/showcase.dart
+++ b/lib/showcase.dart
@@ -3,7 +3,10 @@ import 'package:flutter/material.dart';
class ShowCase extends StatefulWidget {
final Widget child;
- const ShowCase({Key key, @required this.child}) : super(key: key);
+ const ShowCase({
+ Key key,
+ @required this.child,
+ }) : super(key: key);
static activeTargetWidget(BuildContext context) {
return (context.inheritFromWidgetOfExactType(_InheritedShowCaseView)
diff --git a/lib/target_widget.dart b/lib/target_widget.dart
index c481aeeb..2d319328 100644
--- a/lib/target_widget.dart
+++ b/lib/target_widget.dart
@@ -5,6 +5,7 @@ import 'package:showcaseview/custom_paint.dart';
import 'package:showcaseview/tooltip_widget.dart';
import 'get_position.dart';
+import 'layout_overlays.dart';
class TargetWidget extends StatefulWidget {
final Widget child;
@@ -21,30 +22,34 @@ class TargetWidget extends StatefulWidget {
final Color textColor;
final bool showArrow;
final double cHeight;
- final double cWidht;
+ final double cWidth;
+ final Duration slideDuration;
const TargetWidget({
this.key,
@required this.child,
- this.container,
@required this.title,
@required this.description,
+ this.container,
this.shapeBorder,
this.overlayColor,
this.overlayOpacity,
this.titleTextStyle,
this.descTextStyle,
- this.tooltipColor,
- this.textColor,
+ this.tooltipColor = Colors.white,
+ this.textColor = Colors.black,
this.showArrow,
this.cHeight,
- this.cWidht
+ this.cWidth,
+ this.slideDuration = const Duration(milliseconds: 2000),
});
const TargetWidget.withWidget({
this.key,
@required this.child,
@required this.container,
+ @required this.cHeight,
+ @required this.cWidth,
this.title,
this.description,
this.shapeBorder,
@@ -52,11 +57,10 @@ class TargetWidget extends StatefulWidget {
this.overlayOpacity,
this.titleTextStyle,
this.descTextStyle,
- this.tooltipColor,
- this.textColor,
- this.showArrow,
- @required this.cHeight,
- @required this.cWidht
+ this.tooltipColor = Colors.white,
+ this.textColor = Colors.black,
+ this.showArrow = false,
+ this.slideDuration = const Duration(milliseconds: 2000),
});
@override
@@ -67,30 +71,16 @@ class _TargetWidgetState extends State
with TickerProviderStateMixin {
bool _showShowCase = false;
Animation _slideAnimation;
- Animation _widthAnimation;
-
AnimationController _slideAnimationController;
- AnimationController _widthAnimationController;
GetPosition position;
@override
void initState() {
super.initState();
- _widthAnimationController = AnimationController(
- duration: const Duration(milliseconds: 2000), vsync: this);
-
- _widthAnimation = CurvedAnimation(
- parent: _widthAnimationController,
- curve: Curves.easeInOut,
- );
-
- _widthAnimationController.addListener(() {
- setState(() {});
- });
_slideAnimationController = AnimationController(
- duration: const Duration(milliseconds: 2000),
+ duration: widget.slideDuration,
vsync: this,
)..addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.completed) {
@@ -105,6 +95,7 @@ class _TargetWidgetState extends State
parent: _slideAnimationController,
curve: Curves.easeInOut,
);
+
position = GetPosition(key: widget.key);
}
@@ -112,7 +103,6 @@ class _TargetWidgetState extends State
void dispose() {
super.dispose();
_slideAnimationController.dispose();
- _widthAnimationController.dispose();
}
@override
@@ -121,6 +111,9 @@ class _TargetWidgetState extends State
showOverlay();
}
+ ///
+ /// show overlay if there is any target widget
+ ///
void showOverlay() {
GlobalKey activeStep = ShowCase.activeTargetWidget(context);
setState(() {
@@ -129,7 +122,6 @@ class _TargetWidgetState extends State
if (activeStep == widget.key) {
_slideAnimationController.forward();
- _widthAnimationController.forward();
}
}
@@ -144,18 +136,9 @@ class _TargetWidgetState extends State
);
}
- // _onTargetTap() {
- // ShowCase.dismiss(context);
- // setState(() {
- // _showShowCase = false;
- // print(_showShowCase);
- // });
- // }
-
_nextIfAny() {
ShowCase.completed(context, widget.key);
_slideAnimationController.forward();
- _widthAnimationController.forward();
}
buildOverlayOnTarget(
@@ -175,7 +158,6 @@ class _TargetWidgetState extends State
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
- // color: Colors.grey.withOpacity(0.3),
child: CustomPaint(
painter: ShapePainter(
opacity: widget.overlayOpacity ?? 0.7,
@@ -188,7 +170,6 @@ class _TargetWidgetState extends State
_TargetWidget(
offset: offset,
size: size,
- widthAnimation: _widthAnimation,
onTap: _nextIfAny,
shapeBorder: widget.shapeBorder,
),
@@ -202,18 +183,17 @@ class _TargetWidgetState extends State
titleTextStyle: widget.titleTextStyle,
descTextStyle: widget.descTextStyle,
container: widget.container,
- tooltipColor: widget.tooltipColor ?? Colors.white,
- textColor: widget.textColor ?? Colors.black,
+ tooltipColor: widget.tooltipColor,
+ textColor: widget.textColor,
showArrow: widget.showArrow ?? true,
- cHeight: widget.cHeight,
- cWidht: widget.cWidht,
+ contentHeight: widget.cHeight,
+ contentWidth: widget.cWidth,
),
],
),
);
}
-
class _TargetWidget extends StatelessWidget {
final Offset offset;
final Size size;
@@ -236,19 +216,16 @@ class _TargetWidget extends StatelessWidget {
top: offset.dy,
left: offset.dx,
child: FractionalTranslation(
- translation: Offset(-0.5, -0.5),
+ translation: const Offset(-0.5, -0.5),
child: GestureDetector(
onTap: onTap,
child: Container(
height: size.height + 16,
- width: Tween(
- begin: 0,
- end: size.width + 16, //controls the opening of the slice
- ).animate(widthAnimation).value,
+ width: size.width + 16,
decoration: ShapeDecoration(
shape: shapeBorder ??
RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
+ borderRadius: const BorderRadius.all(
Radius.circular(8),
),
),
@@ -259,149 +236,3 @@ class _TargetWidget extends StatelessWidget {
);
}
}
-
-class AnchoredOverlay extends StatelessWidget {
- final bool showOverlay;
- final Widget Function(BuildContext, Rect anchorBounds, Offset anchor)
- overlayBuilder;
- final Widget child;
-
- AnchoredOverlay({
- key,
- this.showOverlay = false,
- this.overlayBuilder,
- this.child,
- }) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- return LayoutBuilder(
- builder: (BuildContext context, BoxConstraints constraints) {
- return OverlayBuilder(
- showOverlay: showOverlay,
- overlayBuilder: (BuildContext overlayContext) {
- // To calculate the "anchor" point we grab the render box of
- // our parent Container and then we find the center of that box.
- RenderBox box = context.findRenderObject() as RenderBox;
- final topLeft =
- box.size.topLeft(box.localToGlobal(const Offset(0.0, 0.0)));
- final bottomRight =
- box.size.bottomRight(box.localToGlobal(const Offset(0.0, 0.0)));
- final Rect anchorBounds = Rect.fromLTRB(
- topLeft.dx,
- topLeft.dy,
- bottomRight.dx,
- bottomRight.dy,
- );
- final anchorCenter = box.size.center(topLeft);
- return overlayBuilder(overlayContext, anchorBounds, anchorCenter);
- },
- child: child,
- );
- },
- );
- }
-}
-
-class OverlayBuilder extends StatefulWidget {
- final bool showOverlay;
- final Widget Function(BuildContext) overlayBuilder;
- final Widget child;
-
- OverlayBuilder({
- key,
- this.showOverlay = false,
- this.overlayBuilder,
- this.child,
- }) : super(key: key);
-
- @override
- _OverlayBuilderState createState() => _OverlayBuilderState();
-}
-
-class _OverlayBuilderState extends State {
- OverlayEntry _overlayEntry;
-
- @override
- void initState() {
- super.initState();
-
- if (widget.showOverlay) {
- // showOverlay();
- WidgetsBinding.instance.addPostFrameCallback((_) => showOverlay());
- }
- }
-
- @override
- void didUpdateWidget(OverlayBuilder oldWidget) {
- super.didUpdateWidget(oldWidget);
- // syncWidgetAndOverlay();
- WidgetsBinding.instance.addPostFrameCallback((_) => syncWidgetAndOverlay());
- }
-
- @override
- void reassemble() {
- super.reassemble();
- // syncWidgetAndOverlay();
- WidgetsBinding.instance.addPostFrameCallback((_) => syncWidgetAndOverlay());
- }
-
- @override
- void dispose() {
- if (isShowingOverlay()) {
- hideOverlay();
- }
-
- super.dispose();
- }
-
- bool isShowingOverlay() => _overlayEntry != null;
-
- void showOverlay() {
- if (_overlayEntry == null) {
- // Create the overlay.
- _overlayEntry = OverlayEntry(
- builder: widget.overlayBuilder,
- );
- addToOverlay(_overlayEntry);
- } else {
- // Rebuild overlay.
- buildOverlay();
- }
- }
-
- void addToOverlay(OverlayEntry overlayEntry) async {
- Overlay.of(context).insert(overlayEntry);
- final overlay = Overlay.of(context);
- if (overlayEntry == null)
- WidgetsBinding.instance
- .addPostFrameCallback((_) => overlay.insert(overlayEntry));
- }
-
- void hideOverlay() {
- if (_overlayEntry != null) {
- _overlayEntry.remove();
- _overlayEntry = null;
- }
- }
-
- void syncWidgetAndOverlay() {
- if (isShowingOverlay() && !widget.showOverlay) {
- hideOverlay();
- } else if (!isShowingOverlay() && widget.showOverlay) {
- showOverlay();
- }
- }
-
- void buildOverlay() async {
- WidgetsBinding.instance
- .addPostFrameCallback((_) => _overlayEntry?.markNeedsBuild());
- }
-
- @override
- Widget build(BuildContext context) {
- buildOverlay();
-
- return widget.child;
- }
-}
diff --git a/lib/tooltip_widget.dart b/lib/tooltip_widget.dart
index 631588a6..c25fed61 100644
--- a/lib/tooltip_widget.dart
+++ b/lib/tooltip_widget.dart
@@ -14,39 +14,40 @@ class Content extends StatelessWidget {
final Color tooltipColor;
final Color textColor;
final bool showArrow;
- final double cHeight;
- final double cWidht;
+ final double contentHeight;
+ final double contentWidth;
static bool isArrowUp;
- Content(
- {this.position,
- this.offset,
- this.screenSize,
- this.title,
- this.description,
- this.animationOffset,
- this.titleTextStyle,
- this.descTextStyle,
- this.container,
- this.tooltipColor,
- this.textColor,
- this.showArrow,
- this.cHeight,
- this.cWidht});
+ Content({
+ this.position,
+ this.offset,
+ this.screenSize,
+ this.title,
+ this.description,
+ this.animationOffset,
+ this.titleTextStyle,
+ this.descTextStyle,
+ this.container,
+ this.tooltipColor,
+ this.textColor,
+ this.showArrow,
+ this.contentHeight,
+ this.contentWidth,
+ });
bool isCloseToTopOrBottom(Offset position) {
double height = 120;
- if (cHeight != null) {
- height = cHeight;
+ if (contentHeight != null) {
+ height = contentHeight;
}
return (screenSize.height - position.dy) <= height;
}
String findPositionForContent(Offset position) {
if (isCloseToTopOrBottom(position)) {
- return 'A';
+ return 'ABOVE';
} else {
- return 'B';
+ return 'BELOW';
}
}
@@ -61,13 +62,13 @@ class Content extends StatelessWidget {
}
bool _isLeft() {
- double screenWidht = screenSize.width / 3;
- return !(screenWidht <= position.getCenter());
+ double screenWidth = screenSize.width / 3;
+ return !(screenWidth <= position.getCenter());
}
bool _isRight() {
- double screenWidht = screenSize.width / 3;
- return ((screenWidht * 2) <= position.getCenter());
+ double screenWidth = screenSize.width / 3;
+ return ((screenWidth * 2) <= position.getCenter());
}
double _getLeft() {
@@ -102,10 +103,10 @@ class Content extends StatelessWidget {
}
double _getSpace() {
- double space = position.getCenter() - (cWidht / 2);
- if (space + cWidht > screenSize.width) {
- space = screenSize.width - cWidht - 8;
- } else if (space < (cWidht / 2)) {
+ double space = position.getCenter() - (contentWidth / 2);
+ if (space + contentWidth > screenSize.width) {
+ space = screenSize.width - contentWidth - 8;
+ } else if (space < (contentWidth / 2)) {
space = 16;
}
return space;
@@ -114,19 +115,21 @@ class Content extends StatelessWidget {
@override
Widget build(BuildContext context) {
final contentOrientation = findPositionForContent(offset);
- final contentOffsetMultiplier = contentOrientation == "B" ? 1.0 : -1.0;
+ final contentOffsetMultiplier = contentOrientation == "BELOW" ? 1.0 : -1.0;
isArrowUp = contentOffsetMultiplier == 1.0 ? true : false;
+
final contentY = isArrowUp
? position.getBottom() + (contentOffsetMultiplier * 3)
: position.getTop() + (contentOffsetMultiplier * 3);
+
final contentFractionalOffset = contentOffsetMultiplier.clamp(-1.0, 0.0);
- double padingTop = isArrowUp ? 22 : 0;
- double padingBottom = isArrowUp ? 0 : 27;
+ double paddingTop = isArrowUp ? 22 : 0;
+ double paddingBottom = isArrowUp ? 0 : 27;
if (!showArrow) {
- padingTop = 10;
- padingBottom = 10;
+ paddingTop = 10;
+ paddingBottom = 10;
}
if (container == null) {
@@ -148,9 +151,9 @@ class Content extends StatelessWidget {
color: Colors.transparent,
child: Container(
padding:
- EdgeInsets.only(top: padingTop, bottom: padingBottom),
+ EdgeInsets.only(top: paddingTop, bottom: paddingBottom),
child: ClipRRect(
- borderRadius: BorderRadius.circular(8.0),
+ borderRadius: BorderRadius.circular(8),
child: Container(
width: _getTooltipWidth(),
padding: EdgeInsets.only(
@@ -207,11 +210,13 @@ class Content extends StatelessWidget {
child: Center(
child: Container(
padding: EdgeInsets.only(
- top: padingTop, bottom: padingBottom),
+ top: paddingTop,
+ bottom: paddingBottom,
+ ),
child: Container(
color: Colors.transparent,
- height: cHeight,
- width: cWidht,
+ height: contentHeight,
+ width: contentWidth,
child: Center(
child: container,
),
@@ -232,26 +237,27 @@ class Content extends StatelessWidget {
final contentFractionalOffset = contentOffsetMultiplier.clamp(-1.0, 0.0);
return Positioned(
top: isArrowUp ? position.getBottom() : position.getTop(),
- left: position.getCenter() - 25,
+ left: position.getCenter() - 24,
child: FractionalTranslation(
- translation: Offset(0.0, contentFractionalOffset),
- child: SlideTransition(
- position: Tween(
- begin: Offset(0.0, contentFractionalOffset / 5),
- end: Offset(0.0, 0.100),
- ).animate(animationOffset),
- child: isArrowUp
- ? Icon(
- Icons.arrow_drop_up,
- color: tooltipColor,
- size: 50.0,
- )
- : Icon(
- Icons.arrow_drop_down,
- color: tooltipColor,
- size: 50.0,
- ),
- )),
+ translation: Offset(0.0, contentFractionalOffset),
+ child: SlideTransition(
+ position: Tween(
+ begin: Offset(0.0, contentFractionalOffset / 5),
+ end: Offset(0.0, 0.150),
+ ).animate(animationOffset),
+ child: isArrowUp
+ ? Icon(
+ Icons.arrow_drop_up,
+ color: tooltipColor,
+ size: 50,
+ )
+ : Icon(
+ Icons.arrow_drop_down,
+ color: tooltipColor,
+ size: 50,
+ ),
+ ),
+ ),
);
}
}
diff --git a/pubspec.yaml b/pubspec.yaml
index b2f4c45b..44c5f3e4 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,8 +1,9 @@
name: showcaseview
-description: A new Flutter package.
-version: 0.0.1
-author:
-homepage:
+description: A Flutter package to Showcase/Highlight widgets step by step.
+version: 0.1.0
+author: Simform solutions
+homepage: https://github.com/simformsolutions/flutter_showcaseview
+issue_tracker: https://github.com/simformsolutions/flutter_showcaseview/issues
environment:
sdk: ">=2.1.0 <3.0.0"
diff --git a/showcaseview.iml b/showcaseview.iml
deleted file mode 100644
index 70b4a9bf..00000000
--- a/showcaseview.iml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file