Yangi Oʻzbekistonni, albatta, yoshlar bilan birga quramiz. 2020-yil yoshlarga
Download 1.38 Mb. Pdf ko'rish
|
Adxam Soataliyev BMI65018
Internet tarmog‘idagi manbalar
1 .https://medium.com/flutter 2 .https://docs.flutter.dev/resources/faq 3. https://www.raywenderlich.com/27738690-dart-null-safety-in-flutter 4. https://techblog.geekyants.com/ 5. https://nodirbek.uz/2020/07/dasturlashni-organish-qollanma-2021/ 6. https://sof.uz/uz/post/shavkat-mirziyoyev-bog-cha-bolalariga-sovg-alar-berdi 74 ILOVA void moveDown() { if (!canMoveDown()) { return; } for (int r = row - 2; r >= 0; --r) { for (int c = 0; c < column; ++c) { mergeDown(r, c); } } randomEmptyCell(1); resetMergeStatus(); } bool canMoveLeft() { for (int r = 0; r < row; ++r) { for (int c = 1; c < column; ++c) { if (canMerge(_boardCells[r][c], _boardCells[r][c - 1])) { return true; } } } return false; } bool canMoveRight() { for (int r = 0; r < row; ++r) { for (int c = column - 2; c >= 0; --c) { if (canMerge(_boardCells[r][c], _boardCells[r][c + 1])) { return true; } } } return false; } bool canMoveUp() { for (int r = 1; r < row; ++r) { for (int c = 0; c < column; ++c) { 75 if (canMerge(_boardCells[r][c], _boardCells[r - 1][c])) { return true; } } } return false; } bool canMoveDown() { for (int r = row - 2; r >= 0; --r) { var data2; Future next() async { setState(() { rightAnswer = false; }); var data = await DefaultAssetBundle.of(context) .loadString('assets/json/image.json'); data2 = jsonDecode(data); length = data2.length; randomNumber(length); } @override void didChangeDependencies() { if(firstTime){ setOrientation(true); firstTime = false; } super.didChangeDependencies(); } @override void initState() { super.initState(); initTts(); next(); readDataLevel(); 76 setOrientation(true); } readDataLevel() async { var data = await readData(); if (!data.contains('No‘)) { currentLevel = int.parse(data); nextLevel = currentLevel + 1; } else { currentLevel = 0; nextLevel = 1; } } void loseFunction() { Alert( context: context, title: "Xato", desc: "Noto‘g‘ri tanlov", style: AlertStyle( titleStyle: TextStyle(fontFamily: 'ballo‘), descStyle: TextStyle(fontFamily: 'ballo‘), alertBorder: Border( bottom: BorderSide( color: Colors.green, width: 3.0, ), ), animationDuration: Duration(seconds: 1), animationType: AnimationType.grow, isCloseButton: false), image: Image(image: AssetImage('assets/image/sadCat.gif')), buttons: [ DialogButton( radius: BorderRadius.circular(20.0), child: Text( "Qaytadan urinib ko‘ring", style: TextStyle( color: Colors.white, fontSize: 20, fontFamily: 'ballo‘), ), 77 onPressed: () => Navigator.pop(context), color: Colors.red.shade700, ), ], ).show(); } void rightAnswerCall() { Alert( context: context, style: AlertStyle( titleStyle: TextStyle(fontFamily: 'ballo‘), alertBorder: Border( bottom: BorderSide( color: Colors.green, width: 3.0, ), ), animationType: AnimationType.grow, isCloseButton: false, overlayColor: Colors.black45, isOverlayTapDismiss: false), type: AlertType.success, title: "Javob to‘g‘ri", buttons: [ DialogButton( child: Text( "Keyingisi", style: TextStyle( color: Colors.white, fontSize: 20, fontFamily: 'ballo‘), ), onPressed: () { Navigator.pop(context); next(); setState(() { nextLevel += 1; currentLevel += 1; }); writeData(nextLevel.toString()); 78 }, color: Color.fromRGBO(0, 179, 134, 1.0), ), ], ).show(); } Widget imageForm1(BuildContext context, var data) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: InkWell( onTap: () { if (data[index]['image'] == image) { setState(() { wrongAnswerCount = 0; rightAnswer = true; rightAnswerCount += 1; }); _speak(data[index]['enName']); Future.delayed(const Duration(seconds: 1), rightAnswerCall); if (rightAnswerCount == 3) { rightAnswerCount = 0; } } }, child: Container( width: 100.0, height: 250.0, margin: EdgeInsets.symmetric(horizontal: 10.0), decoration: BoxDecoration( gradient: leniarColor[0], borderRadius: BorderRadius.circular(300.0)), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: Container( height: 100.0, 79 alignment: Alignment.center, child: Image.asset( data[index]['image'], ), ), Container( height: 90, alignment: Alignment.center, width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.only( bottomLeft: Radius.circular(300.0), bottomRight: Radius.circular(300.0))), padding: EdgeInsets.symmetric(vertical: 20, horizontal: 7.0), child: Text( data[index]['name'], textAlign: TextAlign.center, style: TextStyle(color: Colors.white, fontFamily: 'ballo‘), ), ), ], ), ), ), InkWell( onTap: () { if (data[index2]['image'] == image) { print('Right'); } else { setState(() { rightAnswer = false; wrongAnswerCount += 1; if (wrongAnswerCount >= 2) { loseFunction(); } }); } }, child: Container( 80 width: 100.0, height: 250.0, margin: EdgeInsets.symmetric(horizontal: 10.0), decoration: BoxDecoration( gradient: leniarColor[1], borderRadius: BorderRadius.circular(300.0)), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: Container( height: 100.0, alignment: Alignment.center, child: Image.asset( data[index2]['image'], ), ), Container( height: 90, alignment: Alignment.center, width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.only( bottomLeft: Radius.circular(300.0), bottomRight: Radius.circular(300.0))), padding: EdgeInsets.symmetric(vertical: 20, horizontal: 7.0), child: Text( data[index2]['name'], textAlign: TextAlign.center, style: TextStyle(color: Colors.white, fontFamily: 'ballo‘), ), ), ], ), ), ), InkWell( onTap: () { if (data[index3]['image'] == image) { print('Right'); } else { 81 setState(() { rightAnswer = false; wrongAnswerCount += 1; if (wrongAnswerCount >= 2) { loseFunction(); } }); } }, child: Container( width: 100.0, height: 250.0, margin: EdgeInsets.symmetric(horizontal: 10.0), decoration: BoxDecoration( gradient: leniarColor[2], borderRadius: BorderRadius.circular(300.0)), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: Container( height: 100.0, alignment: Alignment.center, child: Image.asset( data[index3]['image'], ), ), Container( height: 90, alignment: Alignment.center, width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.only( bottomLeft: Radius.circular(300.0), bottomRight: Radius.circular(300.0))), padding: EdgeInsets.symmetric(vertical: 20, horizontal: 7.0), child: Text( data[index3]['name'], textAlign: TextAlign.center, style: TextStyle(color: Colors.white, fontFamily: 'ballo‘), 82 ), ), ], ), ), ), ], ); } child: Container( width: 100.0, height: 250.0, margin: EdgeInsets.symmetric(horizontal: 10.0), decoration: BoxDecoration( gradient: leniarColor[2], borderRadius: BorderRadius.circular(300.0)), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: Container( height: 100.0, alignment: Alignment.center, child: Image.asset( data[index3]['image'], ), ), Container( height: 90, alignment: Alignment.center, width: MediaQuery.of(context).size.width, decoration: BoxDecoration( borderRadius: BorderRadius.only( bottomLeft: Radius.circular(300.0), bottomRight: Radius.circular(300.0))), padding: EdgeInsets.symmetric(vertical: 20, horizontal: 7.0), child: Text( data[index3]['name'], textAlign: TextAlign.center, style: TextStyle(color: Colors.white, fontFamily: 'ballo‘), 83 ), ), ], ), ), ), TtsState ttsState = TtsState.stopped; late FlutterTts flutterTts; dynamic languages; initTts() { flutterTts = FlutterTts(); flutterTts.setLanguage('en-UA'); } Future _speak(String _newVoiceText) async { await flutterTts.setVolume(1); await flutterTts.setSpeechRate(0.3); await flutterTts.setPitch(1.2); if (_newVoiceText != null) { if (_newVoiceText.isNotEmpty) { var result = await flutterTts.speak(_newVoiceText); if (result == 1) setState(() => ttsState = TtsState.playing); } } } Future final path = await getApplicationDocumentsDirectory(); return path.path; } Download 1.38 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling