You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys. I'm trying to use your plugin with Flutter WebView to render an epub file. The problem is that it seems that the PageTurn plugin doesn't work as expected when using Flutter WebView. All the pages are blank when using them together. Below the example main.dart I'm running:
import'dart:convert';
import'package:flutter/material.dart';
import'package:page_turn/page_turn.dart';
import'package:webview_flutter/webview_flutter.dart';
voidmain() {
runApp(MyApp());
}
classMyAppextendsStatelessWidget {
// This widget is the root of your application.@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
title:'Flutter Demo',
theme:ThemeData(
primarySwatch:Colors.blue,
visualDensity:VisualDensity.adaptivePlatformDensity,
),
home:MyHomePage(title:'Flutter Demo Home Page'),
);
}
}
classMyHomePageextendsStatefulWidget {
MyHomePage({Key key}) :super(key: key);
@override_MyHomePageStatecreateState() =>_MyHomePageState();
}
class_MyHomePageStateextendsState<MyHomePage> {
final _controller =GlobalKey<PageTurnState>();
@overrideWidgetbuild(BuildContext context) {
returnScaffold(
body:PageTurn(
key: _controller,
backgroundColor:Colors.white,
showDragCutoff:false,
lastPage:Container(child:Center(child:Text('Last Page!'))),
children:<Widget>[
for (var i =0; i <20; i++) WebViewWidget(),
],
),
floatingActionButton:FloatingActionButton(
child:Icon(Icons.search),
onPressed: () {
_controller.currentState.goToPage(2);
},
),
);
}
}
classWebViewWidgetextendsStatelessWidget {
@overrideWidgetbuild(BuildContext context) {
final htmlExample ="<!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>";
returnWebView(
initialUrl:Uri.dataFromString(
htmlExample,
mimeType:'text/html',
encoding:Encoding.getByName('utf-8')
).toString(),
javascriptMode:JavascriptMode.unrestricted,
initialMediaPlaybackPolicy:AutoMediaPlaybackPolicy.always_allow,
);
}
}
And the pubspec.yaml:
name: page_turn_webviewdescription: A new Flutter project.environment:
sdk: ">=2.7.0 <3.0.0"dependencies:
flutter:
sdk: flutter# Webviewwebview_flutter: ^0.3.20+2page_turn: ^1.0.1dev_dependencies:
flutter_test:
sdk: flutteruses-material-design: true
The text was updated successfully, but these errors were encountered:
Hi guys. I'm trying to use your plugin with Flutter WebView to render an epub file. The problem is that it seems that the PageTurn plugin doesn't work as expected when using Flutter WebView. All the pages are blank when using them together. Below the example main.dart I'm running:
And the pubspec.yaml:
The text was updated successfully, but these errors were encountered: