Fakultas Ilmu Komputer UI

Commit 190369a8 authored by Jovi Handono Hutama's avatar Jovi Handono Hutama
Browse files

Merge branch 'dev-jovi' into 'PBI-12-info_kegiatan'

Refactor & bugfix

See merge request !68
parents f251c685 2de78608
Pipeline #81653 passed with stages
in 19 minutes and 11 seconds
......@@ -16,7 +16,6 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:http_parser/http_parser.dart';
import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:multi_image_picker/multi_image_picker.dart';
......@@ -192,19 +191,9 @@ class _AddKegiatanState extends State<AddKegiatan> {
});
}
final picker = ImagePicker();
// File _image;
// Future _getCameraImage() async {
// final image =
// await picker.getImage(source: ImageSource.camera, imageQuality: 50);
// return File(image.path);
// }
Future<void> pickImages() async {
var resultList = <Asset>[];
await _getStoragePermission();
await _getCameraPermission();
await _getPermission();
try {
if (permissionGranted) {
......@@ -232,28 +221,16 @@ class _AddKegiatanState extends State<AddKegiatan> {
}
}
Future _getStoragePermission() async {
if (await Permission.storage.request().isGranted) {
setState(() {
permissionGranted = true;
});
} else if (await Permission.storage.request().isPermanentlyDenied) {
await openAppSettings();
} else if (await Permission.storage.request().isDenied) {
setState(() {
permissionGranted = false;
});
}
}
Future _getCameraPermission() async {
if (await Permission.camera.request().isGranted) {
Future _getPermission() async {
var _camera = await Permission.storage.request();
var _storage = await Permission.camera.request();
if (_camera.isGranted && _storage.isGranted) {
setState(() {
permissionGranted = true;
});
} else if (await Permission.camera.request().isPermanentlyDenied) {
} else if (_camera.isPermanentlyDenied || _storage.isPermanentlyDenied) {
await openAppSettings();
} else if (await Permission.camera.request().isDenied) {
} else if (_camera.isDenied || _storage.isDenied) {
setState(() {
permissionGranted = false;
});
......
......@@ -22,7 +22,7 @@ class _KegiatanState extends State<Kegiatan> {
return InkWell(
key: Key(widget.kegiatan.namaKegiatan),
onTap: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) => DetailPostKegiatanPage(
lokasi: widget.lokasi,
kegiatan: KegiatanModel(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment