-
Notifications
You must be signed in to change notification settings - Fork 447
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 f4a88fb
Showing
5 changed files
with
225 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,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.