Protótipo Vilacorp

This commit is contained in:
2021-09-15 09:18:36 -03:00
parent c995325ba7
commit 001ee87e87
58 changed files with 502 additions and 437 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# decpisos
# vilacorp
A new Flutter project.
+1 -1
View File
@@ -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()
+5 -5
View File
@@ -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"
}
}
]
+1 -1
View File
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hightechx.mobile.decpisos">
package="com.hightechx.mobile.vilacorp">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
+2 -2
View File
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hightechx.mobile.decpisos">
package="com.hightechx.mobile.vilacorp">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
@@ -8,7 +8,7 @@
<application
android:usesCleartextTraffic="true"
android:name="io.flutter.app.FlutterApplication"
android:label="Decpisos"
android:label="Vilacorp"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
@@ -1,4 +1,4 @@
package com.hightechx.mobile.decpisos
package com.hightechx.mobile.vilacorp
import io.flutter.embedding.android.FlutterActivity
Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
</item>
<item>
<bitmap android:gravity="center" android:src="@drawable/splash"/>
</item>
</layer-list>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_color"/>
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
</item>
<item>
<bitmap android:gravity="center" android:src="@drawable/splash"/>
</item>
</layer-list>
</layer-list>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:windowFullscreen">false</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
+1 -1
View File
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hightechx.mobile.decpisos">
package="com.hightechx.mobile.vilacorp">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 47 KiB

+7 -7
View File
@@ -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 */;
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 26 KiB

+1 -1
View File
@@ -15,7 +15,7 @@
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.hightechx.mobile.decpisos</string>
<string>com.hightechx.mobile.vilacorp</string>
<key>PROJECT_ID</key>
<string>appcards-75f33</string>
<key>STORAGE_BUCKET</key>
+74 -74
View File
@@ -1,81 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Decpisos</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>decpisos</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>vilacorp</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>vilacorp</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>Para selecionar áudios para trnascrição</string>
<key>NSCameraUsageDescription</key>
<string>Para atualizar sua foto de perfil</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Para determinar a audiência das mídias por geolocalização.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Para determinar a audiência das mídias por geolocalização.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Para gravar áudios</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Para compartilhar os downloads</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Para selecionar vídeos para trancrição ou atualizar sua foto</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportsDocumentBrowser</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
</dict>
<key>NSAppleMusicUsageDescription</key>
<string>Para selecionar áudios para trnascrição</string>
<key>NSCameraUsageDescription</key>
<string>Para atualizar sua foto de perfil</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Para determinar a audiência das mídias por geolocalização.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Para determinar a audiência das mídias por geolocalização.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Para gravar áudios</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Para compartilhar os downloads</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Para selecionar vídeos para trancrição ou atualizar sua foto</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportsDocumentBrowser</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
</dict>
</plist>
</plist>
+50 -58
View File
@@ -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<bool> checkInternetConnection() async{
static Future<bool> 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<String> getUsuToken()async{
static Future<String> getUsuToken() async {
return Future<String>.value(tokenPadrao);
}
static Future<void> 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<void> 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<String, String> 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<VersaoMinimaResponse> checkVersaoMinimaOk() async{
static Future<VersaoMinimaResponse> 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<String, String> 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;
}
}
return objRetorno;
}
}
+57 -52
View File
@@ -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<HomeScreen> with AutomaticKeepAliveClientMixin<HomeScreen> {
class _HomeScreenState extends State<HomeScreen>
with AutomaticKeepAliveClientMixin<HomeScreen> {
bool error = false;
String msg = '';
@override
@@ -25,66 +25,71 @@ class _HomeScreenState extends State<HomeScreen> 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<HomeScreen> with AutomaticKeepAliveClientMi
@override
bool get wantKeepAlive => true;
}
}
+5 -5
View File
@@ -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<IndexScreen> {
// NotificacoesScreen()
// ]
children: c.childrenTabs.map((element) => element).toList(),
)),
)),
bottomNavigationBar: Obx(() => ConvexAppBar(
// items: [
// TabItem(icon: Icons.video_collection, title: 'Vídeos'),
+7 -8
View File
@@ -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);
+32 -29
View File
@@ -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<InstagramScreen> with AutomaticKeepAliveClientMixin<InstagramScreen> {
class _InstagramScreenState extends State<InstagramScreen>
with AutomaticKeepAliveClientMixin<InstagramScreen> {
bool error = false;
String msg = '';
@override
Widget build(BuildContext context) {
super.build(context);
return SafeArea(
child: this.error ? this._buildError() : WebView(
initialUrl: 'https://blog.hightechx.com/teste-feed-instagram/',
javascriptMode: JavascriptMode.unrestricted,
onWebResourceError: (err){
this.error = true;
this.msg = err.description;
setState(() {
});
},
// navigationDelegate: (navigation){
// print(navigation.url);
// if (navigation.url.startsWith(FuncoesGerais.dominioPermitido)) {
// return NavigationDecision.navigate;
// }
// //print('allowing navigation to $request');
// launch(navigation.url);
// return NavigationDecision.prevent;
// },
),
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<InstagramScreen> with AutomaticKeepAli
@override
bool get wantKeepAlive => true;
}
}
+20 -22
View File
@@ -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<void> 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()));
}
+15 -9
View File
@@ -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,
)),
);
}
}
+23 -21
View File
@@ -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<io.File?> _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'),)
],
),
);
}
}
}
+21 -7
View File
@@ -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
);
}
}
}
+23 -27
View File
@@ -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<void> verTutorial()async{
// SharedPreferences prefs = await SharedPreferences.getInstance();
// this._tutorialOk = prefs.getBool('tutorial') ?? false;
// this._tutorialOk = prefs.getBool('tutorial') ?? false;
// }
Future<Widget> verUsuLogado()async{
Future<Widget> 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<void> firebaseCloudMessagingListeners() async{
Future<void> 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");
// });
}
}
}
+42 -32
View File
@@ -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<Offset>(
// 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<Offset>(
// 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<YouTubeItems>();
this.getChannelVideosBloc();
}
}
Future<void> 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<YouTubeItems>();
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;
}
}
}
+79 -68
View File
@@ -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<YouTubeVideosScreen> with AutomaticKeepAliveClientMixin<YouTubeVideosScreen> {
class _YouTubeVideosScreenState extends State<YouTubeVideosScreen>
with AutomaticKeepAliveClientMixin<YouTubeVideosScreen> {
final YouTubeController c = Get.put(YouTubeController());
@override
@@ -195,66 +195,74 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> 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<YouTubeVideosScreen> 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<YouTubeVideosScreen> 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<YouTubeVideosScreen> with Automati
);
}
Widget _buildError(){
Widget _buildError() {
return Container(
width: double.maxFinite,
child: Column(
@@ -321,5 +332,5 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
],
),
);
}
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
name: decpisos
name: vilacorp
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
+1 -1
View File
@@ -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';