diff --git a/README.md b/README.md index 2211acb..2253679 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# decpisos +# vilacorp A new Flutter project. diff --git a/android/app/build.gradle b/android/app/build.gradle index 295ce8f..d85862e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -44,7 +44,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.hightechx.mobile.decpisos" + applicationId "com.hightechx.mobile.vilacorp" minSdkVersion 19 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() diff --git a/android/app/google-services.json b/android/app/google-services.json index 6f13d7b..eae3b4c 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -35,7 +35,7 @@ "client_id": "952783625736-gam8124p405njsrlqfidnse74ca00ool.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "com.hightechx.mobile.decpisos" + "bundle_id": "com.hightechx.mobile.vilacorp" } } ] @@ -46,7 +46,7 @@ "client_info": { "mobilesdk_app_id": "1:952783625736:android:1c56b06e23740153c07bbd", "android_client_info": { - "package_name": "com.hightechx.mobile.decpisos" + "package_name": "com.hightechx.mobile.vilacorp" } }, "oauth_client": [ @@ -54,7 +54,7 @@ "client_id": "952783625736-10ripa3l39un48r3k49cd00bnv7nts6i.apps.googleusercontent.com", "client_type": 1, "android_info": { - "package_name": "com.hightechx.mobile.decpisos", + "package_name": "com.hightechx.mobile.vilacorp", "certificate_hash": "ce5f6fbc5eae2dc39f5e4a36ff2f85ea2c269676" } }, @@ -62,7 +62,7 @@ "client_id": "952783625736-e798mjtemfqqrbmahj0t1monoc9gptgb.apps.googleusercontent.com", "client_type": 1, "android_info": { - "package_name": "com.hightechx.mobile.decpisos", + "package_name": "com.hightechx.mobile.vilacorp", "certificate_hash": "64cead3173785642d31904f0f7d5036aba3a82e1" } }, @@ -87,7 +87,7 @@ "client_id": "952783625736-gam8124p405njsrlqfidnse74ca00ool.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "com.hightechx.mobile.decpisos" + "bundle_id": "com.hightechx.mobile.vilacorp" } } ] diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index dd87c66..09882f2 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.hightechx.mobile.vilacorp"> diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 2ff25d3..421c6d4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.hightechx.mobile.vilacorp"> - + + + - + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index 34b38eb..e86961e 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 65f547c..12fc7db 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index dfbccdc..302bed6 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index c0d6c55..b51ffaa 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 24c2b12..e646835 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..7c806c6 --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index dd87c66..09882f2 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.hightechx.mobile.vilacorp"> diff --git a/assets/images/logo.png b/assets/images/logo.png index db8daef..7ca9352 100644 Binary files a/assets/images/logo.png and b/assets/images/logo.png differ diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 8d7d7d1..ef533ae 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -381,9 +381,9 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.decpisos; + PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.vilacorp; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "Decpisos - Store"; + PROVISIONING_PROFILE_SPECIFIER = "vilacorp - Store"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -523,9 +523,9 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.decpisos; + PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.vilacorp; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "Decpisos - Developer"; + PROVISIONING_PROFILE_SPECIFIER = "vilacorp - Developer"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -560,9 +560,9 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.decpisos; + PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.vilacorp; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "Decpisos - Store"; + PROVISIONING_PROFILE_SPECIFIER = "vilacorp - Store"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -595,4 +595,4 @@ /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; -} +} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index 097399f..e779347 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index 611415f..71355d2 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index efac7ef..4923c0b 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index 6a2a245..e453313 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index b811872..2c4f8b4 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index ac8c600..9a1bf40 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index 085b8df..e19e256 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index efac7ef..4923c0b 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index 2c1dfa0..97335cf 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index 94374bc..a4d4320 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index 94374bc..a4d4320 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index 169e16b..a0e81a8 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index c25be4f..3feeec6 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index f69ec0f..a495e26 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index 2aa6ca6..2220aa2 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png index a24f811..0c4b8f2 100644 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png index 88190c3..3a371ae 100644 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png index 097399f..e779347 100644 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist index bd44dd5..4d4cc72 100644 --- a/ios/Runner/GoogleService-Info.plist +++ b/ios/Runner/GoogleService-Info.plist @@ -15,7 +15,7 @@ PLIST_VERSION 1 BUNDLE_ID - com.hightechx.mobile.decpisos + com.hightechx.mobile.vilacorp PROJECT_ID appcards-75f33 STORAGE_BUCKET diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index b3b2e08..7873a7d 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -1,81 +1,81 @@ - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - Decpisos - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - decpisos - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - LSSupportsOpeningDocumentsInPlace - - NSAppTransportSecurity - NSAllowsArbitraryLoads + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + vilacorp + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + vilacorp + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS - NSAllowsArbitraryLoadsInWebContent + LSSupportsOpeningDocumentsInPlace + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSAllowsArbitraryLoadsInWebContent + + + NSAppleMusicUsageDescription + Para selecionar áudios para trnascrição + NSCameraUsageDescription + Para atualizar sua foto de perfil + NSLocationAlwaysUsageDescription + Para determinar a audiência das mídias por geolocalização. + NSLocationWhenInUseUsageDescription + Para determinar a audiência das mídias por geolocalização. + NSMicrophoneUsageDescription + Para gravar áudios + NSPhotoLibraryAddUsageDescription + Para compartilhar os downloads + NSPhotoLibraryUsageDescription + Para selecionar vídeos para trancrição ou atualizar sua foto + UIBackgroundModes + + fetch + remote-notification + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIStatusBarHidden + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportsDocumentBrowser + + UIViewControllerBasedStatusBarAppearance + + io.flutter.embedded_views_preview - NSAppleMusicUsageDescription - Para selecionar áudios para trnascrição - NSCameraUsageDescription - Para atualizar sua foto de perfil - NSLocationAlwaysUsageDescription - Para determinar a audiência das mídias por geolocalização. - NSLocationWhenInUseUsageDescription - Para determinar a audiência das mídias por geolocalização. - NSMicrophoneUsageDescription - Para gravar áudios - NSPhotoLibraryAddUsageDescription - Para compartilhar os downloads - NSPhotoLibraryUsageDescription - Para selecionar vídeos para trancrição ou atualizar sua foto - UIBackgroundModes - - fetch - remote-notification - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIStatusBarHidden - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportsDocumentBrowser - - UIViewControllerBasedStatusBarAppearance - - io.flutter.embedded_views_preview - - - + \ No newline at end of file diff --git a/lib/funcoes_gerais.dart b/lib/funcoes_gerais.dart index 06a2aba..7baa7cd 100644 --- a/lib/funcoes_gerais.dart +++ b/lib/funcoes_gerais.dart @@ -6,52 +6,49 @@ import 'dart:io'; import 'default_response_api.dart'; -class FuncoesGerais{ - +class FuncoesGerais { //static const String urlLexLiteApi = "https://apis.lexstation.com/api/v1/"; - static const String tokenPadrao = "6JN4NNEP6IDEK7I2BCXTA7D1DPJR78"; + static const String tokenPadrao = "GA9P876KYL2XNHHKMU0VSHEEYEL37D"; static const String urlBaseNewCore = "https://newcore.services/newcore/"; static const int appMobileCodigo = 18; - static const String nomeApp = "Decpisos"; + static const String nomeApp = "Vilacorp"; static const int versaoAtual = 100; - static const int usuCodPadrao = 36718; - static const String youtubeApiKey = "AIzaSyAmqjP0MxgASbt98Px1_hqaIvcsqeHO15k";//"AIzaSyA8jo3qsr-JJRm40iSHfkrzaMZXdMjo9v4"; - static const String channelId = "UCJ_EUoswNTvRGotJ-ROxaKw"; - static const String homeURL = "https://www.decpisos.com.br/produtos-listar"; - static const String dominioPermitido = "https://www.decpisos.com.br"; - static const String urlPDF = "http://app-cards.com/files/card-decpisos.pdf"; + static const int usuCodPadrao = 70435; + static const String youtubeApiKey = + "AIzaSyAmqjP0MxgASbt98Px1_hqaIvcsqeHO15k"; //"AIzaSyA8jo3qsr-JJRm40iSHfkrzaMZXdMjo9v4"; + static const String channelId = "UCJ_EUoswNTvRGotJ-ROxaKw"; + static const String homeURL = "https://vilacorp.com.br/"; + static const String dominioPermitido = "https://vilacorp.com.br/"; + static const String urlPDF = "http://app-cards.com/files/vilacorp.pdf"; - - static Future checkInternetConnection() async{ + static Future checkInternetConnection() async { bool retorno = true; try { - final result = await InternetAddress.lookup('google.com').timeout(Duration(seconds: 5)); + final result = await InternetAddress.lookup('google.com') + .timeout(Duration(seconds: 5)); if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) { retorno = true; - } - else{ + } else { retorno = false; } } on SocketException catch (_) { retorno = false; - } - catch(err){ + } catch (err) { retorno = false; - } + } return retorno; } - static Future getUsuToken()async{ + static Future getUsuToken() async { return Future.value(tokenPadrao); } - static Future registraDevice(String? token) async{ - - if(await FuncoesGerais.checkInternetConnection()){ - if(token != null && token.isNotEmpty){ - - String url = FuncoesGerais.urlBaseNewCore+ "api/v1/user/${FuncoesGerais.tokenPadrao}/registra_device"; + static Future registraDevice(String? token) async { + if (await FuncoesGerais.checkInternetConnection()) { + if (token != null && token.isNotEmpty) { + String url = FuncoesGerais.urlBaseNewCore + + "api/v1/user/${FuncoesGerais.tokenPadrao}/registra_device"; Map heads = Map(); heads["Content-type"] = "application/json; charset=utf-8"; heads["auth-key"] = token; @@ -66,8 +63,8 @@ class FuncoesGerais{ platformCoddigo = 1; var info = await deviceInfo.iosInfo; model = info.utsname.machine; - } - + } + var objPost = new RegistraDeviceRequest( aPPMOBILECODIGO: appMobileCodigo, dEVICETOKEN: token, @@ -79,7 +76,7 @@ class FuncoesGerais{ try { var body = json.encode(objPost); //var response = await http.post(url, body: body,headers: heads); - await http.post(Uri.parse(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) { @@ -88,32 +85,30 @@ class FuncoesGerais{ // retorno = LoginResponse.fromJson(data); // } // } - } catch (e) { - } - - } + } catch (e) {} + } } // else{ // print('Nada'); - // } + // } } - static Future checkVersaoMinimaOk() async{ + static Future checkVersaoMinimaOk() async { VersaoMinimaResponse objRetorno = VersaoMinimaResponse( - errorCode: 0, - errorMessage: '', - linkLoja: '', - nome: '', - versaoMinima: 0, - vOk: true - ); - if(await FuncoesGerais.checkInternetConnection()){ - String url = FuncoesGerais.urlBaseNewCore + "api/v1/appmobile/${FuncoesGerais.tokenPadrao}/versaominima/$appMobileCodigo"; + errorCode: 0, + errorMessage: '', + linkLoja: '', + nome: '', + versaoMinima: 0, + vOk: true); + if (await FuncoesGerais.checkInternetConnection()) { + String url = FuncoesGerais.urlBaseNewCore + + "api/v1/appmobile/${FuncoesGerais.tokenPadrao}/versaominima/$appMobileCodigo"; Map heads = Map(); heads["Content-type"] = "application/json; charset=utf-8"; try { - http.Response response = await http.get(Uri.parse(url),headers: heads); + 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); @@ -122,30 +117,27 @@ 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(objRetorno.versaoMinima! > FuncoesGerais.versaoAtual){ + if (objRetorno.versaoMinima! > FuncoesGerais.versaoAtual) { objRetorno.vOk = false; } - } - else{ + } else { objRetorno.errorCode = 4; - objRetorno.errorMessage = 'Falha na comunição com a API error:${response.statusCode}.'; + objRetorno.errorMessage = + 'Falha na comunição com a API error:${response.statusCode}.'; } - } - else{ + } else { objRetorno.errorCode = 3; - objRetorno.errorMessage = 'Falha na comunição com o server.'; + objRetorno.errorMessage = 'Falha na comunição com o server.'; } } catch (e) { objRetorno.errorCode = 2; objRetorno.errorMessage = 'Falha na comunição com o server.'; - } - } - else{ + } + } else { objRetorno.errorCode = 1; objRetorno.errorMessage = 'Sem Conexão com a internet.'; } - return objRetorno; - } - -} \ No newline at end of file + return objRetorno; + } +} diff --git a/lib/home/home.dart b/lib/home/home.dart index a911ec5..6547a11 100644 --- a/lib/home/home.dart +++ b/lib/home/home.dart @@ -1,5 +1,5 @@ -import 'package:decpisos/charts/radial_gauge.dart'; -import 'package:decpisos/funcoes_gerais.dart'; +import 'package:vilacorp/charts/radial_gauge.dart'; +import 'package:vilacorp/funcoes_gerais.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:line_icons/line_icons.dart'; @@ -7,13 +7,13 @@ import 'package:syncfusion_flutter_gauges/gauges.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:webview_flutter/webview_flutter.dart'; - class HomeScreen extends StatefulWidget { @override _HomeScreenState createState() => _HomeScreenState(); } -class _HomeScreenState extends State with AutomaticKeepAliveClientMixin { +class _HomeScreenState extends State + with AutomaticKeepAliveClientMixin { bool error = false; String msg = ''; @override @@ -25,66 +25,71 @@ class _HomeScreenState extends State with AutomaticKeepAliveClientMi 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) - ), - IconButton(onPressed: (){ - Get.bottomSheet(BottomSheet(onClosing: ()=>null, builder: (_){ - return Padding( - padding: const EdgeInsets.all(8.0), - child: RadialEaseExample(), - ); - })); - //Get.to(() => Scaffold(appBar: AppBar(),body: RadialEaseExample())); - }, icon: Icon(Icons.monetization_on_outlined)) + 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)), + // IconButton( + // onPressed: () { + // Get.bottomSheet(BottomSheet( + // onClosing: () => null, + // builder: (_) { + // return Padding( + // padding: const EdgeInsets.all(8.0), + // child: RadialEaseExample(), + // ); + // })); + // //Get.to(() => Scaffold(appBar: AppBar(),body: RadialEaseExample())); + // }, + // icon: Icon(Icons.monetization_on_outlined)) ], ), 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; - }, - ), + 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; + }, + ), ), ); } - Widget _buildError(){ + Widget _buildError() { return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text(msg), - ElevatedButton(onPressed: (){ - this.error = false; - this.msg = ''; - setState(() { - }); - }, child: Text('Atualizar')) + ElevatedButton( + onPressed: () { + this.error = false; + this.msg = ''; + setState(() {}); + }, + child: Text('Atualizar')) // RaisedButton(onPressed: (){ // this.error = false; // this.msg = ''; @@ -98,4 +103,4 @@ class _HomeScreenState extends State with AutomaticKeepAliveClientMi @override bool get wantKeepAlive => true; -} \ No newline at end of file +} diff --git a/lib/index/index.dart b/lib/index/index.dart index 2393a6b..ffff895 100644 --- a/lib/index/index.dart +++ b/lib/index/index.dart @@ -1,7 +1,7 @@ -//import 'package:decpisos/home/home.dart'; -import 'package:decpisos/index/index_controller.dart'; -//import 'package:decpisos/notificacoes/notificacoes.dart'; -//import 'package:decpisos/videos/youtube_videos.dart'; +//import 'package:vilacorp/home/home.dart'; +import 'package:vilacorp/index/index_controller.dart'; +//import 'package:vilacorp/notificacoes/notificacoes.dart'; +//import 'package:vilacorp/videos/youtube_videos.dart'; import 'package:convex_bottom_bar/convex_bottom_bar.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -40,7 +40,7 @@ class _IndexScreenState extends State { // NotificacoesScreen() // ] children: c.childrenTabs.map((element) => element).toList(), - )), + )), bottomNavigationBar: Obx(() => ConvexAppBar( // items: [ // TabItem(icon: Icons.video_collection, title: 'Vídeos'), diff --git a/lib/index/index_controller.dart b/lib/index/index_controller.dart index 3ceb615..d1bd7d6 100644 --- a/lib/index/index_controller.dart +++ b/lib/index/index_controller.dart @@ -1,9 +1,9 @@ -import 'package:decpisos/home/home.dart'; -//import 'package:decpisos/instagram_embed/instagram_embed.dart'; -import 'package:decpisos/notificacoes/notificacoes.dart'; -//import 'package:decpisos/videos/youtube_videos.dart'; +import 'package:vilacorp/home/home.dart'; +//import 'package:vilacorp/instagram_embed/instagram_embed.dart'; +import 'package:vilacorp/notificacoes/notificacoes.dart'; +//import 'package:vilacorp/videos/youtube_videos.dart'; import 'package:convex_bottom_bar/convex_bottom_bar.dart'; -import 'package:decpisos/pdfviewer/pdfviewer.dart'; +import 'package:vilacorp/pdfviewer/pdfviewer.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:line_icons/line_icons.dart'; @@ -36,9 +36,8 @@ class IndexController extends GetxController with SingleGetTickerProviderMixin { this.childrenTabs.add(Tab(child: NotificacoesScreen())); //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: LineIcons.identificationCard, title: 'DecCard')); + this.tabs.add( + TabItem(icon: LineIcons.identificationCard, title: 'Vilacorp card')); this.tabs.add(TabItem(icon: Icons.home, title: 'Home')); this.tabs.add(TabItem(icon: Icons.notifications, title: 'Notificações')); this.tabController = TabController(vsync: this, length: this.tabs.length); diff --git a/lib/instagram_embed/instagram_embed.dart b/lib/instagram_embed/instagram_embed.dart index 5dac883..56216d6 100644 --- a/lib/instagram_embed/instagram_embed.dart +++ b/lib/instagram_embed/instagram_embed.dart @@ -1,4 +1,4 @@ -//import 'package:decpisos/funcoes_gerais.dart'; +//import 'package:vilacorp/funcoes_gerais.dart'; import 'package:flutter/material.dart'; //import 'package:url_launcher/url_launcher.dart'; import 'package:webview_flutter/webview_flutter.dart'; @@ -8,48 +8,51 @@ class InstagramScreen extends StatefulWidget { _InstagramScreenState createState() => _InstagramScreenState(); } -class _InstagramScreenState extends State with AutomaticKeepAliveClientMixin { +class _InstagramScreenState extends State + with AutomaticKeepAliveClientMixin { 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; - // }, - ), + 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(){ + Widget _buildError() { return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text(msg), - ElevatedButton(onPressed: (){ - this.error = false; - this.msg = ''; - setState(() { - }); - }, child: Text('Atualizar')) + ElevatedButton( + onPressed: () { + this.error = false; + this.msg = ''; + setState(() {}); + }, + child: Text('Atualizar')) // RaisedButton(onPressed: (){ // this.error = false; // this.msg = ''; @@ -63,4 +66,4 @@ class _InstagramScreenState extends State with AutomaticKeepAli @override bool get wantKeepAlive => true; -} \ No newline at end of file +} diff --git a/lib/main.dart b/lib/main.dart index ad003f8..5682de3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,4 @@ -import 'package:decpisos/funcoes_gerais.dart'; +import 'package:vilacorp/funcoes_gerais.dart'; import 'package:firebase_core/firebase_core.dart'; //import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; @@ -17,25 +17,23 @@ Future main() async { // }); runApp(GetMaterialApp( - title: FuncoesGerais.nomeApp, - localizationsDelegates: [ - // ... app-specific localization delegate[s] here - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate - ], - 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, - home: SplashScreen() - )); + title: FuncoesGerais.nomeApp, + localizationsDelegates: [ + // ... app-specific localization delegate[s] here + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate + ], + 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, + home: SplashScreen())); } - diff --git a/lib/pdfviewer/pdfviewer.dart b/lib/pdfviewer/pdfviewer.dart index 8ed506d..db9c462 100644 --- a/lib/pdfviewer/pdfviewer.dart +++ b/lib/pdfviewer/pdfviewer.dart @@ -1,5 +1,5 @@ //import 'package:advance_pdf_viewer/advance_pdf_viewer.dart'; -import 'package:decpisos/pdfviewer/pdfviewer_controller.dart'; +import 'package:vilacorp/pdfviewer/pdfviewer_controller.dart'; import 'package:flutter/material.dart'; import 'package:flutter_pdfview/flutter_pdfview.dart'; import 'package:get/get.dart'; @@ -10,13 +10,17 @@ class PDFViewerScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('DecCard'), + title: Text('Vilacorp card'), centerTitle: false, leading: Container(), leadingWidth: 0, actions: [ - Obx(() => c.loadPDF.value ? Center(child: CircularProgressIndicator()) : IconButton(icon: Icon(Icons.share), onPressed: c.sharePDF)), - Obx(() => c.visibleRefresh.value ? IconButton(icon: Icon(Icons.refresh), onPressed: c.refreshPDF) : Container()) + Obx(() => c.loadPDF.value + ? Center(child: CircularProgressIndicator()) + : IconButton(icon: Icon(Icons.share), onPressed: c.sharePDF)), + Obx(() => c.visibleRefresh.value + ? IconButton(icon: Icon(Icons.refresh), onPressed: c.refreshPDF) + : Container()) ], ), // body: Obx(() => c.loading.value @@ -31,11 +35,13 @@ class PDFViewerScreen extends StatelessWidget { ? Center( child: CircularProgressIndicator(), ) - : c.error.value ? c.buildError() : PDFView( - filePath: c.filePDF!.path, - //nightMode: true, - fitPolicy: FitPolicy.BOTH, - )), + : 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 214d5e9..f4b52e4 100644 --- a/lib/pdfviewer/pdfviewer_controller.dart +++ b/lib/pdfviewer/pdfviewer_controller.dart @@ -1,14 +1,14 @@ import 'dart:io' as io; //import 'package:advance_pdf_viewer/advance_pdf_viewer.dart'; -import 'package:decpisos/funcoes_gerais.dart'; +import 'package:vilacorp/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'; import 'package:share/share.dart'; -class PDFViewerScreenController extends GetxController{ +class PDFViewerScreenController extends GetxController { var loading = true.obs; var loadPDF = false.obs; var visibleRefresh = false.obs; @@ -29,7 +29,7 @@ class PDFViewerScreenController extends GetxController{ // 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; @@ -37,10 +37,10 @@ class PDFViewerScreenController extends GetxController{ // else{ // this.doc = await PDFDocument.fromURL(FuncoesGerais.urlPDF); // } - - // } - - if(file == null || await file.exists() == false){ + + // } + + if (file == null || await file.exists() == false) { this.error.value = true; } @@ -63,13 +63,13 @@ 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: 'Vilacorp card') + .then((value) => this.loadPDF.value = false); } catch (e) { this.loadPDF.value = false; Get.rawSnackbar(message: 'Não foi possível compartilhar o PDF'); } - - } + } Future _createFileOfPdfUrl() async { final url = FuncoesGerais.urlPDF; @@ -78,24 +78,24 @@ class PDFViewerScreenController extends GetxController{ final filename = url.substring(url.lastIndexOf("/") + 1); String dir = (await getApplicationDocumentsDirectory()).path; file = io.File('$dir/$filename'); - if(!await file.exists()){ - if(await FuncoesGerais.checkInternetConnection()){ + if (!await file.exists()) { + if (await FuncoesGerais.checkInternetConnection()) { var request = await io.HttpClient().getUrl(Uri.parse(url)); var response = await request.close(); var bytes = await consolidateHttpClientResponseBytes(response); await file.writeAsBytes(bytes); - } - else{ + } else { file = null; - } + } } this.filePDF = file; - if(this.filePDF != null) this.visibleRefresh.value = await this.filePDF!.exists(); + if (this.filePDF != null) + this.visibleRefresh.value = await this.filePDF!.exists(); return file; - } + } - Widget buildError(){ + Widget buildError() { return Container( width: double.maxFinite, child: Column( @@ -103,11 +103,13 @@ class PDFViewerScreenController extends GetxController{ crossAxisAlignment: CrossAxisAlignment.center, children: [ Text('Não foi possível carregar o PDF'), - SizedBox(height: 10.0,), - ElevatedButton(onPressed: this.refreshPDF,child: Text('Atualizar')) + SizedBox( + height: 10.0, + ), + ElevatedButton(onPressed: this.refreshPDF, child: Text('Atualizar')) //RaisedButton(onPressed: this.refreshPDF,child: Text('Atualizar'),) ], ), ); } -} \ No newline at end of file +} diff --git a/lib/splash/splash.dart b/lib/splash/splash.dart index 55011b8..32a424b 100644 --- a/lib/splash/splash.dart +++ b/lib/splash/splash.dart @@ -1,10 +1,11 @@ -import 'package:decpisos/funcoes_gerais.dart'; +import 'package:vilacorp/funcoes_gerais.dart'; import 'package:flutter/material.dart'; import 'package:animated_splash_screen/animated_splash_screen.dart'; import 'package:get/get.dart'; import 'package:page_transition/page_transition.dart'; import 'splash_controller.dart'; + class SplashScreen extends StatelessWidget { final SplashController c = Get.put(SplashController()); @override @@ -19,11 +20,24 @@ class SplashScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: Container(width: 120.0,height: 120.0,child: Image.asset('assets/images/logo.png',fit: BoxFit.contain,)) + borderRadius: BorderRadius.circular(8.0), + child: Container( + width: 120.0, + height: 120.0, + child: Image.asset( + 'assets/images/logo.png', + fit: BoxFit.contain, + ))), + SizedBox( + height: 10.0, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Text( + FuncoesGerais.nomeApp, + style: TextStyle(color: Colors.white, fontSize: 22.0), + ), ), - SizedBox(height: 10.0,), - Text(FuncoesGerais.nomeApp,style: TextStyle(color: Colors.green.shade600,fontSize: 22.0),), LinearProgressIndicator() ], ), @@ -33,7 +47,7 @@ class SplashScreen extends StatelessWidget { splashTransition: SplashTransition.slideTransition, pageTransitionType: PageTransitionType.fade, backgroundColor: Colors.blueGrey.shade800, - screenFunction: ()async{ + screenFunction: () async { await c.firebaseCloudMessagingListeners(); //await c.verTutorial(); var screen = await c.verUsuLogado(); @@ -42,4 +56,4 @@ class SplashScreen extends StatelessWidget { //backgroundColor: Colors.blue ); } -} \ No newline at end of file +} diff --git a/lib/splash/splash_controller.dart b/lib/splash/splash_controller.dart index 2d42009..aacca0f 100644 --- a/lib/splash/splash_controller.dart +++ b/lib/splash/splash_controller.dart @@ -1,8 +1,8 @@ import 'dart:io'; -import 'package:decpisos/atualizarapp/atualizarapp.dart'; -import 'package:decpisos/index/index.dart'; -import 'package:decpisos/notificacoes/notificacoes.dart'; +import 'package:vilacorp/atualizarapp/atualizarapp.dart'; +import 'package:vilacorp/index/index.dart'; +import 'package:vilacorp/notificacoes/notificacoes.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -12,11 +12,10 @@ import 'package:shared_preferences/shared_preferences.dart'; import '../funcoes_gerais.dart'; class SplashController extends GetxController { - //bool _tutorialOk = false; //FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); //FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; - + @override void onInit() { super.onInit(); @@ -29,26 +28,23 @@ class SplashController extends GetxController { // Future verTutorial()async{ // SharedPreferences prefs = await SharedPreferences.getInstance(); - // this._tutorialOk = prefs.getBool('tutorial') ?? false; + // this._tutorialOk = prefs.getBool('tutorial') ?? false; // } - Future verUsuLogado()async{ + 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); return IndexScreen(); - } - else{ + } else { return AtualizarScreen(linkLoja: resp.linkLoja); - } - - } + } + } - Future firebaseCloudMessagingListeners() async{ + Future firebaseCloudMessagingListeners() async { try { - //if (_firebaseMessaging == null) return; if (Platform.isIOS) iOSPermission(); @@ -58,7 +54,7 @@ class SplashController extends GetxController { // SharedPreferences prefs = await SharedPreferences.getInstance(); // await prefs.setString('token_notif', token); // }); - FirebaseMessaging.instance.getToken().then((token) async{ + FirebaseMessaging.instance.getToken().then((token) async { print(token); SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.setString('token_notif', token!); @@ -69,26 +65,28 @@ class SplashController extends GetxController { // //onBackgroundMessage: this._onNotification, // onResume: this._onNotification // ); - FirebaseMessaging.onMessage.listen((RemoteMessage message) { + 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 - ); + 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); } } - void _onNotification(RemoteMessage message){ + void _onNotification(RemoteMessage message) { Get.to(() => NotificacoesScreen()); //print(message); //print(message['aps']['alert']['title']); @@ -103,7 +101,5 @@ class SplashController extends GetxController { // .listen((IosNotificationSettings settings) { // print("Settings registered: $settings"); // }); - } - + } } - diff --git a/lib/videos/bloc/youtube_controller.dart b/lib/videos/bloc/youtube_controller.dart index 94888de..0eda71e 100644 --- a/lib/videos/bloc/youtube_controller.dart +++ b/lib/videos/bloc/youtube_controller.dart @@ -1,6 +1,6 @@ -import 'package:decpisos/index/index_controller.dart'; -import 'package:decpisos/videos/api/youtube_api.dart'; -import 'package:decpisos/videos/api/youtube_classes.dart'; +import 'package:vilacorp/index/index_controller.dart'; +import 'package:vilacorp/videos/api/youtube_api.dart'; +import 'package:vilacorp/videos/api/youtube_classes.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart' show DateFormat; @@ -16,50 +16,61 @@ class YouTubeController extends GetxController { bool atualizar = false; var errorCode = 0.obs; String? errorMessage = ''; - var loading = true.obs; + var loading = true.obs; final f = DateFormat('dd/MM/yyyy HH:mm:ss'); @override void onInit() { super.onInit(); - - // _controller = AnimationController( - // duration: const Duration(milliseconds: 650), - // vsync: this, - // )..forward(); - // animation = Tween( - // begin: const Offset(-0.5, 0.0), - // end: const Offset(0.0, 0.0), - // ).animate(CurvedAnimation( - // parent: _controller, - // curve: Curves.easeInCubic, - // )); + + // _controller = AnimationController( + // duration: const Duration(milliseconds: 650), + // vsync: this, + // )..forward(); + // animation = Tween( + // begin: const Offset(-0.5, 0.0), + // end: const Offset(0.0, 0.0), + // ).animate(CurvedAnimation( + // parent: _controller, + // curve: Curves.easeInCubic, + // )); this.atualizar = true; this.itens = new RxList(); this.getChannelVideosBloc(); - } + } Future getChannelVideosBloc({String textoBusca = '-'}) async { //this.loading.value = true; - if (results.value.errorCode == 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(); + 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.errorCode.value = results.value.errorCode!; + this.errorMessage = results.value.errorMessage; this.atualizar = false; - } 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!; - this.errorMessage = more.errorMessage; - this.itens.addAll(more.items!); + } 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!; + this.errorMessage = more.errorMessage; + this.itens.addAll(more.items!); results.value.nextPageToken = more.nextPageToken ?? ''; results.value.items!.addAll(more.items!); } - if(this.errorCode.value == -5){ + if (this.errorCode.value == -5) { this._ic.tabsWithoutVideos(); } this.loading.value = false; @@ -76,12 +87,11 @@ class YouTubeController extends GetxController { this.getChannelVideosBloc(); } - String getDateFormatada(String dt){ + String getDateFormatada(String dt) { String r = ''; try { r = this.f.format(DateTime.parse(dt)); - } catch (e) { - } + } catch (e) {} return r; - } + } } diff --git a/lib/videos/youtube_videos.dart b/lib/videos/youtube_videos.dart index d080b12..bdaf220 100644 --- a/lib/videos/youtube_videos.dart +++ b/lib/videos/youtube_videos.dart @@ -1,4 +1,4 @@ -import 'package:decpisos/videos/youtube_video_player.dart'; +import 'package:vilacorp/videos/youtube_video_player.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:get/get.dart'; @@ -53,18 +53,18 @@ import 'bloc/youtube_controller.dart'; // Text("Não há mais Vídeos para exibir."), // ), // ); -// } -// } +// } +// } // else { // return Center(child: Padding( // padding: const EdgeInsets.only(top: 8.0), // child: Text("Não há mais Vídeos para exibir."), // ),); -// } +// } // }, // ), // ), -// )), +// )), // ); // } @@ -102,7 +102,7 @@ import 'bloc/youtube_controller.dart'; // // fullScreen: true //default false // // ); // // }, -// // ) +// // ) // ], // ), // )); @@ -168,7 +168,7 @@ import 'bloc/youtube_controller.dart'; // RaisedButton(onPressed: c.refresh, child: Text('Atualizar'),) // ], // ); -// } +// } // } class YouTubeVideosScreen extends StatefulWidget { @@ -176,8 +176,8 @@ class YouTubeVideosScreen extends StatefulWidget { _YouTubeVideosScreenState createState() => _YouTubeVideosScreenState(); } -class _YouTubeVideosScreenState extends State with AutomaticKeepAliveClientMixin { - +class _YouTubeVideosScreenState extends State + with AutomaticKeepAliveClientMixin { final YouTubeController c = Get.put(YouTubeController()); @override @@ -195,66 +195,74 @@ class _YouTubeVideosScreenState extends State with Automati appBar: AppBar( title: Text('Vídeos'), ), - body: Obx(() => c.loading.value ? Center(child: CircularProgressIndicator(),) : c.errorCode.value != 0 ? this._buildError() : RefreshIndicator( - onRefresh: c.refresh, - child: AnimationLimiter( - child: ListView.builder( - padding: const EdgeInsets.all(8.0), - itemCount: c.itens.length + 1, - itemBuilder: (_,index){ - if (index < c.itens.length) { - var item = c.itens[index]; - return AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 375), - child: SlideAnimation( - verticalOffset: 30.0, - child: FadeInAnimation( - child: listItem(item), - ) - ) - ); - // return SlideTransition( - // position: c.animation, - // child: this._buildListTile(index) - // ); - } else if (index > 1) { - if (!GetUtils.isNullOrBlank(c.results.value.nextPageToken)!) { - c.getChannelVideosBloc(); - return Center(child: CircularProgressIndicator(),); - } else { - return Center( - child: Padding( - padding: const EdgeInsets.only(top: 8.0,bottom: 25.0), - child: - Text("Não há mais Vídeos para exibir."), + body: Obx(() => c.loading.value + ? Center( + child: CircularProgressIndicator(), + ) + : c.errorCode.value != 0 + ? this._buildError() + : RefreshIndicator( + onRefresh: c.refresh, + child: AnimationLimiter( + child: ListView.builder( + padding: const EdgeInsets.all(8.0), + itemCount: c.itens.length + 1, + itemBuilder: (_, index) { + if (index < c.itens.length) { + var item = c.itens[index]; + return AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 375), + child: SlideAnimation( + verticalOffset: 30.0, + child: FadeInAnimation( + child: listItem(item), + ))); + // return SlideTransition( + // position: c.animation, + // child: this._buildListTile(index) + // ); + } else if (index > 1) { + if (!GetUtils.isNullOrBlank( + c.results.value.nextPageToken)!) { + c.getChannelVideosBloc(); + return Center( + child: CircularProgressIndicator(), + ); + } else { + return Center( + child: Padding( + padding: const EdgeInsets.only( + top: 8.0, bottom: 25.0), + child: Text("Não há mais Vídeos para exibir."), + ), + ); + } + } else { + return Center( + child: Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text("Não há mais Vídeos para exibir."), + ), + ); + } + }, ), - ); - } - } - else { - return Center(child: Padding( - padding: const EdgeInsets.only(top: 8.0), - child: Text("Não há mais Vídeos para exibir."), - ),); - } - }, - ), - ), - )), + ), + )), ); } Widget listItem(YouTubeItems item) { return InkWell( - onTap: (){ - if(GetUtils.isNullOrBlank(item.id!.videoId)!){ + onTap: () { + if (GetUtils.isNullOrBlank(item.id!.videoId)!) { Get.rawSnackbar(message: 'Não foi possível reproduzir o vídeo'); + } else { + Get.to(() => YouTubeVideoPlayerScreen( + ytVideo: item, + )); } - else{ - Get.to(() => YouTubeVideoPlayerScreen(ytVideo: item,)); - } - }, child: Card( elevation: 0, @@ -266,7 +274,7 @@ class _YouTubeVideosScreenState extends State with Automati LimitedBox( maxHeight: 100.0, child: AspectRatio( - aspectRatio: 4/3, + aspectRatio: 4 / 3, child: FadeInImage.memoryNetwork( placeholder: kTransparentImage, image: item.snippet?.thumbnails?.thumbDefault?.url ?? '', @@ -284,21 +292,24 @@ class _YouTubeVideosScreenState extends State with Automati item.snippet!.title!, softWrap: true, maxLines: 2, - style: TextStyle(fontSize: 13.0,fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 13.0, fontWeight: FontWeight.bold), ), Padding(padding: EdgeInsets.only(bottom: 1.5)), Text( item.snippet!.description!, softWrap: true, maxLines: 3, - style: TextStyle(fontSize: 11.0,fontWeight: FontWeight.w400), + style: TextStyle( + fontSize: 11.0, fontWeight: FontWeight.w400), ), Padding(padding: EdgeInsets.only(bottom: 3.0)), Text( c.getDateFormatada(item.snippet!.publishedAt!), softWrap: true, maxLines: 1, - style: TextStyle(fontSize: 9.0,fontWeight: FontWeight.w300), + style: + TextStyle(fontSize: 9.0, fontWeight: FontWeight.w300), ), ])) ], @@ -308,7 +319,7 @@ class _YouTubeVideosScreenState extends State with Automati ); } - Widget _buildError(){ + Widget _buildError() { return Container( width: double.maxFinite, child: Column( @@ -321,5 +332,5 @@ class _YouTubeVideosScreenState extends State with Automati ], ), ); - } -} \ No newline at end of file + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 98916c2..6af2ff8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,4 @@ -name: decpisos +name: vilacorp description: A new Flutter project. # The following line prevents the package from being accidentally published to diff --git a/test/widget_test.dart b/test/widget_test.dart index fef4e33..efd5993 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -5,7 +5,7 @@ // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. -import 'package:decpisos/splash/splash.dart'; +import 'package:vilacorp/splash/splash.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart';