I am making a book reader app using flutter,
I use the PageView widget to do pagination, and it need childCount
and content by index, which max words per line and max lines per page needs to be calculated to split a string content into pages and passing to PageView.custom.
here is the code.
PageView.custom(
childrenDelegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Container(
child: Text(
text,
style: TextStyle(
fontSize: 14.0,
color: Color.fromRGBO(70, 62, 44, 1.0),
decoration: TextDecoration.none,
),
overflow: TextOverflow.clip,
maxLines: 20,
textScaleFactor: 1.0,
),
);
},
childCount: 20,
addAutomaticKeepAlives: false,
addRepaintBoundaries: false,
));
how do I calculate how many words the screen can display per page? need some help please.