-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added `toolTipAction` parameter in `Showcase` which is used to get action widget configuration and defaults to `null` - Added `DefaultToolTipActionWidget` class for default tooltip action widgets
- Loading branch information
1 parent
c36c85a
commit 84a5883
Showing
6 changed files
with
270 additions
and
109 deletions.
There are no files selected for viewing
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
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
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
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,22 @@ | ||
// import 'package:flutter/material.dart'; | ||
// | ||
// /// This class is used to provide context of Showcase widget to Overlay so | ||
// /// that we can access ShowcaseWidget in widget tree from overlay. | ||
// class ShowcaseContextProvider extends InheritedWidget { | ||
// final BuildContext context; | ||
// | ||
// const ShowcaseContextProvider({ | ||
// Key? key, | ||
// required this.context, | ||
// required Widget child, | ||
// }) : super(key: key, child: child); | ||
// | ||
// static ShowcaseContextProvider? of(BuildContext context) { | ||
// final result = | ||
// context.dependOnInheritedWidgetOfExactType<ShowcaseContextProvider>(); | ||
// return result; | ||
// } | ||
// | ||
// @override | ||
// bool updateShouldNotify(ShowcaseContextProvider oldWidget) => false; | ||
// } |
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,81 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'showcase_widget.dart'; | ||
|
||
/// Default Tooltip action Widget Nav | ||
/// Shows tooltip navigation and index / count elements if the conditions are | ||
/// indicated. | ||
class DefaultToolTipActionWidget extends StatelessWidget { | ||
const DefaultToolTipActionWidget({ | ||
Key? key, | ||
required this.color, | ||
required this.showCaseWidgetState, | ||
this.padding = const EdgeInsets.only(top: 5), | ||
this.textStyle, | ||
this.iconSize, | ||
}) : super(key: key); | ||
|
||
final Color? color; | ||
final ShowCaseWidgetState showCaseWidgetState; | ||
final EdgeInsets padding; | ||
final TextStyle? textStyle; | ||
final double? iconSize; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
var ids = showCaseWidgetState.ids; | ||
var activeWidgetId = showCaseWidgetState.activeWidgetId; | ||
bool isFirstTip = activeWidgetId == 0; | ||
return Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
GestureDetector( | ||
behavior: HitTestBehavior.translucent, | ||
onTap: (isFirstTip) | ||
? null | ||
: () { | ||
showCaseWidgetState.previous(); | ||
}, | ||
child: Padding( | ||
padding: padding, | ||
child: Icon( | ||
Icons.keyboard_arrow_left, | ||
size: iconSize, | ||
color: (isFirstTip) | ||
? color?.withOpacity(0.3) ?? Colors.black26 | ||
: color, | ||
), | ||
), | ||
), | ||
if (ids != null && activeWidgetId != null) ...[ | ||
const SizedBox(width: 4.0), | ||
Padding( | ||
padding: padding, | ||
child: Text( | ||
"${activeWidgetId + 1} / ${ids.length}", | ||
style: textStyle ?? | ||
Theme.of(context).textTheme.bodyMedium?.copyWith( | ||
color: color, | ||
), | ||
), | ||
), | ||
const SizedBox(width: 4.0), | ||
], | ||
GestureDetector( | ||
behavior: HitTestBehavior.translucent, | ||
onTap: () { | ||
showCaseWidgetState.next(); | ||
}, | ||
child: Padding( | ||
padding: padding, | ||
child: Icon( | ||
Icons.keyboard_arrow_right, | ||
color: color, | ||
size: iconSize, | ||
), | ||
), | ||
), | ||
], | ||
); | ||
} | ||
} |
Oops, something went wrong.