1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099 |
-
- import 'dart:async';
- import 'dart:convert';
- import 'dart:io';
- import 'package:path/path.dart' as path;
- import 'package:flutter_map/flutter_map.dart';
- import 'package:image_picker/image_picker.dart';
- import 'package:latlong2/latlong.dart' as latlong;
- import 'package:flutter/material.dart';
- import 'package:fluttertoast/fluttertoast.dart';
- import 'package:geolocator/geolocator.dart';
- import 'package:google_fonts/google_fonts.dart';
- import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
- import 'package:shared_preferences/shared_preferences.dart';
- import 'package:tower_app/Screens/Menu/Survey/getdetailtsurvey_post.dart';
- import 'package:tower_app/Screens/Menu/Survey/sendSurvey_post.dart';
- import 'package:tower_app/Screens/Menu/Survey/surveylist_screen.dart';
- import 'package:tower_app/Screens/Settings/RequestHttp/getDetail_post.dart';
-
- import 'dart:developer' as logDev;
-
- import '../../background.dart';
- import '../Canvasing/canvasingDetail_screen.dart';
-
- TextEditingController isiDesaTeksController = TextEditingController();
- TextEditingController isiKecamatanTeksController = TextEditingController();
- TextEditingController isiKabupatenTeksController = TextEditingController();
- TextEditingController isiProvinsiTeksController = TextEditingController();
- TextEditingController isiJumlahPendudukTeksController = TextEditingController();
- TextEditingController isiSignal2TeksController = TextEditingController();
- TextEditingController isiSignal3TeksController = TextEditingController();
- TextEditingController isiSignal4TeksController = TextEditingController();
- TextEditingController isiCatatanTeksController = TextEditingController();
-
- class DetailSurveyScreen extends StatefulWidget {
- const DetailSurveyScreen({Key? key}) : super(key: key);
-
- @override
- State<DetailSurveyScreen> createState() => _DetailSurveyScreen();
- }
-
- class _DetailSurveyScreen extends State<DetailSurveyScreen> {
- bool visibleNamaDesa = true;
- bool visibleEditDesa = true;
- bool visibleFormDesa = false;
-
- bool visibleNamaKecamatan = true;
- bool visibleEditKecamatan = true;
- bool visibleFormKecamatan = false;
-
- bool visibleNamaKabupaten = true;
- bool visibleEditKabupaten = true;
- bool visibleFormKabupaten = false;
-
- bool visibleNamaProvinsi = true;
- bool visibleEditProvinsi = true;
- bool visibleFormProvinsi = false;
-
- final List<TextEditingController> _jenisTempat = [];
- final List<TextEditingController> _km = [];
-
- final List<InkWell> _ambilFoto = [];
- File? _imagePath;
-
- final List<String> _pathFoto = [];
- final List<String> _base64Foto = [];
-
- latlong.LatLng point = latlong.LatLng(-6.183580253674716, 106.93103973792664);
- late Position position;
- MapController _mapController = MapController();
-
- late String titik;
-
- late String survey_name;
- late String nama_desa, nama_kecamatan, nama_kabupaten, nama_provinsi, posisi, signal2G, signal3G, signal4G, catatan;
- late int jumlah_penduduk;
-
- initState(){
- isiDesaTeksController.clear();
- isiKecamatanTeksController.clear();
- isiKabupatenTeksController.clear();
- isiProvinsiTeksController.clear();
- isiJumlahPendudukTeksController.clear();
- isiSignal2TeksController.clear();
- isiSignal3TeksController.clear();
- isiSignal4TeksController.clear();
- isiCatatanTeksController.clear();
- survey_name = "Survey";
- nama_desa = "";
- nama_kecamatan = "";
- nama_kabupaten = "";
- nama_provinsi = "";
- posisi = "";
- signal2G = "";
- signal3G = "";
- signal4G = "";
- catatan = "";
- jumlah_penduduk = 0;
-
- titik = "";
-
- WidgetsBinding.instance.addPostFrameCallback((_) {
- getSurveyName();
- //getDetailSurvey();
- });
- super.initState();
- }
-
- getSurveyName() async {
- ProgressDialog loading = ProgressDialog(context);
- loading = ProgressDialog(context, type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
- loading.style(
- message: 'Please Wait .....',
- borderRadius: 3,
- backgroundColor: Colors.white,
- progressWidget: CircularProgressIndicator(),
- elevation: 10.0,
- padding: EdgeInsets.all(10),
- insetAnimCurve: Curves.easeInOut,
- progress: 0.0,
- maxProgress: 100.0,
- progressTextStyle: TextStyle(color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
- messageTextStyle: TextStyle(color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
-
- await loading.show();
- final SharedPreferences prefs = await SharedPreferences.getInstance();
- survey_name = prefs.getString('nameDetail')!;
- logDev.log(survey_name, name: "Nama Survey");
-
- getDetailSurvey();
- }
-
- getDetailSurvey() async {
- ProgressDialog loading = ProgressDialog(context);
- loading = ProgressDialog(context, type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
- loading.style(
- message: 'Please Wait .....',
- borderRadius: 3,
- backgroundColor: Colors.white,
- progressWidget: CircularProgressIndicator(),
- elevation: 10.0,
- padding: EdgeInsets.all(10),
- insetAnimCurve: Curves.easeInOut,
- progress: 0.0,
- maxProgress: 100.0,
- progressTextStyle: TextStyle(color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
- messageTextStyle: TextStyle(color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
-
- final SharedPreferences prefs = await SharedPreferences.getInstance();
- int? idDetail = prefs.getInt('idDetail');
-
- GetDetailSurvey_Post.connectToAPI(idDetail!).then((valueResult) async {
- Map<String, dynamic> object = jsonDecode(valueResult);
- String status = object['result']['status'].toString();
- if (status.contains("failed")) {
- await loading.hide();
- alertDialogFailedRetrievedData(context);
- } else if (status.contains("success")) {
- logDev.log(status, name: "SUCCeSS?");
- //List <dynamic> allData = object['result']['data'];
- setState(() {
- nama_desa = object['result']['data']['desa'].toString();
- logDev.log(nama_desa, name:"NAMA DESA?");
- nama_kecamatan = object['result']['data']['kecamatan'].toString();
- nama_kabupaten = object['result']['data']['kabupaten'].toString();
- nama_provinsi = object['result']['data']['provinsi'].toString();
- jumlah_penduduk = object['result']['data']['jumlah_penduduk'];
- posisi = object['result']['data']['posisi'].toString();
- signal2G = object['result']['data']['signal_2G'].toString();
- signal3G = object['result']['data']['signal_3G'].toString();
- signal4G = object['result']['data']['signal_4G'].toString();
- catatan = object['result']['data']['catatan'].toString();
-
- point = latlong.LatLng(double.parse(posisi.split(",")[0]), double.parse(posisi.split(",")[1]));
- });
- }
- await loading.hide();
- });
- }
-
- @override
- Widget build(BuildContext context) {
- var size = MediaQuery.sizeOf(context);
- return Scaffold(
- body: SingleChildScrollView(
- child: Column(
- children: <Widget>[
- Stack(
- children: [
- WavyHeader(),
- Container(
- margin: EdgeInsets.only(top: MediaQuery.of(context).size.height/6 - 20),
- padding: EdgeInsets.fromLTRB(20, 5, 25, 5),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.end,
- crossAxisAlignment: CrossAxisAlignment.end,
- children: [
- Text(
- //'Survey\t\t',
- "Detail Survey\t\t",
- maxLines: 2,
- style: GoogleFonts.luckiestGuy(
- fontSize: 28,
- color: Color(0xFF4858A7),
- fontStyle: FontStyle.italic,
- ),
- ),
- Image.asset("assets/icons/menu/survey_3.png",
- width: 40,
- height: 40,
- ),
- ],
- )),
- SafeArea(
- child: Container(
- width: MediaQuery.of(context).size.width,
- margin: EdgeInsets.only(
- top: MediaQuery.of(context).size.height / 5,
- left: 10,
- right: 10,
- bottom : 15,
- ),
- child: Column(
- children: [
- Container(
- child: Card(
- elevation: 10,
- child: Container(
- decoration: BoxDecoration(
- color: Color(0XFFFAF7EE),
- borderRadius: BorderRadius.circular(10)),
- child: Column(
- children: [
- Container(
- margin: EdgeInsets.only(
- left: 10, right: 10, top: 15, bottom: 10),
- child: Text(survey_name, style:
- GoogleFonts.ubuntu(fontSize: 19, fontWeight: FontWeight.bold, /*decoration: TextDecoration.underline*/
- decorationStyle: TextDecorationStyle.dashed),),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Desa',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- Container(
- width: size.width,
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), shape: BoxShape.rectangle, color: Colors.white),
- padding: EdgeInsets.all(10),
- child:
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- nama_desa,
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Kecamatan',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- Container(
- width: size.width,
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), shape: BoxShape.rectangle, color: Colors.white),
- padding: EdgeInsets.all(10),
- child:
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- nama_kecamatan,
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Kabupaten',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- Container(
- width: size.width,
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), shape: BoxShape.rectangle, color: Colors.white),
- padding: EdgeInsets.all(10),
- child:
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- nama_kabupaten,
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Provinsi',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- Container(
- width: size.width,
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), shape: BoxShape.rectangle, color: Colors.white),
- padding: EdgeInsets.all(10),
- child:
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- nama_provinsi,
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Jumlah Penduduk',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- Container(
- width: size.width,
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), shape: BoxShape.rectangle, color: Colors.white),
- padding: EdgeInsets.all(10),
- child:
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- jumlah_penduduk.toString(),
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Posisi',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold),
- )),
- Container(
- height: size.height*0.4,
- width: size.width,
- margin: EdgeInsets.only(top: 2),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5)
- ),
- child: Stack(
- children:[
- FlutterMap(
- mapController: _mapController,
- options: new MapOptions(
- onTap: (p, point) async {}, center: point, zoom: 15),
- children: [
- TileLayer(
- minZoom: 1,
- maxZoom: 22,
- maxNativeZoom: 18,
- minNativeZoom: 1,
- backgroundColor: Colors.black54,
- urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
- subdomains: ['a', 'b', 'c'],
- ),
- MarkerLayer(markers: [
- Marker(
- width: 135,
- height: 135,
- point: point,
- builder: (ctx) => Container(
- child: Icon(
- Icons.location_on,
- color: Colors.red,
- ),
- ))
- ])
- ],
- ),
- /*Container(
- alignment: AlignmentDirectional.bottomEnd,
- child: Container(
- margin: EdgeInsets.only(bottom: 10),
- *//*margin: EdgeInsets.fromLTRB(10, 15, 0, (size.height*0.4) + 15),*//*
- child: RawMaterialButton(
- onPressed: () {
- setState(() {
- updatePosition();
- });
- },
- elevation: 5.0,
- fillColor: Colors.white,
- child: Image.asset('assets/images/location1.png',
- height: 35, width: 35),
- padding: EdgeInsets.all(5.0),
- shape: CircleBorder(),
- ),
- ),
- ),*/]
-
- )
- ),
-
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(
- left: 10, right: 10, top: 5),
- child:Align(
- alignment: Alignment.center,
- child: Text(
- posisi,
- overflow: TextOverflow.fade,
- softWrap: true,
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold),
- )
- )
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Signal 2G (dBm)',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- Container(
- width: size.width,
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), shape: BoxShape.rectangle, color: Colors.white),
- padding: EdgeInsets.all(10),
- child:
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- signal2G,
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Signal 3G (dBm)',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- Container(
- width: size.width,
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), shape: BoxShape.rectangle, color: Colors.white),
- padding: EdgeInsets.all(10),
- child:
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- signal3G,
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Signal 4G (dBm)',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- Container(
- width: size.width,
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), shape: BoxShape.rectangle, color: Colors.white),
- padding: EdgeInsets.all(10),
- child:
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- signal4G,
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Tempat Keramaian (Contoh: Sekolah, Pasar, dll)',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold),
- ),
- ),
- ListView.builder(
- shrinkWrap: true,
- itemCount: _jenisTempat.length,
- itemBuilder: (context, i) {
- return Padding(
- padding: const EdgeInsets.only(top: 2),
- child: Row(
- children: [
- Expanded(
- flex: 7,
- child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 10),
- //height: 60,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(5),
- ),
- child: TextFormField(
- controller: _jenisTempat[i],
- autofocus: false,
- style: const TextStyle(color: Colors.black),
- decoration: const InputDecoration(
- border: InputBorder.none,
- hintText: "Jenis Tempat",
- hintStyle: TextStyle(
- color: Color.fromARGB(255, 132, 140, 155)),
- ),
- ),
- ),
- ),
- SizedBox(width: 5),
- Expanded(
- flex: 3,
- child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 10),
- //height: 60,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(5),
- ),
- child: TextFormField(
- controller: _km[i],
- autofocus: false,
- style: const TextStyle(color: Colors.black),
- decoration: const InputDecoration(
- border: InputBorder.none,
- hintText: "KM",
- hintStyle: TextStyle(
- color: Color.fromARGB(255, 132, 140, 155)),
- ),
- ),
- ),
- ),
- /* i != 0
- ? GestureDetector(
- onTap: (){
- setState(() {
- _removeItemTempat(i);
- });
- },
- child: const Icon(
- Icons.delete,
- color: Color(0xFF6B74D6),
- size: 40,
- ),
- )
- : const SizedBox()*/
- ],
- ),
- );
- },
- ),
- const SizedBox(
- height: 10,
- ),
- /*GestureDetector(
- onTap: () {
- setState(() {
- _addFieldTempat();
- });
- },
- child: Center(
- child: Container(
- width: size.width,
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
- decoration: BoxDecoration(
- color: Colors.blueAccent,
- borderRadius: BorderRadius.circular(5)),
- child: Align(
- alignment: Alignment.center,
- child: Text("Tambah Data Tempat+",
- style:
- GoogleFonts.nunito(color: const Color(0xFFF8F8FF))),
- ),
- ),
- ),
- ),*/
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Catatan',
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- Container(
- width: size.width,
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), shape: BoxShape.rectangle, color: Colors.white),
- padding: EdgeInsets.all(10),
- child:
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- catatan,
- style: GoogleFonts.inconsolata(
- fontSize: 16, fontWeight: FontWeight.bold, ),
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 15),
- child: Column(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- 'Foto',
- style: GoogleFonts.inconsolata(
- fontSize: 16,
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- ListView.builder(
- shrinkWrap: true,
- itemCount: _ambilFoto.length,
- itemBuilder: (context, i) {
- return Padding(
- padding: const EdgeInsets.only(top: 2),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child:
- Column(
- children:[
- Visibility (
- child: Align(
- alignment: Alignment.centerLeft,
- child:
- InkWell(
- child: Container(
- padding: EdgeInsets.all(5),
- //width: size.width * 0.5,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(5),
- gradient: LinearGradient(
- colors: [
- Colors.redAccent,
- Colors.redAccent
- ],
- ),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- "Ambil Foto\t\t",
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Colors.white,
- //fontSize: 17,
- fontWeight: FontWeight.w500,
- ),
- ),
- const Icon(
- Icons.camera_alt,
- //color: Color(0xFF6B74D6),
- size: 25,
- ),
- ],
- ),
- ),
- onTap: () async {
- final ImagePicker _picker = ImagePicker();
- final XFile? imagePicked = await _picker.pickImage(
- source: ImageSource.camera);
- if (imagePicked != null) {
- _imagePath = File(imagePicked.path);
- logDev.log(_imagePath.toString(), name: "IMAGE PATH");
- List<int> imageBytes = _imagePath!.readAsBytesSync();
- String base64Image = base64Encode(imageBytes);
- //logDev.log(base64Image, name: "String base64");
- setState(() {
- logDev.log(_ambilFoto.length.toString(), name: "ada berapa banyak buttonambil foto");
- _pathFoto[i] = path.basename(_imagePath.toString());
- _base64Foto[i] = base64Image;
- logDev.log(_pathFoto.length.toString(), name: "Banyak path foto");
- logDev.log(_base64Foto.length.toString(), name: "Banyak Base64");
- logDev.log(_pathFoto.toString(), name: "Isi Path FOTO");
- });
- } else if (imagePicked == null) {
- //_imagePath = await getImageFileFromAssets('assets/images/ic_administrator.png') as File?;
- }
- },
- ),
- ),
- ),
- Visibility(
- child: Align(
- alignment: Alignment.centerLeft,
- child:
- FittedBox(
- fit: BoxFit.scaleDown, // Sesuaikan teks agar tidak melebihi lebar container
- child: Text(
- _pathFoto[i]
- /*style: TextStyle(fontSize: size.width),*/
- ),
- ),
-
- )
- ),
- ]
- )
- ),
- /*GestureDetector(
- onTap: () {
- setState(() {
- _removeItemFoto(i);
- logDev.log(_pathFoto.length.toString(), name: "Banyak path foto");
- logDev.log(_pathFoto.toString(), name: "Isi Path FOTO");
- });
- },
- child:
- const Icon(
- Icons.delete,
- color: Color(0xFF6B74D6),
- size: 40,
- )
- )*/
- ],
- ),
- );
- },
- ),
- const SizedBox(
- height: 5,
- ),
- /*GestureDetector(
- onTap: () {
- setState(() {
- _addFieldFoto();
- });
- },
- child: Center(
- child: Container(
- width: MediaQuery.of(context).size.width,
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
- decoration: BoxDecoration(
- color: Colors.blueAccent,
- borderRadius: BorderRadius.circular(5),
- ),
- child: Align(
- alignment: Alignment.center,
- child: Text(
- "Tambah Foto+",
- style: GoogleFonts.nunito(
- color: const Color(0xFFF8F8FF),
- ),
- ),
- ),
- ),
- ),
- ),*/
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- ],
- )),
- );
- }
-
- //Validasi Form Survey
- bool validateFormSurvey(BuildContext context) {
- bool result = true;
- if (nama_desa == "" && visibleFormDesa == false) {
- Fluttertoast.showToast(
- msg: "Nama Desa Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (visibleFormDesa == true){
- Fluttertoast.showToast(
- msg: "Mohon Konfirmasi Data Desa Terlebih Dahulu!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (nama_kecamatan == "" && visibleFormKecamatan == false) {
- Fluttertoast.showToast(
- msg: "Nama Kecamatan Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (visibleFormKecamatan == true){
- Fluttertoast.showToast(
- msg: "Mohon Konfirmasi Data Kecamatan Terlebih Dahulu!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (nama_kabupaten == "" && visibleFormKabupaten == false) {
- Fluttertoast.showToast(
- msg: "Nama Kabupaten Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (visibleFormKabupaten == true){
- Fluttertoast.showToast(
- msg: "Mohon Konfirmasi Data Kabupaten Terlebih Dahulu!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (nama_provinsi == "" && visibleFormProvinsi == false) {
- Fluttertoast.showToast(
- msg: "Nama Provinsi Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (visibleFormProvinsi == true){
- Fluttertoast.showToast(
- msg: "Mohon Konfirmasi Data Provinsi Terlebih Dahulu!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (isiJumlahPendudukTeksController.text.toString().isEmpty) {
- Fluttertoast.showToast(
- msg: "Jumlah Penduduk Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (isiSignal2TeksController.text.toString().isEmpty) {
- Fluttertoast.showToast(
- msg: "Signal 2G Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (isiSignal3TeksController.text.toString().isEmpty) {
- Fluttertoast.showToast(
- msg: "Signal 3G Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (isiSignal4TeksController.text.toString().isEmpty) {
- Fluttertoast.showToast(
- msg: "Signal 4G Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (_jenisTempat[0].text.toString().isEmpty){
- Fluttertoast.showToast(
- msg: "Tempat Keramaian Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (_km[0].text.toString().isEmpty){
- Fluttertoast.showToast(
- msg: "Tempat Keramaian Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- } else if (isiCatatanTeksController.text.toString().isEmpty) {
- Fluttertoast.showToast(
- msg: "Catatan Harus Diisi!",
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- textColor: Colors.white,
- fontSize: 16.0);
- result = false;
- }
-
- return result;
- }
- }
-
- alertDialogFailedRetrievedData(BuildContext context){
- Widget okButton = TextButton(
- child: Text("Refresh"),
- onPressed: () {
- Navigator.of(context, rootNavigator: true).pop();
- Navigator.pushReplacement(context, MaterialPageRoute(
- builder: (context) => DetailSurveyScreen()));
- },
- );
-
- Widget noButton = TextButton(
- child: Text("Back"),
- onPressed: () {
- Navigator.of(context, rootNavigator: true).pop();
- Navigator.pop(context);
-
- },
- );
-
- // set up the AlertDialog
- AlertDialog alert = AlertDialog(
- title: Text("Tower Application"),
- content: Text("Failed to Retrieve Data"),
- actions: [
- noButton,
- okButton,
- ],
- );
-
- // show the dialog
- showDialog(
- context: context,
- barrierDismissible: false,
- builder: (BuildContext context) {
- return alert;
- },
- );
- }
-
- alertDialogFailedResponse(BuildContext context){
- Widget okButton = TextButton(
- child: Text("Refresh"),
- onPressed: () {
- Navigator.of(context, rootNavigator: true).pop();
- Navigator.pushReplacement(context, MaterialPageRoute(
- builder: (context) => DetailSurveyScreen()));
- },
- );
-
- Widget noButton = TextButton(
- child: Text("Back"),
- onPressed: () {
- Navigator.of(context, rootNavigator: true).pop();
- Navigator.pop(context);
-
- },
- );
-
- // set up the AlertDialog
- AlertDialog alert = AlertDialog(
- title: Text("Tower Application"),
- content: Text("Server Response Error"),
- actions: [
- noButton,
- okButton,
- ],
- );
-
- // show the dialog
- showDialog(
- context: context,
- barrierDismissible: false,
- builder: (BuildContext context) {
- return alert;
- },
- );
- }
|