Last active
May 14, 2022 14:29
-
-
Save rutvik110/7c555c133c74491b719b3f6de7a0c9f6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class TwitterEmbed extends StatefulWidget { | |
const TwitterEmbed({Key? key}) : super(key: key); | |
@override | |
State<TwitterEmbed> createState() => _TwitterEmbedState(); | |
} | |
class _TwitterEmbedState extends State<TwitterEmbed> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: const Text("Twitter Embed"), | |
), | |
body: WebView( | |
initialUrl: Uri.dataFromString( | |
getHtmlString(), | |
mimeType: 'text/html', | |
encoding: Encoding.getByName('utf-8'), | |
).toString(), | |
javascriptMode: JavascriptMode.unrestricted, | |
), | |
); | |
} | |
} | |
String getHtmlString() { | |
return """ | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
// Your content goes here | |
</body> | |
<script> | |
// Write your javascript code here | |
</script> | |
</html> | |
"""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment