migração flutter 2.2.1
This commit is contained in:
@@ -5,13 +5,13 @@ import 'api/notificacoes_api.dart';
|
||||
import 'api/notificacoes_classes.dart';
|
||||
|
||||
class NotificacoesController extends GetxController with SingleGetTickerProviderMixin{
|
||||
var notificacoesResults = List<NotificacaoResults>().obs;
|
||||
var notificacoesResults = <NotificacaoResults>[].obs;
|
||||
bool loadMore = true;
|
||||
NotificacoesApi _api = new NotificacoesApi();
|
||||
var notificacaoDetail = NotificacaoResponse().obs;
|
||||
int page = 1;
|
||||
var errorCode = 0.obs;
|
||||
var errorMessage = '';
|
||||
String? errorMessage = '';
|
||||
var loading = true.obs;
|
||||
var loadingDetail = true.obs;
|
||||
var like = ''.obs;
|
||||
@@ -45,27 +45,27 @@ class NotificacoesController extends GetxController with SingleGetTickerProvider
|
||||
getNotificacoesBloc()async{
|
||||
|
||||
var response = await this._api.getNotificacoes(page);
|
||||
this.loadMore = response.results.length < 1 ? false : true;
|
||||
this.loadMore = response.results!.length < 1 ? false : true;
|
||||
if(response.errorCode != 0){
|
||||
this.errorCode.value = response.errorCode;
|
||||
this.errorCode.value = response.errorCode!;
|
||||
this.errorMessage = response.errorMessage;
|
||||
}
|
||||
else{
|
||||
//if(this.page > 1)this.listKey.currentState.insertItem(2,duration: const Duration(milliseconds: 1500));
|
||||
page++;
|
||||
this.notificacoesResults.addAll(response.results);
|
||||
this.notificacoesResults.addAll(response.results!);
|
||||
}
|
||||
|
||||
if(this.loading.value)this.loading.value = false;
|
||||
|
||||
}
|
||||
|
||||
getNotificacaoDetail(int id) async {
|
||||
getNotificacaoDetail(int? id) async {
|
||||
this.loadingDetail.value = true;
|
||||
this.notificacaoDetail.value.result = new NotificacaoResults();
|
||||
var response = await this._api.getNotificacao(id);
|
||||
this.notificacaoDetail.value = response;
|
||||
this.like.value = response.result.like;
|
||||
this.like.value = response.result!.like!;
|
||||
this.loadingDetail.value = false;
|
||||
}
|
||||
|
||||
@@ -80,10 +80,11 @@ class NotificacoesController extends GetxController with SingleGetTickerProvider
|
||||
|
||||
Future<void> notificacaoLikeBloc(NotificacaoLikeRequest item) async {
|
||||
var response = await this._api.notificacaoLike(item);
|
||||
if(response != null && response.errorCode == 0)
|
||||
//if(response != null && response.errorCode == 0)
|
||||
if(response.errorCode != null && response.errorCode == 0)
|
||||
{
|
||||
this.notificacaoDetail.value.result.like = item.like;
|
||||
this.like.value = item.like;
|
||||
this.notificacaoDetail.value.result!.like = item.like;
|
||||
this.like.value = item.like!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +97,7 @@ class NotificacoesController extends GetxController with SingleGetTickerProvider
|
||||
return r;
|
||||
}
|
||||
|
||||
Future<void> notificacaoLidaBloc(int notificacaoID) async {
|
||||
Future<void> notificacaoLidaBloc(int? notificacaoID) async {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user