anyusernewbie
anyusernewbie

Reputation: 85

How to make flutter full page scroll view?

I want to make a scroll view onboarding, I've made my script algorithm script like this,

Scaffold ~> SingleChildScrollView ~> ConstrainedBox ~> Row [ Expanded ~> My container set this to full size screen,

Expanded ~> My container set this to full size screen,

],

But when I scroll to the right it doesn't fully move to one screen, how does SingleChildScrollView move to one full screen?

Upvotes: 0

Views: 255

Answers (1)

anyusernewbie
anyusernewbie

Reputation: 85

I replaced the scroll widget with a PageView and it worked

  PageView(
    onPageChanged: (int page) {},
    controller: pageController,
    children: List.generate(5, (index) {
      return Container(
        constraints: BoxConstraints(
          maxHeight: constraints.maxHeight / 1.5,
          minWidth: constraints.maxWidth,
          maxWidth: constraints.maxWidth,
        ),
        padding: const EdgeInsets.symmetric(
          vertical: 10,
        ),
        child: ProfilePicture(
          pathImage: "assets/debug/girl.jpg",
          width: constraints.maxWidth,
          height: constraints.maxHeight,
          borderRadius: BorderRadius.circular(0),
          onPressed: null,
        ),
      );
    }).toList().cast<Widget>(),
  );

Upvotes: 1

Related Questions