In my app, I have a PageView that each page contains a page of a book. Naturally, all of the pages are larger than the viewport, so I used SingleChildScrollView inside each page so I can scroll the content of the page. The problem is that I can't scroll to the next page of the PageView when I get to the bottom of the page (It tries to continue scrolling the page itself and not the page view). Is there a way to make my app scroll the page when reaching the page vertical borders? (both the top and the bottom border.)
Here's my code
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:penguinovel/core/source/chapter.dart';
class ChapterPage extends StatelessWidget {
final List<Chapter> chapters;
final int initialIndex;
ChapterPage(this.chapters, this.initialIndex);
@override
Widget build(BuildContext context){
return Scaffold(
appBar: AppBar(title: Text(this.chapters[this.initialIndex].name, style: TextStyle(color: Colors.white),), backgroundColor: Colors.black,),
body: PageView.builder(
controller: PageController(initialPage: this.initialIndex),
scrollDirection: Axis.vertical,
itemCount: this.chapters.length,
itemBuilder: (BuildContext context, int index) => buildChapter(this.chapters[index]),
)
);
}
Widget buildChapter(Chapter chapter) {
return FutureBuilder<String>(future: chapter.getContent(), builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
if(snapshot.hasData){
return SingleChildScrollView(child: Html(data: snapshot.data));
} else if (snapshot.hasError) {
return Center(child: Text(snapshot.error.toString()));
} else {
return Center(child: CircularProgressIndicator());
}
});
}
}
Thanks in advance :)