SimformSolutionsPvtLtd / flutter_showcaseview

Flutter plugin that allows you to showcase your features on flutter application. 👌🔝🎉
https://pub.dev/packages/showcaseview
MIT License
1.49k stars 433 forks source link

Bug when I used show case #372

Closed neonlee closed 1 year ago

neonlee commented 1 year ago

I'm using gorouter as navigation and I've implemented the showcase to do a tutorial on the app's usability, but it doesn't work.

I'm using the latest version of flutter and the latest version of showcase;

I did a decoupling of the showcase;

any tips on how to proceed?

ujas-m-simformsolutions commented 1 year ago

can you please share your implementation and also error you are getting

neonlee commented 1 year ago

import 'package:app/core/drivers/localstorage/local_storage.dart'; import 'package:app/core/ui/components/cards/widget_description.dart'; import 'package:flutter/material.dart'; import 'package:showcaseview/showcaseview.dart'; import 'package:get_it/get_it.dart';

class CustomShowCase { static bool firstAccess = false; CustomShowCase.();

static void setFistAccess(bool value) { _firstAccess = value; }

static Widget showCaseWidget({ required Widget widget, }) { return ShowCaseWidget( enableShowcase: _firstAccess, onFinish: () { LocalStorage localStorage = GetIt.I.get(); localStorage.save(completeFirstAccess, 'true'); _firstAccess = false; }, onComplete: (index, key) {}, builder: Builder( builder: (context) { return widget; }, ), ); }

static const _height = 100.0; static const _width = 150.0;

static Widget showCaseWithWidget({ required GlobalKey key, required Widget widget, void Function()? onTargetClick, String? textBody, String? textTitle, double height = _height, double width = _width, }) { return Showcase.withWidget( key: key, container: WidgetDescription( textBody: textBody, textTitle: textTitle, height: height, width: width, ), height: height, width: width, onTargetClick: onTargetClick, child: widget, ); }

static Widget showCase({ required GlobalKey key, required Widget widget, required String textBody, void Function()? onToolTipClick, }) { return Showcase( key: key, description: textBody, onToolTipClick: onToolTipClick, child: widget, ); }

static void startShowCase( BuildContext context, List<GlobalKey<State>> widgetIds, ) { if (_firstAccess) { ShowCaseWidget.of(context).startShowCase(widgetIds); } }

static void next(BuildContext context) { ShowCaseWidget.of(context).next(); }

static void previous(BuildContext context) { ShowCaseWidget.of(context).previous(); } }

I did a decoupling of the showcase; in this file, after I try to call this in my routes

GoRoute( path: NamedRoutes.capturedRoute, builder: (BuildContext context, GoRouterState state) => CustomShowCase.showCaseWidget( widget: const ScreenCaptured(), ), ),

but not working. nothing appears on the screen.

I try to call this CustomShowCase.showCaseWidget in my screen to, but no appears to.

ujas-m-simformsolutions commented 1 year ago

This issue looks like can be resolved resolved with suggestion from this #378. I'm going to close this issue but feel free to open a new one.