Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Future<Widget> select2() async {
- final String currentTimeZone =
- await FlutterNativeTimezone.getLocalTimezone();
- timeZoneName = currentTimeZone;
- tz.initializeTimeZones();
- final location = tz.getLocation(currentTimeZone.toString());
- DateTime date = tz.TZDateTime.from(DateTime.now(), location);
- Coordinates coordinates =
- Coordinates(lat..., long...);
- CalculationParameters params = CalculationMethod.Singapore();
- params.madhab = Madhab.Shafi;
- PrayerTimes prayerTimes =
- PrayerTimes(coordinates, date, params, precision: true);
- DateTime fajrTime = tz.TZDateTime.from(prayerTimes.fajr!, location);
- DateTime sunriseTime = tz.TZDateTime.from(prayerTimes.sunrise!, location);
- DateTime dhuhrTime = tz.TZDateTime.from(prayerTimes.dhuhr!, location);
- DateTime asrTime = tz.TZDateTime.from(prayerTimes.asr!, location);
- DateTime maghribTime = tz.TZDateTime.from(prayerTimes.maghrib!, location);
- DateTime ishaTime = tz.TZDateTime.from(prayerTimes.isha!, location);
- SunnahTimes sunnahTimes = SunnahTimes(prayerTimes);
- var qiblaDirection = Qibla.qibla(coordinates);
- DateTime dhuha = sunriseTime.add(const Duration(minutes: 20));
- log(dhuha.toString());
- return Padding(
- padding: const EdgeInsets.fromLTRB(10, 10, 10, 10),
- child: DropdownButtonFormField2(
- decoration: InputDecoration(
- isDense: true,
- contentPadding: EdgeInsets.zero,
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(10),
- ),
- ),
- isExpanded: true,
- hint: const Text(
- 'Pilih waktu shalat',
- style: TextStyle(fontSize: 14),
- ),
- icon: const Icon(
- Icons.arrow_drop_down,
- color: Colors.black45,
- ),
- iconSize: 30,
- buttonHeight: 60,
- buttonPadding: const EdgeInsets.only(left: 20, right: 10),
- dropdownDecoration: BoxDecoration(
- borderRadius: BorderRadius.circular(15),
- ),
- items: [
- DropdownMenuItem(
- value: fajrTime,
- child: Text("Subuh: ${DateFormat('HH:mm').format(fajrTime)}")),
- DropdownMenuItem(
- value: sunriseTime,
- child:
- Text("Terbit: ${DateFormat('HH:mm').format(sunriseTime)}")),
- DropdownMenuItem(
- value: dhuha,
- child: Text("Dhuha: ${DateFormat('HH:mm').format(dhuha)}")),
- DropdownMenuItem(
- value: dhuhrTime,
- child: Text("Dhuhur: ${DateFormat('HH:mm').format(dhuhrTime)}")),
- DropdownMenuItem(
- value: asrTime,
- child: Text("Ashar: ${DateFormat('HH:mm').format(asrTime)}")),
- DropdownMenuItem(
- value: maghribTime,
- child:
- Text("Maghrib: ${DateFormat('HH:mm').format(maghribTime)}")),
- DropdownMenuItem(
- value: ishaTime,
- child: Text("Isya: ${DateFormat('HH:mm').format(ishaTime)}")),
- ],
- onChanged: (value) {
- selectedWaktuShalat = DateTime.parse(value.toString()).toLocal();
- },
- onSaved: (value) {
- selectedWaktuShalat = DateTime.parse(value.toString()).toLocal();
- },
- value: selectedWaktuShalat,
- ),
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement