mirror of
https://github.com/theindianappguy/FlutterNewsApp.git
synced 2025-08-06 19:43:52 +08:00
57 lines
1.5 KiB
Dart
57 lines
1.5 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:webview_flutter/webview_flutter.dart';
|
|
|
|
class ArticleView extends StatefulWidget {
|
|
|
|
final String postUrl;
|
|
ArticleView({@required this.postUrl});
|
|
|
|
@override
|
|
_ArticleViewState createState() => _ArticleViewState();
|
|
}
|
|
|
|
class _ArticleViewState extends State<ArticleView> {
|
|
|
|
final Completer<WebViewController> _controller = Completer<WebViewController>();
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Text(
|
|
"Flutter",
|
|
style:
|
|
TextStyle(color: Colors.black87, fontWeight: FontWeight.w600),
|
|
),
|
|
Text(
|
|
"News",
|
|
style: TextStyle(color: Colors.blue, fontWeight: FontWeight.w600),
|
|
)
|
|
],
|
|
),
|
|
actions: <Widget>[
|
|
Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
|
child: Icon(Icons.share,))
|
|
],
|
|
backgroundColor: Colors.transparent,
|
|
elevation: 0.0,
|
|
),
|
|
body: Container(
|
|
height: MediaQuery.of(context).size.height,
|
|
width: MediaQuery.of(context).size.width,
|
|
child: WebView(
|
|
initialUrl: widget.postUrl,
|
|
onWebViewCreated: (WebViewController webViewController){
|
|
_controller.complete(webViewController);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|