I'm using a PageView
to create sliding transitions between multiple pages containing a basic RaisedButton
.
However, the button is not clickable during the transition. Instead, when the screen is taped, it cancels or terminates the transition, but a second click is required afterward.
My app looks like this:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final controller = PageController();
return MaterialApp(
title: "MyApp",
initialRoute: "/",
routes: {
"/": (context) => PageView(
controller: controller,
children: List.generate(100, (_) => MyPage(controller)),
),
},
);
}
}
My page looks like this:
class MyPage extends StatelessWidget {
final PageController controller;
MyPage(this.controller);
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
RaisedButton(
onPressed: () {
controller.nextPage(
duration: Duration(milliseconds: 5000),
curve: Curves.ease,
);
},
child: Text("Go to next page"),
),
SizedBox(
width: 200,
height: 200,
child: RaisedButton(
onPressed: () => debugPrint("Button clicked!"),
child: Text("Click me"),
),
)
],
);
}
}
Is there a way to somehow "force" the button to be pressed even if a transition from one page to another is in progress?