Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'dart:async';
- import 'dart:io';
- import 'package:cached_network_image/cached_network_image.dart';
- import 'package:dio/dio.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_calendar_carousel/classes/event.dart';
- import 'package:flutter_calendar_carousel/classes/event_list.dart';
- import 'package:geolocator/geolocator.dart';
- import 'package:rflutter_alert/rflutter_alert.dart';
- import 'package:rohisapp/endpoint/api.dart';
- import 'package:rohisapp/model/amalanModel.dart';
- import 'package:rohisapp/model/artikel.dart';
- import 'package:rohisapp/model/event_model.dart';
- import 'package:rohisapp/model/youtube_model.dart';
- import 'package:rohisapp/notification/firebase_notification_handler.dart';
- import 'package:rohisapp/page/amalan_harian.dart';
- import 'package:rohisapp/page/arahKiblat.dart';
- import 'package:rohisapp/page/artikel.dart';
- import 'package:rohisapp/page/artikel_detail.dart';
- import 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart';
- import 'package:intl/intl.dart' show DateFormat, toBeginningOfSentenceCase;
- import 'package:flutter_calendar/flutter_calendar.dart';
- import 'package:rohisapp/page/dzkirdoa.dart';
- import 'package:rohisapp/page/jadwal_shalat.dart';
- import 'package:rohisapp/page/jadwal_sholat.dart';
- import 'package:rohisapp/page/kalender.dart';
- import 'package:rohisapp/page/kalender_kegiatan.dart';
- import 'package:rohisapp/page/kiblat.dart';
- import 'package:rohisapp/page/login.dart';
- import 'package:rohisapp/page/notif.dart';
- import 'package:rohisapp/page/notifikasi.dart';
- import 'package:rohisapp/page/pengaturan.dart';
- import 'package:rohisapp/page/quran.dart';
- import 'package:rohisapp/page/screen/quran_list.dart';
- import 'package:rohisapp/page/video_kajian.dart';
- import 'package:rohisapp/page/video_kajian_detail.dart';
- import 'package:shared_preferences/shared_preferences.dart';
- import 'package:permission_handler/permission_handler.dart';
- import 'package:android_intent/android_intent.dart';
- import 'package:device_info/device_info.dart';
- import 'package:geocoder/geocoder.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'dart:math' as math;
- import 'package:html_unescape/html_unescape.dart';
- import 'package:sliding_up_panel/sliding_up_panel.dart';
- import 'package:pull_to_refresh/pull_to_refresh.dart';
- import 'kiblatcompass.dart';
- class HomePanel extends StatefulWidget {
- @override
- _HomePanelState createState() => _HomePanelState();
- }
- class _HomePanelState extends State<HomePanel>
- with SingleTickerProviderStateMixin {
- Future<List<AmalanModel>> _listFutureAmalan;
- Future<List<ArtikelModel>> _listFutureArtikel;
- Future<List<YoutubeModel>> _listFutureYoutube;
- final RefreshController _refreshController = RefreshController();
- double _panelHeightOpen = 300.0;
- double _panelHeightClosed = 100.0;
- int jumartikel = 0;
- Timer timer;
- String timeText = '';
- String statusText = '';
- int jam = 0;
- int menit = 0;
- int detik = 0;
- Stopwatch stopwatch = Stopwatch();
- static const delay = Duration(microseconds: 1);
- var begin = 0.0;
- Animation<double> heightSize;
- AnimationController controller;
- void updateClock() {
- final duration = Duration(hours: jam, minutes: menit, seconds: detik);
- // if time is up, stop the timer
- if (stopwatch.elapsed.inMilliseconds == duration.inMilliseconds) {
- print('--finished Timer Page--');
- stopwatch.stop();
- stopwatch.reset();
- controller.stop(canceled: false);
- setState(() {
- statusText = 'Finished';
- // buttonText = "Restart";
- });
- return;
- } else {
- statusText = '';
- }
- final millisecondsRemaining =
- duration.inMilliseconds - stopwatch.elapsed.inMilliseconds;
- final hoursRemaining =
- ((millisecondsRemaining / (1000 * 60 * 60)) % 24).toInt();
- final minutesRemaining =
- ((millisecondsRemaining / (1000 * 60)) % 60).toInt();
- final secondsRemaining = ((millisecondsRemaining / 1000) % 60).toInt();
- setState(() {
- timeText = '${hoursRemaining.toString().padLeft(2, '0')}:'
- '${minutesRemaining.toString().padLeft(2, '0')}:'
- '${secondsRemaining.toString().padLeft(2, '0')}';
- });
- if (stopwatch.isRunning) {
- setState(() {});
- } else if (stopwatch.elapsed.inSeconds == 0) {
- setState(() {
- timeText = '${jam.toString().padLeft(2, "0")}:'
- '${menit.toString().padLeft(2, '0')}:'
- '${detik.toString().padLeft(2, '0')}';
- });
- } else {
- setState(() {});
- }
- }
- Position positions;
- double lat;
- double long;
- PermissionStatus _statusPermission;
- static double _minHeight = 130, _maxHeight = 290;
- Offset _offset = Offset(0, _minHeight);
- bool _isOpen = false;
- DateTime _currentDate = DateTime.now();
- DateTime _currentDate2 = DateTime.now();
- DateTime _targetDateTime = DateTime.now();
- String _currentMonth = '';
- bool content = false;
- SharedPreferences sharedPreferences;
- bool islogin = false;
- var email = "";
- var userid = "";
- var full_name = "";
- var waktu_sholat = "";
- var jam_sholat = "";
- var kota = "";
- var lokasiAdzan = "";
- var tglHijriah = "";
- var tglMasehi = "";
- var deviceid = "";
- var lokasi_adzan = "";
- String timerString = '';
- static Widget _eventIcon = new Container(
- decoration: new BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(1000)),
- border: Border.all(color: Colors.blue, width: 2.0)),
- child: new Icon(
- Icons.check_circle,
- color: Colors.blue,
- ),
- );
- static Widget _holidayIcon = new Container(
- decoration: new BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(1000)),
- border: Border.all(color: Colors.red, width: 2.0)),
- child: new Icon(
- Icons.home,
- color: Colors.red,
- ),
- );
- EventList<Event> _markedDateMap = EventList<Event>();
- List<EventModel> _listEvent = [];
- CalendarCarousel _calendarCarousel, _calendarCarouselNoHeader;
- void handleNewDate(date) {
- print("handleNewDate ${date}");
- }
- getDeviceDetails() async {
- String deviceName;
- String deviceVersion;
- String identifier;
- final DeviceInfoPlugin deviceInfoPlugin = new DeviceInfoPlugin();
- try {
- if (Platform.isAndroid) {
- var build = await deviceInfoPlugin.androidInfo;
- deviceName = build.model;
- deviceVersion = build.version.toString();
- identifier = build.androidId; //UUID for Android
- print('identifier ' + identifier);
- } else if (Platform.isIOS) {
- var data = await deviceInfoPlugin.iosInfo;
- deviceName = data.name;
- deviceVersion = data.systemVersion;
- identifier = data.identifierForVendor; //UUID for iOS
- }
- setState(() {
- deviceid = identifier;
- });
- _checkJadwalSholat(deviceid);
- String url = new Api().url;
- var dio = new Dio();
- await dio.post(
- url + "index.php/api/Device_info",
- data: {
- "device_id": identifier,
- "deviceName": deviceName,
- },
- options:
- new Options(contentType: ContentType.parse("application/json")),
- );
- } catch (e) {
- print('Failed to get platform version');
- }
- return [deviceName, deviceVersion, identifier];
- }
- _checkJadwalSholat(identifier) async {
- var now = new DateTime.now();
- var formatter = new DateFormat('MM');
- var dates = formatter.format(now);
- String url = new Api().url;
- Response response;
- var dio = new Dio();
- try {
- // for (int i = 1; i <= 7; i++) {
- response = await dio
- .get(url + "index.php/api/CheckJadwalSholat?device_id=" + identifier);
- final json = response.data;
- if (response.statusCode == 200) {
- // print(json.toString());
- lokasiAdzan = json.toString();
- getWaktuSholat(lokasiAdzan);
- getJadwalSholat(lokasiAdzan);
- } else {
- throw Exception('Failed to load');
- }
- } on DioError catch (e) {
- print("GAGAL");
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- }
- @override
- void initState() {
- new FirebaseNotifications().setUpFirebase();
- // requestLocationPermission(context);
- // getWaktuSholat();
- super.initState();
- (() async {
- await _event();
- await _hariLibur();
- await getDeviceDetails();
- // await getJadwalSholat();
- sharedPreferences = await SharedPreferences.getInstance();
- setState(() {
- if (sharedPreferences.getBool("isLogin") != null) {
- islogin = sharedPreferences.getBool("isLogin");
- email = sharedPreferences.getString("email");
- full_name = sharedPreferences.getString("full_name");
- userid = sharedPreferences.getString("userid");
- } else {
- full_name = "";
- }
- });
- _listFutureAmalan = fetchAmalanBelumDikerjakan();
- _listFutureArtikel = fetchArtikel();
- _listFutureYoutube = fetchVideo();
- })();
- // _askPermission();
- }
- @override
- void dispose() {
- controller.dispose();
- stopwatch.stop();
- timer.cancel();
- super.dispose();
- }
- getJadwalSholat(lokasi) async {
- String url = new Api().url;
- Response response;
- response = await Dio()
- .get(url + "index.php/api/JadwalSholatByKota?kota=" + lokasi);
- }
- void getWaktuSholat(lokasi) async {
- String url = new Api().url;
- Response response;
- response = await Dio().get(url + "index.php/api/NextPrayer?kota=" + lokasi);
- final json = response.data;
- print('json ' + json.toString());
- setState(() {
- waktu_sholat = json["waktu_sholat"].toString();
- jam_sholat = json["jam"].toString();
- tglHijriah = json["hijr"].toString();
- tglMasehi = json["tanggal"];
- detik = int.parse(json["detik"]);
- jam = int.parse(json["jams"]);
- menit = int.parse(json["menit"]);
- print('tglMasehi ' + tglMasehi);
- });
- }
- // void requestLocationPermission(BuildContext context) async {
- // try {
- // Position currentPosition = await Geolocator()
- // .getCurrentPosition(desiredAccuracy: LocationAccuracy.best);
- // if (this.mounted) {
- // final coordinates = new Coordinates(
- // currentPosition.latitude, currentPosition.longitude);
- // var addresses =
- // await Geocoder.local.findAddressesFromCoordinates(coordinates);
- // List<Address> first = addresses;
- // setState(() {
- // lat = currentPosition.latitude;
- // long = currentPosition.longitude;
- // kota = first[0].subAdminArea;
- // print("position " + currentPosition.toString());
- // });
- // getWaktuSholat(currentPosition.latitude, currentPosition.longitude);
- // }
- // } on PlatformException catch (e) {
- // print("!!!!" + e.toString());
- // } catch (e) {
- // print("!!GEOLOC ERROR " + e.toString());
- // }
- // }
- // void _askPermission() {
- // PermissionHandler().requestPermissions(
- // [PermissionGroup.locationWhenInUse]).then(_onStatusRequested);
- // }
- // void _onStatusRequested(Map<PermissionGroup, PermissionStatus> statuses) {
- // final status = statuses[PermissionGroup.locationWhenInUse];
- // if (status != PermissionStatus.granted) {
- // new Alert(
- // context: context,
- // type: AlertType.warning,
- // title: "Aktifkan Lokasi ?",
- // desc: "Untuk Mengakses Fitur ini Anda Harus mengaktifkan Lokasi Anda",
- // buttons: [
- // DialogButton(
- // child: Text(
- // "TIDAK",
- // style: TextStyle(color: Colors.white, fontSize: 20),
- // ),
- // onPressed: () {
- // Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
- // return new Home();
- // }));
- // },
- // color: Colors.blue,
- // ),
- // DialogButton(
- // child: Text(
- // "YA",
- // style: TextStyle(color: Colors.white, fontSize: 20),
- // ),
- // onPressed: () async {
- // openLocationSetting();
- // Navigator.of(context).pop();
- // },
- // color: Colors.blue,
- // )
- // ],
- // ).show();
- // }
- // }
- void openLocationSetting() async {
- final AndroidIntent intent = new AndroidIntent(
- action: 'android.settings.LOCATION_SOURCE_SETTINGS',
- );
- await intent.launch();
- }
- Widget _content() {
- if (content == true) {
- return Text(
- "Pertama, banyak membaca tasbih.\n\nKedua, membaca Al Ikhlash, Al Falaq dan An Nas (3x) (HR. Abu Dawud 5082 dan Tirmidzi 3575, dihasankan Albani)\n\n Ketiga, ketika pagi membaca (1x):\n\nأَصْبَحْنَا وَأَصْبَحَ الْمُلْكُ لِلَّهِ، وَالْحَمْدُ لِلَّهِ، لاَ إِلَـهَ إِلاَّ اللهُ وَحْدَهُ لاَ شَرِيْكَ لَهُ، لَهُ الْمُلْكُ وَلَهُ الْحَمْدُ وَهُوَ عَلَى كُلِّ شَيْءٍ قَدِيْرُ. رَبِّ أَسْأَلُكَ خَيْرَ مَا فِيْ هَذَا الْيَوْمِ وَخَيْرَ مَا بَعْدَهُ، وَأَعُوْذُ بِكَ مِنْ شَرِّ مَا فِيْ هَذَا الْيَوْمِ وَشَرِّ مَا بَعْدَهُ، رَبِّ أَعُوْذُ بِكَ مِنَ الْكَسَلِ وَسُوْءِ الْكِبَرِ، رَبِّ أَعُوْذُ بِكَ مِنْ عَذَابٍ فِي النَّارِ وَعَذَابٍ فِي الْقَبْرِ \n\nKeempat, ketika pagi membaca (1x):\n\n اَللَّهُمَّ بِكَ أَصْبَحْنَا، وَبِكَ أَمْسَيْنَا، وَبِكَ نَحْيَا، وَبِكَ نَمُوْتُ وَإِلَيْكَ النُّشُوْرُ \n\nKelima, membaca sayyidul istighfar (1x):\n\nاَللَّهُمَّ أَنْتَ رَبِّيْ لاَ إِلَـهَ إِلاَّ أَنْتَ، خَلَقْتَنِيْ وَأَنَا عَبْدُكَ، وَأَنَا عَلَى عَهْدِكَ وَوَعْدِكَ مَا اسْتَطَعْتُ، أَعُوْذُ بِكَ مِنْ شَرِّ مَا صَنَعْتُ، أَبُوْءُ لَكَ بِنِعْمَتِكَ عَلَيَّ، وَأَبُوْءُ بِذَنْبِيْ فَاغْفِرْ لِيْ فَإِنَّهُ لاَ يَغْفِرُ الذُّنُوْبَ إِلاَّ أَنْتَ. \n\nKeenam, membaca (3x):\n\nرَضِيْتُ بِاللهِ رَبًّا، وَبِاْلإِسْلاَمِ دِيْنًا، وَبِمُحَمَّدٍ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ نَبِيًّ \n\nKetujuh, membaca (1x):\n\nيَا حَيُّ يَا قَيُّوْمُ بِرَحْمَتِكَ أَسْتَغِيْثُ، أَصْلِحْ لِيْ شَأْنِيْ كُلَّهُ وَلاَ تَكِلْنِيْ إِلَى نَفْسِيْ طَرْفَةَ عَيْنٍ وَبِمُحَمَّدٍ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ نَبِيًّا");
- } else {
- return Container();
- }
- }
- Future<List<AmalanModel>> fetchAmalanBelumDikerjakan() async {
- String url = new Api().url;
- var dio = new Dio();
- try {
- var notes = List<AmalanModel>();
- Response response;
- response = await dio.get(
- url + "index.php/api/AmalanBelumDikerjakan?id_device=" + deviceid);
- final json = response.data;
- if (response.statusCode == 200) {
- notes = (json)
- .map<AmalanModel>((item) => AmalanModel.fromJson(item))
- .toList();
- } else {
- throw Exception('Failed to load');
- }
- return new Future.delayed(new Duration(seconds: 1), () {
- return notes.where((i) => i.id_amalan_harian != null).toList();
- });
- } catch (e) {
- print('Failed to get platform version');
- }
- }
- _amalkan(idamal) async {
- var now = new DateTime.now();
- var formatter = new DateFormat('yyyy-MM-dd');
- var dates = formatter.format(now);
- String url = new Api().url;
- var dio = new Dio();
- print("idamal " + idamal.toString());
- try {
- await dio.post(
- url + "index.php/api/Amalan",
- data: {
- "id_amalan_harian": idamal,
- "id_device": deviceid,
- "tanggal": dates,
- "diamalkan": "1",
- "created_by": "user",
- },
- options:
- new Options(contentType: ContentType.parse("application/json")),
- );
- print("SUKSES");
- new Alert(
- context: context,
- type: AlertType.success,
- title: "Sukses",
- desc: "Data Disimpan",
- buttons: [
- DialogButton(
- child: Text(
- "OK",
- style: TextStyle(color: Colors.white, fontSize: 20),
- ),
- onPressed: () {
- Navigator.of(context)
- .pushReplacement(new MaterialPageRoute(builder: (_) {
- return new HomePanel();
- }));
- },
- width: 120,
- )
- ],
- ).show();
- } on DioError catch (e) {
- print("GAGAL");
- new Alert(
- context: context,
- type: AlertType.warning,
- title: "Gagal",
- desc: "Data Gagal Disimpan",
- buttons: [
- DialogButton(
- child: Text(
- "OK",
- style: TextStyle(color: Colors.white, fontSize: 20),
- ),
- onPressed: () {
- Navigator.of(context).pop();
- },
- width: 120,
- )
- ],
- ).show();
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- }
- _event() async {
- String url = new Api().url;
- Response res;
- var dio = new Dio();
- try {
- res = await dio.get(url + "index.php/api/Jadwal_kajian");
- final dataEvents = res.data;
- if (res.statusCode == 200) {
- for (int i = 0; i < int.parse(dataEvents[0]['total']); i++) {
- var now = DateTime.parse(dataEvents[i]['date']);
- var end = DateTime.parse(dataEvents[i]['dates']);
- var formatter = new DateFormat('dd/MM/yyyy');
- var dates = formatter.format(now);
- var datesend = formatter.format(end);
- var formatterJam = new DateFormat('HH:mm');
- var jam = formatterJam.format(now);
- var unescape = new HtmlUnescape();
- var text = unescape.convert(dataEvents[i]['ustadz']);
- var kat = unescape.convert(dataEvents[i]['kategori']);
- var lokasi = unescape.convert(dataEvents[i]['lokasi']);
- _markedDateMap.add(
- new DateTime(
- int.parse(dataEvents[i]['eventyear']),
- int.parse(dataEvents[i]['eventmonth']),
- int.parse(dataEvents[i]['eventday'])),
- new Event(
- date: new DateTime(
- int.parse(dataEvents[i]['eventyear']),
- int.parse(dataEvents[i]['eventmonth']),
- int.parse(dataEvents[i]['eventday'])),
- title: dataEvents[i]['title'] +
- '-' +
- dates +
- ' s/d ' +
- datesend +
- '-' +
- jam +
- '-' +
- text +
- '*' +
- kat,
- desc: text + '-' + lokasi,
- icon: _eventIcon,
- ),
- );
- }
- } else {
- throw Exception('Failed to load');
- }
- } on DioError catch (e) {
- print("GAGAL");
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- }
- _hariLibur() async {
- String url = new Api().url;
- Response res;
- var dio = new Dio();
- try {
- res = await dio.get(url + "index.php/api/Jadwal_kajian/harilibur");
- final dataEvents = res.data;
- if (res.statusCode == 200) {
- for (int i = 0; i < int.parse(dataEvents[0]['total']); i++) {
- var now = DateTime.parse(dataEvents[i]['date']);
- var end = DateTime.parse(dataEvents[i]['dates']);
- var formatter = new DateFormat('dd/MM/yyyy');
- var dates = formatter.format(now);
- var datesend = formatter.format(end);
- var formatterJam = new DateFormat('HH:mm');
- var jam = formatterJam.format(now);
- var unescape = new HtmlUnescape();
- var text = unescape.convert(dataEvents[i]['ustadz']);
- var kat = unescape.convert(dataEvents[i]['kategori']);
- var lokasi = unescape.convert(dataEvents[i]['lokasi']);
- var description_event =
- unescape.convert(dataEvents[i]['description_event']);
- _markedDateMap.add(
- new DateTime(
- int.parse(dataEvents[i]['eventyear']),
- int.parse(dataEvents[i]['eventmonth']),
- int.parse(dataEvents[i]['eventday'])),
- new Event(
- date: new DateTime(
- int.parse(dataEvents[i]['eventyear']),
- int.parse(dataEvents[i]['eventmonth']),
- int.parse(dataEvents[i]['eventday'])),
- title: dataEvents[i]['title'] +
- '-' +
- dates +
- ' s/d ' +
- datesend +
- '-' +
- jam +
- '-' +
- text +
- '*' +
- kat,
- desc: text + '-' + lokasi,
- icon: _holidayIcon,
- ),
- );
- }
- } else {
- throw Exception('Failed to load');
- }
- } on DioError catch (e) {
- print("GAGAL");
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- }
- _viewEven(title, desc) async {
- var kajian = title.toString().split('-');
- var deskripsi = desc.toString().split('-');
- var kategori = title.toString().split('*');
- var titles = "";
- var judul = "";
- var newtgl = "";
- var jam = "";
- var ustadz = "";
- var tgl = "";
- var lokasi = '';
- if (kategori[1] == '1') {
- titles = 'Hari Libur';
- judul = '';
- tgl = '';
- newtgl = kajian[0].toString();
- jam = '';
- ustadz = '';
- lokasi = '';
- } else {
- judul = 'Tema : ' + kajian[0].toString();
- tgl = kajian[1].toString();
- newtgl = 'Tanggal : ' + tgl.replaceAll('s/d', '-');
- jam = 'Jam : ' + kajian[2].toString();
- ustadz = 'Pengisi : ' + deskripsi[0].toString();
- lokasi = 'Lokasi : ' + deskripsi[1].toString();
- titles = 'Jadwal Kajian';
- }
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return AlertDialog(
- title: new Text(titles),
- content: Container(
- width: MediaQuery.of(context).size.width,
- child: SingleChildScrollView(
- child: Column(
- children: <Widget>[
- new Row(
- children: <Widget>[
- Text(
- newtgl,
- style: TextStyle(fontSize: 12),
- ),
- ],
- ),
- new Padding(
- padding: EdgeInsets.only(top: 5.0),
- ),
- new Row(
- children: <Widget>[
- Text(
- jam,
- style: TextStyle(fontSize: 12),
- ),
- ],
- ),
- new Padding(
- padding: EdgeInsets.only(top: 5.0),
- ),
- new Row(
- children: <Widget>[
- Text(judul, style: TextStyle(fontSize: 12)),
- ],
- ),
- new Padding(
- padding: EdgeInsets.only(top: 5.0),
- ),
- new Row(
- children: <Widget>[
- Text(ustadz, style: TextStyle(fontSize: 12)),
- ],
- ),
- new Padding(
- padding: EdgeInsets.only(top: 5.0),
- ),
- new Row(
- children: <Widget>[
- Text(lokasi, style: TextStyle(fontSize: 12)),
- ],
- ),
- new Padding(
- padding: EdgeInsets.only(top: 15.0),
- ),
- DialogButton(
- child: Text(
- "OK",
- style: TextStyle(color: Colors.white, fontSize: 20),
- ),
- onPressed: () {
- Navigator.of(context).pop();
- },
- width: 120,
- )
- ],
- ),
- ),
- ),
- );
- },
- );
- }
- @override
- Widget build(BuildContext context) {
- _calendarCarouselNoHeader = CalendarCarousel<Event>(
- todayBorderColor: Colors.green,
- onDayPressed: (DateTime date, List<Event> events) {
- this.setState(() => _currentDate2 = date);
- for (var item in events) {
- _viewEven(item.title, item.desc);
- }
- // events.forEach((event) => _checkExternal(event.title));
- print(events[0].title);
- },
- weekendTextStyle: TextStyle(
- color: Colors.red,
- ),
- thisMonthDayBorderColor: Colors.grey,
- weekFormat: false,
- markedDatesMap: _markedDateMap,
- height: 310.0,
- selectedDateTime: _currentDate2,
- targetDateTime: _targetDateTime,
- customGridViewPhysics: NeverScrollableScrollPhysics(),
- markedDateShowIcon: true,
- markedDateIconMaxShown: 2,
- markedDateMoreShowTotal:
- false, // null for not showing hidden events indicator
- showHeader: false,
- markedDateIconBuilder: (event) {
- return event.icon;
- },
- todayTextStyle: TextStyle(
- color: Colors.blue,
- ),
- todayButtonColor: Colors.yellow,
- selectedDayTextStyle: TextStyle(
- color: Colors.yellow,
- ),
- minSelectedDate: _currentDate.subtract(Duration(days: 360)),
- maxSelectedDate: _currentDate.add(Duration(days: 360)),
- prevDaysTextStyle: TextStyle(
- fontSize: 16,
- color: Colors.pinkAccent,
- ),
- inactiveDaysTextStyle: TextStyle(
- color: Colors.tealAccent,
- fontSize: 16,
- ),
- onCalendarChanged: (DateTime date) {
- this.setState(() {
- _targetDateTime = date;
- _currentMonth = DateFormat.yMMM().format(_targetDateTime);
- });
- },
- );
- return Scaffold(
- appBar: AppBar(
- backgroundColor: Color.fromRGBO(0, 185, 92, 1),
- title: Center(child: Text("Assalamu'alaikum " + full_name)),
- elevation: 0,
- ),
- body: Stack(
- alignment: Alignment.topCenter,
- children: <Widget>[
- SlidingUpPanel(
- margin: const EdgeInsets.only(left: 10.0, right: 10.0),
- maxHeight: _panelHeightOpen,
- minHeight: _panelHeightClosed,
- parallaxEnabled: true,
- parallaxOffset: .5,
- body: _body(),
- panel: _panel(),
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(18.0),
- topRight: Radius.circular(18.0)),
- onPanelSlide: (double pos) => setState(() {}),
- ),
- ],
- ));
- }
- Widget _panel() {
- return Column(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(left: 15.0),
- child: Row(
- children: <Widget>[
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- Text("",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- Padding(padding: EdgeInsets.only(left: 10.0)),
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- Text(" ",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- Padding(padding: EdgeInsets.only(left: 10.0)),
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- InkWell(
- onTap: () {
- _handleClick();
- // setState(() {
- // _isOpen = true;
- // });
- },
- child: Row(
- children: <Widget>[
- Material(
- color: Colors.black,
- child: Container(
- width: 53.0,
- height: 5.0,
- ), // Container
- )
- ],
- ),
- ),
- ],
- )),
- Padding(padding: EdgeInsets.only(left: 10.0)),
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- Text("",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- Padding(padding: EdgeInsets.only(left: 10.0)),
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- Text("",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- ],
- ),
- ),
- Container(
- padding: EdgeInsets.only(left: 15.0),
- child: Row(
- children: <Widget>[
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(
- builder: (BuildContext context) =>
- new DzkirDoa(0),
- ));
- },
- child: Image.asset(
- 'img/doadzikir.png',
- height: 50.0,
- ),
- ),
- ],
- ),
- Row(
- children: <Widget>[
- Text("Dzikir & Doa",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- Row(
- children: <Widget>[
- Text("",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- Padding(padding: EdgeInsets.only(left: 10.0)),
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(
- builder: (BuildContext context) =>
- new KalenderKegiatan(deviceid),
- ));
- },
- child: Image.asset(
- 'assets/icons/icon-kalender-hijriah/drawable-hdpi/Group 154.png',
- height: 50.0,
- ),
- ),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Kalender",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Kegiatan",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- Padding(padding: EdgeInsets.only(left: 10.0)),
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(
- builder: (BuildContext context) =>
- new KiblatCompass(),
- ));
- },
- child: Image.asset(
- 'assets/icons/icon-kiblat/drawable-hdpi/Group 155.png',
- height: 50.0,
- ),
- ),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Kiblat",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- Row(
- children: <Widget>[
- Text("",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- Padding(padding: EdgeInsets.only(left: 10.0)),
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(
- builder: (BuildContext context) =>
- new AmalanHarian(deviceid),
- ));
- },
- child: Image.asset(
- 'assets/icons/icon-amalan-harian/drawable-hdpi/Group 156.png',
- height: 50.0,
- ),
- ),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Amalan",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Harian",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- ],
- ),
- ),
- Padding(padding: EdgeInsets.only(top: 15.0)),
- _iconLain(),
- _iconLain2(),
- ],
- );
- }
- Widget _body() {
- return SmartRefresher(
- controller: _refreshController,
- enablePullDown: true,
- enablePullUp: true,
- header: WaterDropHeader(),
- onRefresh: () async {
- await _event();
- await _hariLibur();
- await getDeviceDetails();
- _listFutureAmalan = fetchAmalanBelumDikerjakan();
- _listFutureArtikel = fetchArtikel();
- _listFutureYoutube = fetchVideo();
- await Future.delayed(Duration(seconds: 1));
- _refreshController.refreshCompleted();
- },
- onLoading: () async{
- await Future.delayed(Duration(milliseconds: 1000));
- print("AAAA");
- _refreshController.loadComplete();
- },
- child: new SingleChildScrollView(
- child: Container(
- decoration: BoxDecoration(color: Colors.blueGrey[100]),
- padding: EdgeInsets.only(bottom: 100.0),
- child: Column(
- children: <Widget>[
- Align(
- alignment: Alignment.topLeft,
- child: Column(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(left: 10.0, right: 10.0),
- height: 180.0,
- decoration: new BoxDecoration(
- color: Color.fromRGBO(0, 185, 92, 1),
- borderRadius: new BorderRadius.vertical(
- bottom: new Radius.elliptical(
- MediaQuery.of(context).size.width, 100.0)),
- ),
- alignment: Alignment.center, // where to position the child
- child: Container(
- // padding: EdgeInsets.all(15.0),
- // color: Colors.blue,
- decoration: BoxDecoration(
- borderRadius: new BorderRadius.circular(35.0),
- image: DecorationImage(
- image: AssetImage("assets/img/moskee.jpg"),
- fit: BoxFit.cover,
- ),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- Flexible(
- flex: 1,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.only(
- left: 40.0, top: 20.0),
- ),
- Icon(
- Icons.timer,
- color: Colors.white,
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 5.0),
- ),
- ],
- )),
- Padding(
- padding: EdgeInsets.only(left: 10.0),
- ),
- Flexible(
- flex: 6,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.only(
- left: 20.0, top: 10.0),
- ),
- Row(
- children: <Widget>[
- Text(
- waktu_sholat,
- style: TextStyle(
- fontSize: 11.0,
- fontWeight: FontWeight.normal,
- color: Colors.white),
- ),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 5.0),
- ),
- Row(
- children: <Widget>[
- Text(
- tglMasehi,
- style: TextStyle(
- fontSize: 11.0,
- fontWeight: FontWeight.normal,
- color: Colors.white),
- ),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 5.0),
- ),
- Row(
- children: <Widget>[
- Text(
- tglHijriah,
- style: TextStyle(
- fontSize: 11.0,
- fontWeight: FontWeight.normal,
- color: Colors.white,
- ),
- ),
- ],
- ),
- ],
- )),
- Padding(
- padding: EdgeInsets.only(left: 10.0),
- ),
- Flexible(
- flex: 3,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.only(left: 20.0),
- ),
- Row(
- children: <Widget>[
- Text(
- "Next Prayer",
- style: TextStyle(
- fontSize: 11.0,
- fontWeight: FontWeight.normal,
- color: Colors.white),
- ),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 5.0),
- ),
- Row(
- children: <Widget>[
- Text(
- toBeginningOfSentenceCase(
- lokasiAdzan),
- style: TextStyle(
- fontSize: 11.0,
- fontWeight: FontWeight.normal,
- color: Colors.white),
- ),
- ],
- ),
- ],
- ))
- ],
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 10.0),
- ),
- Row(
- children: <Widget>[
- Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.only(left: 210.0),
- ),
- Row(
- children: <Widget>[
- Text(
- jam_sholat,
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 36.0,
- fontWeight: FontWeight.normal,
- color: Colors.white),
- ),
- ],
- ),
- ],
- ),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 5.0),
- ),
- Row(
- children: <Widget>[
- Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.only(left: 195.0),
- ),
- Row(
- children: <Widget>[
- Text(
- // '(- ' + timeText + ')',
- '',
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 16.0,
- fontWeight: FontWeight.normal,
- color: Colors.white),
- ),
- ],
- ),
- ],
- ),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 10.0),
- ),
- Row(
- children: <Widget>[
- Column(
- crossAxisAlignment: CrossAxisAlignment.end,
- children: <Widget>[
- Padding(
- padding: EdgeInsets.only(left: 310.0),
- ),
- InkWell(
- onTap: () {
- Navigator.of(context)
- .push(new MaterialPageRoute(
- builder: (BuildContext context) =>
- new JadwalShalat(
- deviceid, lokasiAdzan),
- ));
- },
- child: Row(
- children: <Widget>[
- Text(
- "View All",
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 16.0,
- fontWeight: FontWeight.normal,
- color: Colors.white),
- ),
- Icon(
- Icons.arrow_right,
- color: Colors.white,
- ),
- ],
- ),
- ),
- ],
- ),
- ],
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 20.0),
- ),
- Align(
- child: Padding(
- padding: EdgeInsets.only(left: 10.0, right: 10.0),
- child: Container(
- height: 440.0,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(10.0)),
- boxShadow: <BoxShadow>[
- new BoxShadow(
- color: Colors.black12,
- blurRadius: 10.0,
- offset: new Offset(0.0, 10.0),
- ),
- ],
- ),
- child: Column(
- children: <Widget>[
- Container(
- margin: EdgeInsets.only(
- top: 30.0,
- bottom: 16.0,
- left: 16.0,
- right: 16.0,
- ),
- child: new Row(
- children: <Widget>[
- Expanded(
- child: Text(
- _currentMonth,
- style: TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 24.0,
- ),
- )),
- FlatButton(
- child: Text('PREV'),
- onPressed: () {
- setState(() {
- _currentDate2 = _currentDate2
- .subtract(Duration(days: 30));
- _currentMonth =
- DateFormat.yMMM().format(_currentDate2);
- });
- },
- ),
- FlatButton(
- child: Text('NEXT'),
- onPressed: () {
- setState(() {
- _currentDate2 =
- _currentDate2.add(Duration(days: 30));
- _currentMonth =
- DateFormat.yMMM().format(_currentDate2);
- });
- },
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.symmetric(horizontal: 16.0),
- child: _calendarCarouselNoHeader,
- ), //
- ],
- )),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 10.0),
- ),
- Align(
- child: Padding(
- padding: const EdgeInsets.only(left: 10.0, right: 10.0),
- child: Container(
- padding: EdgeInsets.all(15.0),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(10.0)),
- boxShadow: <BoxShadow>[
- new BoxShadow(
- color: Colors.black12,
- blurRadius: 10.0,
- offset: new Offset(0.0, 10.0),
- ),
- ],
- ),
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- Text(
- "Dzikir & Doa",
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 16.0,
- fontWeight: FontWeight.bold,
- color: Colors.black),
- ),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 10.0),
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- // decoration: BoxDecoration(
- // color: Colors.blueGrey[100]),
- height: 120.0,
- child: new FutureBuilder<List>(
- future: _listFutureAmalan,
- builder: (context, snapshot) {
- if (snapshot.hasData) {
- return new ListView.builder(
- itemCount: snapshot.data.length,
- padding: EdgeInsets.only(top: 4.0),
- itemBuilder: (context, index) {
- return _listAmalan(snapshot.data[index]);
- },
- );
- }
- return Center(
- child: SizedBox(
- width: 40.0,
- height: 40.0,
- child: const CircularProgressIndicator()),
- );
- }),
- ),
- ],
- )),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 10.0),
- ),
- Align(
- child: Padding(
- padding: const EdgeInsets.only(left: 10.0, right: 10.0),
- child: Column(
- children: <Widget>[
- Container(
- padding: EdgeInsets.all(15.0),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(10.0)),
- boxShadow: <BoxShadow>[
- new BoxShadow(
- color: Colors.black12,
- blurRadius: 10.0,
- offset: new Offset(0.0, 10.0),
- ),
- ],
- ),
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- Text(
- "Artikel Hari Ini",
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 16.0,
- fontWeight: FontWeight.bold,
- color: Colors.black),
- ),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 10.0),
- ),
- SizedBox(
- height: 250.0,
- child: new FutureBuilder<List>(
- future: _listFutureArtikel,
- builder: (context, snapshot) {
- if (snapshot.hasData) {
- return new ListView.builder(
- itemCount: snapshot.data.length,
- padding: EdgeInsets.only(top: 12.0),
- physics: new ClampingScrollPhysics(),
- scrollDirection: Axis.horizontal,
- itemBuilder: (context, index) {
- return _listArtikel(
- snapshot.data[index]);
- },
- );
- }
- return Center(
- child: SizedBox(
- width: 40.0,
- height: 40.0,
- child:
- const CircularProgressIndicator()),
- );
- }),
- ),
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 10.0),
- ),
- ],
- ),
- ),
- ),
- Align(
- child: Padding(
- padding: const EdgeInsets.only(left: 10.0, right: 10.0),
- child: Column(
- children: <Widget>[
- Container(
- padding: EdgeInsets.all(15.0),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(10.0)),
- boxShadow: <BoxShadow>[
- new BoxShadow(
- color: Colors.black12,
- blurRadius: 10.0,
- offset: new Offset(0.0, 10.0),
- ),
- ],
- ),
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- Text(
- "Video Kajian Hari Ini",
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 16.0,
- fontWeight: FontWeight.bold,
- color: Colors.black),
- ),
- ],
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 10.0),
- ),
- Container(
- child: new FutureBuilder<List>(
- future: _listFutureYoutube,
- builder: (context, snapshot) {
- if (snapshot.hasData) {
- if (snapshot.data.length > 0) {
- return new GridView.builder(
- itemCount: 2,
- gridDelegate:
- SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisSpacing: 10.0,
- mainAxisSpacing: 20.0,
- crossAxisCount: 2,
- childAspectRatio: 16 / 20),
- shrinkWrap: true,
- itemBuilder:
- (BuildContext context, int index) {
- return _listItem(
- snapshot.data[index]);
- },
- );
- } else {
- return Container();
- }
- }
- return Center(
- child: SizedBox(
- width: 40.0,
- height: 40.0,
- child:
- const CircularProgressIndicator()),
- );
- }),
- ),
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 10.0),
- ),
- ],
- ),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: 150.0),
- ),
- ],
- ),
- ),
- ),
- );
- }
- void _handleClick() {
- _isOpen = !_isOpen;
- Timer.periodic(Duration(milliseconds: 5), (timer) {
- if (_isOpen) {
- double value = _offset.dy +
- 10; // we increment the height of the Container by 10 every 5ms
- _offset = Offset(0, value);
- if (_offset.dy > _maxHeight) {
- _offset =
- Offset(0, _maxHeight); // makes sure it does't go above maxHeight
- timer.cancel();
- }
- } else {
- double value = _offset.dy - 10; // we decrement the height by 10 here
- _offset = Offset(0, value);
- if (_offset.dy < _minHeight) {
- _offset = Offset(
- 0, _minHeight); // makes sure it doesn't go beyond minHeight
- timer.cancel();
- }
- }
- setState(() {});
- });
- }
- Widget _iconLain() {
- // if (_isOpen == true) {
- // if (_offset.dy > 200) {
- return Container(
- padding: EdgeInsets.only(left: 15.0),
- child: Row(
- children: <Widget>[
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(
- builder: (BuildContext context) => new Artikel(),
- ));
- },
- child: Image.asset(
- 'assets/icons/icon-artikel/drawable-hdpi/Group 157.png',
- height: 50.0,
- ),
- ),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Artikel",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- Row(
- children: <Widget>[
- Text("",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- Padding(padding: EdgeInsets.only(left: 10.0)),
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(
- builder: (BuildContext context) =>
- new VideoKajian(),
- ));
- },
- child: Image.asset(
- 'assets/icons/icon-video/drawable-hdpi/Group 158.png',
- height: 50.0,
- ),
- ),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Video",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Kajian",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- Padding(padding: EdgeInsets.only(left: 10.0)),
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(
- builder: (BuildContext context) =>
- new JadwalShalat(deviceid, lokasiAdzan),
- // new Notif(),
- ));
- },
- child: Image.asset(
- 'assets/icons/icon-jadwal-shalat/drawable-hdpi/Group 159.png',
- height: 50.0,
- ),
- ),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Jadwal",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Sholat",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- Padding(padding: EdgeInsets.only(left: 10.0)),
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(
- builder: (BuildContext context) => new Pengaturan(),
- ));
- },
- child: Image.asset(
- 'assets/icons/icon-pengaturan/drawable-hdpi/Group 160.png',
- height: 50.0,
- ),
- ),
- ],
- ),
- Row(
- children: <Widget>[
- Text("Pengaturan",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" ",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- ],
- ),
- );
- // } else {
- // return Container();
- // }
- // } else {
- // return Container();
- // }
- }
- Widget _iconLain2() {
- // if (_isOpen == true) {
- // if (_offset.dy > 200) {
- return Container(
- padding: EdgeInsets.only(left: 15.0),
- child: Row(
- children: <Widget>[
- Flexible(
- flex: 2,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(
- builder: (BuildContext context) => new QuranList(),
- ));
- },
- child: Image.asset(
- 'assets/icons/icon-artikel/drawable-hdpi/Group 157.png',
- height: 50.0,
- ),
- ),
- ],
- ),
- Row(
- children: <Widget>[
- Text(" Al-Quran",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- Row(
- children: <Widget>[
- Text("",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black)),
- ],
- ),
- ],
- )),
- ],
- ),
- );
- // } else {
- // return Container();
- // }
- // } else {
- // return Container();
- // }
- }
- _listAmalan(AmalanModel amalan) {
- return Padding(
- padding: const EdgeInsets.only(top: 8.0),
- child: new Row(
- children: <Widget>[
- Expanded(
- flex: 2,
- child: InkWell(
- onTap: () {
- if (content == false) {
- setState(() {
- content = true;
- });
- } else {
- setState(() {
- content = false;
- });
- }
- },
- child: Image.asset(
- "img/doadzikir.png",
- height: 50.0,
- ),
- ),
- ),
- Expanded(
- flex: 6,
- child: InkWell(
- onTap: () {
- if (content == false) {
- setState(() {
- content = true;
- });
- } else {
- setState(() {
- content = false;
- });
- }
- },
- child: Text(amalan.title))),
- // Expanded(
- // flex: 2,
- // child:
- InkWell(
- onTap: () {
- _amalkan(amalan.id_amalan_harian);
- },
- child: new ClipOval(
- child: Container(
- color: Colors.blueGrey[100],
- height: 35.0, // height of the button
- width: 35.0, // width of the button
- child: Center(
- child: Icon(
- Icons.check,
- color: Colors.white,
- )),
- ),
- ),
- ),
- ],
- ),
- );
- }
- Widget _listItem(YoutubeModel yt) {
- return Column(
- children: <Widget>[
- CachedNetworkImage(
- imageUrl: yt.thumb,
- placeholder: (context, url) => CircularProgressIndicator(),
- errorWidget: (context, url, error) => Icon(Icons.error),
- ),
- Padding(
- padding: EdgeInsets.only(top: 5.0),
- ),
- Text(
- yt.title,
- // textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black),
- ),
- Padding(
- padding: EdgeInsets.only(top: 5.0),
- ),
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(
- builder: (BuildContext context) => new VideoKajianDetail(
- youtube: yt,
- ),
- ));
- },
- child: Align(
- alignment: Alignment.topRight,
- child: Container(
- decoration: BoxDecoration(
- color: Color.fromRGBO(0, 185, 92, 1),
- borderRadius: BorderRadius.all(Radius.circular(10.0)),
- boxShadow: <BoxShadow>[
- new BoxShadow(
- color: Colors.black12,
- blurRadius: 10.0,
- offset: new Offset(0.0, 10.0),
- ),
- ],
- ),
- // color: Color.fromRGBO(
- // 0, 185, 92, 1),
- height: 25.0, // height of the button
- width: 55.0, // width of the button
- child: Center(
- child: Text("Tonton",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.white))),
- ),
- ),
- ),
- ],
- );
- }
- Future<List<YoutubeModel>> fetchVideo() async {
- String url = new Api().url;
- print(url + "index.php/api/Youtube/date");
- var notes = List<YoutubeModel>();
- Response response;
- response = await Dio().get(url + "index.php/api/Youtube/date");
- final json = response.data;
- if (response.statusCode == 200) {
- notes = (json)
- .map<YoutubeModel>((item) => YoutubeModel.fromJson(item))
- .toList();
- } else {
- throw Exception('Failed to load');
- }
- // print("json " + json.toString());
- return new Future.delayed(new Duration(seconds: 1), () {
- return notes.toList();
- });
- }
- Widget _listArtikel(ArtikelModel a) {
- return Container(
- margin: EdgeInsets.only(right: 16.0),
- child: Column(
- children: <Widget>[
- CachedNetworkImage(
- imageUrl: "http://103.4.52.200/upload/" + a.imageThumbFile,
- placeholder: (context, url) => CircularProgressIndicator(),
- errorWidget: (context, url, error) => Icon(Icons.error),
- width: 200.0,
- height: 160.0,
- ),
- // Image.network(
- // "http://103.4.52.200/upload/" + a.imageThumbFile,
- // width: 200.0,
- // height: 160.0,
- // ),
- Padding(
- padding: EdgeInsets.only(top: 5.0),
- ),
- Text(
- a.title,
- // textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.black),
- ),
- Padding(
- padding: EdgeInsets.only(top: 5.0),
- ),
- InkWell(
- onTap: () {
- Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
- return new ArtikelDetail(a);
- }));
- },
- child: Align(
- alignment: Alignment.topRight,
- child: Container(
- decoration: BoxDecoration(
- color: Color.fromRGBO(0, 185, 92, 1),
- borderRadius: BorderRadius.all(Radius.circular(10.0)),
- boxShadow: <BoxShadow>[
- new BoxShadow(
- color: Colors.black12,
- blurRadius: 10.0,
- // offset: new Offset(0.0, 10.0),
- ),
- ],
- ),
- // color: Color.fromRGBO(
- // 0, 185, 92, 1),
- height: 25.0, // height of the button
- width: 55.0, // width of the button
- child: Center(
- child: Text("Baca",
- style: TextStyle(
- fontSize: 12.0,
- fontWeight: FontWeight.normal,
- color: Colors.white))),
- ),
- ),
- ),
- ],
- ),
- );
- }
- Future<List<ArtikelModel>> fetchArtikel() async {
- String url = new Api().url;
- var dio = new Dio();
- var notes = List<ArtikelModel>();
- try {
- Response response;
- response = await dio.get(url + "index.php/api/Artikel/date");
- final json = response.data;
- if (response.statusCode == 200) {
- notes = (json)
- .map<ArtikelModel>((item) => ArtikelModel.fromJson(item))
- .toList();
- } else {
- throw Exception('Failed to load');
- }
- // print("json " + json.toString());
- return new Future.delayed(new Duration(seconds: 1), () {
- setState(() {
- jumartikel = notes
- .where((i) => i.statusDeleted == "n")
- .where((i) => i.statusActive == "y")
- .length;
- });
- return notes
- .where((i) => i.statusDeleted == "n")
- .where((i) => i.statusActive == "y")
- .toList();
- });
- } on DioError catch (e) {
- print("GAGAL");
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement