From dd6bbb650b1ac3d89878fee8835416ada93712a1 Mon Sep 17 00:00:00 2001 From: Renan Date: Tue, 1 Jun 2021 16:52:01 -0300 Subject: [PATCH] =?UTF-8?q?migra=C3=A7=C3=A3o=20flutter=202.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle | 32 +- ios/Runner/Info.plist | 2 + lib/atualizarapp/atualizarapp.dart | 4 +- lib/default_response_api.dart | 38 +- lib/funcoes_gerais.dart | 11 +- lib/home/home.dart | 73 ++-- lib/index/index_controller.dart | 10 +- lib/instagram_embed/instagram_embed.dart | 12 +- lib/main.dart | 23 +- lib/notificacoes/api/notificacoes_api.dart | 20 +- .../api/notificacoes_classes.dart | 48 +-- lib/notificacoes/notificacao.dart | 17 +- lib/notificacoes/notificacoes.dart | 27 +- lib/notificacoes/notificacoes_controller.dart | 23 +- lib/pdfviewer/pdfviewer.dart | 20 +- lib/pdfviewer/pdfviewer_controller.dart | 61 +-- lib/splash/splash.dart | 2 +- lib/splash/splash_controller.dart | 68 ++-- lib/videos/api/youtube_api.dart | 9 +- lib/videos/api/youtube_classes.dart | 76 ++-- lib/videos/bloc/youtube_controller.dart | 20 +- lib/videos/youtube_video_player.dart | 10 +- lib/videos/youtube_videos.dart | 15 +- pubspec.lock | 364 +++++++++--------- pubspec.yaml | 52 +-- 25 files changed, 568 insertions(+), 469 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 8d5c074..295ce8f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -45,7 +45,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.hightechx.mobile.decpisos" - minSdkVersion 17 + minSdkVersion 19 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -82,27 +82,27 @@ android { signingConfig signingConfigs.debug } } - // splits { + splits { - // //Configures multiple APKs based on ABI. - // abi { + //Configures multiple APKs based on ABI. + abi { - // //Enables building multiple APKs per ABI. - // enable true + //Enables building multiple APKs per ABI. + enable true - // //By default all ABIs are included, so use reset() and include to specify that we only - // //want APKs for x86 and x86_64. + //By default all ABIs are included, so use reset() and include to specify that we only + //want APKs for x86 and x86_64. - // //Resets the list of ABIs that Gradle should create APKs for to none. - // reset() + //Resets the list of ABIs that Gradle should create APKs for to none. + reset() - // //Specifies a list of ABIs that Gradle should create APKs for. - // include "x86", "x86_64", "armeabi", "armeabi-v7a", "arm64-v8a" + //Specifies a list of ABIs that Gradle should create APKs for. + include "x86", "x86_64", "armeabi", "armeabi-v7a", "arm64-v8a" - // //Specifies that we do not want to also generate a universal APK that includes all ABIs. - // universalApk false - // } - // } + //Specifies that we do not want to also generate a universal APK that includes all ABIs. + universalApk false + } + } } flutter { diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index bef1050..b3b2e08 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -75,5 +75,7 @@ UIViewControllerBasedStatusBarAppearance + io.flutter.embedded_views_preview + diff --git a/lib/atualizarapp/atualizarapp.dart b/lib/atualizarapp/atualizarapp.dart index 5fd813b..da4a1db 100644 --- a/lib/atualizarapp/atualizarapp.dart +++ b/lib/atualizarapp/atualizarapp.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; class AtualizarScreen extends StatefulWidget { - final String linkLoja; + final String? linkLoja; AtualizarScreen({this.linkLoja}); @override _AtualizarScreenState createState() => _AtualizarScreenState(); @@ -55,7 +55,7 @@ class _AtualizarScreenState extends State { borderRadius: BorderRadius.circular(10.0) ), onPressed: (){ - launch(widget.linkLoja); + launch(widget.linkLoja!); } ), ], diff --git a/lib/default_response_api.dart b/lib/default_response_api.dart index a04d36b..f06654b 100644 --- a/lib/default_response_api.dart +++ b/lib/default_response_api.dart @@ -1,6 +1,6 @@ class DefaultResponseApi { - int errorCode; - String errorMessage; + int? errorCode; + String? errorMessage; DefaultResponseApi({this.errorCode, this.errorMessage}); @@ -18,11 +18,11 @@ class DefaultResponseApi { } class RegistraDeviceRequest { - int aPPMOBILECODIGO; - int pLATAFORMAMOBILECODIGO; - String dEVICETOKEN; - String mODELODEVICE; - int uSUCOD; + int? aPPMOBILECODIGO; + int? pLATAFORMAMOBILECODIGO; + String? dEVICETOKEN; + String? mODELODEVICE; + int? uSUCOD; RegistraDeviceRequest( {this.aPPMOBILECODIGO, @@ -51,12 +51,12 @@ class RegistraDeviceRequest { } class ApiStatusResponse { - String sistema; - String upload; - String download; - String pagamento; - int errorCode; - String errorMessage; + String? sistema; + String? upload; + String? download; + String? pagamento; + int? errorCode; + String? errorMessage; ApiStatusResponse( {this.sistema, @@ -77,12 +77,12 @@ class ApiStatusResponse { } class VersaoMinimaResponse { - int versaoMinima; - String linkLoja; - String nome; - int errorCode; - String errorMessage; - bool vOk; + int? versaoMinima; + String? linkLoja; + String? nome; + int? errorCode; + String? errorMessage; + bool? vOk; VersaoMinimaResponse({this.errorCode, this.errorMessage,this.linkLoja,this.nome,this.versaoMinima,this.vOk}); diff --git a/lib/funcoes_gerais.dart b/lib/funcoes_gerais.dart index 9e6cb29..0befa0f 100644 --- a/lib/funcoes_gerais.dart +++ b/lib/funcoes_gerais.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'package:get/get.dart'; import 'package:http/http.dart' as http; import 'package:device_info/device_info.dart'; import 'dart:io'; @@ -45,7 +46,7 @@ class FuncoesGerais{ return Future.value(tokenPadrao); } - static Future registraDevice(String token) async{ + static Future registraDevice(String? token) async{ if(await FuncoesGerais.checkInternetConnection()){ if(token != null && token.isNotEmpty){ @@ -78,7 +79,7 @@ class FuncoesGerais{ try { var body = json.encode(objPost); //var response = await http.post(url, body: body,headers: heads); - await http.post(url, body: body,headers: heads); + await http.post(Uri.parse(url), body: body,headers: heads); //var r = await http.post(url, body: body,headers: heads); //print(r); // if (response != null) { @@ -112,8 +113,8 @@ class FuncoesGerais{ heads["Content-type"] = "application/json; charset=utf-8"; try { - var response = await http.get(url,headers: heads); - if (response != null) { + http.Response response = await http.get(Uri.parse(url),headers: heads); + if (!GetUtils.isNullOrBlank(response.body)!) { if (response.statusCode == 200) { var data = jsonDecode(response.body); objRetorno = VersaoMinimaResponse.fromJson(data); @@ -121,7 +122,7 @@ class FuncoesGerais{ // var v = packageInfo.version.split('.'); // int versaoAtual = 0; //if(v.length > 0)versaoAtual = v[0] != null && v[0].isNotEmpty ? int.parse(v[0]) : 0; - if(FuncoesGerais.versaoAtual != null && objRetorno.versaoMinima > FuncoesGerais.versaoAtual){ + if(objRetorno.versaoMinima! > FuncoesGerais.versaoAtual){ objRetorno.vOk = false; } } diff --git a/lib/home/home.dart b/lib/home/home.dart index beab829..9e87e5c 100644 --- a/lib/home/home.dart +++ b/lib/home/home.dart @@ -1,5 +1,7 @@ import 'package:decpisos/funcoes_gerais.dart'; import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:line_icons/line_icons.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:webview_flutter/webview_flutter.dart'; @@ -14,25 +16,46 @@ class _HomeScreenState extends State with AutomaticKeepAliveClientMi @override Widget build(BuildContext context) { super.build(context); - return SafeArea( - child: this.error ? this._buildError() : WebView( - initialUrl: FuncoesGerais.homeURL, - 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; - }, + return Scaffold( + appBar: AppBar( + title: Text(FuncoesGerais.nomeApp), + centerTitle: false, + actions: [ + IconButton( + onPressed: (){ + if(Get.theme.brightness == Brightness.dark){ + Get.changeThemeMode(ThemeMode.light); + } + else{ + Get.changeThemeMode(ThemeMode.dark); + } + }, + tooltip: 'Alternar modo dark/light', + icon: Icon(LineIcons.palette) + ) + ], + ), + body: SafeArea( + child: this.error ? this._buildError() : WebView( + initialUrl: FuncoesGerais.homeURL, + javascriptMode: JavascriptMode.unrestricted, + onWebResourceError: (err){ + this.error = true; + this.msg = err.description; + setState(() { + }); + }, + allowsInlineMediaPlayback: true, + 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; + }, + ), ), ); } @@ -44,12 +67,18 @@ class _HomeScreenState extends State with AutomaticKeepAliveClientMi crossAxisAlignment: CrossAxisAlignment.center, children: [ Text(msg), - RaisedButton(onPressed: (){ + ElevatedButton(onPressed: (){ this.error = false; this.msg = ''; setState(() { - }); - }, child: Text('Atualizar'),) + }); + }, child: Text('Atualizar')) + // RaisedButton(onPressed: (){ + // this.error = false; + // this.msg = ''; + // setState(() { + // }); + // }, child: Text('Atualizar'),) ], ), ); diff --git a/lib/index/index_controller.dart b/lib/index/index_controller.dart index f248d13..3ceb615 100644 --- a/lib/index/index_controller.dart +++ b/lib/index/index_controller.dart @@ -10,19 +10,19 @@ import 'package:line_icons/line_icons.dart'; //import 'package:line_icons/line_icons.dart'; class IndexController extends GetxController with SingleGetTickerProviderMixin { - TabController tabController; - var tabs = List().obs; - var childrenTabs = List().obs; + TabController? tabController; + var tabs = [].obs; + var childrenTabs = [].obs; @override void onInit() { super.onInit(); this.initTabs(); - this.tabController.index = 1; + this.tabController!.index = 1; } @override void onClose() { - this.tabController.dispose(); + this.tabController!.dispose(); super.onClose(); } diff --git a/lib/instagram_embed/instagram_embed.dart b/lib/instagram_embed/instagram_embed.dart index 9290ff1..5dac883 100644 --- a/lib/instagram_embed/instagram_embed.dart +++ b/lib/instagram_embed/instagram_embed.dart @@ -44,12 +44,18 @@ class _InstagramScreenState extends State with AutomaticKeepAli crossAxisAlignment: CrossAxisAlignment.center, children: [ Text(msg), - RaisedButton(onPressed: (){ + ElevatedButton(onPressed: (){ this.error = false; this.msg = ''; setState(() { - }); - }, child: Text('Atualizar'),) + }); + }, child: Text('Atualizar')) + // RaisedButton(onPressed: (){ + // this.error = false; + // this.msg = ''; + // setState(() { + // }); + // }, child: Text('Atualizar'),) ], ), ); diff --git a/lib/main.dart b/lib/main.dart index 817a1f5..ad003f8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,11 +1,21 @@ import 'package:decpisos/funcoes_gerais.dart'; +import 'package:firebase_core/firebase_core.dart'; +//import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:get/get.dart'; import 'splash/splash.dart'; -void main() { +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp(); + // Set the background messaging handler early on, as a named top-level function + // FirebaseMessaging.onBackgroundMessage((RemoteMessage message) async { + // await Firebase.initializeApp(); + // print('Handling a background message ${message.messageId}'); + // }); + runApp(GetMaterialApp( title: FuncoesGerais.nomeApp, localizationsDelegates: [ @@ -17,11 +27,14 @@ void main() { supportedLocales: [ const Locale('pt'), ], + theme: ThemeData.light().copyWith(primaryColor: Color(0xFF05578e)), + darkTheme: ThemeData.dark().copyWith(primaryColor: Colors.black87), + // theme: ThemeData( + // //brightness: Brightness.dark, + // visualDensity: VisualDensity.adaptivePlatformDensity, + // primarySwatch: Colors.blueGrey + // ), themeMode: ThemeMode.dark, - theme: ThemeData( - brightness: Brightness.dark, - visualDensity: VisualDensity.adaptivePlatformDensity, - ), home: SplashScreen() )); } diff --git a/lib/notificacoes/api/notificacoes_api.dart b/lib/notificacoes/api/notificacoes_api.dart index 03498ef..39fd598 100644 --- a/lib/notificacoes/api/notificacoes_api.dart +++ b/lib/notificacoes/api/notificacoes_api.dart @@ -1,6 +1,7 @@ import 'dart:convert'; +import 'package:get/get_utils/src/get_utils/get_utils.dart'; import 'package:http/http.dart' as http; import '../../default_response_api.dart'; @@ -26,9 +27,10 @@ class NotificacoesApi{ Map heads = Map(); heads["Content-type"] = "application/json; charset=utf-8"; - var response = await http.get(url, headers: heads); + var response = await http.get(Uri.parse(url), headers: heads); - if (response != null) { + //if (response != null) { + if (!GetUtils.isNullOrBlank(response.body)!) { if (response.statusCode == 200) { var data = jsonDecode(response.body); retorno = NotificacoesResponse.fromJson(data); @@ -47,7 +49,7 @@ class NotificacoesApi{ return retorno; } - Future getNotificacao(int id) async{ + Future getNotificacao(int? id) async{ var retorno = new NotificacaoResponse( errorCode: 0, errorMessage: "" @@ -63,9 +65,9 @@ class NotificacoesApi{ Map heads = Map(); heads["Content-type"] = "application/json; charset=utf-8"; - var response = await http.get(url, headers: heads); + var response = await http.get(Uri.parse(url), headers: heads); - if (response != null) { + if (!GetUtils.isNullOrBlank(response.body)!) { if (response.statusCode == 200) { var data = jsonDecode(response.body); retorno = NotificacaoResponse.fromJson(data); @@ -100,9 +102,9 @@ class NotificacoesApi{ var body = json.encode(post); - var response = await http.post(url, headers: heads, body: body); + var response = await http.post(Uri.parse(url), headers: heads, body: body); - if (response != null) { + if (!GetUtils.isNullOrBlank(response.body)!) { if (response.statusCode == 200) { var data = jsonDecode(response.body); objRetorno = DefaultResponseApi.fromJson(data); @@ -135,10 +137,10 @@ class NotificacoesApi{ var body = json.encode(post); - var response = await http.post(url, headers: heads, body: body); + var response = await http.post(Uri.parse(url), headers: heads, body: body); - if (response != null) { + if (!GetUtils.isNullOrBlank(response.body)!) { if (response.statusCode == 200) { var data = jsonDecode(response.body); objRetorno = DefaultResponseApi.fromJson(data); diff --git a/lib/notificacoes/api/notificacoes_classes.dart b/lib/notificacoes/api/notificacoes_classes.dart index a9a4b88..a25dd21 100644 --- a/lib/notificacoes/api/notificacoes_classes.dart +++ b/lib/notificacoes/api/notificacoes_classes.dart @@ -1,6 +1,6 @@ class NotificacaoLikeRequest { - int iD; - String like; + int? iD; + String? like; NotificacaoLikeRequest({this.iD, this.like}); @@ -18,8 +18,8 @@ class NotificacaoLikeRequest { } class NotificacaoLidaRequest { - String latitude; - String longitude; + String? latitude; + String? longitude; NotificacaoLidaRequest({this.latitude, this.longitude}); @@ -38,9 +38,9 @@ class NotificacaoLidaRequest { class NotificacaoResponse { - NotificacaoResults result; - int errorCode; - String errorMessage; + NotificacaoResults? result; + int? errorCode; + String? errorMessage; NotificacaoResponse({this.result, this.errorCode, this.errorMessage}); @@ -54,7 +54,7 @@ class NotificacaoResponse { Map toJson() { final Map data = new Map(); if (this.result != null) { - data['Result'] = this.result.toJson(); + data['Result'] = this.result!.toJson(); } data['ErrorCode'] = this.errorCode; data['ErrorMessage'] = this.errorMessage; @@ -63,18 +63,18 @@ class NotificacaoResponse { } class NotificacoesResponse { - List results; - int errorCode; - String errorMessage; - bool loadMore; + List? results; + int? errorCode; + String? errorMessage; + bool? loadMore; NotificacoesResponse({this.results, this.errorCode, this.errorMessage,this.loadMore}); NotificacoesResponse.fromJson(Map json) { if (json['Results'] != null) { - results = new List(); + results = []; json['Results'].forEach((v) { - results.add(new NotificacaoResults.fromJson(v)); + results!.add(new NotificacaoResults.fromJson(v)); }); } errorCode = json['ErrorCode']; @@ -84,7 +84,7 @@ class NotificacoesResponse { Map toJson() { final Map data = new Map(); if (this.results != null) { - data['Results'] = this.results.map((v) => v.toJson()).toList(); + data['Results'] = this.results!.map((v) => v.toJson()).toList(); } data['ErrorCode'] = this.errorCode; data['ErrorMessage'] = this.errorMessage; @@ -93,15 +93,15 @@ class NotificacoesResponse { } class NotificacaoResults { - int iD; - String titulo; - String texto; - String conteudo; - String dataNotificacao; - String tipoConteudo; - bool visualizado; - String imageUrl; - String like; + int? iD; + String? titulo; + String? texto; + String? conteudo; + String? dataNotificacao; + String? tipoConteudo; + bool? visualizado; + String? imageUrl; + String? like; NotificacaoResults( {this.iD, diff --git a/lib/notificacoes/notificacao.dart b/lib/notificacoes/notificacao.dart index 7950216..3509451 100644 --- a/lib/notificacoes/notificacao.dart +++ b/lib/notificacoes/notificacao.dart @@ -15,17 +15,17 @@ class NotificacaoDetail extends StatelessWidget { // //title: Obx(() => Text(c.notificacaoDetail.value.result.titulo ?? 'Notificação')), ), - body: Obx(() => c.loadingDetail.value ? Center(child: CircularProgressIndicator(),) : c.notificacaoDetail.value.errorCode != 0 ? Center(child: Text(c.notificacaoDetail.value.errorMessage),) : ListView( + body: Obx(() => c.loadingDetail.value ? Center(child: CircularProgressIndicator(),) : c.notificacaoDetail.value.errorCode != 0 ? Center(child: Text(c.notificacaoDetail.value.errorMessage!),) : ListView( children: [ Visibility( - visible: GetUtils.isNullOrBlank(c.notificacaoDetail.value.result.imageUrl) == false, + visible: GetUtils.isNullOrBlank(c.notificacaoDetail.value.result!.imageUrl) == false, child: Container( color: Colors.black38, height: 250, child: Padding( padding: const EdgeInsets.all(70.0), child: Image.network( - c.notificacaoDetail.value.result.imageUrl ?? '', + c.notificacaoDetail.value.result!.imageUrl ?? '', fit: BoxFit.contain, ), ), @@ -37,14 +37,17 @@ class NotificacaoDetail extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - c.notificacaoDetail.value.result.titulo, + c.notificacaoDetail.value.result!.titulo!, style: TextStyle(fontSize: 30.0,), ), const SizedBox(height: 10), Html( - data: c.notificacaoDetail.value.result.conteudo, - onLinkTap: (url){ - launch(url); + data: c.notificacaoDetail.value.result!.conteudo, + // onLinkTap: (url){ + // launch(url); + // }, + onLinkTap: (url,ctx,mp,element){ + launch(url!); }, // style: Theme.of(context).textTheme.bodyText2.copyWith( // color: Colors.black54, diff --git a/lib/notificacoes/notificacoes.dart b/lib/notificacoes/notificacoes.dart index 2dec89d..5616644 100644 --- a/lib/notificacoes/notificacoes.dart +++ b/lib/notificacoes/notificacoes.dart @@ -71,7 +71,7 @@ class NotificacoesScreen extends StatelessWidget { // child: this._buildListTile(index) // ); } else if (index > 1) { - if(c.loadMore == null || c.loadMore){ + if(c.loadMore){ c.getNotificacoesBloc(); return Container( height: 40, @@ -113,8 +113,9 @@ class NotificacoesScreen extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text(c.errorMessage), - RaisedButton(onPressed: c.refresh, child: Text('Atualizar'),) + Text(c.errorMessage!), + ElevatedButton(onPressed: c.refresh, child: Text('Atualizar')) + //RaisedButton(onPressed: c.refresh, child: Text('Atualizar'),) ], ), ); @@ -123,12 +124,12 @@ class NotificacoesScreen extends StatelessWidget { Widget _buildListTile(int index) { if(c.notificacoesResults[index].tipoConteudo == 'L'){ return this._buildListTileTile(index: index,onTap: (){ - c.notificacaoLidaBloc(c.notificacoesResults[index].iD).then((value) => launch(c.notificacoesResults[index].conteudo)); + c.notificacaoLidaBloc(c.notificacoesResults[index].iD).then((value) => launch(c.notificacoesResults[index].conteudo!)); }); } return OpenContainer( //openColor: Colors.transparent, - closedColor: Colors.black87.withOpacity(0.2), + closedColor: Get.theme.primaryColor.withOpacity(0.2), transitionType: ContainerTransitionType.fadeThrough, openBuilder: (BuildContext _, VoidCallback openContainer) { c.notificacoesResults[index].visualizado = true; @@ -136,7 +137,7 @@ class NotificacoesScreen extends StatelessWidget { //return _DetailsPage(); return NotificacaoDetail(); }, - onClosed: (bool isMarkedAsDone) { + onClosed: (bool? isMarkedAsDone) { c.notificacaoLidaBloc(c.notificacoesResults[index].iD); if (isMarkedAsDone ?? false) Get.rawSnackbar(message: 'Marked as done!'); @@ -150,21 +151,21 @@ class NotificacoesScreen extends StatelessWidget { ); } - Widget _buildListTileTile({Function onTap,@required int index}){ + Widget _buildListTileTile({Function? onTap,required int index}){ return ListTile( leading: CircleAvatar( - backgroundImage: GetUtils.isNullOrBlank(c.notificacoesResults[index].imageUrl) ? AssetImage( + backgroundImage: (GetUtils.isNullOrBlank(c.notificacoesResults[index].imageUrl)! ? AssetImage( 'assets/images/logo.png', - ) : NetworkImage(c.notificacoesResults[index].imageUrl), + ) : NetworkImage(c.notificacoesResults[index].imageUrl!)) as ImageProvider?, // child: Image.asset( // 'assets/images/logo.png', // width: 40, // ), ), - onTap: onTap, - trailing: c.notificacoesResults[index].visualizado ? Text('') : Text('●',style: TextStyle(color: Colors.blue),), - title: Text(c.notificacoesResults[index].titulo), - subtitle: Text(c.getDateFormatada(c.notificacoesResults[index].dataNotificacao)), + onTap: onTap as void Function()?, + trailing: c.notificacoesResults[index].visualizado! ? Text('') : Text('●',style: TextStyle(color: Colors.blue),), + title: Text(c.notificacoesResults[index].titulo!), + subtitle: Text(c.getDateFormatada(c.notificacoesResults[index].dataNotificacao!)), ); } } \ No newline at end of file diff --git a/lib/notificacoes/notificacoes_controller.dart b/lib/notificacoes/notificacoes_controller.dart index a5a1fa0..245ba36 100644 --- a/lib/notificacoes/notificacoes_controller.dart +++ b/lib/notificacoes/notificacoes_controller.dart @@ -5,13 +5,13 @@ import 'api/notificacoes_api.dart'; import 'api/notificacoes_classes.dart'; class NotificacoesController extends GetxController with SingleGetTickerProviderMixin{ - var notificacoesResults = List().obs; + var notificacoesResults = [].obs; bool loadMore = true; NotificacoesApi _api = new NotificacoesApi(); var notificacaoDetail = NotificacaoResponse().obs; int page = 1; var errorCode = 0.obs; - var errorMessage = ''; + String? errorMessage = ''; var loading = true.obs; var loadingDetail = true.obs; var like = ''.obs; @@ -45,27 +45,27 @@ class NotificacoesController extends GetxController with SingleGetTickerProvider getNotificacoesBloc()async{ var response = await this._api.getNotificacoes(page); - this.loadMore = response.results.length < 1 ? false : true; + this.loadMore = response.results!.length < 1 ? false : true; if(response.errorCode != 0){ - this.errorCode.value = response.errorCode; + this.errorCode.value = response.errorCode!; this.errorMessage = response.errorMessage; } else{ //if(this.page > 1)this.listKey.currentState.insertItem(2,duration: const Duration(milliseconds: 1500)); page++; - this.notificacoesResults.addAll(response.results); + this.notificacoesResults.addAll(response.results!); } if(this.loading.value)this.loading.value = false; } - getNotificacaoDetail(int id) async { + getNotificacaoDetail(int? id) async { this.loadingDetail.value = true; this.notificacaoDetail.value.result = new NotificacaoResults(); var response = await this._api.getNotificacao(id); this.notificacaoDetail.value = response; - this.like.value = response.result.like; + this.like.value = response.result!.like!; this.loadingDetail.value = false; } @@ -80,10 +80,11 @@ class NotificacoesController extends GetxController with SingleGetTickerProvider Future notificacaoLikeBloc(NotificacaoLikeRequest item) async { var response = await this._api.notificacaoLike(item); - if(response != null && response.errorCode == 0) + //if(response != null && response.errorCode == 0) + if(response.errorCode != null && response.errorCode == 0) { - this.notificacaoDetail.value.result.like = item.like; - this.like.value = item.like; + this.notificacaoDetail.value.result!.like = item.like; + this.like.value = item.like!; } } @@ -96,7 +97,7 @@ class NotificacoesController extends GetxController with SingleGetTickerProvider return r; } - Future notificacaoLidaBloc(int notificacaoID) async { + Future notificacaoLidaBloc(int? notificacaoID) async { return; } } \ No newline at end of file diff --git a/lib/pdfviewer/pdfviewer.dart b/lib/pdfviewer/pdfviewer.dart index eaba796..8ed506d 100644 --- a/lib/pdfviewer/pdfviewer.dart +++ b/lib/pdfviewer/pdfviewer.dart @@ -1,6 +1,7 @@ -import 'package:advance_pdf_viewer/advance_pdf_viewer.dart'; +//import 'package:advance_pdf_viewer/advance_pdf_viewer.dart'; import 'package:decpisos/pdfviewer/pdfviewer_controller.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_pdfview/flutter_pdfview.dart'; import 'package:get/get.dart'; class PDFViewerScreen extends StatelessWidget { @@ -18,14 +19,23 @@ class PDFViewerScreen extends StatelessWidget { Obx(() => c.visibleRefresh.value ? IconButton(icon: Icon(Icons.refresh), onPressed: c.refreshPDF) : Container()) ], ), + // body: Obx(() => c.loading.value + // ? Center( + // child: CircularProgressIndicator(), + // ) + // : c.error.value ? c.buildError() : PDFViewer( + // lazyLoad: false, + // document: c.doc, + // )), body: Obx(() => c.loading.value ? Center( child: CircularProgressIndicator(), ) - : c.error.value ? c.buildError() : PDFViewer( - lazyLoad: false, - document: c.doc, - )), + : c.error.value ? c.buildError() : PDFView( + filePath: c.filePDF!.path, + //nightMode: true, + fitPolicy: FitPolicy.BOTH, + )), ); } } diff --git a/lib/pdfviewer/pdfviewer_controller.dart b/lib/pdfviewer/pdfviewer_controller.dart index 9c6ef66..214d5e9 100644 --- a/lib/pdfviewer/pdfviewer_controller.dart +++ b/lib/pdfviewer/pdfviewer_controller.dart @@ -1,8 +1,8 @@ -import 'dart:io'; -import 'package:flutter/foundation.dart'; +import 'dart:io' as io; -import 'package:advance_pdf_viewer/advance_pdf_viewer.dart'; +//import 'package:advance_pdf_viewer/advance_pdf_viewer.dart'; import 'package:decpisos/funcoes_gerais.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:path_provider/path_provider.dart'; @@ -13,8 +13,8 @@ class PDFViewerScreenController extends GetxController{ var loadPDF = false.obs; var visibleRefresh = false.obs; var error = false.obs; - PDFDocument doc; - File _filePDF; + //PDFDocument doc = PDFDocument(); + io.File? filePDF; @override void onInit() { @@ -24,27 +24,33 @@ class PDFViewerScreenController extends GetxController{ Future _loadPDF() async { var file = await this._createFileOfPdfUrl(); - if(file != null && await file.exists()){ - this.doc = await PDFDocument.fromFile(file); - //this.visibleRefresh.value = true; - } - else{ - if(await FuncoesGerais.checkInternetConnection() == false){ - this.error.value = true; - } - else{ - this.doc = await PDFDocument.fromURL(FuncoesGerais.urlPDF); - } + // if(file != null && await file.exists()){ + // //io.File fpdf = new io.File('${file.path}'); + // this.doc = await PDFDocument.fromFile(file); + // //this.doc = await PDFDocument.fromFile(file); + // //this.visibleRefresh.value = true; + // } + // else{ + // if(await FuncoesGerais.checkInternetConnection() == false){ + // this.error.value = true; + // } + // else{ + // this.doc = await PDFDocument.fromURL(FuncoesGerais.urlPDF); + // } - } + // } + if(file == null || await file.exists() == false){ + this.error.value = true; + } + this.loading.value = false; } Future refreshPDF() async { this.loading.value = true; try { - await this._filePDF.delete(); + await this.filePDF!.delete(); this._loadPDF(); } catch (e) { Get.rawSnackbar(message: 'Não possível atualizar o PDF. Tente novamente'); @@ -57,7 +63,7 @@ class PDFViewerScreenController extends GetxController{ this.loadPDF.value = true; var file = await this._createFileOfPdfUrl(); try { - Share.shareFiles([file.path], text: 'DecCard').then((value) => this.loadPDF.value = false); + Share.shareFiles([file!.path], text: 'DecCard').then((value) => this.loadPDF.value = false); } catch (e) { this.loadPDF.value = false; Get.rawSnackbar(message: 'Não foi possível compartilhar o PDF'); @@ -65,16 +71,16 @@ class PDFViewerScreenController extends GetxController{ } - Future _createFileOfPdfUrl() async { + Future _createFileOfPdfUrl() async { final url = FuncoesGerais.urlPDF; - File file; - + io.File? file; + //f.File file2; final filename = url.substring(url.lastIndexOf("/") + 1); String dir = (await getApplicationDocumentsDirectory()).path; - file = new File('$dir/$filename'); + file = io.File('$dir/$filename'); if(!await file.exists()){ if(await FuncoesGerais.checkInternetConnection()){ - var request = await HttpClient().getUrl(Uri.parse(url)); + var request = await io.HttpClient().getUrl(Uri.parse(url)); var response = await request.close(); var bytes = await consolidateHttpClientResponseBytes(response); await file.writeAsBytes(bytes); @@ -83,8 +89,8 @@ class PDFViewerScreenController extends GetxController{ file = null; } } - this._filePDF = file; - if(this._filePDF != null) this.visibleRefresh.value = await this._filePDF.exists(); + this.filePDF = file; + if(this.filePDF != null) this.visibleRefresh.value = await this.filePDF!.exists(); return file; } @@ -98,7 +104,8 @@ class PDFViewerScreenController extends GetxController{ children: [ Text('Não foi possível carregar o PDF'), SizedBox(height: 10.0,), - RaisedButton(onPressed: this.refreshPDF,child: Text('Atualizar'),) + ElevatedButton(onPressed: this.refreshPDF,child: Text('Atualizar')) + //RaisedButton(onPressed: this.refreshPDF,child: Text('Atualizar'),) ], ), ); diff --git a/lib/splash/splash.dart b/lib/splash/splash.dart index 51b652c..55011b8 100644 --- a/lib/splash/splash.dart +++ b/lib/splash/splash.dart @@ -35,7 +35,7 @@ class SplashScreen extends StatelessWidget { backgroundColor: Colors.blueGrey.shade800, screenFunction: ()async{ await c.firebaseCloudMessagingListeners(); - await c.verTutorial(); + //await c.verTutorial(); var screen = await c.verUsuLogado(); return screen; }, diff --git a/lib/splash/splash_controller.dart b/lib/splash/splash_controller.dart index 0cfbb1a..2d42009 100644 --- a/lib/splash/splash_controller.dart +++ b/lib/splash/splash_controller.dart @@ -13,8 +13,9 @@ import '../funcoes_gerais.dart'; class SplashController extends GetxController { - bool _tutorialOk = false; - FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); + //bool _tutorialOk = false; + //FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); + //FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; @override void onInit() { @@ -26,14 +27,14 @@ class SplashController extends GetxController { super.onClose(); } - Future verTutorial()async{ - SharedPreferences prefs = await SharedPreferences.getInstance(); - this._tutorialOk = prefs.getBool('tutorial') ?? false; - } + // Future verTutorial()async{ + // SharedPreferences prefs = await SharedPreferences.getInstance(); + // this._tutorialOk = prefs.getBool('tutorial') ?? false; + // } Future verUsuLogado()async{ var resp = await FuncoesGerais.checkVersaoMinimaOk(); - if(resp.vOk){ + if(resp.vOk!){ SharedPreferences prefs = await SharedPreferences.getInstance(); var token = prefs.getString('token_notif'); await FuncoesGerais.registraDevice(token); @@ -48,28 +49,46 @@ class SplashController extends GetxController { Future firebaseCloudMessagingListeners() async{ try { - if (_firebaseMessaging == null) return; + //if (_firebaseMessaging == null) return; if (Platform.isIOS) iOSPermission(); - _firebaseMessaging.getToken().then((token) async { + // _firebaseMessaging.getToken().then((token) async { + // print(token); + // SharedPreferences prefs = await SharedPreferences.getInstance(); + // await prefs.setString('token_notif', token); + // }); + FirebaseMessaging.instance.getToken().then((token) async{ print(token); SharedPreferences prefs = await SharedPreferences.getInstance(); - await prefs.setString('token_notif', token); + await prefs.setString('token_notif', token!); }); - - _firebaseMessaging.configure( - onLaunch: this._onNotification, - onMessage: this._onNotification, - //onBackgroundMessage: this._onNotification, - onResume: this._onNotification - ); + // _firebaseMessaging.configure( + // onLaunch: this._onNotification, + // onMessage: this._onNotification, + // //onBackgroundMessage: this._onNotification, + // onResume: this._onNotification + // ); + FirebaseMessaging.onMessage.listen((RemoteMessage message) { + print('Push onMessage'); + Get.snackbar(message.notification!.title ?? 'Notificação', message.notification!.body ?? 'Nova notificação', + mainButton: TextButton(onPressed: () => this._onNotification(message), child: Text('Ver')), + backgroundColor: Colors.black.withOpacity(0.7), + colorText: Colors.white + ); + //this._onNotification(message); + }); + FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { + print('A new onMessageOpenedApp event was published!'); + print(message); + //Get.snackbar(message.notification!.title ?? 'Notificação', message.notification!.body ?? 'Nova notificação',mainButton: TextButton(onPressed: () => this._onNotification(message), child: Text('Ver'))); + }); } on PlatformException catch (e) { print(e.message); } } - Future _onNotification(Map message) async{ + void _onNotification(RemoteMessage message){ Get.to(() => NotificacoesScreen()); //print(message); //print(message['aps']['alert']['title']); @@ -77,12 +96,13 @@ class SplashController extends GetxController { } void iOSPermission() { - _firebaseMessaging.requestNotificationPermissions( - IosNotificationSettings(sound: true, badge: true, alert: true)); - _firebaseMessaging.onIosSettingsRegistered - .listen((IosNotificationSettings settings) { - print("Settings registered: $settings"); - }); + FirebaseMessaging.instance.requestPermission(); + // _firebaseMessaging.requestNotificationPermissions( + // IosNotificationSettings(sound: true, badge: true, alert: true)); + // _firebaseMessaging.onIosSettingsRegistered + // .listen((IosNotificationSettings settings) { + // print("Settings registered: $settings"); + // }); } } diff --git a/lib/videos/api/youtube_api.dart b/lib/videos/api/youtube_api.dart index fb32467..3dc88f5 100644 --- a/lib/videos/api/youtube_api.dart +++ b/lib/videos/api/youtube_api.dart @@ -7,7 +7,7 @@ import 'youtube_classes.dart'; class YouTubeApi{ - Future getChannelVideos({String nextPageToken = ''}) async { + Future getChannelVideos({String? nextPageToken = ''}) async { var retorno = new YouTubeSearchResponse( errorCode: 0, errorMessage: '', @@ -25,12 +25,13 @@ class YouTubeApi{ String url = "https://www.googleapis.com/youtube/v3/search?key=${FuncoesGerais.youtubeApiKey}&channelId=${FuncoesGerais.channelId}&part=snippet,id&order=date&maxResults=10"; - if(nextPageToken.isNotEmpty) url += "&pageToken=$nextPageToken"; + if(nextPageToken!.isNotEmpty) url += "&pageToken=$nextPageToken"; try{ - var response = await http.get(url); + var response = await http.get(Uri.parse(url)); - if (response != null) { + //if (response != null) { + if (response.body.isNotEmpty) { if (response.statusCode == 200) { var data = jsonDecode(response.body); retorno = YouTubeSearchResponse.fromJson(data); diff --git a/lib/videos/api/youtube_classes.dart b/lib/videos/api/youtube_classes.dart index 6323557..e1337f0 100644 --- a/lib/videos/api/youtube_classes.dart +++ b/lib/videos/api/youtube_classes.dart @@ -1,12 +1,12 @@ class YouTubeSearchResponse { - String kind; - String etag; - String nextPageToken; - String regionCode; - PageInfo pageInfo; - List items; - int errorCode; - String errorMessage; + String? kind; + String? etag; + String? nextPageToken; + String? regionCode; + PageInfo? pageInfo; + List? items; + int? errorCode; + String? errorMessage; YouTubeSearchResponse({this.kind, this.etag, this.nextPageToken, this.regionCode, this.pageInfo, this.items,this.errorCode = 0, this.errorMessage = ''}); @@ -17,8 +17,8 @@ class YouTubeSearchResponse { regionCode = json['regionCode'] ?? ''; pageInfo = json['pageInfo'] != null ? new PageInfo.fromJson(json['pageInfo']) : null; if (json['items'] != null) { - items = new List(); - json['items'].forEach((v) { items.add(new YouTubeItems.fromJson(v)); }); + items = []; + json['items'].forEach((v) { items!.add(new YouTubeItems.fromJson(v)); }); } errorCode = 0; errorMessage = ''; @@ -26,8 +26,8 @@ class YouTubeSearchResponse { } class PageInfo { - int totalResults; - int resultsPerPage; + int? totalResults; + int? resultsPerPage; PageInfo({this.totalResults, this.resultsPerPage}); @@ -45,10 +45,10 @@ class PageInfo { } class YouTubeItems { - String kind; - String etag; - Id id; - Snippet snippet; + String? kind; + String? etag; + Id? id; + Snippet? snippet; YouTubeItems({this.kind, this.etag, this.id, this.snippet}); @@ -64,18 +64,18 @@ class YouTubeItems { data['kind'] = this.kind; data['etag'] = this.etag; if (this.id != null) { - data['id'] = this.id.toJson(); + data['id'] = this.id!.toJson(); } if (this.snippet != null) { - data['snippet'] = this.snippet.toJson(); + data['snippet'] = this.snippet!.toJson(); } return data; } } class Id { - String kind; - String videoId; + String? kind; + String? videoId; Id({this.kind, this.videoId}); @@ -93,14 +93,14 @@ class Id { } class Snippet { - String publishedAt; - String channelId; - String title; - String description; - Thumbnails thumbnails; - String channelTitle; - String liveBroadcastContent; - String publishTime; + String? publishedAt; + String? channelId; + String? title; + String? description; + Thumbnails? thumbnails; + String? channelTitle; + String? liveBroadcastContent; + String? publishTime; Snippet({this.publishedAt, this.channelId, this.title, this.description, this.thumbnails, this.channelTitle, this.liveBroadcastContent, this.publishTime}); @@ -122,7 +122,7 @@ class Snippet { data['title'] = this.title; data['description'] = this.description; if (this.thumbnails != null) { - data['thumbnails'] = this.thumbnails.toJson(); + data['thumbnails'] = this.thumbnails!.toJson(); } data['channelTitle'] = this.channelTitle; data['liveBroadcastContent'] = this.liveBroadcastContent; @@ -132,9 +132,9 @@ class Snippet { } class Thumbnails { - ThumbDefault thumbDefault; - ThumbDefault medium; - ThumbDefault high; + ThumbDefault? thumbDefault; + ThumbDefault? medium; + ThumbDefault? high; Thumbnails({this.thumbDefault, this.medium, this.high}); @@ -147,22 +147,22 @@ class Thumbnails { Map toJson() { final Map data = new Map(); if (this.thumbDefault != null) { - data['default'] = this.thumbDefault.toJson(); + data['default'] = this.thumbDefault!.toJson(); } if (this.medium != null) { - data['medium'] = this.medium.toJson(); + data['medium'] = this.medium!.toJson(); } if (this.high != null) { - data['high'] = this.high.toJson(); + data['high'] = this.high!.toJson(); } return data; } } class ThumbDefault { - String url; - int width; - int height; + String? url; + int? width; + int? height; ThumbDefault({this.url, this.width, this.height}); diff --git a/lib/videos/bloc/youtube_controller.dart b/lib/videos/bloc/youtube_controller.dart index aefda89..94888de 100644 --- a/lib/videos/bloc/youtube_controller.dart +++ b/lib/videos/bloc/youtube_controller.dart @@ -15,7 +15,7 @@ class YouTubeController extends GetxController { var itens = [].obs; bool atualizar = false; var errorCode = 0.obs; - var errorMessage = ''; + String? errorMessage = ''; var loading = true.obs; final f = DateFormat('dd/MM/yyyy HH:mm:ss'); @@ -41,23 +41,23 @@ class YouTubeController extends GetxController { Future getChannelVideosBloc({String textoBusca = '-'}) async { //this.loading.value = true; - if (results == null || atualizar || results.value.errorCode != 0) { + if (results.value.errorCode == null || atualizar || results.value.errorCode != 0) { results.value = new YouTubeSearchResponse(); this.itens = new RxList(); results.value = await this._api.getChannelVideos(); - results.value.items = results.value.items.where((element) => GetUtils.isNullOrBlank(element.id.videoId) == false).toList(); - this.itens.addAll(results.value.items); - this.errorCode.value = results.value.errorCode; + results.value.items = results.value.items!.where((element) => GetUtils.isNullOrBlank(element.id!.videoId) == false).toList(); + this.itens.addAll(results.value.items!); + this.errorCode.value = results.value.errorCode!; this.errorMessage = results.value.errorMessage; this.atualizar = false; - } else if (results.value.nextPageToken != null && results.value.nextPageToken.isNotEmpty) { + } else if (results.value.nextPageToken != null && results.value.nextPageToken!.isNotEmpty) { var more = await this._api.getChannelVideos(nextPageToken: results.value.nextPageToken); - more.items = more.items.where((element) => GetUtils.isNullOrBlank(element.id.videoId) == false).toList(); - this.errorCode.value = more.errorCode; + more.items = more.items!.where((element) => GetUtils.isNullOrBlank(element.id!.videoId) == false).toList(); + this.errorCode.value = more.errorCode!; this.errorMessage = more.errorMessage; - this.itens.addAll(more.items); + this.itens.addAll(more.items!); results.value.nextPageToken = more.nextPageToken ?? ''; - results.value.items += more.items; + results.value.items!.addAll(more.items!); } if(this.errorCode.value == -5){ this._ic.tabsWithoutVideos(); diff --git a/lib/videos/youtube_video_player.dart b/lib/videos/youtube_video_player.dart index 9b4e9e3..aa40d66 100644 --- a/lib/videos/youtube_video_player.dart +++ b/lib/videos/youtube_video_player.dart @@ -5,19 +5,19 @@ import 'api/youtube_classes.dart'; class YouTubeVideoPlayerScreen extends StatefulWidget { final YouTubeItems ytVideo; - YouTubeVideoPlayerScreen({@required this.ytVideo}); + YouTubeVideoPlayerScreen({required this.ytVideo}); @override _YouTubeVideoPlayerScreenState createState() => _YouTubeVideoPlayerScreenState(); } class _YouTubeVideoPlayerScreenState extends State { - YoutubePlayerController _controller; + late YoutubePlayerController _controller; bool _fullScreen = false; @override void initState() { super.initState(); - _controller = new YoutubePlayerController(initialVideoId: widget.ytVideo.id.videoId); + _controller = new YoutubePlayerController(initialVideoId: widget.ytVideo.id!.videoId!); } @override @@ -58,9 +58,9 @@ class _YouTubeVideoPlayerScreenState extends State { padding: const EdgeInsets.all(8.0), child: Column( children: [ - Text(widget.ytVideo.snippet.title), + Text(widget.ytVideo.snippet!.title!), SizedBox(height: 10.0,), - Text(widget.ytVideo.snippet.description), + Text(widget.ytVideo.snippet!.description!), ], ), ) diff --git a/lib/videos/youtube_videos.dart b/lib/videos/youtube_videos.dart index 5166be0..d080b12 100644 --- a/lib/videos/youtube_videos.dart +++ b/lib/videos/youtube_videos.dart @@ -219,7 +219,7 @@ class _YouTubeVideosScreenState extends State with Automati // child: this._buildListTile(index) // ); } else if (index > 1) { - if (!GetUtils.isNullOrBlank(c.results.value.nextPageToken)) { + if (!GetUtils.isNullOrBlank(c.results.value.nextPageToken)!) { c.getChannelVideosBloc(); return Center(child: CircularProgressIndicator(),); } else { @@ -248,7 +248,7 @@ class _YouTubeVideosScreenState extends State with Automati Widget listItem(YouTubeItems item) { return InkWell( onTap: (){ - if(GetUtils.isNullOrBlank(item.id.videoId)){ + if(GetUtils.isNullOrBlank(item.id!.videoId)!){ Get.rawSnackbar(message: 'Não foi possível reproduzir o vídeo'); } else{ @@ -281,21 +281,21 @@ class _YouTubeVideosScreenState extends State with Automati crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - item.snippet.title, + item.snippet!.title!, softWrap: true, maxLines: 2, style: TextStyle(fontSize: 13.0,fontWeight: FontWeight.bold), ), Padding(padding: EdgeInsets.only(bottom: 1.5)), Text( - item.snippet.description, + item.snippet!.description!, softWrap: true, maxLines: 3, style: TextStyle(fontSize: 11.0,fontWeight: FontWeight.w400), ), Padding(padding: EdgeInsets.only(bottom: 3.0)), Text( - c.getDateFormatada(item.snippet.publishedAt), + c.getDateFormatada(item.snippet!.publishedAt!), softWrap: true, maxLines: 1, style: TextStyle(fontSize: 9.0,fontWeight: FontWeight.w300), @@ -315,8 +315,9 @@ class _YouTubeVideosScreenState extends State with Automati mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text(c.errorMessage), - RaisedButton(onPressed: c.refresh, child: Text('Atualizar'),) + Text(c.errorMessage!), + ElevatedButton(onPressed: c.refresh, child: Text('Atualizar')) + //RaisedButton(onPressed: c.refresh, child: Text('Atualizar'),) ], ), ); diff --git a/pubspec.lock b/pubspec.lock index 9501abd..8bf5516 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,254 +1,275 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - advance_pdf_viewer: - dependency: "direct main" - description: - name: advance_pdf_viewer - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.2" animated_splash_screen: dependency: "direct main" description: name: animated_splash_screen url: "https://pub.dartlang.org" source: hosted - version: "1.0.1+2" + version: "1.1.0" animations: dependency: "direct main" description: name: animations url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "2.0.0" archive: dependency: transitive description: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" + version: "3.1.2" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.6.0" + version: "2.0.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.1" + version: "2.6.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" chewie: dependency: transitive description: name: chewie url: "https://pub.dartlang.org" source: hosted - version: "0.12.2" + version: "1.2.0" chewie_audio: dependency: transitive description: name: chewie_audio url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" circular_reveal_animation: dependency: "direct main" description: name: circular_reveal_animation url: "https://pub.dartlang.org" source: hosted - version: "1.1.5" + version: "2.0.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.3" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" + version: "1.15.0" convex_bottom_bar: dependency: "direct main" description: name: convex_bottom_bar url: "https://pub.dartlang.org" source: hosted - version: "2.7.1+2" + version: "3.0.0" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" - css_colors: - dependency: transitive - description: - name: css_colors - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" + version: "3.0.1" csslib: dependency: transitive description: name: csslib url: "https://pub.dartlang.org" source: hosted - version: "0.16.2" + version: "0.17.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.3" device_info: dependency: "direct main" description: name: device_info url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "2.0.2" device_info_platform_interface: dependency: transitive description: name: device_info_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.1" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.1.1" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.2.1" + version: "6.1.1" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.1" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" firebase_messaging: dependency: "direct main" description: name: firebase_messaging url: "https://pub.dartlang.org" source: hosted - version: "6.0.16" + version: "10.0.0" + firebase_messaging_platform_interface: + dependency: transitive + description: + name: firebase_messaging_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" + firebase_messaging_web: + dependency: transitive + description: + name: firebase_messaging_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" - flutter_cache_manager: - dependency: transitive - description: - name: flutter_cache_manager - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.2" flutter_html: dependency: "direct main" description: name: flutter_html url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "2.0.0" flutter_inappwebview: dependency: transitive description: name: flutter_inappwebview url: "https://pub.dartlang.org" source: hosted - version: "4.0.0+4" + version: "5.3.2" flutter_launcher_icons: dependency: "direct dev" description: name: flutter_launcher_icons url: "https://pub.dartlang.org" source: hosted - version: "0.8.1" + version: "0.9.0" flutter_layout_grid: dependency: transitive description: name: flutter_layout_grid url: "https://pub.dartlang.org" source: hosted - version: "0.10.5" + version: "1.0.1" flutter_localizations: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_math_fork: + dependency: transitive + description: + name: flutter_math_fork + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.3" flutter_native_splash: dependency: "direct dev" description: name: flutter_native_splash url: "https://pub.dartlang.org" source: hosted - version: "0.3.2" + version: "1.1.8+4" + flutter_pdfview: + dependency: "direct main" + description: + name: flutter_pdfview + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" flutter_staggered_animations: dependency: "direct main" description: name: flutter_staggered_animations url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.0" flutter_svg: dependency: transitive description: name: flutter_svg url: "https://pub.dartlang.org" source: hosted - version: "0.19.1" + version: "0.22.0" flutter_test: dependency: "direct dev" description: flutter @@ -265,273 +286,252 @@ packages: name: get url: "https://pub.dartlang.org" source: hosted - version: "3.26.0" + version: "4.1.4" html: dependency: transitive description: name: html url: "https://pub.dartlang.org" source: hosted - version: "0.14.0+4" + version: "0.15.0" http: dependency: "direct main" description: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.12.2" + version: "0.13.3" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "4.0.0" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.19" - import_js_library: - dependency: transitive - description: - name: import_js_library - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - infinite_listview: - dependency: transitive - description: - name: infinite_listview - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1+1" + version: "3.0.2" intl: dependency: transitive description: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" + version: "0.17.0" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.2" + version: "0.6.3" line_icons: dependency: "direct main" description: name: line_icons url: "https://pub.dartlang.org" source: hosted - version: "1.3.2" + version: "2.0.1" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" mime: dependency: transitive description: name: mime url: "https://pub.dartlang.org" source: hosted - version: "0.9.7" - numberpicker: + version: "1.0.0" + nested: dependency: transitive description: - name: numberpicker + name: nested url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.0.0" page_transition: dependency: transitive description: name: page_transition url: "https://pub.dartlang.org" source: hosted - version: "1.1.7+6" + version: "2.0.1-nullsafety.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.1" + version: "1.8.0" path_drawing: dependency: transitive description: name: path_drawing url: "https://pub.dartlang.org" source: hosted - version: "0.4.1+1" + version: "0.5.1" path_parsing: dependency: transitive description: name: path_parsing url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.2.1" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.28" + version: "2.0.2" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+2" + version: "2.0.0" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+8" + version: "2.0.0" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+3" + version: "2.0.1" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.9.2" + version: "1.11.0" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "4.1.0" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.0.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.13" + version: "4.2.1" + provider: + dependency: transitive + description: + name: provider + url: "https://pub.dartlang.org" + source: hosted + version: "5.0.0" quiver: dependency: transitive description: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" - rxdart: - dependency: transitive - description: - name: rxdart - url: "https://pub.dartlang.org" - source: hosted - version: "0.25.0" - sa_v1_migration: - dependency: transitive - description: - name: sa_v1_migration - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.2" + version: "3.0.1" share: dependency: "direct main" description: name: share url: "https://pub.dartlang.org" source: hosted - version: "0.6.5+4" + version: "2.0.4" shared_preferences: dependency: "direct main" description: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "0.5.12+4" + version: "2.0.6" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.2+4" + version: "2.0.0" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+11" + version: "2.0.0" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.0" shared_preferences_web: dependency: transitive description: name: shared_preferences_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.2+7" + version: "2.0.0" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.2+3" + version: "2.0.0" simple_animations: dependency: "direct main" description: name: simple_animations url: "https://pub.dartlang.org" source: hosted - version: "2.5.1" + version: "3.1.1" sky_engine: dependency: transitive description: flutter @@ -543,231 +543,231 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.2" - sqflite: - dependency: transitive - description: - name: sqflite - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.2+4" - sqflite_common: - dependency: transitive - description: - name: sqflite_common - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3+3" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.1" + version: "1.1.0" supercharged: dependency: "direct main" description: name: supercharged url: "https://pub.dartlang.org" source: hosted - version: "1.12.0" + version: "2.0.0" supercharged_dart: dependency: transitive description: name: supercharged_dart url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" - synchronized: - dependency: transitive - description: - name: synchronized - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.0+2" + version: "2.0.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.2" + version: "0.3.0" transparent_image: dependency: "direct main" description: name: transparent_image url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "2.0.0" + tuple: + dependency: transitive + description: + name: tuple + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0" + universal_io: + dependency: transitive + description: + name: universal_io + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" url_launcher: dependency: "direct main" description: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "5.7.10" + version: "6.0.4" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+4" + version: "2.0.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+9" + version: "2.0.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.9" + version: "2.0.3" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.5+3" + version: "2.0.0" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+3" - uuid: - dependency: transitive - description: - name: uuid - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.2" + version: "2.0.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" video_player: dependency: transitive description: name: video_player url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.1.4" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "4.1.0" video_player_web: dependency: transitive description: name: video_player_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.4+1" + version: "2.0.0" wakelock: dependency: transitive description: name: wakelock url: "https://pub.dartlang.org" source: hosted - version: "0.2.1+1" + version: "0.5.2" + wakelock_macos: + dependency: transitive + description: + name: wakelock_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0+1" wakelock_platform_interface: dependency: transitive description: name: wakelock_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "0.1.0+1" + version: "0.2.1+1" wakelock_web: dependency: transitive description: name: wakelock_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.0+3" + version: "0.2.0+1" + wakelock_windows: + dependency: transitive + description: + name: wakelock_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0" webview_flutter: dependency: "direct main" description: name: webview_flutter url: "https://pub.dartlang.org" source: hosted - version: "1.0.7" + version: "2.0.8" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.4+1" + version: "2.1.2" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.2.0" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "4.5.1" + version: "5.1.1" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.1.0" youtube_player_flutter: dependency: "direct main" description: name: youtube_player_flutter url: "https://pub.dartlang.org" source: hosted - version: "7.0.0+7" + version: "8.0.0" sdks: - dart: ">=2.10.2 <2.11.0" - flutter: ">=1.22.2 <2.0.0" + dart: ">=2.13.0 <3.0.0" + flutter: ">=2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index a2e8166..6bb30d5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: @@ -29,34 +29,36 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.0 - webview_flutter: ^1.0.7 - convex_bottom_bar: ^2.7.1+2 - http: ^0.12.2 - transparent_image: ^1.0.0 - flutter_staggered_animations: ^0.1.3 - simple_animations: ^2.5.1 - circular_reveal_animation: ^1.1.5 - supercharged: ^1.12.0 - url_launcher: ^5.7.10 - flutter_html: ^1.2.0 - device_info: ^1.0.0 - firebase_messaging: 6.0.16 - get: ^3.26.0 - line_icons: ^1.3.2 - animated_splash_screen: ^1.0.1+2 - animations: ^1.1.2 - shared_preferences: ^0.5.12+4 - youtube_player_flutter: ^7.0.0+7 - share: ^0.6.5+4 - advance_pdf_viewer: ^1.2.2 - path_provider: ^1.6.28 + cupertino_icons: ^1.0.3 + webview_flutter: ^2.0.8 + convex_bottom_bar: ^3.0.0 + http: ^0.13.3 + transparent_image: ^2.0.0 + flutter_staggered_animations: ^1.0.0 + simple_animations: ^3.1.1 + circular_reveal_animation: ^2.0.0 + supercharged: ^2.0.0 + url_launcher: ^6.0.4 + flutter_html: ^2.0.0 + device_info: ^2.0.2 + firebase_core: ^1.2.0 + firebase_messaging: ^10.0.0 + get: ^4.1.4 + line_icons: ^2.0.1 + animated_splash_screen: ^1.1.0 + animations: ^2.0.0 + shared_preferences: ^2.0.6 + youtube_player_flutter: ^8.0.0 + share: ^2.0.4 + #advance_pdf_viewer: ^2.0.0 + path_provider: ^2.0.2 + flutter_pdfview: ^1.1.0 dev_dependencies: flutter_test: sdk: flutter - flutter_launcher_icons: ^0.8.1 - flutter_native_splash: ^0.3.2 + flutter_launcher_icons: ^0.9.0 + flutter_native_splash: ^1.1.8+4 flutter_icons: android: true