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. A new Flutter project.
+1 -1
View File
@@ -44,7 +44,7 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // 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 minSdkVersion 19
targetSdkVersion 30 targetSdkVersion 30
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
+5 -5
View File
@@ -35,7 +35,7 @@
"client_id": "952783625736-gam8124p405njsrlqfidnse74ca00ool.apps.googleusercontent.com", "client_id": "952783625736-gam8124p405njsrlqfidnse74ca00ool.apps.googleusercontent.com",
"client_type": 2, "client_type": 2,
"ios_info": { "ios_info": {
"bundle_id": "com.hightechx.mobile.decpisos" "bundle_id": "com.hightechx.mobile.vilacorp"
} }
} }
] ]
@@ -46,7 +46,7 @@
"client_info": { "client_info": {
"mobilesdk_app_id": "1:952783625736:android:1c56b06e23740153c07bbd", "mobilesdk_app_id": "1:952783625736:android:1c56b06e23740153c07bbd",
"android_client_info": { "android_client_info": {
"package_name": "com.hightechx.mobile.decpisos" "package_name": "com.hightechx.mobile.vilacorp"
} }
}, },
"oauth_client": [ "oauth_client": [
@@ -54,7 +54,7 @@
"client_id": "952783625736-10ripa3l39un48r3k49cd00bnv7nts6i.apps.googleusercontent.com", "client_id": "952783625736-10ripa3l39un48r3k49cd00bnv7nts6i.apps.googleusercontent.com",
"client_type": 1, "client_type": 1,
"android_info": { "android_info": {
"package_name": "com.hightechx.mobile.decpisos", "package_name": "com.hightechx.mobile.vilacorp",
"certificate_hash": "ce5f6fbc5eae2dc39f5e4a36ff2f85ea2c269676" "certificate_hash": "ce5f6fbc5eae2dc39f5e4a36ff2f85ea2c269676"
} }
}, },
@@ -62,7 +62,7 @@
"client_id": "952783625736-e798mjtemfqqrbmahj0t1monoc9gptgb.apps.googleusercontent.com", "client_id": "952783625736-e798mjtemfqqrbmahj0t1monoc9gptgb.apps.googleusercontent.com",
"client_type": 1, "client_type": 1,
"android_info": { "android_info": {
"package_name": "com.hightechx.mobile.decpisos", "package_name": "com.hightechx.mobile.vilacorp",
"certificate_hash": "64cead3173785642d31904f0f7d5036aba3a82e1" "certificate_hash": "64cead3173785642d31904f0f7d5036aba3a82e1"
} }
}, },
@@ -87,7 +87,7 @@
"client_id": "952783625736-gam8124p405njsrlqfidnse74ca00ool.apps.googleusercontent.com", "client_id": "952783625736-gam8124p405njsrlqfidnse74ca00ool.apps.googleusercontent.com",
"client_type": 2, "client_type": 2,
"ios_info": { "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" <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 <!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. 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" <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 <!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method. calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide In most cases you can leave this as-is, but you if you want to provide
@@ -8,7 +8,7 @@
<application <application
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
android:name="io.flutter.app.FlutterApplication" android:name="io.flutter.app.FlutterApplication"
android:label="Decpisos" android:label="Vilacorp"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
@@ -1,4 +1,4 @@
package com.hightechx.mobile.decpisos package com.hightechx.mobile.vilacorp
import io.flutter.embedding.android.FlutterActivity 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,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?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"> <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> <item>
<bitmap android:gravity="center" android:src="@drawable/splash"/> <bitmap android:gravity="center" android:src="@drawable/splash"/>
</item> </item>
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" <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 <!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. 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

+6 -6
View File
@@ -381,9 +381,9 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.decpisos; PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.vilacorp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Decpisos - Store"; PROVISIONING_PROFILE_SPECIFIER = "vilacorp - Store";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
@@ -523,9 +523,9 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.decpisos; PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.vilacorp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Decpisos - Developer"; PROVISIONING_PROFILE_SPECIFIER = "vilacorp - Developer";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@@ -560,9 +560,9 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.decpisos; PRODUCT_BUNDLE_IDENTIFIER = com.hightechx.mobile.vilacorp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Decpisos - Store"; PROVISIONING_PROFILE_SPECIFIER = "vilacorp - Store";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
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> <key>PLIST_VERSION</key>
<string>1</string> <string>1</string>
<key>BUNDLE_ID</key> <key>BUNDLE_ID</key>
<string>com.hightechx.mobile.decpisos</string> <string>com.hightechx.mobile.vilacorp</string>
<key>PROJECT_ID</key> <key>PROJECT_ID</key>
<string>appcards-75f33</string> <string>appcards-75f33</string>
<key>STORAGE_BUCKET</key> <key>STORAGE_BUCKET</key>
+4 -4
View File
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>Decpisos</string> <string>vilacorp</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>decpisos</string> <string>vilacorp</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
@@ -77,5 +77,5 @@
<false/> <false/>
<key>io.flutter.embedded_views_preview</key> <key>io.flutter.embedded_views_preview</key>
<true/> <true/>
</dict> </dict>
</plist> </plist>
+34 -42
View File
@@ -6,52 +6,49 @@ import 'dart:io';
import 'default_response_api.dart'; import 'default_response_api.dart';
class FuncoesGerais{ class FuncoesGerais {
//static const String urlLexLiteApi = "https://apis.lexstation.com/api/v1/"; //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 String urlBaseNewCore = "https://newcore.services/newcore/";
static const int appMobileCodigo = 18; static const int appMobileCodigo = 18;
static const String nomeApp = "Decpisos"; static const String nomeApp = "Vilacorp";
static const int versaoAtual = 100; static const int versaoAtual = 100;
static const int usuCodPadrao = 36718; static const int usuCodPadrao = 70435;
static const String youtubeApiKey = "AIzaSyAmqjP0MxgASbt98Px1_hqaIvcsqeHO15k";//"AIzaSyA8jo3qsr-JJRm40iSHfkrzaMZXdMjo9v4"; static const String youtubeApiKey =
"AIzaSyAmqjP0MxgASbt98Px1_hqaIvcsqeHO15k"; //"AIzaSyA8jo3qsr-JJRm40iSHfkrzaMZXdMjo9v4";
static const String channelId = "UCJ_EUoswNTvRGotJ-ROxaKw"; static const String channelId = "UCJ_EUoswNTvRGotJ-ROxaKw";
static const String homeURL = "https://www.decpisos.com.br/produtos-listar"; static const String homeURL = "https://vilacorp.com.br/";
static const String dominioPermitido = "https://www.decpisos.com.br"; static const String dominioPermitido = "https://vilacorp.com.br/";
static const String urlPDF = "http://app-cards.com/files/card-decpisos.pdf"; static const String urlPDF = "http://app-cards.com/files/vilacorp.pdf";
static Future<bool> checkInternetConnection() async {
static Future<bool> checkInternetConnection() async{
bool retorno = true; bool retorno = true;
try { 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) { if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
retorno = true; retorno = true;
} } else {
else{
retorno = false; retorno = false;
} }
} on SocketException catch (_) { } on SocketException catch (_) {
retorno = false; retorno = false;
} } catch (err) {
catch(err){
retorno = false; retorno = false;
} }
return retorno; return retorno;
} }
static Future<String> getUsuToken()async{ static Future<String> getUsuToken() async {
return Future<String>.value(tokenPadrao); return Future<String>.value(tokenPadrao);
} }
static Future<void> registraDevice(String? token) async{ static Future<void> registraDevice(String? token) async {
if (await FuncoesGerais.checkInternetConnection()) {
if(await FuncoesGerais.checkInternetConnection()){ if (token != null && token.isNotEmpty) {
if(token != null && token.isNotEmpty){ String url = FuncoesGerais.urlBaseNewCore +
"api/v1/user/${FuncoesGerais.tokenPadrao}/registra_device";
String url = FuncoesGerais.urlBaseNewCore+ "api/v1/user/${FuncoesGerais.tokenPadrao}/registra_device";
Map<String, String> heads = Map(); Map<String, String> heads = Map();
heads["Content-type"] = "application/json; charset=utf-8"; heads["Content-type"] = "application/json; charset=utf-8";
heads["auth-key"] = token; heads["auth-key"] = token;
@@ -79,7 +76,7 @@ class FuncoesGerais{
try { try {
var body = json.encode(objPost); var body = json.encode(objPost);
//var response = await http.post(url, body: body,headers: heads); //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); //var r = await http.post(url, body: body,headers: heads);
//print(r); //print(r);
// if (response != null) { // if (response != null) {
@@ -88,9 +85,7 @@ class FuncoesGerais{
// retorno = LoginResponse.fromJson(data); // retorno = LoginResponse.fromJson(data);
// } // }
// } // }
} catch (e) { } catch (e) {}
}
} }
} }
// else{ // else{
@@ -98,22 +93,22 @@ class FuncoesGerais{
// } // }
} }
static Future<VersaoMinimaResponse> checkVersaoMinimaOk() async{ static Future<VersaoMinimaResponse> checkVersaoMinimaOk() async {
VersaoMinimaResponse objRetorno = VersaoMinimaResponse( VersaoMinimaResponse objRetorno = VersaoMinimaResponse(
errorCode: 0, errorCode: 0,
errorMessage: '', errorMessage: '',
linkLoja: '', linkLoja: '',
nome: '', nome: '',
versaoMinima: 0, versaoMinima: 0,
vOk: true vOk: true);
); if (await FuncoesGerais.checkInternetConnection()) {
if(await FuncoesGerais.checkInternetConnection()){ String url = FuncoesGerais.urlBaseNewCore +
String url = FuncoesGerais.urlBaseNewCore + "api/v1/appmobile/${FuncoesGerais.tokenPadrao}/versaominima/$appMobileCodigo"; "api/v1/appmobile/${FuncoesGerais.tokenPadrao}/versaominima/$appMobileCodigo";
Map<String, String> heads = Map(); Map<String, String> heads = Map();
heads["Content-type"] = "application/json; charset=utf-8"; heads["Content-type"] = "application/json; charset=utf-8";
try { 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 (!GetUtils.isNullOrBlank(response.body)!) {
if (response.statusCode == 200) { if (response.statusCode == 200) {
var data = jsonDecode(response.body); var data = jsonDecode(response.body);
@@ -122,16 +117,15 @@ class FuncoesGerais{
// var v = packageInfo.version.split('.'); // var v = packageInfo.version.split('.');
// int versaoAtual = 0; // int versaoAtual = 0;
//if(v.length > 0)versaoAtual = v[0] != null && v[0].isNotEmpty ? int.parse(v[0]) : 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; objRetorno.vOk = false;
} }
} } else {
else{
objRetorno.errorCode = 4; 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.errorCode = 3;
objRetorno.errorMessage = 'Falha na comunição com o server.'; objRetorno.errorMessage = 'Falha na comunição com o server.';
} }
@@ -139,13 +133,11 @@ class FuncoesGerais{
objRetorno.errorCode = 2; objRetorno.errorCode = 2;
objRetorno.errorMessage = 'Falha na comunição com o server.'; objRetorno.errorMessage = 'Falha na comunição com o server.';
} }
} } else {
else{
objRetorno.errorCode = 1; objRetorno.errorCode = 1;
objRetorno.errorMessage = 'Sem Conexão com a internet.'; objRetorno.errorMessage = 'Sem Conexão com a internet.';
} }
return objRetorno; return objRetorno;
} }
} }
+35 -30
View File
@@ -1,5 +1,5 @@
import 'package:decpisos/charts/radial_gauge.dart'; import 'package:vilacorp/charts/radial_gauge.dart';
import 'package:decpisos/funcoes_gerais.dart'; import 'package:vilacorp/funcoes_gerais.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:line_icons/line_icons.dart'; 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:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
class HomeScreen extends StatefulWidget { class HomeScreen extends StatefulWidget {
@override @override
_HomeScreenState createState() => _HomeScreenState(); _HomeScreenState createState() => _HomeScreenState();
} }
class _HomeScreenState extends State<HomeScreen> with AutomaticKeepAliveClientMixin<HomeScreen> { class _HomeScreenState extends State<HomeScreen>
with AutomaticKeepAliveClientMixin<HomeScreen> {
bool error = false; bool error = false;
String msg = ''; String msg = '';
@override @override
@@ -25,42 +25,46 @@ class _HomeScreenState extends State<HomeScreen> with AutomaticKeepAliveClientMi
centerTitle: false, centerTitle: false,
actions: [ actions: [
IconButton( IconButton(
onPressed: (){ onPressed: () {
if(Get.theme.brightness == Brightness.dark){ if (Get.theme.brightness == Brightness.dark) {
Get.changeThemeMode(ThemeMode.light); Get.changeThemeMode(ThemeMode.light);
} } else {
else{
Get.changeThemeMode(ThemeMode.dark); Get.changeThemeMode(ThemeMode.dark);
} }
}, },
tooltip: 'Alternar modo dark/light', tooltip: 'Alternar modo dark/light',
icon: Icon(LineIcons.palette) icon: Icon(LineIcons.palette)),
), // IconButton(
IconButton(onPressed: (){ // onPressed: () {
Get.bottomSheet(BottomSheet(onClosing: ()=>null, builder: (_){ // Get.bottomSheet(BottomSheet(
return Padding( // onClosing: () => null,
padding: const EdgeInsets.all(8.0), // builder: (_) {
child: RadialEaseExample(), // return Padding(
); // padding: const EdgeInsets.all(8.0),
})); // child: RadialEaseExample(),
//Get.to(() => Scaffold(appBar: AppBar(),body: RadialEaseExample())); // );
}, icon: Icon(Icons.monetization_on_outlined)) // }));
// //Get.to(() => Scaffold(appBar: AppBar(),body: RadialEaseExample()));
// },
// icon: Icon(Icons.monetization_on_outlined))
], ],
), ),
body: SafeArea( body: SafeArea(
child: this.error ? this._buildError() : WebView( child: this.error
? this._buildError()
: WebView(
initialUrl: FuncoesGerais.homeURL, initialUrl: FuncoesGerais.homeURL,
javascriptMode: JavascriptMode.unrestricted, javascriptMode: JavascriptMode.unrestricted,
onWebResourceError: (err){ onWebResourceError: (err) {
this.error = true; this.error = true;
this.msg = err.description; this.msg = err.description;
setState(() { setState(() {});
});
}, },
allowsInlineMediaPlayback: true, allowsInlineMediaPlayback: true,
navigationDelegate: (navigation){ navigationDelegate: (navigation) {
print(navigation.url); print(navigation.url);
if (navigation.url.startsWith(FuncoesGerais.dominioPermitido)) { if (navigation.url
.startsWith(FuncoesGerais.dominioPermitido)) {
return NavigationDecision.navigate; return NavigationDecision.navigate;
} }
//print('allowing navigation to $request'); //print('allowing navigation to $request');
@@ -72,19 +76,20 @@ class _HomeScreenState extends State<HomeScreen> with AutomaticKeepAliveClientMi
); );
} }
Widget _buildError(){ Widget _buildError() {
return Center( return Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text(msg), Text(msg),
ElevatedButton(onPressed: (){ ElevatedButton(
onPressed: () {
this.error = false; this.error = false;
this.msg = ''; this.msg = '';
setState(() { setState(() {});
}); },
}, child: Text('Atualizar')) child: Text('Atualizar'))
// RaisedButton(onPressed: (){ // RaisedButton(onPressed: (){
// this.error = false; // this.error = false;
// this.msg = ''; // this.msg = '';
+4 -4
View File
@@ -1,7 +1,7 @@
//import 'package:decpisos/home/home.dart'; //import 'package:vilacorp/home/home.dart';
import 'package:decpisos/index/index_controller.dart'; import 'package:vilacorp/index/index_controller.dart';
//import 'package:decpisos/notificacoes/notificacoes.dart'; //import 'package:vilacorp/notificacoes/notificacoes.dart';
//import 'package:decpisos/videos/youtube_videos.dart'; //import 'package:vilacorp/videos/youtube_videos.dart';
import 'package:convex_bottom_bar/convex_bottom_bar.dart'; import 'package:convex_bottom_bar/convex_bottom_bar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
+7 -8
View File
@@ -1,9 +1,9 @@
import 'package:decpisos/home/home.dart'; import 'package:vilacorp/home/home.dart';
//import 'package:decpisos/instagram_embed/instagram_embed.dart'; //import 'package:vilacorp/instagram_embed/instagram_embed.dart';
import 'package:decpisos/notificacoes/notificacoes.dart'; import 'package:vilacorp/notificacoes/notificacoes.dart';
//import 'package:decpisos/videos/youtube_videos.dart'; //import 'package:vilacorp/videos/youtube_videos.dart';
import 'package:convex_bottom_bar/convex_bottom_bar.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:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:line_icons/line_icons.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.childrenTabs.add(Tab(child: NotificacoesScreen()));
//this.tabs.add(TabItem(icon: Icons.video_collection, title: 'Vídeos')); //this.tabs.add(TabItem(icon: Icons.video_collection, title: 'Vídeos'));
//this.tabs.add(TabItem(icon: LineIcons.instagram, title: 'Instagram')); //this.tabs.add(TabItem(icon: LineIcons.instagram, title: 'Instagram'));
this this.tabs.add(
.tabs TabItem(icon: LineIcons.identificationCard, title: 'Vilacorp card'));
.add(TabItem(icon: LineIcons.identificationCard, title: 'DecCard'));
this.tabs.add(TabItem(icon: Icons.home, title: 'Home')); this.tabs.add(TabItem(icon: Icons.home, title: 'Home'));
this.tabs.add(TabItem(icon: Icons.notifications, title: 'Notificações')); this.tabs.add(TabItem(icon: Icons.notifications, title: 'Notificações'));
this.tabController = TabController(vsync: this, length: this.tabs.length); this.tabController = TabController(vsync: this, length: this.tabs.length);
+14 -11
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:flutter/material.dart';
//import 'package:url_launcher/url_launcher.dart'; //import 'package:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
@@ -8,21 +8,23 @@ class InstagramScreen extends StatefulWidget {
_InstagramScreenState createState() => _InstagramScreenState(); _InstagramScreenState createState() => _InstagramScreenState();
} }
class _InstagramScreenState extends State<InstagramScreen> with AutomaticKeepAliveClientMixin<InstagramScreen> { class _InstagramScreenState extends State<InstagramScreen>
with AutomaticKeepAliveClientMixin<InstagramScreen> {
bool error = false; bool error = false;
String msg = ''; String msg = '';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return SafeArea( return SafeArea(
child: this.error ? this._buildError() : WebView( child: this.error
? this._buildError()
: WebView(
initialUrl: 'https://blog.hightechx.com/teste-feed-instagram/', initialUrl: 'https://blog.hightechx.com/teste-feed-instagram/',
javascriptMode: JavascriptMode.unrestricted, javascriptMode: JavascriptMode.unrestricted,
onWebResourceError: (err){ onWebResourceError: (err) {
this.error = true; this.error = true;
this.msg = err.description; this.msg = err.description;
setState(() { setState(() {});
});
}, },
// navigationDelegate: (navigation){ // navigationDelegate: (navigation){
// print(navigation.url); // print(navigation.url);
@@ -37,19 +39,20 @@ class _InstagramScreenState extends State<InstagramScreen> with AutomaticKeepAli
); );
} }
Widget _buildError(){ Widget _buildError() {
return Center( return Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text(msg), Text(msg),
ElevatedButton(onPressed: (){ ElevatedButton(
onPressed: () {
this.error = false; this.error = false;
this.msg = ''; this.msg = '';
setState(() { setState(() {});
}); },
}, child: Text('Atualizar')) child: Text('Atualizar'))
// RaisedButton(onPressed: (){ // RaisedButton(onPressed: (){
// this.error = false; // this.error = false;
// this.msg = ''; // this.msg = '';
+2 -4
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_core/firebase_core.dart';
//import 'package:firebase_messaging/firebase_messaging.dart'; //import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -35,7 +35,5 @@ Future<void> main() async {
// primarySwatch: Colors.blueGrey // primarySwatch: Colors.blueGrey
// ), // ),
themeMode: ThemeMode.dark, themeMode: ThemeMode.dark,
home: SplashScreen() home: SplashScreen()));
));
} }
+11 -5
View File
@@ -1,5 +1,5 @@
//import 'package:advance_pdf_viewer/advance_pdf_viewer.dart'; //import 'package:advance_pdf_viewer/advance_pdf_viewer.dart';
import 'package:decpisos/pdfviewer/pdfviewer_controller.dart'; import 'package:vilacorp/pdfviewer/pdfviewer_controller.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_pdfview/flutter_pdfview.dart'; import 'package:flutter_pdfview/flutter_pdfview.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -10,13 +10,17 @@ class PDFViewerScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('DecCard'), title: Text('Vilacorp card'),
centerTitle: false, centerTitle: false,
leading: Container(), leading: Container(),
leadingWidth: 0, leadingWidth: 0,
actions: [ actions: [
Obx(() => c.loadPDF.value ? Center(child: CircularProgressIndicator()) : IconButton(icon: Icon(Icons.share), onPressed: c.sharePDF)), Obx(() => c.loadPDF.value
Obx(() => c.visibleRefresh.value ? IconButton(icon: Icon(Icons.refresh), onPressed: c.refreshPDF) : Container()) ? 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 // body: Obx(() => c.loading.value
@@ -31,7 +35,9 @@ class PDFViewerScreen extends StatelessWidget {
? Center( ? Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
) )
: c.error.value ? c.buildError() : PDFView( : c.error.value
? c.buildError()
: PDFView(
filePath: c.filePDF!.path, filePath: c.filePDF!.path,
//nightMode: true, //nightMode: true,
fitPolicy: FitPolicy.BOTH, fitPolicy: FitPolicy.BOTH,
+15 -13
View File
@@ -1,14 +1,14 @@
import 'dart:io' as io; import 'dart:io' as io;
//import 'package:advance_pdf_viewer/advance_pdf_viewer.dart'; //import 'package:advance_pdf_viewer/advance_pdf_viewer.dart';
import 'package:decpisos/funcoes_gerais.dart'; import 'package:vilacorp/funcoes_gerais.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:share/share.dart'; import 'package:share/share.dart';
class PDFViewerScreenController extends GetxController{ class PDFViewerScreenController extends GetxController {
var loading = true.obs; var loading = true.obs;
var loadPDF = false.obs; var loadPDF = false.obs;
var visibleRefresh = false.obs; var visibleRefresh = false.obs;
@@ -40,7 +40,7 @@ class PDFViewerScreenController extends GetxController{
// } // }
if(file == null || await file.exists() == false){ if (file == null || await file.exists() == false) {
this.error.value = true; this.error.value = true;
} }
@@ -63,12 +63,12 @@ class PDFViewerScreenController extends GetxController{
this.loadPDF.value = true; this.loadPDF.value = true;
var file = await this._createFileOfPdfUrl(); var file = await this._createFileOfPdfUrl();
try { 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) { } catch (e) {
this.loadPDF.value = false; this.loadPDF.value = false;
Get.rawSnackbar(message: 'Não foi possível compartilhar o PDF'); Get.rawSnackbar(message: 'Não foi possível compartilhar o PDF');
} }
} }
Future<io.File?> _createFileOfPdfUrl() async { Future<io.File?> _createFileOfPdfUrl() async {
@@ -78,24 +78,24 @@ class PDFViewerScreenController extends GetxController{
final filename = url.substring(url.lastIndexOf("/") + 1); final filename = url.substring(url.lastIndexOf("/") + 1);
String dir = (await getApplicationDocumentsDirectory()).path; String dir = (await getApplicationDocumentsDirectory()).path;
file = io.File('$dir/$filename'); file = io.File('$dir/$filename');
if(!await file.exists()){ if (!await file.exists()) {
if(await FuncoesGerais.checkInternetConnection()){ if (await FuncoesGerais.checkInternetConnection()) {
var request = await io.HttpClient().getUrl(Uri.parse(url)); var request = await io.HttpClient().getUrl(Uri.parse(url));
var response = await request.close(); var response = await request.close();
var bytes = await consolidateHttpClientResponseBytes(response); var bytes = await consolidateHttpClientResponseBytes(response);
await file.writeAsBytes(bytes); await file.writeAsBytes(bytes);
} } else {
else{
file = null; file = null;
} }
} }
this.filePDF = file; 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; return file;
} }
Widget buildError(){ Widget buildError() {
return Container( return Container(
width: double.maxFinite, width: double.maxFinite,
child: Column( child: Column(
@@ -103,8 +103,10 @@ class PDFViewerScreenController extends GetxController{
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text('Não foi possível carregar o PDF'), Text('Não foi possível carregar o PDF'),
SizedBox(height: 10.0,), SizedBox(
ElevatedButton(onPressed: this.refreshPDF,child: Text('Atualizar')) height: 10.0,
),
ElevatedButton(onPressed: this.refreshPDF, child: Text('Atualizar'))
//RaisedButton(onPressed: this.refreshPDF,child: Text('Atualizar'),) //RaisedButton(onPressed: this.refreshPDF,child: Text('Atualizar'),)
], ],
), ),
+19 -5
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:flutter/material.dart';
import 'package:animated_splash_screen/animated_splash_screen.dart'; import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:page_transition/page_transition.dart'; import 'package:page_transition/page_transition.dart';
import 'splash_controller.dart'; import 'splash_controller.dart';
class SplashScreen extends StatelessWidget { class SplashScreen extends StatelessWidget {
final SplashController c = Get.put(SplashController()); final SplashController c = Get.put(SplashController());
@override @override
@@ -20,10 +21,23 @@ class SplashScreen extends StatelessWidget {
children: [ children: [
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
child: Container(width: 120.0,height: 120.0,child: Image.asset('assets/images/logo.png',fit: BoxFit.contain,)) 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() LinearProgressIndicator()
], ],
), ),
@@ -33,7 +47,7 @@ class SplashScreen extends StatelessWidget {
splashTransition: SplashTransition.slideTransition, splashTransition: SplashTransition.slideTransition,
pageTransitionType: PageTransitionType.fade, pageTransitionType: PageTransitionType.fade,
backgroundColor: Colors.blueGrey.shade800, backgroundColor: Colors.blueGrey.shade800,
screenFunction: ()async{ screenFunction: () async {
await c.firebaseCloudMessagingListeners(); await c.firebaseCloudMessagingListeners();
//await c.verTutorial(); //await c.verTutorial();
var screen = await c.verUsuLogado(); var screen = await c.verUsuLogado();
+15 -19
View File
@@ -1,8 +1,8 @@
import 'dart:io'; import 'dart:io';
import 'package:decpisos/atualizarapp/atualizarapp.dart'; import 'package:vilacorp/atualizarapp/atualizarapp.dart';
import 'package:decpisos/index/index.dart'; import 'package:vilacorp/index/index.dart';
import 'package:decpisos/notificacoes/notificacoes.dart'; import 'package:vilacorp/notificacoes/notificacoes.dart';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -12,7 +12,6 @@ import 'package:shared_preferences/shared_preferences.dart';
import '../funcoes_gerais.dart'; import '../funcoes_gerais.dart';
class SplashController extends GetxController { class SplashController extends GetxController {
//bool _tutorialOk = false; //bool _tutorialOk = false;
//FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); //FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
//FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; //FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance;
@@ -32,23 +31,20 @@ class SplashController extends GetxController {
// 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(); var resp = await FuncoesGerais.checkVersaoMinimaOk();
if(resp.vOk!){ if (resp.vOk!) {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
var token = prefs.getString('token_notif'); var token = prefs.getString('token_notif');
await FuncoesGerais.registraDevice(token); await FuncoesGerais.registraDevice(token);
return IndexScreen(); return IndexScreen();
} } else {
else{
return AtualizarScreen(linkLoja: resp.linkLoja); return AtualizarScreen(linkLoja: resp.linkLoja);
} }
} }
Future<void> firebaseCloudMessagingListeners() async{ Future<void> firebaseCloudMessagingListeners() async {
try { try {
//if (_firebaseMessaging == null) return; //if (_firebaseMessaging == null) return;
if (Platform.isIOS) iOSPermission(); if (Platform.isIOS) iOSPermission();
@@ -58,7 +54,7 @@ class SplashController extends GetxController {
// SharedPreferences prefs = await SharedPreferences.getInstance(); // SharedPreferences prefs = await SharedPreferences.getInstance();
// await prefs.setString('token_notif', token); // await prefs.setString('token_notif', token);
// }); // });
FirebaseMessaging.instance.getToken().then((token) async{ FirebaseMessaging.instance.getToken().then((token) async {
print(token); print(token);
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString('token_notif', token!); await prefs.setString('token_notif', token!);
@@ -71,11 +67,13 @@ class SplashController extends GetxController {
// ); // );
FirebaseMessaging.onMessage.listen((RemoteMessage message) { FirebaseMessaging.onMessage.listen((RemoteMessage message) {
print('Push onMessage'); print('Push onMessage');
Get.snackbar(message.notification!.title ?? 'Notificação', message.notification!.body ?? 'Nova notificação', Get.snackbar(message.notification!.title ?? 'Notificação',
mainButton: TextButton(onPressed: () => this._onNotification(message), child: Text('Ver')), message.notification!.body ?? 'Nova notificação',
mainButton: TextButton(
onPressed: () => this._onNotification(message),
child: Text('Ver')),
backgroundColor: Colors.black.withOpacity(0.7), backgroundColor: Colors.black.withOpacity(0.7),
colorText: Colors.white colorText: Colors.white);
);
//this._onNotification(message); //this._onNotification(message);
}); });
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
@@ -88,7 +86,7 @@ class SplashController extends GetxController {
} }
} }
void _onNotification(RemoteMessage message){ void _onNotification(RemoteMessage message) {
Get.to(() => NotificacoesScreen()); Get.to(() => NotificacoesScreen());
//print(message); //print(message);
//print(message['aps']['alert']['title']); //print(message['aps']['alert']['title']);
@@ -104,6 +102,4 @@ class SplashController extends GetxController {
// print("Settings registered: $settings"); // print("Settings registered: $settings");
// }); // });
} }
} }
+22 -12
View File
@@ -1,6 +1,6 @@
import 'package:decpisos/index/index_controller.dart'; import 'package:vilacorp/index/index_controller.dart';
import 'package:decpisos/videos/api/youtube_api.dart'; import 'package:vilacorp/videos/api/youtube_api.dart';
import 'package:decpisos/videos/api/youtube_classes.dart'; import 'package:vilacorp/videos/api/youtube_classes.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart' show DateFormat; import 'package:intl/intl.dart' show DateFormat;
@@ -41,25 +41,36 @@ class YouTubeController extends GetxController {
Future<void> getChannelVideosBloc({String textoBusca = '-'}) async { Future<void> getChannelVideosBloc({String textoBusca = '-'}) async {
//this.loading.value = true; //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(); results.value = new YouTubeSearchResponse();
this.itens = new RxList<YouTubeItems>(); this.itens = new RxList<YouTubeItems>();
results.value = await this._api.getChannelVideos(); 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.itens.addAll(results.value.items!);
this.errorCode.value = results.value.errorCode!; this.errorCode.value = results.value.errorCode!;
this.errorMessage = results.value.errorMessage; this.errorMessage = results.value.errorMessage;
this.atualizar = false; this.atualizar = false;
} else if (results.value.nextPageToken != null && results.value.nextPageToken!.isNotEmpty) { } else if (results.value.nextPageToken != null &&
var more = await this._api.getChannelVideos(nextPageToken: results.value.nextPageToken); results.value.nextPageToken!.isNotEmpty) {
more.items = more.items!.where((element) => GetUtils.isNullOrBlank(element.id!.videoId) == false).toList(); 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.errorCode.value = more.errorCode!;
this.errorMessage = more.errorMessage; this.errorMessage = more.errorMessage;
this.itens.addAll(more.items!); this.itens.addAll(more.items!);
results.value.nextPageToken = more.nextPageToken ?? ''; results.value.nextPageToken = more.nextPageToken ?? '';
results.value.items!.addAll(more.items!); results.value.items!.addAll(more.items!);
} }
if(this.errorCode.value == -5){ if (this.errorCode.value == -5) {
this._ic.tabsWithoutVideos(); this._ic.tabsWithoutVideos();
} }
this.loading.value = false; this.loading.value = false;
@@ -76,12 +87,11 @@ class YouTubeController extends GetxController {
this.getChannelVideosBloc(); this.getChannelVideosBloc();
} }
String getDateFormatada(String dt){ String getDateFormatada(String dt) {
String r = ''; String r = '';
try { try {
r = this.f.format(DateTime.parse(dt)); r = this.f.format(DateTime.parse(dt));
} catch (e) { } catch (e) {}
}
return r; return r;
} }
} }
+39 -28
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/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -176,8 +176,8 @@ class YouTubeVideosScreen extends StatefulWidget {
_YouTubeVideosScreenState createState() => _YouTubeVideosScreenState(); _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()); final YouTubeController c = Get.put(YouTubeController());
@override @override
@@ -195,13 +195,19 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
appBar: AppBar( appBar: AppBar(
title: Text('Vídeos'), title: Text('Vídeos'),
), ),
body: Obx(() => c.loading.value ? Center(child: CircularProgressIndicator(),) : c.errorCode.value != 0 ? this._buildError() : RefreshIndicator( body: Obx(() => c.loading.value
? Center(
child: CircularProgressIndicator(),
)
: c.errorCode.value != 0
? this._buildError()
: RefreshIndicator(
onRefresh: c.refresh, onRefresh: c.refresh,
child: AnimationLimiter( child: AnimationLimiter(
child: ListView.builder( child: ListView.builder(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
itemCount: c.itens.length + 1, itemCount: c.itens.length + 1,
itemBuilder: (_,index){ itemBuilder: (_, index) {
if (index < c.itens.length) { if (index < c.itens.length) {
var item = c.itens[index]; var item = c.itens[index];
return AnimationConfiguration.staggeredList( return AnimationConfiguration.staggeredList(
@@ -211,32 +217,34 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
verticalOffset: 30.0, verticalOffset: 30.0,
child: FadeInAnimation( child: FadeInAnimation(
child: listItem(item), child: listItem(item),
) )));
)
);
// return SlideTransition( // return SlideTransition(
// position: c.animation, // position: c.animation,
// child: this._buildListTile(index) // child: this._buildListTile(index)
// ); // );
} else if (index > 1) { } else if (index > 1) {
if (!GetUtils.isNullOrBlank(c.results.value.nextPageToken)!) { if (!GetUtils.isNullOrBlank(
c.results.value.nextPageToken)!) {
c.getChannelVideosBloc(); c.getChannelVideosBloc();
return Center(child: CircularProgressIndicator(),); return Center(
child: CircularProgressIndicator(),
);
} else { } else {
return Center( return Center(
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 8.0,bottom: 25.0), padding: const EdgeInsets.only(
child: top: 8.0, bottom: 25.0),
Text("Não há mais Vídeos para exibir."), child: Text("Não há mais Vídeos para exibir."),
), ),
); );
} }
} } else {
else { return Center(
return Center(child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 8.0), padding: const EdgeInsets.only(top: 8.0),
child: Text("Não há mais Vídeos para exibir."), child: Text("Não há mais Vídeos para exibir."),
),); ),
);
} }
}, },
), ),
@@ -247,14 +255,14 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
Widget listItem(YouTubeItems item) { Widget listItem(YouTubeItems item) {
return InkWell( return InkWell(
onTap: (){ onTap: () {
if(GetUtils.isNullOrBlank(item.id!.videoId)!){ if (GetUtils.isNullOrBlank(item.id!.videoId)!) {
Get.rawSnackbar(message: 'Não foi possível reproduzir o vídeo'); 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( child: Card(
elevation: 0, elevation: 0,
@@ -266,7 +274,7 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
LimitedBox( LimitedBox(
maxHeight: 100.0, maxHeight: 100.0,
child: AspectRatio( child: AspectRatio(
aspectRatio: 4/3, aspectRatio: 4 / 3,
child: FadeInImage.memoryNetwork( child: FadeInImage.memoryNetwork(
placeholder: kTransparentImage, placeholder: kTransparentImage,
image: item.snippet?.thumbnails?.thumbDefault?.url ?? '', image: item.snippet?.thumbnails?.thumbDefault?.url ?? '',
@@ -284,21 +292,24 @@ class _YouTubeVideosScreenState extends State<YouTubeVideosScreen> with Automati
item.snippet!.title!, item.snippet!.title!,
softWrap: true, softWrap: true,
maxLines: 2, 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)), Padding(padding: EdgeInsets.only(bottom: 1.5)),
Text( Text(
item.snippet!.description!, item.snippet!.description!,
softWrap: true, softWrap: true,
maxLines: 3, 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)), Padding(padding: EdgeInsets.only(bottom: 3.0)),
Text( Text(
c.getDateFormatada(item.snippet!.publishedAt!), c.getDateFormatada(item.snippet!.publishedAt!),
softWrap: true, softWrap: true,
maxLines: 1, 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( return Container(
width: double.maxFinite, width: double.maxFinite,
child: Column( child: Column(
+1 -1
View File
@@ -1,4 +1,4 @@
name: decpisos name: vilacorp
description: A new Flutter project. description: A new Flutter project.
# The following line prevents the package from being accidentally published to # 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 // 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. // 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/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';