forked from RafaelBarbosatec/tutorial_coach_mark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ab2c2a
commit a9c2bdc
Showing
11 changed files
with
316 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
import 'package:flutter/widgets.dart'; | ||
|
||
class AnimetedFocusLight extends StatefulWidget { | ||
@override | ||
_AnimetedFocusLightState createState() => _AnimetedFocusLightState(); | ||
} | ||
|
||
class _AnimetedFocusLightState extends State<AnimetedFocusLight> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Container(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
import 'package:flutter/widgets.dart'; | ||
|
||
enum AlignContent{ | ||
top, | ||
bottom, | ||
left, | ||
right | ||
} | ||
|
||
class ContentTarget{ | ||
|
||
final AlignContent align; | ||
final Widget child; | ||
|
||
ContentTarget({this.align = AlignContent.bottom, this.child}):assert(child != null); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'dart:math'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/rendering.dart'; | ||
|
||
class LightPaint extends CustomPainter { | ||
|
||
final double progress; | ||
final Offset positioned; | ||
final double sizeCircle; | ||
|
||
Paint _paintFocus; | ||
|
||
LightPaint(this.progress, this.positioned, this.sizeCircle){ | ||
_paintFocus = Paint() | ||
..color = Colors.transparent | ||
..blendMode = BlendMode.clear; | ||
} | ||
|
||
@override | ||
void paint(Canvas canvas, Size size) { | ||
|
||
canvas.saveLayer(Offset.zero & size, Paint()); | ||
canvas.drawColor(Colors.black.withOpacity(0.8), BlendMode.dstATop); | ||
|
||
double sizeFocus = (size.height * 1.4) * (1-progress) + sizeCircle; | ||
double radius = min(sizeFocus,sizeFocus); | ||
|
||
canvas.drawCircle( | ||
positioned, | ||
radius, | ||
_paintFocus | ||
); | ||
canvas.restore(); | ||
|
||
} | ||
|
||
@override | ||
bool shouldRepaint(LightPaint oldDelegate) { | ||
return oldDelegate.progress != progress; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:tutorial_coach_mark/content_target.dart'; | ||
import 'package:tutorial_coach_mark/target_position.dart'; | ||
|
||
class TargetFocus{ | ||
|
||
final GlobalKey keyTarget; | ||
final TargetPosition targetPosition; | ||
final List<ContentTarget> contents; | ||
|
||
TargetFocus({this.keyTarget, this.targetPosition, this.contents}):assert(keyTarget != null || targetPosition != null); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
import 'dart:ui'; | ||
|
||
class TargetPosition{ | ||
final Size size; | ||
final Offset offset; | ||
|
||
TargetPosition(this.size, this.offset); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,30 @@ | ||
library tutorial_coach_mark; | ||
import 'package:flutter/material.dart'; | ||
import 'package:tutorial_coach_mark/tutorial_coach_mark_widget.dart'; | ||
|
||
/// A Calculator. | ||
class Calculator { | ||
/// Returns [value] plus 1. | ||
int addOne(int value) => value + 1; | ||
class TutorialCoachMark { | ||
final BuildContext _context; | ||
|
||
OverlayEntry _overlayEntry; | ||
|
||
TutorialCoachMark( | ||
this._context,); | ||
|
||
OverlayEntry _buildOverlay() { | ||
return OverlayEntry(builder: (context) { | ||
return TutorialCoachMarkWidget(); | ||
}); | ||
} | ||
|
||
void show() { | ||
if (_overlayEntry == null) { | ||
_overlayEntry = _buildOverlay(); | ||
Overlay.of(_context).insert(_overlayEntry); | ||
} | ||
} | ||
|
||
void _hide() { | ||
_overlayEntry?.remove(); | ||
_overlayEntry = null; | ||
} | ||
} |
Oops, something went wrong.