0

I want to do scrolling using flutter driver on a page that uses SingleChildScrollView.. the layout looks like this

return Scaffold(
 backgroundColor: PinColorsV2.neutralMin,
 body: NotificationListener<OverscrollIndicatorNotification>(
 onNotification: (overscroll) {
 overscroll.disallowGlow();
 return true;
 },
 child: LayoutBuilder(
 builder: (context, constraints) {
 return SingleChildScrollView(
 key: Key(ProfileSettingKey.profileScrollView),
 child: ConstrainedBox(
 constraints: BoxConstraints(
 minWidth: constraints.maxWidth,
 minHeight: constraints.maxHeight,
 ),
 child: IntrinsicHeight(
 child: Column(
 mainAxisSize: MainAxisSize.max,
 children: <Widget>[
 BusinessCardProfileWidget(),
 Expanded(
 child: Padding(
 padding: EdgeInsets.only(top: 10.0),
 child: ProfileSettingsWidget(),
 ),
 ),
 ],
 ),
 ),
 ),
 );
 },
 ),
 ),
 );

and here's how i scroll in my flutter driver script:

await world.driver.scrollUntilVisible(ProfileSettingFinder.profileScrollView, ProfileSettingFinder.logout, dyScroll: -15000.0, timeout: scrollTimeoout);

the page actually scrolls, but it only scrolls once a little bit.. not until my widget that i search for is displayed..as far as i know scrollUntilVisible command should keep scrolling until my desired widget shown

i noticed that the behavior is different when the layout is using ListView.Builder.. this is on different page on the app

return ListView.builder(
 key: Key(HomeKey.homeListView),
 itemCount: 1,
 itemBuilder: (context, index) {
 return Column(
 children: <Widget>[
 _staticBanner(context, model),
 if (_remoteConfigService.agentDashboardEnabled) ...[
 UIHelper.vertSpace(12),
 AgentDashboardWidget(),
 ],
 if (_remoteConfigService.howToGetCommissionEnabled) ...[
 UIHelper.vertSpace(20),
 HowToGetCommissionWidget(),
 ],
 if (_remoteConfigService.featureToggles.infoForYouSectionEnabled) ...[
 InfoForYouWidget(),
 ],
 if (_remoteConfigService.projectFilterShortcutEnabled) ...[
 UIHelper.vertSpace(24),
 BuildingTypeFilterWidget(),
 ],
 if (_remoteConfigService.userSellingPointEnabled) ...[
 UIHelper.vertSpace(36),
 UserSellingPointWidget(
 onTapCallback: () => _goToBenefitWithPinhomeView(context, model),
 ),
 ],
 if (_remoteConfigService.featuredProjectEnabled) ...[
 UIHelper.vertSpace(28),
 ProjectHorizontalListWidget(
 type: ProjectHorizontalListType.featuredProjects,
 ),
 ],
 if (_remoteConfigService.newProjectEnabled) ...[
 UIHelper.vertSpace(28),
 ProjectHorizontalListWidget(
 type: ProjectHorizontalListType.latestProjects,
 widgetKey: Key(HomeKey.proyekTerbaruHeader)
 ),
 ],
 UIHelper.vertSpace(12),
 ],
 );
 },
 );

i can scroll on that ListView normally, until my desired widget found, using the exact same syntax.. something like

await world.driver.scrollUntilVisible(HomeFinder.homeListView, HomeFinder.proyekTerbaruHeader, dyScroll: -500.0, timeout: temot);

so do i have to use different command if i want to scroll on a layout that uses SingleChildScrollView?

asked Feb 3, 2021 at 15:21

1 Answer 1

2

Incase anyone stumbles upon this, with the new integration_test package this works:

await tester.scrollUntilVisible(myFinder, 20,
 scrollable: find.descendant(of: find.byType(SingleChildScrollView), matching: find.byType(Scrollable)));
answered Aug 17, 2021 at 19:14
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.