Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨Add staticContainer into ToolTipWidget for a custom tooltip th… #396

Conversation

MichaelCadavillo
Copy link
Contributor

@MichaelCadavillo MichaelCadavillo commented Sep 21, 2023

feat: ✨Provided a parameter to add a static widget which can be placed anywhere on the screen and is not affected by the animation.

Description

Implemented a FloatingActionWidget to show static widget at any place on the screen. Primarily used for when we want to show another widget (perhaps a 'Skip Showcases' button) which is not affected by the animation that is given to the tooltip.
We have also added a directional constructor for the use cases where directionality is important.

Checklist

  • The title of my PR starts with a [Conventional Commit] prefix (fix:, feat:, docs: etc).
  • I have followed the [Contributor Guide] when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #395

Sample implementation

Screen_recording_20241203_180104.webm

@erperejildo
Copy link

I need to integrate a skip button and I don't want to rely on custom buttons for now if this is going to be implemented. This was opened 7 months ago. Any plan to merge this soon?

@erperejildo
Copy link

@aditya-css any update?

@mgaucher
Copy link

mgaucher commented Jun 4, 2024

Is it possible to add it for the Showcase() constructor too ? (when container is null)

@Juliocsreis Juliocsreis mentioned this pull request Sep 4, 2024
7 tasks
@omi-jeybsbaterna
Copy link

any update on this PR?

@Sahil-Simform Sahil-Simform force-pushed the feature/custom_static_widget branch 3 times, most recently from 8a55dac to f2d362e Compare October 22, 2024 09:24
@Sahil-Simform Sahil-Simform force-pushed the feature/custom_static_widget branch 2 times, most recently from 716860e to e612eb9 Compare December 2, 2024 13:10
Copy link
Collaborator

@aditya-css aditya-css left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also consider providing an option to disable the global floating action widget for particular showcase.

README.md Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update for globalFloatingActionWidget as well.

Comment on lines 264 to 298
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(
Theme.of(context).primaryColor),
shape: MaterialStateProperty.all<
RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side: BorderSide(
color: Theme.of(context).primaryColor,
width: 2.0,
),
),
),
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this minimal.

Comment on lines 39 to 40
double? left;
double? right;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have default values.

@Sahil-Simform Sahil-Simform force-pushed the feature/custom_static_widget branch 5 times, most recently from bff83f1 to 1e054f1 Compare December 3, 2024 07:03
@@ -777,6 +785,8 @@ class _ShowcaseState extends State<Showcase> {
titleTextStyle: widget.titleTextStyle,
descTextStyle: widget.descTextStyle,
container: widget.container,
floatingActionWidget: widget.floatingActionWidget ??
showCaseWidgetState.globalFloatingActionWidget?.call(context),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take this as late class member as to avoid calling this function over and over again.

lib/src/showcase_widget.dart Show resolved Hide resolved
/// Return a [widget.globalFloatingActionWidget] if not need to hide this for
/// current showcase
FloatingActionWidget Function(BuildContext)? get globalFloatingActionWidget =>
widget.hideFloatingActionWidgetForShowcase.contains(ids![activeWidgetId!])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid force null checks.

@@ -651,8 +654,22 @@ class _ToolTipWidgetState extends State<ToolTipWidget>
),
),
);

if (widget.floatingActionWidget != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please prefer positive condition.

@@ -187,6 +202,13 @@ class ShowCaseWidgetState extends State<ShowCaseWidget> {
/// Returns value of [ShowCaseWidget.blurValue]
double get blurValue => widget.blurValue;

/// Return a [widget.globalFloatingActionWidget] if not need to hide this for
/// current showcase
FloatingActionWidget Function(BuildContext)? get globalFloatingActionWidget =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use typedef.

@Sahil-Simform Sahil-Simform force-pushed the feature/custom_static_widget branch 2 times, most recently from e0a2d12 to 7dfee8b Compare December 3, 2024 11:26
child: Padding(
padding: const EdgeInsets.all(16.0),
child: ElevatedButton(
onPressed: () => ShowCaseWidget.of(showcaseContext).dismiss(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use tear-off

lib/src/tooltip_widget.dart Show resolved Hide resolved
@Sahil-Simform Sahil-Simform force-pushed the feature/custom_static_widget branch 4 times, most recently from 5db4ffd to 0ea94f5 Compare December 3, 2024 13:36
/// This Stores keys of showcase for which we will hide the
/// [globalFloatingActionWidget].
late var _hideFloatingWidgetKeys = {
for (var item in widget.hideFloatingActionWidgetForShowcase) item: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this final.

@@ -184,9 +203,37 @@ class ShowCaseWidgetState extends State<ShowCaseWidget> {

bool get isShowCaseCompleted => ids == null && activeWidgetId == null;

List<GlobalKey> get hideFloatingActionWidgetForShowcase =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this as to make it differ from the function.

void hideFloatingActionWidgetForKeys(
List<GlobalKey> updatedList,
) {
_hideFloatingWidgetKeys = {for (var item in updatedList) item: true};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this final.

@Sahil-Simform Sahil-Simform force-pushed the feature/custom_static_widget branch 2 times, most recently from da37b4e to b55f5cf Compare December 4, 2024 05:27
@nanox77
Copy link

nanox77 commented Dec 26, 2024

Any update? Changes is already approved 😄

@Sahil-Simform Sahil-Simform force-pushed the feature/custom_static_widget branch from b55f5cf to e939ff9 Compare December 31, 2024 05:15
MichaelCadavillo and others added 3 commits December 31, 2024 10:46
…at can be placed anywhere on screen and is not affected by the animation

Signed-off-by: Michael Angelo Cadavillo <[email protected]>
…oatingAction Widget for the default showcase widget
@Sahil-Simform Sahil-Simform force-pushed the feature/custom_static_widget branch from e939ff9 to a87ab7f Compare December 31, 2024 05:18
@aditya-css aditya-css merged commit 91c519d into SimformSolutionsPvtLtd:master Dec 31, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom non-animating widget of Showcase.withWidget
8 participants