Fakultas Ilmu Komputer UI

Commit 59e7c612 authored by BIMO IMAN SMARTADI's avatar BIMO IMAN SMARTADI
Browse files

Merge branch 'dev-bayu' into 'PBI-4-menambahkan_informasi_fasilitas_publik'

Dev bayu

See merge request !51
parents 04efeefb fcae1899
Pipeline #42260 passed with stages
in 3 minutes and 56 seconds
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]}]}
\ No newline at end of file
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]}]}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
]>
<svg version="1.1" id="Livello_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 533.5 544.3"
style="enable-background:new 0 0 533.5 544.3;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4285F4;}
.st1{fill:#34A853;}
.st2{fill:#FBBC04;}
.st3{fill:#EA4335;}
</style>
<metadata>
<sfw xmlns="&ns_sfw;">
<slices></slices>
<sliceSourceBounds bottomLeftOrigin="true" height="544.3" width="533.5" x="0.1" y="110.1"></sliceSourceBounds>
</sfw>
</metadata>
<g>
<path class="st0" d="M533.5,278.4c0-18.5-1.5-37.1-4.7-55.3H272.1v104.8h147c-6.1,33.8-25.7,63.7-54.4,82.7v68h87.7
C503.9,431.2,533.5,361.2,533.5,278.4z"/>
<path class="st1" d="M272.1,544.3c73.4,0,135.3-24.1,180.4-65.7l-87.7-68c-24.4,16.6-55.9,26-92.6,26c-71,0-131.2-47.9-152.8-112.3
H28.9v70.1C75.1,486.3,169.2,544.3,272.1,544.3z"/>
<path class="st2" d="M119.3,324.3c-11.4-33.8-11.4-70.4,0-104.2V150H28.9c-38.6,76.9-38.6,167.5,0,244.4L119.3,324.3z"/>
<path class="st3" d="M272.1,107.7c38.8-0.6,76.3,14,104.4,40.8l0,0l77.7-77.7C405,24.6,339.7-0.8,272.1,0C169.2,0,75.1,58,28.9,150
l90.4,70.1C140.8,155.6,201.1,107.7,272.1,107.7z"/>
</g>
</svg>
......@@ -41,5 +41,12 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<!-- image picker -->
<key>NSPhotoLibraryUsageDescription</key>
<string>Need to upload image</string>
<key>NSCameraUsageDescription</key>
<string>Need to upload image</string>
<key>NSMicrophoneUsageDescription</key>
<string>Need to upload image</string>
</dict>
</plist>
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/page/dashboard/dashboard.dart';
//import 'package:ppl_disabilitas/page/addInformasi/addInfromasi.dart';
class BisaGo extends StatelessWidget {
@override
......
......@@ -6,4 +6,4 @@ import 'flavor/flavor.dart';
void main() {
ApiFlavor.flavor = BuildFlavor.production.toString();
runApp(BisaGo());
}
\ No newline at end of file
}
import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/utils/customDeskripsiField.dart';
import 'package:ppl_disabilitas/utils/customButton.dart';
import 'package:ppl_disabilitas/utils/validator.dart';
import 'package:smooth_star_rating/smooth_star_rating.dart';
import 'package:image_picker/image_picker.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class AddInformasi extends StatefulWidget{
AddInformasiState createState() => AddInformasiState();
}
class AddInformasiState extends State<AddInformasi> {
File _image;
var rating = 0.0;
var tag = '';
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
Map<String, bool> fasilitas = {
'Kursi Roda': false,
'Lift Disabilitas': false,
'Toilet Disabilitas': false,
'Masjid/Mushola': false,
'Guiding Block': false,
'Bidang Miring': false,
'Teman Disabilitas': false,
'Juru Bahasa Isyarat': false,
'Tongkat Disabilitas Netra':false,
'Kursi Umum Disabilitas': false,
'Tempat Parkir Disabilitas': false,
'Running Text': false,
'Tempat Parkir Biasa' : false,
};
Map<String, String> tags = {
'Kursi Roda': 'KD',
'Lift Disabilitas': 'LF',
'Toilet Disabilitas': 'TD',
'Masjid/Mushola': 'MM',
'Guiding Block': 'GB',
'Bidang Miring': 'BM',
'Teman Disabilitas': 'CP',
'Juru Bahasa Isyarat': 'JI',
'Tongkat Disabilitas Netra':'TN',
'Kursi Umum Disabilitas': 'KD',
'Tempat Parkir Disabilitas': 'PK',
'Running Text': 'RT',
'Tempat Parkir Biasa' : 'TB',
};
Future _getImage() async {
var image = await ImagePicker.pickImage(source: ImageSource.gallery);
setState(() {
_image = image;
print('_image : $_image');
});
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Tambah Informasi'),
centerTitle: true,
backgroundColor: Color(0xff3A903A),
),
body: SingleChildScrollView(
child: Form(
key: _formKey,
child: Container(
margin: EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 20),
Text("Foto Fasilitas",style: TextStyle(fontSize: 18),textAlign: TextAlign.left,),
GridView.count(
key: Key('Input Gambar'),
shrinkWrap: true,
primary: false,
padding: const EdgeInsets.all(10),
crossAxisSpacing: 10,
crossAxisCount: 2,
children: <Widget>[
GestureDetector(
onTap: _getImage,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 2.0),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0),
bottomLeft: const Radius.circular(20.0),
bottomRight: const Radius.circular(20.0),
),
color: Colors.black12,
),
child: _image == null ? Icon(FontAwesomeIcons.plus) : Image.file(_image),
),
)
],
),
CustomDeskripsiField(
title: 'Informasi Fasilitas',
key: Key('Text Field Informasi'),
onSaved: (input) {
},
validator: FieldValidator.validateInfo,
controller: deskripsiController,
),
SizedBox(height: 20),
Text("Tag Pencarian",style: TextStyle(fontSize: 18),textAlign: TextAlign.left,),
ListView(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
key: Key('Checkbox Fasilitas'),
children: fasilitas.keys.map((String key) {
return new CheckboxListTile(
title: Text(key),
value: fasilitas[key],
onChanged: (bool value) {
setState(() {
fasilitas[key] = value;
});
},
);
}).toList(),
),
SizedBox(height: 20),
Container(
alignment: Alignment.center,
key: Key('Star Rating'),
child: SmoothStarRating(
allowHalfRating: false,
onRatingChanged: (v) {
rating = v;
setState(() {});
},
starCount: 5,
rating: rating,
size: 40.0,
filledIconData: Icons.star,
halfFilledIconData: Icons.star_half,
color: Colors.green,
borderColor: Colors.green,
spacing:0.0,
),
),
Container(
margin: EdgeInsets.fromLTRB(0, 30, 0, 10),
alignment: Alignment.center,
child: ButtonTheme(
key: Key("Simpan Button"),
minWidth: double.infinity,
height: 40,
child: submitButton(
'Simpan', Color(0xff3A903A), Colors.white,
Color(0xff3A903A), Colors.white, _validateLoginInput),
)
),
],
),
),
)
)
);
}
TextEditingController deskripsiController = TextEditingController();
addInfo(String tag, String deskripsi, String rating) async {
for(MapEntry<String, bool> me in fasilitas.entries)
if(me.value == true) tag = tag + tags[me.key] + ' ';
Map data = {
'tag': tag,
'deskripsi': deskripsi,
'rating' : rating,
};
var response = await http.post(
'http://poipole-staging.herokuapp.com/informasi-lokasi/lokasi/detail/*nama_lokasi*', body: data);
if (response.statusCode == 200) {
inputData(context);
}
else {
print(data);
inputData(context);
}
}
void inputData(BuildContext context){
var alertDialog = AlertDialog(
title: Text('Tambah Informasi berhasil'),
content: Icon(FontAwesomeIcons.checkCircle),
);
showDialog(
context: context,
builder: (BuildContext context){
return alertDialog;
}
);
}
void _validateLoginInput() async {
final FormState form = _formKey.currentState;
if(_formKey.currentState.validate()) {
form.save();
await addInfo(tag, deskripsiController.text.toString(), rating.toStringAsFixed(2));
}
}
}
\ No newline at end of file
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/utils/customButton.dart';
import 'package:ppl_disabilitas/utils/customTextField.dart';
import 'package:ppl_disabilitas/utils/validator.dart';
class Login extends StatefulWidget{
LoginState createState() => LoginState();
}
class LoginState extends State<Login> {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('bisaGO'),
centerTitle: true,
backgroundColor: Color(0xff3A903A),
),
body: SingleChildScrollView(
child: Form(
key: _formKey,
child: Center(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 25),
Text('Masuk ke Akun',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
SizedBox(height: 20),
CustomTextField(
title: 'Nomor Telepon atau Email',
key: Key('Text Field Akun'),
onSaved: (input) {
},
validator: FieldValidator.validateEmail,
),
CustomTextField(
title: 'Password',
key: Key('Text Field Password'),
obsecure: true,
onSaved: (input) {
},
validator: FieldValidator.validatePassword,
),
Container(
margin: EdgeInsets.fromLTRB(0, 30, 0, 10),
alignment: Alignment.center,
child: ButtonTheme(
minWidth: double.infinity,
height: 40,
child: submitButton(
'Masuk', Color(0xff3A903A), Colors.white,
Color(0xff3A903A), Colors.white, _validateLoginInput),
)
),
Container(
child: separator('Atau masuk dengan', 12, 0xff000000, 1, 0xff000000),
),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 30),
alignment: Alignment.center,
child: googleButton(),
),
],
),
),
)
)
)
);
}
void _validateLoginInput() async {
final FormState form = _formKey.currentState;
if(_formKey.currentState.validate()) {
form.save();
}
}
}
\ No newline at end of file
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/utils/customButton.dart';
import 'package:ppl_disabilitas/utils/customTextField.dart';
class Registrasi extends StatefulWidget {
RegistrasiState createState() => RegistrasiState();
}
class RegistrasiState extends State<Registrasi> {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('bisaGO'),
centerTitle: true,
backgroundColor: Color(0xff3A903A),
),
body: SingleChildScrollView(
child: Form(
key: _formKey,
child: Center(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 25),
Text('Daftar Akun Baru',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
SizedBox(height: 20),
CustomTextField(
title: 'Nama Lengkap',
key: Key('Text Field Nama'),
validator: (input) => input.isEmpty ? "*Wajib diisi" : null,
),
CustomTextField(
title: 'Nomor Telepon',
key: Key('Text Field Nomor Telepon'),
validator: (input) => input.isEmpty ? "*Wajib diisi" : null,
),
CustomTextField(
title: 'Email (Opsional)',
key: Key('Text Field Email'),
),
CustomTextField(
title: 'Password',
key: Key('Text Field Password'),
obsecure: true,
validator: (input) => input.isEmpty ? "*Wajib diisi" : null,
),
CustomTextField(
title: 'Konfirmasi Password',
key: Key('Text Field Konfirmasi Password'),
obsecure: true,
validator: (input) => input.isEmpty ? "*Wajib diisi" : null,
),
Container(
margin: EdgeInsets.fromLTRB(0, 30, 0, 10),
alignment: Alignment.center,
child: ButtonTheme(
minWidth: double.infinity,
height: 40,
child: submitButton('Daftar', Color(0xff3A903A), Colors.white,
Color(0xff3A903A), Colors.white, _validateLoginInput),
)
),
Container(
child: separator('Atau daftar dengan', 12, 0xff000000, 1, 0xff000000),
),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 30),
alignment: Alignment.center,
child: googleButton(),
),
],
),
),
),
),
),
);
}
void _validateLoginInput() async {
final FormState form = _formKey.currentState;
if (_formKey.currentState.validate()) {
form.save();
}
}
}
\ No newline at end of file
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Widget submitButton(String text, Color splashColor, Color highlightColor,
Color fillColor, Color textColor, void function()) {
return RaisedButton(
padding: EdgeInsets.symmetric(vertical: 15),
highlightElevation: 0.0,
splashColor: splashColor,
highlightColor: highlightColor,
elevation: 0.0,
color: fillColor,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.all(Radius.circular(10)),
),
child: Text(
text,
style: TextStyle(fontSize: 20, color: textColor, fontWeight: FontWeight.bold),
),
onPressed: () => function(),
);
}
Widget separator(String text, double textSize, int textColor, double thickness, int color) {
return Row(
children: <Widget>[
SizedBox(
width: 20,
),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Divider(
thickness: thickness,
color: Color(color),
),
),
),
Text(text,
style: TextStyle(fontSize: textSize, color: Color(textColor))),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Divider(
thickness: thickness,
color: Color(color),
),
),
),
SizedBox(
width: 20,
),
],
);
}
Widget googleButton() {
return InkWell(
onTap: () {
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
border: Border.all(),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.shade200,
offset: Offset(2, 4),
blurRadius: 5,
spreadRadius: 2)
],
color: Colors.white,
),
child: Stack(
children: <Widget>[
Container(
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(10),
topLeft: Radius.circular(10)),
),
child: Image(
image: AssetImage('assets/logo/google.png'),
width: 20.0,
),
),
Container(
padding: EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(10),
topRight: Radius.circular(10)),
),
alignment: Alignment.center,
child: Text('Akun Google',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)
),
),
],
),
),
);
}
\ No newline at end of file
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class CustomDeskripsiField extends StatelessWidget {