我正在改编 Wikipedia Explorer(开源)中的一个类来浏览预先选择的页面。我正在尝试添加一个不会更新的页面计数器,因为它是 StatelessWidget。有人可以帮我把它变成 StatefulWidget 吗?
class NavigationControls extends StatelessWidget {
const NavigationControls(this._webViewControllerFuture)
: assert(_webViewControllerFuture != null);
final Future<WebViewController> _webViewControllerFuture;
@override
Widget build(BuildContext context) {
return FutureBuilder<WebViewController>(
future: _webViewControllerFuture,
builder:
(BuildContext context, AsyncSnapshot<WebViewController> snapshot) {
final bool webViewReady =
snapshot.connectionState == ConnectionState.done;
final WebViewController controller = snapshot.data;
return _buttonsPagination(webViewReady, controller, context);
},
);
}