hotfix considerações finais do pr

This commit is contained in:
J. A. Messias 2024-11-08 14:49:26 -03:00
parent 83f7b0aeff
commit 5fd43b48f3
4 changed files with 49 additions and 49 deletions

View File

@ -28,15 +28,15 @@ class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> with
late final PeopleOnThePropertyPageModel model;
late Future<void> _petsFuture;
List<dynamic> _petsWrap = [];
late Future<void> _future;
List<dynamic> _wrap = [];
@override
void initState() {
super.initState();
model = createModel(context, () => PeopleOnThePropertyPageModel(onRefresh: () => safeSetState(() {})));
_petsFuture = _fetchVisits();
_future = _fetchVisits();
_scrollController = ScrollController()
..addListener(() {
@ -68,7 +68,7 @@ class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> with
children: [
Center(
child: Text(FFLocalizations.of(context)
.getVariableText(ptText: "Nenhum veículo encontrado!", enText: "No vehicle found")),
.getVariableText(ptText: "Nenhum morador encontrado!", enText: "No residents found!")),
)
],
),
@ -76,26 +76,25 @@ class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> with
else if (_hasData == true || _pageNumber >= 1)
Expanded(
child: FutureBuilder<void>(
future: _petsFuture,
future: _future,
builder: (context, snapshot) {
return ListView.builder(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
controller: _scrollController,
itemCount: _petsWrap.length + 1,
itemCount: _wrap.length + 1,
itemBuilder: (context, index) {
if (index == 0) {
// Add your item here
return Padding(
padding: const EdgeInsets.only(right: 30, top: 10),
child: Text(
// model.petAmountRegister == '0' ? FFLocalizations.of(context).getVariableText(ptText: "Ilimitado", enText: "Unlimited") : "${FFLocalizations.of(context).getVariableText(ptText: "Quantidade de Pets: ", enText: "Amount of Pets: ")}$count/${model.petAmountRegister}",
'',
textAlign: TextAlign.right,
),
);
} else {
final item = _petsWrap[index - 1];
final item = _wrap[index - 1];
return _item(context, item);
}
});
@ -157,12 +156,12 @@ class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> with
var response = await PhpGroup.getResidentsByProperty.call(_pageNumber.toString());
final List<dynamic> pets = response.jsonBody['residents'] ?? [];
final List<dynamic> residents = response.jsonBody['residents'] ?? [];
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
if (pets.isNotEmpty) {
if (residents.isNotEmpty) {
setState(() {
_petsWrap.addAll(pets);
_wrap.addAll(residents);
_hasData = true;
_loading = false;
});
@ -180,7 +179,7 @@ class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> with
return null;
} catch (e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de moradores", e, s);
setState(() {
_hasData = false;
_loading = false;
@ -193,7 +192,7 @@ class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> with
if (_hasData == true) {
_pageNumber++;
_petsFuture = _fetchVisits();
_future = _fetchVisits();
}
}

View File

@ -25,14 +25,14 @@ class _VehicleOnThePropertyState extends State<VehicleOnTheProperty> with Ticker
int count = 0;
late final VehicleModel model;
late Future<void> _petsFuture;
List<dynamic> _petsWrap = [];
late Future<void> _future;
List<dynamic> _wrap = [];
@override
void initState() {
super.initState();
model = createModel(context, () => VehicleModel());
_petsFuture = _fetchVisits();
_future = _fetchVisits();
_scrollController = ScrollController()
..addListener(() {
@ -72,26 +72,25 @@ class _VehicleOnThePropertyState extends State<VehicleOnTheProperty> with Ticker
else if (_hasData == true || _pageNumber >= 1)
Expanded(
child: FutureBuilder<void>(
future: _petsFuture,
future: _future,
builder: (context, snapshot) {
return ListView.builder(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
controller: _scrollController,
itemCount: _petsWrap.length + 1,
itemCount: _wrap.length + 1,
itemBuilder: (context, index) {
if (index == 0) {
// Add your item here
return Padding(
padding: const EdgeInsets.only(right: 30, top: 10),
child: Text(
// model.petAmountRegister == '0' ? FFLocalizations.of(context).getVariableText(ptText: "Ilimitado", enText: "Unlimited") : "${FFLocalizations.of(context).getVariableText(ptText: "Quantidade de Pets: ", enText: "Amount of Pets: ")}$count/${model.petAmountRegister}",
'',
textAlign: TextAlign.right,
),
);
} else {
final item = _petsWrap[index - 1];
final item = _wrap[index - 1];
return _item(context, item);
}
});
@ -153,12 +152,12 @@ class _VehicleOnThePropertyState extends State<VehicleOnTheProperty> with Ticker
var response = await PhpGroup.getVehiclesByProperty.call(_pageNumber.toString());
final List<dynamic> pets = response.jsonBody['vehicles'] ?? [];
final List<dynamic> vehicles = response.jsonBody['vehicles'] ?? [];
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
if (pets.isNotEmpty) {
if (vehicles.isNotEmpty) {
setState(() {
_petsWrap.addAll(pets);
_wrap.addAll(vehicles);
_hasData = true;
_loading = false;
});
@ -176,7 +175,7 @@ class _VehicleOnThePropertyState extends State<VehicleOnTheProperty> with Ticker
return null;
} catch (e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Veículo", e, s);
setState(() {
_hasData = false;
_loading = false;
@ -189,7 +188,7 @@ class _VehicleOnThePropertyState extends State<VehicleOnTheProperty> with Ticker
if (_hasData == true) {
_pageNumber++;
_petsFuture = _fetchVisits();
_future = _fetchVisits();
}
}
@ -231,12 +230,12 @@ class _VehicleOnThePropertyState extends State<VehicleOnTheProperty> with Ticker
).whenComplete(() {
safeSetState(() {
_pageNumber = 1;
_petsWrap = [];
_petsFuture = _fetchVisits().then((value) => value!.jsonBody['pets'] ?? []);
_wrap = [];
_future = _fetchVisits().then((value) => value!.jsonBody['vehicles'] ?? []);
});
}).catchError((e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Veículos", e, s);
safeSetState(() {
_hasData = false;
_loading = false;

View File

@ -78,10 +78,13 @@ class VisitsModel extends FlutterFlowModel<VehicleOnTheProperty> {
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${devUUID}&cliID=${cliUUID}&atividade=getFoto&Documento=${item['VDO_DOCUMENTO']}&tipo=E',
statusHashMap: [
if (item['VTA_NOME'] != null)
Map<String, Color>.from(
{item['VTA_NOME'].toString().toUpperCase(): FlutterFlowTheme.of(context).warning}),
],
);
if (item['VTA_FIXA'] != null)
Map<String, Color>.from({
item['VTA_FIXA']
? FFLocalizations.of(context).getVariableText(ptText: "Entrada Única", enText: "Single Entry")
: FFLocalizations.of(context).getVariableText(ptText: "Entrada Recorrente", enText: "Recurrent Entry")
: FlutterFlowTheme.of(context).warning
}),
]);
}
}

View File

@ -25,14 +25,14 @@ class _VisitsOnThePropertyState extends State<VisitsOnTheProperty> with TickerPr
int count = 0;
late final VisitsModel model;
late Future<void> _visitsFuture;
List<dynamic> _visitsList = [];
late Future<void> _future;
List<dynamic> _list = [];
@override
void initState() {
super.initState();
model = createModel(context, () => VisitsModel(onRefresh: () => safeSetState((){})));
_visitsFuture = _fetchVisits();
_future = _fetchVisits();
_scrollController = ScrollController()
..addListener(() {
@ -72,26 +72,25 @@ class _VisitsOnThePropertyState extends State<VisitsOnTheProperty> with TickerPr
else if (_hasData == true || _pageNumber >= 1)
Expanded(
child: FutureBuilder<void>(
future: _visitsFuture,
future: _future,
builder: (context, snapshot) {
return ListView.builder(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
controller: _scrollController,
itemCount: _visitsList.length + 1,
itemCount: _list.length + 1,
itemBuilder: (context, index) {
if (index == 0) {
// Add your item here
return Padding(
padding: const EdgeInsets.only(right: 30, top: 10),
child: Text(
// model.petAmountRegister == '0' ? FFLocalizations.of(context).getVariableText(ptText: "Ilimitado", enText: "Unlimited") : "${FFLocalizations.of(context).getVariableText(ptText: "Quantidade de Pets: ", enText: "Amount of Pets: ")}$count/${model.petAmountRegister}",
'',
textAlign: TextAlign.right,
),
);
} else {
final item = _visitsList[index - 1];
final item = _list[index - 1];
return _item(context, item);
}
});
@ -153,12 +152,12 @@ class _VisitsOnThePropertyState extends State<VisitsOnTheProperty> with TickerPr
var response = await PhpGroup.getOpenedVisits.call(_pageNumber.toString());
final List<dynamic> pets = response.jsonBody['visitas'] ?? [];
final List<dynamic> visits = response.jsonBody['visitas'] ?? [];
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
if (pets.isNotEmpty) {
if (visits.isNotEmpty) {
setState(() {
_visitsList.addAll(pets);
_list.addAll(visits);
_hasData = true;
_loading = false;
});
@ -176,7 +175,7 @@ class _VisitsOnThePropertyState extends State<VisitsOnTheProperty> with TickerPr
return null;
} catch (e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s);
setState(() {
_hasData = false;
_loading = false;
@ -189,7 +188,7 @@ class _VisitsOnThePropertyState extends State<VisitsOnTheProperty> with TickerPr
if (_hasData == true) {
_pageNumber++;
_visitsFuture = _fetchVisits();
_future = _fetchVisits();
}
}
@ -248,12 +247,12 @@ class _VisitsOnThePropertyState extends State<VisitsOnTheProperty> with TickerPr
).whenComplete(() {
safeSetState(() {
_pageNumber = 1;
_visitsList = [];
_visitsFuture = _fetchVisits().then((value) => value!.jsonBody['pets'] ?? []);
_list = [];
_future = _fetchVisits().then((value) => value!.jsonBody['visitas'] ?? []);
});
}).catchError((e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Pets", e, s);
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Visitas", e, s);
safeSetState(() {
_hasData = false;
_loading = false;