This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SurahsList { | |
| final List<Surah> surahs; | |
| SurahsList({this.surahs}); | |
| factory SurahsList.fromJSON(Map<String, dynamic> json) { | |
| Iterable surahlist = json['data']['surahs']; | |
| List<Surah> surahsList = surahlist.map((i) => Surah.fromJSON(i)).toList(); | |
| return SurahsList(surahs: surahsList); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SajdaList { | |
| final List<SajdaAyat> sajdaAyahs; | |
| SajdaList({this.sajdaAyahs}); | |
| factory SajdaList.fromJSON(Map<String, dynamic> json) { | |
| Iterable allSajdas = json['data']['ayahs']; | |
| List<SajdaAyat> sajdas = | |
| allSajdas.map((e) => SajdaAyat.fromJSON(e)).toList(); | |
| return SajdaList(sajdaAyahs: sajdas); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class QuranAPI { | |
| Future<SurahsList> getSurahList() async { | |
| String url = "http://api.alquran.cloud/v1/quran/quran-uthmani"; | |
| final response = await http.get(url); | |
| if (response.statusCode == 200) { | |
| return SurahsList.fromJSON(json.decode(response.body)); | |
| } else { | |
| print("Failed to load"); | |
| throw Exception("Failed to Load Post"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| codeAutoRetrievalTimeout() { | |
| return (String verificationID) { | |
| _verificationId = verificationID; | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _verifyCode() async { | |
| final AuthCredential credential = PhoneAuthProvider.getCredential( | |
| verificationId: _verificationId, smsCode: _controllerCode.text); | |
| final FirebaseUser user = | |
| (await _auth.signInWithCredential(credential)).user; | |
| final FirebaseUser currentUser = await _auth.currentUser(); | |
| assert(user.uid == currentUser.uid); | |
| if (user != null) { | |
| Navigator.pop(context); | |
| Navigator.push( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| codeSent() { | |
| return (String verificationID, [int forceResendingToken]) { | |
| showDialog( | |
| context: context, | |
| barrierDismissible: false, | |
| builder: (context) { | |
| return AlertDialog( | |
| title: Text('Enter 6-Digit Code'), | |
| content: Column( | |
| mainAxisSize: MainAxisSize.min, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| verificationFailed() { | |
| return (AuthException exception) { | |
| print('Verification Failed: ${exception.code}'); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| verificationCompleted() { | |
| return (AuthCredential credential) async { | |
| await _auth.signInWithCredential(credential).then((AuthResult value) { | |
| if (value.user != null) { | |
| Navigator.pop(context); | |
| Navigator.push( | |
| context, | |
| new MaterialPageRoute( | |
| builder: (context) => SecondScreen( | |
| user: value.user, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Container( | |
| height: 500, | |
| margin: EdgeInsets.symmetric(horizontal: 10), | |
| child: ListView.builder( | |
| padding: EdgeInsets.symmetric(horizontal: 10), | |
| itemCount: _tasks.length, | |
| itemBuilder: (context, index) { | |
| return ListTile( | |
| leading: Icon(Icons.check), | |
| title: Text(_tasks[index], style: TextStyle(color: !darkTheme ? Colors.black : Colors.white),), |