Skip to content

Instantly share code, notes, and snippets.

@rutvik110
Last active May 14, 2022 14:29
Show Gist options
  • Save rutvik110/7c555c133c74491b719b3f6de7a0c9f6 to your computer and use it in GitHub Desktop.
Save rutvik110/7c555c133c74491b719b3f6de7a0c9f6 to your computer and use it in GitHub Desktop.
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