changes area to kecamatan and some changes
This commit is contained in:
@ -1,14 +1,14 @@
|
|||||||
class AreaListModel {
|
class KecamatanDetail {
|
||||||
List<AreaModel>? area;
|
List<KecamatanModel>? kecamatan;
|
||||||
int? jumlah;
|
int? jumlah;
|
||||||
|
|
||||||
AreaListModel({this.area, this.jumlah});
|
KecamatanDetail({this.kecamatan, this.jumlah});
|
||||||
|
|
||||||
AreaListModel.fromJson(Map<String, dynamic> json) {
|
KecamatanDetail.fromJson(Map<String, dynamic> json) {
|
||||||
if (json['area'] != null) {
|
if (json['kecamatan'] != null) {
|
||||||
area = <AreaModel>[];
|
kecamatan = <KecamatanModel>[];
|
||||||
json['area'].forEach((v) {
|
json['kecamatan'].forEach((v) {
|
||||||
area!.add(AreaModel.fromJson(v));
|
kecamatan!.add(KecamatanModel.fromJson(v));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
jumlah = json['jumlah'];
|
jumlah = json['jumlah'];
|
||||||
@ -16,29 +16,77 @@ class AreaListModel {
|
|||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
if (area != null) {
|
if (kecamatan != null) {
|
||||||
data['area'] = area!.map((v) => v.toJson()).toList();
|
data['kecamatan'] = kecamatan!.map((v) => v.toJson()).toList();
|
||||||
}
|
}
|
||||||
data['jumlah'] = jumlah;
|
data['jumlah'] = jumlah;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AreaModel {
|
class KecamatanModel {
|
||||||
int? idArea;
|
String? kecamatanId;
|
||||||
String? namaArea;
|
String? name;
|
||||||
|
|
||||||
AreaModel({this.idArea, this.namaArea});
|
KecamatanModel({this.kecamatanId, this.name});
|
||||||
|
|
||||||
AreaModel.fromJson(Map<String, dynamic> json) {
|
KecamatanModel.fromJson(Map<String, dynamic> json) {
|
||||||
idArea = json['id_area'];
|
kecamatanId = json['kecamatan_id'];
|
||||||
namaArea = json['nama_area'];
|
name = json['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
data['id_area'] = idArea;
|
data['kecamatan_id'] = kecamatanId;
|
||||||
data['nama_area'] = namaArea;
|
data['name'] = name;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class KelurahanDetail {
|
||||||
|
List<KelurahanModel>? kelurahan;
|
||||||
|
int? jumlah;
|
||||||
|
|
||||||
|
KelurahanDetail({this.kelurahan, this.jumlah});
|
||||||
|
|
||||||
|
KelurahanDetail.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['kelurahan'] != null) {
|
||||||
|
kelurahan = <KelurahanModel>[];
|
||||||
|
json['kelurahan'].forEach((v) {
|
||||||
|
kelurahan!.add(KelurahanModel.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
jumlah = json['jumlah'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
if (kelurahan != null) {
|
||||||
|
data['kelurahan'] = kelurahan!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
data['jumlah'] = jumlah;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class KelurahanModel {
|
||||||
|
String? kelurahanId;
|
||||||
|
String? kecamatanId;
|
||||||
|
String? name;
|
||||||
|
|
||||||
|
KelurahanModel({this.kelurahanId, this.kecamatanId, this.name});
|
||||||
|
|
||||||
|
KelurahanModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
kelurahanId = json['kelurahan_id'];
|
||||||
|
kecamatanId = json['kecamatan_id'];
|
||||||
|
name = json['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['kelurahan_id'] = kelurahanId;
|
||||||
|
data['kecamatan_id'] = kecamatanId;
|
||||||
|
data['name'] = name;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import '../app/app.locator.dart';
|
import '../app/app.locator.dart';
|
||||||
import '../services/other_function.dart';
|
import '../services/other_function.dart';
|
||||||
|
|
||||||
class PemilihDetailModel {
|
class PemilihDetail {
|
||||||
List<PemilihModel>? pemilihModel;
|
List<PemilihModel>? pemilihModel;
|
||||||
int? jumlah;
|
int? jumlah;
|
||||||
|
|
||||||
PemilihDetailModel({this.pemilihModel, this.jumlah});
|
PemilihDetail({this.pemilihModel, this.jumlah});
|
||||||
|
|
||||||
PemilihDetailModel.fromJson(Map<String, dynamic> json) {
|
PemilihDetail.fromJson(Map<String, dynamic> json) {
|
||||||
if (json['data'] != null) {
|
if (json['data'] != null) {
|
||||||
pemilihModel = <PemilihModel>[];
|
pemilihModel = <PemilihModel>[];
|
||||||
json['data'].forEach((v) {
|
json['data'].forEach((v) {
|
||||||
@ -36,7 +36,9 @@ class PemilihModel {
|
|||||||
String? nikTimSurvei;
|
String? nikTimSurvei;
|
||||||
String? namaTimSurvei;
|
String? namaTimSurvei;
|
||||||
String? namaCaleg;
|
String? namaCaleg;
|
||||||
String? namaArea;
|
String? kecamatan;
|
||||||
|
String? kelurahan;
|
||||||
|
int? tps;
|
||||||
String? createdAt;
|
String? createdAt;
|
||||||
|
|
||||||
PemilihModel(
|
PemilihModel(
|
||||||
@ -46,7 +48,9 @@ class PemilihModel {
|
|||||||
this.nikTimSurvei,
|
this.nikTimSurvei,
|
||||||
this.namaTimSurvei,
|
this.namaTimSurvei,
|
||||||
this.namaCaleg,
|
this.namaCaleg,
|
||||||
this.namaArea,
|
this.kecamatan,
|
||||||
|
this.kelurahan,
|
||||||
|
this.tps,
|
||||||
this.createdAt});
|
this.createdAt});
|
||||||
|
|
||||||
PemilihModel.fromJson(Map<String, dynamic> json) {
|
PemilihModel.fromJson(Map<String, dynamic> json) {
|
||||||
@ -56,7 +60,9 @@ class PemilihModel {
|
|||||||
nikTimSurvei = json['nik_tim_survei'];
|
nikTimSurvei = json['nik_tim_survei'];
|
||||||
namaTimSurvei = json['nama_tim_survei'];
|
namaTimSurvei = json['nama_tim_survei'];
|
||||||
namaCaleg = json['nama_caleg'];
|
namaCaleg = json['nama_caleg'];
|
||||||
namaArea = json['nama_area'];
|
kecamatan = json['kecamatan'];
|
||||||
|
kelurahan = json['kelurahan'];
|
||||||
|
tps = json['tps'];
|
||||||
createdAt = myFunction.convertDateTime(json['created_at']);
|
createdAt = myFunction.convertDateTime(json['created_at']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +74,9 @@ class PemilihModel {
|
|||||||
data['nik_tim_survei'] = nikTimSurvei;
|
data['nik_tim_survei'] = nikTimSurvei;
|
||||||
data['nama_tim_survei'] = namaTimSurvei;
|
data['nama_tim_survei'] = namaTimSurvei;
|
||||||
data['nama_caleg'] = namaCaleg;
|
data['nama_caleg'] = namaCaleg;
|
||||||
data['nama_area'] = namaArea;
|
data['kecamatan'] = kecamatan;
|
||||||
|
data['kelurahan'] = kelurahan;
|
||||||
|
data['tps'] = tps;
|
||||||
data['created_at'] = createdAt;
|
data['created_at'] = createdAt;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class AreaTpsView extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Jumlah Area TPS : ",
|
"Jumlah Kecamatan : ",
|
||||||
style: italicTextStyle.copyWith(
|
style: italicTextStyle.copyWith(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -56,7 +56,7 @@ class AreaTpsView extends StatelessWidget {
|
|||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
'${model.jumlahArea} TPS',
|
'${model.jumlahArea} Kecamatan',
|
||||||
style: boldTextStyle.copyWith(
|
style: boldTextStyle.copyWith(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -110,7 +110,7 @@ class AreaTpsView extends StatelessWidget {
|
|||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: Text('${i + 1}'),
|
leading: Text('${i + 1}'),
|
||||||
title: Text(
|
title: Text(
|
||||||
'${model.listAreaModel[i].namaArea}'),
|
'${model.listKecamatanModel[i].name}'),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
// trash bin icon
|
// trash bin icon
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
@ -118,8 +118,8 @@ class AreaTpsView extends StatelessWidget {
|
|||||||
color: mainColor,
|
color: mainColor,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
model.cekSuara(
|
model.cekSuara(model
|
||||||
model.listAreaModel[i]);
|
.listKecamatanModel[i]);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -7,7 +7,7 @@ import '../../../../model/my_response.model.dart';
|
|||||||
class AreaTpsViewModel extends CustomBaseViewModel {
|
class AreaTpsViewModel extends CustomBaseViewModel {
|
||||||
final log = getLogger('AreaTpsViewModel');
|
final log = getLogger('AreaTpsViewModel');
|
||||||
|
|
||||||
List<AreaModel> listAreaModel = [];
|
List<KecamatanModel> listKecamatanModel = [];
|
||||||
int jumlahArea = 0;
|
int jumlahArea = 0;
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
@ -23,12 +23,14 @@ class AreaTpsViewModel extends CustomBaseViewModel {
|
|||||||
try {
|
try {
|
||||||
var response = await httpService.get('/area/cek_area_caleg/$idCaleg');
|
var response = await httpService.get('/area/cek_area_caleg/$idCaleg');
|
||||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||||
AreaListModel areaListModel =
|
// log.i('myResponseModel: ${myResponseModel.data}');
|
||||||
AreaListModel.fromJson(myResponseModel.data);
|
KecamatanDetail kecamatanDetail =
|
||||||
listAreaModel = areaListModel.area ?? [];
|
KecamatanDetail.fromJson(myResponseModel.data);
|
||||||
log.i('listAreaModel: $listAreaModel');
|
// log.i('kecamatanDetail: ${kecamatanDetail.kecamatan}');
|
||||||
jumlahArea = listAreaModel.length;
|
listKecamatanModel = kecamatanDetail.kecamatan ?? [];
|
||||||
log.i('jumlahArea: $jumlahArea');
|
|
||||||
|
jumlahArea = kecamatanDetail.jumlah!;
|
||||||
|
// log.i('jumlahArea: $jumlahArea');
|
||||||
status = true;
|
status = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.e(e.toString());
|
log.e(e.toString());
|
||||||
@ -38,13 +40,13 @@ class AreaTpsViewModel extends CustomBaseViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cekSuara(AreaModel areaModel) async {
|
cekSuara(KecamatanModel kecamatanModel) async {
|
||||||
await bottomSheetService.showCustomSheet(
|
await bottomSheetService.showCustomSheet(
|
||||||
data: areaModel.idArea,
|
data: kecamatanModel.kecamatanId,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
title: 'Detail Suara Area ${areaModel.namaArea}',
|
title: 'Detail Suara Kecamatan ${kecamatanModel.name}',
|
||||||
description: 'Tim Survei',
|
description: 'Kecamatan',
|
||||||
ignoreSafeArea: false,
|
ignoreSafeArea: false,
|
||||||
variant: BottomSheetType.detailSuaraBottomSheetView,
|
variant: BottomSheetType.detailSuaraBottomSheetView,
|
||||||
);
|
);
|
||||||
|
@ -111,8 +111,27 @@ class LogSuaraView extends StatelessWidget {
|
|||||||
model.listPemilih[i].namaPemilih!,
|
model.listPemilih[i].namaPemilih!,
|
||||||
style: boldTextStyle,
|
style: boldTextStyle,
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Column(
|
||||||
model.listPemilih[i].namaArea!,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
CardWidget(
|
||||||
|
title: 'Tim',
|
||||||
|
value: model.listPemilih[i]
|
||||||
|
.namaTimSurvei!),
|
||||||
|
CardWidget(
|
||||||
|
title: 'Kec',
|
||||||
|
value: model
|
||||||
|
.listPemilih[i].kecamatan!),
|
||||||
|
CardWidget(
|
||||||
|
title: 'Kel / Desa',
|
||||||
|
value: model
|
||||||
|
.listPemilih[i].kelurahan!),
|
||||||
|
CardWidget(
|
||||||
|
title: 'TPS',
|
||||||
|
value: model.listPemilih[i].tps!
|
||||||
|
.toString()),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
@ -159,3 +178,48 @@ class LogSuaraView extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CardWidget extends StatelessWidget {
|
||||||
|
const CardWidget({
|
||||||
|
super.key,
|
||||||
|
required this.title,
|
||||||
|
required this.value,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 3,
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: italicTextStyle.copyWith(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(
|
||||||
|
' : ',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 6,
|
||||||
|
child: Text(
|
||||||
|
value,
|
||||||
|
style: boldTextStyle.copyWith(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -22,9 +22,9 @@ class LogSuaraViewModel extends CustomBaseViewModel {
|
|||||||
try {
|
try {
|
||||||
var response = await httpService.get('caleg/suara/$idCaleg');
|
var response = await httpService.get('caleg/suara/$idCaleg');
|
||||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||||
PemilihDetailModel pemilihDetailModel =
|
PemilihDetail pemilihDetail =
|
||||||
PemilihDetailModel.fromJson(myResponseModel.data);
|
PemilihDetail.fromJson(myResponseModel.data);
|
||||||
listPemilih = pemilihDetailModel.pemilihModel!;
|
listPemilih = pemilihDetail.pemilihModel!;
|
||||||
counter = listPemilih.length;
|
counter = listPemilih.length;
|
||||||
|
|
||||||
status = true;
|
status = true;
|
||||||
|
@ -46,12 +46,12 @@ class PengaturanCalegView extends StatelessWidget {
|
|||||||
background: warningColor,
|
background: warningColor,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
TopContainer(
|
// TopContainer(
|
||||||
title: 'Area\nTPS',
|
// title: 'Area\nTPS',
|
||||||
value: '${model.suaraCounter} TPS',
|
// value: '${model.suaraCounter} TPS',
|
||||||
icon: Icons.location_on_outlined,
|
// icon: Icons.location_on_outlined,
|
||||||
background: orangeColor,
|
// background: orangeColor,
|
||||||
),
|
// ),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
TopContainer(
|
TopContainer(
|
||||||
title: 'Jumlah Tim Survei',
|
title: 'Jumlah Tim Survei',
|
||||||
|
@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
|
|
||||||
import '../../../app/themes/app_colors.dart';
|
import '../../../../app/themes/app_colors.dart';
|
||||||
import '../../../app/themes/app_text.dart';
|
import '../../../../app/themes/app_text.dart';
|
||||||
import './detail_suara_bottom_sheet_view_model.dart';
|
import './detail_suara_bottom_sheet_view_model.dart';
|
||||||
|
|
||||||
class DetailSuaraBottomSheetView extends StatelessWidget {
|
class DetailSuaraBottomSheetView extends StatelessWidget {
|
||||||
@ -88,13 +88,22 @@ class DetailSuaraBottomSheetView extends StatelessWidget {
|
|||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
if (request!.description == 'Caleg')
|
if (request!.description == 'Caleg')
|
||||||
Text(
|
CardWidget(
|
||||||
model.listPemilih[i].namaTimSurvei!,
|
title: 'Tim',
|
||||||
style: italicTextStyle,
|
value: model
|
||||||
),
|
.listPemilih[i].namaTimSurvei!),
|
||||||
Text(
|
CardWidget(
|
||||||
model.listPemilih[i].namaArea!,
|
title: 'Kec',
|
||||||
),
|
value:
|
||||||
|
model.listPemilih[i].kecamatan!),
|
||||||
|
CardWidget(
|
||||||
|
title: 'Kel / Desa',
|
||||||
|
value:
|
||||||
|
model.listPemilih[i].kelurahan!),
|
||||||
|
CardWidget(
|
||||||
|
title: 'TPS',
|
||||||
|
value: model.listPemilih[i].tps!
|
||||||
|
.toString()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
@ -139,3 +148,48 @@ class DetailSuaraBottomSheetView extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CardWidget extends StatelessWidget {
|
||||||
|
const CardWidget({
|
||||||
|
super.key,
|
||||||
|
required this.title,
|
||||||
|
required this.value,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 3,
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: italicTextStyle.copyWith(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(
|
||||||
|
' : ',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 6,
|
||||||
|
child: Text(
|
||||||
|
value,
|
||||||
|
style: boldTextStyle.copyWith(
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -29,11 +29,11 @@ class DetailSuaraBottomSheetViewModel extends CustomBaseViewModel {
|
|||||||
|
|
||||||
var response = await httpService.get(url);
|
var response = await httpService.get(url);
|
||||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||||
PemilihDetailModel pemilihDetailModel =
|
PemilihDetail pemilihDetail =
|
||||||
PemilihDetailModel.fromJson(myResponseModel.data);
|
PemilihDetail.fromJson(myResponseModel.data);
|
||||||
|
|
||||||
listPemilih = pemilihDetailModel.pemilihModel!;
|
listPemilih = pemilihDetail.pemilihModel!;
|
||||||
counter = pemilihDetailModel.jumlah!;
|
counter = pemilihDetail.jumlah!;
|
||||||
this.status = true;
|
this.status = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.status = false;
|
this.status = false;
|
||||||
|
@ -41,6 +41,7 @@ class DetailSuaraPemilihBottomSheetView extends StatelessWidget {
|
|||||||
topRight: Radius.circular(16.0),
|
topRight: Radius.circular(16.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
@ -103,9 +104,22 @@ class DetailSuaraPemilihBottomSheetView extends StatelessWidget {
|
|||||||
title: 'Tim Survei',
|
title: 'Tim Survei',
|
||||||
value: request.data!.namaTimSurvei!,
|
value: request.data!.namaTimSurvei!,
|
||||||
),
|
),
|
||||||
|
_DetailChildWidget(
|
||||||
|
title: 'Kecamatan',
|
||||||
|
value: request.data!.kecamatan!,
|
||||||
|
),
|
||||||
|
_DetailChildWidget(
|
||||||
|
title: 'Kelurahan',
|
||||||
|
value: request.data!.kelurahan!,
|
||||||
|
),
|
||||||
|
_DetailChildWidget(
|
||||||
|
title: 'TPS',
|
||||||
|
value: request.data!.tps!.toString(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -25,15 +25,21 @@ class LoginScreenViewModel extends CustomBaseViewModel {
|
|||||||
globalVar.backPressed = 'cantBack';
|
globalVar.backPressed = 'cantBack';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// log.i('username: ${usernameController.text}');
|
||||||
|
// log.i('password: ${passwordController.text}');
|
||||||
var formData = FormData.fromMap({
|
var formData = FormData.fromMap({
|
||||||
'username': usernameController.text,
|
'username': usernameController.text,
|
||||||
'password': passwordController.text,
|
'password': passwordController.text,
|
||||||
});
|
});
|
||||||
|
// log.i('formData: $formData');
|
||||||
var response =
|
var response =
|
||||||
await httpService.postWithFormData('login/caleg', formData);
|
await httpService.postWithFormData('login/caleg', formData);
|
||||||
|
|
||||||
|
// log.i('response: ${response.data}');
|
||||||
|
|
||||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||||
var data = myResponseModel.data;
|
var data = myResponseModel.data;
|
||||||
|
// log.i('data: $data');
|
||||||
CalegModel calegModel = CalegModel.fromJson(data);
|
CalegModel calegModel = CalegModel.fromJson(data);
|
||||||
// log.i('calegModel: ${calegModel.toJson()}');
|
// log.i('calegModel: ${calegModel.toJson()}');
|
||||||
await mySharedPrefs.setString('id', calegModel.idCaleg!.toString());
|
await mySharedPrefs.setString('id', calegModel.idCaleg!.toString());
|
||||||
|
Reference in New Issue
Block a user