import 'dart:async';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class MyHomeScreen extends StatefulWidget {
MyHomeScreen({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomeScreenState createState() => _MyHomeScreenState();
}
class _MyHomeScreenState extends State<MyHomeScreen> {
static final Completer<WebViewController> _controller =
Completer<WebViewController>();
WebViewController newController;
int _selectedIndex = 0;
static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static List<Widget> _widgetOptions = <Widget>[
Container(
child: WebView(
initialUrl: "https://www.twitter.com",
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
_controller.complete(webViewController);
}),
decoration: BoxDecoration(
color: const Color(0xff7c94b6),
border: Border.all(
color: Colors.grey,
width: 8,
),
borderRadius: BorderRadius.circular(16),
),
),
Container(
child: WebView(
initialUrl: "https://www.facebook.com",
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
_controller.complete(webViewController);
}),
decoration: BoxDecoration(
color: const Color(0xff7c94b6),
border: Border.all(
color: Colors.grey,
width: 8,
),
borderRadius: BorderRadius.circular(16),
),
),
Container(
child: WebView(
initialUrl: "https://www.instagram.com",
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
_controller.complete(webViewController);
}),
decoration: BoxDecoration(
color: const Color(0xff7c94b6),
border: Border.all(
color: Colors.grey,
width: 8,
),
borderRadius: BorderRadius.circular(16),
),
),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: Builder(
builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.menu),
onPressed: () {
Scaffold.of(context).openDrawer();
},
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
);
},
),
title: const Text('Outcast'),
actions: <Widget>[
IconButton(icon: Icon(Icons.search), onPressed: null)
],
),
body: Center(
child: _widgetOptions.elementAt(_selectedIndex),
),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.person),
title: Text('Twitter'),
),
BottomNavigationBarItem(
icon: Icon(Icons.chat),
title: Text('Facebook'),
),
BottomNavigationBarItem(
icon: Icon(Icons.photo),
title: Text('Instagram'),
),
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.grey,
onTap: _onItemTapped,
),
);
}
}
On Monday, January 6, 2020 at 11:22:46 PM UTC-6, Abada Samuel wrote: