@@ -111,6 +111,39 @@ class FirstPageState extends State<FirstPage> {
111
111
},
112
112
child: const Text ('Same single thread' ),
113
113
),
114
+ const SizedBox (height: 20 ),
115
+ ElevatedButton (
116
+ onPressed: () {
117
+ Navigator .push (context, MaterialPageRoute (builder: (context) {
118
+ return WebFDemoTwoPage (
119
+ controller1: webFController (ThreadMode .differentDedicated),
120
+ controller2: webFController (ThreadMode .differentDedicated));
121
+ }));
122
+ },
123
+ child: const Text ('Different dedicated thread (Two page)' ),
124
+ ),
125
+ const SizedBox (height: 20 ),
126
+ ElevatedButton (
127
+ onPressed: () {
128
+ Navigator .push (context, MaterialPageRoute (builder: (context) {
129
+ return WebFDemoTwoPage (
130
+ controller1: webFController (ThreadMode .sameDedicated),
131
+ controller2: webFController (ThreadMode .sameDedicated));
132
+ }));
133
+ },
134
+ child: const Text ('Same dedicated thread (Two page)' ),
135
+ ),
136
+ const SizedBox (height: 20 ),
137
+ ElevatedButton (
138
+ onPressed: () {
139
+ Navigator .push (context, MaterialPageRoute (builder: (context) {
140
+ return WebFDemoTwoPage (
141
+ controller1: webFController (ThreadMode .sameSingle),
142
+ controller2: webFController (ThreadMode .sameSingle));
143
+ }));
144
+ },
145
+ child: const Text ('Same single thread (Two page)' ),
146
+ ),
114
147
];
115
148
116
149
if (showNewEngineButton) {
@@ -181,3 +214,52 @@ class _WebFDemoState extends State<WebFDemo> {
181
214
));
182
215
}
183
216
}
217
+
218
+ class WebFDemoTwoPage extends StatefulWidget {
219
+ final WebFController controller1;
220
+ final WebFController controller2;
221
+
222
+ const WebFDemoTwoPage ({
223
+ super .key,
224
+ required this .controller1,
225
+ required this .controller2,
226
+ });
227
+
228
+ @override
229
+ _WebFDemoTwoPageState createState () => _WebFDemoTwoPageState ();
230
+ }
231
+
232
+ class _WebFDemoTwoPageState extends State <WebFDemoTwoPage > {
233
+ @override
234
+ void dispose () {
235
+ widget.controller1.dispose ();
236
+ widget.controller2.dispose ();
237
+ super .dispose ();
238
+ }
239
+
240
+ @override
241
+ Widget build (BuildContext context) {
242
+ return Scaffold (
243
+ appBar: AppBar (
244
+ title: const Text ('WebF Demo' ),
245
+ ),
246
+ body: LayoutBuilder (
247
+ builder: (BuildContext context, BoxConstraints constraints) {
248
+ double halfHeight = constraints.maxHeight / 2 ;
249
+ return Column (
250
+ children: [
251
+ SizedBox (
252
+ height: halfHeight,
253
+ child: WebF (controller: widget.controller1),
254
+ ),
255
+ SizedBox (
256
+ height: halfHeight,
257
+ child: WebF (controller: widget.controller2),
258
+ ),
259
+ ],
260
+ );
261
+ },
262
+ ),
263
+ );
264
+ }
265
+ }
0 commit comments