Skip to content

Commit

Permalink
UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
vendz committed Jun 20, 2021
1 parent 440b675 commit 5e27897
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions lib/screens/article_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ArticleScreen extends StatefulWidget {
class _ArticleScreenState extends State<ArticleScreen> {
final Completer<WebViewController> _completer =
Completer<WebViewController>();
int position = 1;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -44,14 +45,30 @@ class _ArticleScreenState extends State<ArticleScreen> {
],
),
),
body: Container(
child: WebView(
initialUrl: widget.articleUrl,
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: ((WebViewController webViewController) {
_completer.complete(webViewController);
}),
),
body: IndexedStack(
index: position,
children: [
WebView(
initialUrl: widget.articleUrl,
javascriptMode: JavascriptMode.unrestricted,
onPageStarted: (value) {
setState(() {
position = 1;
});
},
onPageFinished: (value) {
setState(() {
position = 0;
});
},
onWebViewCreated: ((WebViewController webViewController) {
_completer.complete(webViewController);
}),
),
Container(
child: Center(child: CircularProgressIndicator()),
),
],
),
);
}
Expand Down

0 comments on commit 5e27897

Please sign in to comment.