(More of a workaround)
As I wrote here one option is to use Stack widget as a page loader.
Each "page" expand on the entire screen.
When you want to show the next "page" replace the front layer in the stack with SizedBox.
So all the elements are actually randerd at the same time but will not be visible.
For example, the video on the "second page" will start getting loaded even when the user is on the "first page" and will be ready for the user when he continues.
One way to do that is by using get as state management.
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class PageWithLayers extends StatelessWidget {
const PageWithLayers({super.key});
@override
Widget build(BuildContext context) {
final Controller c = Get.put(Controller());
return Stack(
children: [
Container(
color: Colors.red,
child: const Text('Video here will get loaded before user arrived here'),
),
Obx(
() => c.toShowTopLayer > 0
? Container(
color: Colors.blue,
width: double.infinity,
height: double.infinity,
child: Center(
child: TextButton(
onPressed: c.removeTopLayer,
child: const Text('Next'),
),
),
)
: const SizedBox(),
),
],
);
}
}
class Controller extends GetxController {
var toShowTopLayer = 1.obs;
removeTopLayer() => toShowTopLayer--;
}