change area to kecamatan and some changes
This commit is contained in:
@ -34,143 +34,151 @@ class AdminFirstPageView extends StatelessWidget {
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TopContainer(
|
||||
title: 'Jumlah Area',
|
||||
value: '${model.jumlahArea} Area',
|
||||
icon: Icons.place_outlined,
|
||||
background: warningColor,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TopContainer(
|
||||
title: 'Jumlah Caleg',
|
||||
value: '${model.jumlahCaleg} Caleg',
|
||||
icon: Icons.co_present_outlined,
|
||||
background: greenColor,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TopContainer(
|
||||
title: 'Tim Survei',
|
||||
value: '${model.jumlahTimSurvei} Tim Survei',
|
||||
icon: Icons.co_present_outlined,
|
||||
background: orangeColor,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const TopContainer(
|
||||
title: 'Jumlah Pemilih',
|
||||
value: '10 Pemilih',
|
||||
icon: Icons.people_alt_outlined,
|
||||
background: blueColor,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
if (model.isBusy)
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
if (!model.isBusy && model.status == true)
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
text: 'Selamat Datang, ',
|
||||
style: regularTextStyle,
|
||||
children: [
|
||||
const TextSpan(
|
||||
text: 'Admin\n',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Silahkan tambahkan data ',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: 'Area ',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: greenColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'terlebih dahulu sebelum menambahkan data ',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: 'Caleg',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: greenColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text:
|
||||
'.\n\nData Pemilih akan diambil dari data yang dimasukkan oleh tim survei\n\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text:
|
||||
'Jika terjadi kesalahan pada data, silahkan hubungi ',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// TopContainer(
|
||||
// title: 'Jumlah\nArea',
|
||||
// value: '${model.jumlahArea} Area',
|
||||
// icon: Icons.place_outlined,
|
||||
// background: warningColor,
|
||||
// ),
|
||||
// const SizedBox(height: 10),
|
||||
TopContainer(
|
||||
title: 'Jumlah\nCaleg',
|
||||
value: '${model.jumlahCaleg} Caleg',
|
||||
icon: Icons.co_present_outlined,
|
||||
background: greenColor,
|
||||
),
|
||||
if (!model.isBusy && model.status == false)
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
text: 'Selamat Datang, ',
|
||||
style: regularTextStyle,
|
||||
children: [
|
||||
const TextSpan(
|
||||
text: 'Admin\n',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Terjadi ',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: 'Error ',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: redColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'pada saat mengambil data\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Silahkan coba lagi dengan menekan icon',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: ' Pengaturan\n',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: greenColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'di pojok kanan bawah\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TopContainer(
|
||||
title: 'Tim\nSurvei',
|
||||
value: '${model.jumlahTimSurvei} Tim Survei',
|
||||
icon: Icons.co_present_outlined,
|
||||
background: orangeColor,
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 10),
|
||||
const TopContainer(
|
||||
title: 'Jumlah\nPemilih',
|
||||
value: '10 Pemilih',
|
||||
icon: Icons.people_alt_outlined,
|
||||
background: blueColor,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
if (model.isBusy)
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
if (!model.isBusy && model.status == true)
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
text: 'Selamat Datang, ',
|
||||
style: regularTextStyle,
|
||||
children: [
|
||||
const TextSpan(
|
||||
text: 'Admin\n',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Silahkan tambahkan data ',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: 'Area ',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: greenColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text:
|
||||
'terlebih dahulu sebelum menambahkan data ',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: 'Caleg',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: greenColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text:
|
||||
'.\n\nData Pemilih akan diambil dari data yang dimasukkan oleh tim survei\n\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text:
|
||||
'Jika terjadi kesalahan pada data, silahkan hubungi ',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (!model.isBusy && model.status == false)
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
text: 'Selamat Datang, ',
|
||||
style: regularTextStyle,
|
||||
children: [
|
||||
const TextSpan(
|
||||
text: 'Admin\n',
|
||||
style: boldTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Terjadi ',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: 'Error ',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: redColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'pada saat mengambil data\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'Silahkan coba lagi dengan menekan icon',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
TextSpan(
|
||||
text: ' Pengaturan\n',
|
||||
style: boldTextStyle.copyWith(
|
||||
color: greenColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const TextSpan(
|
||||
text: 'di pojok kanan bawah\n',
|
||||
style: regularTextStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// with setting icon
|
||||
floatingActionButton: FloatingActionButton(
|
||||
backgroundColor: warningColor,
|
||||
onPressed: () {
|
||||
// model.gotoSetting();
|
||||
model.snackbarService.showSnackbar(
|
||||
message: 'Fitur belum tersedia',
|
||||
duration: const Duration(seconds: 2),
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.settings),
|
||||
child: const Icon(Icons.settings, color: fontColor),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.miniEndTop,
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:cek_suara/model/area_model.dart';
|
||||
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../../model/area_model.dart';
|
||||
import '../../../../model/caleg_model.dart';
|
||||
import '../../../../model/my_response.model.dart';
|
||||
import '../../../../model/tim_survei_model.dart';
|
||||
@ -24,11 +25,11 @@ class AdminFirstPageViewModel extends CustomBaseViewModel {
|
||||
setBusy(true);
|
||||
globalVar.backPressed = 'cantBack';
|
||||
try {
|
||||
var response = await httpService.get('area');
|
||||
var response = await httpService.get('area/kecamatan');
|
||||
log.i(response.data);
|
||||
MyResponseModel myResponseModel = MyResponseModel.fromJson(response.data);
|
||||
AreaListModel areaListModel =
|
||||
AreaListModel.fromJson(myResponseModel.data);
|
||||
KecamatanDetail areaListModel =
|
||||
KecamatanDetail.fromJson(myResponseModel.data);
|
||||
jumlahArea = areaListModel.jumlah!;
|
||||
|
||||
response = await httpService.get('caleg');
|
||||
|
Reference in New Issue
Block a user