I have to add pages dynamically at left side.
So, is it possible to set a PageView whose default orientation is horizontal and left, like the orientation of a Japanese book?
If initial List of pages is like:
List<Widget> _pages = [Widget0, Widget1, Widget2];
Plain PageView’s direction:
[0] -> [1] -> [2]
But what I want:
[2] <- [1] <- [0]
>Solution :
From the PageView documentation here, under the properties section you could try using the reverse property, here’s a brief example:
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final PageController controller = PageController();
return PageView(
reverse: true,
controller: controller,
children: const <Widget>[
Center(
child: Text('First Page'),
),
Center(
child: Text('Second Page'),
),
Center(
child: Text('Third Page'),
)
],
);
}
}