embed_instagram
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
import 'package:decpisos/home/home.dart';
|
import 'package:decpisos/home/home.dart';
|
||||||
|
import 'package:decpisos/instagram_embed/instagram_embed.dart';
|
||||||
import 'package:decpisos/notificacoes/notificacoes.dart';
|
import 'package:decpisos/notificacoes/notificacoes.dart';
|
||||||
import 'package:decpisos/videos/youtube_videos.dart';
|
//import 'package:decpisos/videos/youtube_videos.dart';
|
||||||
import 'package:convex_bottom_bar/convex_bottom_bar.dart';
|
import 'package:convex_bottom_bar/convex_bottom_bar.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:line_icons/line_icons.dart';
|
||||||
|
|
||||||
class IndexController extends GetxController with SingleGetTickerProviderMixin{
|
class IndexController extends GetxController with SingleGetTickerProviderMixin{
|
||||||
TabController tabController;
|
TabController tabController;
|
||||||
@@ -23,10 +25,12 @@ class IndexController extends GetxController with SingleGetTickerProviderMixin{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initTabs(){
|
void initTabs(){
|
||||||
this.childrenTabs.add(YouTubeVideosScreen());
|
//this.childrenTabs.add(YouTubeVideosScreen());
|
||||||
|
this.childrenTabs.add(InstagramScreen());
|
||||||
this.childrenTabs.add(HomeScreen());
|
this.childrenTabs.add(HomeScreen());
|
||||||
this.childrenTabs.add(NotificacoesScreen());
|
this.childrenTabs.add(NotificacoesScreen());
|
||||||
this.tabs.add(TabItem(icon: Icons.video_collection, title: 'Vídeos'));
|
//this.tabs.add(TabItem(icon: Icons.video_collection, title: 'Vídeos'));
|
||||||
|
this.tabs.add(TabItem(icon: LineIcons.instagram, title: 'Instagram'));
|
||||||
this.tabs.add(TabItem(icon: Icons.home, title: 'Home'));
|
this.tabs.add(TabItem(icon: Icons.home, title: 'Home'));
|
||||||
this.tabs.add(TabItem(icon: Icons.notifications, title: 'Notificações'));
|
this.tabs.add(TabItem(icon: Icons.notifications, title: 'Notificações'));
|
||||||
this.tabController = TabController(vsync: this, length: this.tabs.length);
|
this.tabController = TabController(vsync: this, length: this.tabs.length);
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
//import 'package:decpisos/funcoes_gerais.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
//import 'package:url_launcher/url_launcher.dart';
|
||||||
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
|
class InstagramScreen extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_InstagramScreenState createState() => _InstagramScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InstagramScreenState extends State<InstagramScreen> with AutomaticKeepAliveClientMixin<InstagramScreen> {
|
||||||
|
bool error = false;
|
||||||
|
String msg = '';
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
super.build(context);
|
||||||
|
return SafeArea(
|
||||||
|
child: this.error ? this._buildError() : WebView(
|
||||||
|
initialUrl: 'https://blog.hightechx.com/teste-feed-instagram/',
|
||||||
|
javascriptMode: JavascriptMode.unrestricted,
|
||||||
|
onWebResourceError: (err){
|
||||||
|
this.error = true;
|
||||||
|
this.msg = err.description;
|
||||||
|
setState(() {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// navigationDelegate: (navigation){
|
||||||
|
// print(navigation.url);
|
||||||
|
// if (navigation.url.startsWith(FuncoesGerais.dominioPermitido)) {
|
||||||
|
// return NavigationDecision.navigate;
|
||||||
|
// }
|
||||||
|
// //print('allowing navigation to $request');
|
||||||
|
// launch(navigation.url);
|
||||||
|
// return NavigationDecision.prevent;
|
||||||
|
// },
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildError(){
|
||||||
|
return Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(msg),
|
||||||
|
RaisedButton(onPressed: (){
|
||||||
|
this.error = false;
|
||||||
|
this.msg = '';
|
||||||
|
setState(() {
|
||||||
|
});
|
||||||
|
}, child: Text('Atualizar'),)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user