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

Exception: Please provide ShowCaseView context #29

Closed
cgowthamanmca opened this issue Nov 5, 2019 · 8 comments
Closed

Exception: Please provide ShowCaseView context #29

cgowthamanmca opened this issue Nov 5, 2019 · 8 comments

Comments

@cgowthamanmca
Copy link

cgowthamanmca commented Nov 5, 2019

@OverRide
void initState() {
bloc = BlocProvider.of(context);
homeBloc = HomeFeedBloc(authenticationBloc: bloc.authenticationBloc);
profileBloc = ProfileBloc();
controller = PageController(initialPage: 0, keepPage: true);
trendBloc = TrendBloc();
affiliatedProductMenuBloc = AffiliatedProductMenuBloc();
super.initState();
WidgetsBinding.instance
.addPostFrameCallback((
) => ShowCaseWidget.of(context).startShowCase([
_one,
]));
}
@OverRide
Widget build(BuildContext context) {
return ShowCaseWidget(
builder: Builder(
builder: (context) => Scaffold(
backgroundColor: ColorResource.BLACKF9,
bottomNavigationBar: FABBottomAppBar(
color: ColorResource.BLACKB7,
selectedColor: Colors.black,
notchedShape: CircularNotchedRectangle(),
onTabSelected: (page) {
setState(() {
selectedIndex = page;
});
if (page == 0) {
if (!(homeBloc.state is HomeFeedDataLoadingState))
this.homeBloc.add(HomeFeedRefreshEvent());
}
bloc.add(HomeUserConatinerPageChangeEvent(page));
},
items: [
FABBottomAppBarItem(
iconData: Icons.home,
text: '',
color: selectedIndex == 0
? Colors.black
: ColorResource.BLACKB7),
FABBottomAppBarItem(
iconData: Icons.trending_up,
text: '',
color: selectedIndex == 1
? Colors.black
: ColorResource.BLACKB7),
FABBottomAppBarItem(
iconData: Icons.shopping_basket,
text: '',
color: selectedIndex == 2
? Colors.black
: ColorResource.BLACKB7),
FABBottomAppBarItem(
iconData: Icons.more_horiz,
text: '',
color: selectedIndex == 3
? Colors.black
: ColorResource.BLACKB7),
],
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
floatingActionButton: _buildFabImage(
context), // This trailing comma makes auto-formatting nicer for build methods.
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Colors.white,
elevation: 0.0,
centerTitle: true,
title: ToolbarTitle(
StringResource.APP_NAME,
font: Font.Yesteryear,
fontSize: 29,
),
actions: [
Image.asset(
ImageConstant.NOTIFICATION,
height: 18,
width: 18,
),
SizedBox(
width: 16,
),
InkWell(
onTap: () {
Navigator.of(context).pushNamed(AppRoutes.viewed_product);
},
child: Image.asset(
ImageConstant.HISTORY,
height: 17,
width: 19,
),
),
SizedBox(
width: 16,
)
],
),
body: WillPopScope(
onWillPop: onWillPop,
child: BlocListener(
bloc: bloc,
listener: (BuildContext context, HomeUserConatinerState state) {
if (state is HomeUserConatinerPageChangeState) {
_controller.animateToPage(bloc.page,
curve: Curves.linear,
duration: Duration(milliseconds: 250));
}
},
child: _buidPage(),
),
),
),
),
);

Widget _buildFabImage(BuildContext context) {
return Showcase(
key: _one,
description: 'Tap to check mail',
child: FloatingActionButton(
onPressed: () {
Navigator.pushNamed(context, AppRoutes.createPost,
arguments: homeBloc);
},
tooltip: 'Increment',
child: Image.asset(ImageConstant.POST_BUTTON),
elevation: 2.0,
));
}

this error:
ShowCaseWidget.of (package:showcaseview/showcase_widget.dart:21:7)
Syncing files to device vivo 1908...
I/flutter ( 6402): #1 _HomeUserContainerState.initState. (package:girlsourced/src/home/user/home_user_container/home_user_container.dart:68:53)
Syncing files to device vivo 1908...
I/flutter ( 6402): #2 SchedulerBinding._invokeFrameCallback
(package:flutter/src/scheduler/binding.dart:1033:15)
Syncing files to device vivo 1908...
I/flutter ( 6402): #3 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:983:9)
Syncing files to device vivo 1908...
I/flutter ( 6402): #4 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:891:5)
Syncing files to device vivo 1908...
I/flutter ( 6402): #5 _rootRun (dart:async/zone.dart:1124:13)
Syncing files to device vivo 1908...
I/flutter ( 6402): #6 _CustomZone.run (dart:async/zone.dart:1021:19)
Syncing files to device vivo 1908...
I/flutter ( 6402): #7 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
Syncing files to device vivo 1908...
I/flutter ( 6402): #8 _invoke (dart:ui/hooks.dart:249:10)
Syncing files to device vivo 1908...
I/flutter ( 6402): #9 _drawFrame (dart:ui/hooks.dart:207:3

@shubham-cueclad
Copy link

Write your code in side WidgetsBinding.instance.addPostFrameCallback

WidgetsBinding.instance.addPostFrameCallback((_)async{ ShowCaseWidget.of(context).startShowCase([_one,_two,_three,_four,_five,_six,_seven,_eight,_nine]); });

@cgowthamanmca
Copy link
Author

Sorry my side issue please close the issue.Thanks

@simform-solutions
Copy link
Collaborator

@cgowthamanmca Closing issue as it was implementation mistake.

@AhmedWagdi1
Copy link

what was wrong with ur code? , because I have the same error !!

@vanvixi
Copy link

vanvixi commented Mar 5, 2021

có gì sai với mã của bạn? , vì tôi cũng bị lỗi như vậy !!

me too

@bayuly94
Copy link

no solution ?

@vivekprasad99
Copy link

I am getting the Same error. what is the Solution ?

@DiegoVega19
Copy link

I'm getting the same error in widget testing, what is the solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants