Created
April 5, 2019 15:22
-
-
Save iskakaushik/ff49eb21274263f4b4fbbacd15750a6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/gestures.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:webview_flutter/webview_flutter.dart'; | |
void main() => runApp(MaterialApp(home: CrashingWebViewExample())); | |
class CrashingWebViewExample extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
final double maxHeight = MediaQuery.of(context).size.height * 0.7; | |
print("maxHeight: $maxHeight"); | |
return SingleChildScrollView( | |
child: Column( | |
children: <Widget>[ | |
Container( | |
padding: const EdgeInsets.all(20), | |
color: Colors.redAccent, | |
child: const Text("My Red TextWidget")), | |
_createWebViewWidget(maxHeight), | |
Container( | |
padding: const EdgeInsets.all(20), | |
color: Colors.blue, | |
child: const Text("My Blue TextWidget")), | |
], | |
), | |
); | |
} | |
Widget _createWebViewWidget(double maxHeight) { | |
final Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers = [ | |
Factory<OneSequenceGestureRecognizer>(() => EagerGestureRecognizer()), | |
].toSet(); | |
return SingleChildScrollView( | |
child: Container( | |
height: maxHeight, | |
child: WebView( | |
initialUrl: 'https://en.wikipedia.org/wiki/Cephalopod_size', | |
gestureRecognizers: gestureRecognizers, | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment