Aqliy qobilyatni aniqlaydigan mobil ilova yaratish


Download 81.05 Kb.
bet1/2
Sana24.01.2023
Hajmi81.05 Kb.
#1114408
  1   2
Bog'liq
3-mustaqil ishi Toshpulatov Sh 102-19


O`ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI


MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI
UNIVERSITETI SAMARQAND FILIALI

"Kompyuter injiniring" fakulteti


"Mobil ilovalar ishlab chiqarish" fanidan

Mustaqil ish_3

Mavzu: Aqliy qobilyatni aniqlaydigan mobil ilova yaratish.

Bajardi: 102-19 guruh talabasi Toshpo’latov Sherzod
Tekshirdi:Yuldoshov A.X.
SAMARQAND – 2022
Topshiriq: Aqliy qobilyatni aniqlaydigan mobil ilova yaratish.
Ushbu Labaratoriyada test ishlash uchun Quiz App namoyish etaman
Dastur kodi:
Answer.dart file kodi:
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';

class Answer extends StatelessWidget {


final VoidCallback selectHandler;
final String answerText;

const Answer(this.selectHandler, this.answerText, {Key? key})


: super(key: key);

@override


Widget build(BuildContext context) {
return ElevatedButton(
child: SizedBox(
width: 200,
child: Text(
answerText,
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.w400,
color: Colors.white,
),
),
),
style:
ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.green)),
onPressed: selectHandler,
);
}
}

Main.dart file kodi:
import "package:flutter/material.dart";
import "package:hexcolor/hexcolor.dart";
import './quiz.dart';
import './result.dart';

void main() {


runApp(const MyApp());
}

class MyApp extends StatefulWidget {


const MyApp({Key? key}) : super(key: key);

@override


State createState() {
return _MyAppState();
}
}

class _MyAppState extends State {


static const _data = [
{
'questionText':
'Flutter bu _____ Google tomonidan ishlab chiqilgan framework.',
'answers': [
{'text': 'Open-source', 'score': 10.00},
{'text': 'Shareware', 'score': 4.61},
{'text': 'ikkalasi', 'score': 1.95},
{'text': 'turi javob yu', 'score': 0.00},
]
},
{
'questionText': 'Flutter dasturlar _____ dasturlash tilida yoziladi.',
'answers': [
{'text': 'Java', 'score': 2.3},
{'text': 'HTML', 'score': 0.32},
{'text': 'JavaScript', 'score': 3.00},
{'text': 'Dart', 'score': 10.00},
]
},
{
'questionText': 'qaysi vidjet layoutlar uchun foydalaniladi?',
'answers': [
{'text': 'Text', 'score': 0.64},
{'text': 'Column', 'score': 10.00},
{'text': 'Inkwell', 'score': 3.28},
{'text': 'Expanded', 'score': 1.02}
]
},
{
'questionText': 'Flutter qachon ishlab chiqilgan?',
'answers': [
{'text': '2012', 'score': 0.12},
{'text': '2013', 'score': 2.13},
{'text': '2017', 'score': 6.42},
{'text': '2015', 'score': 10.00}
]
},
{
'questionText': 'Flutter qachon release qilingan?',
'answers': [
{'text': '2016', 'score': 5.53},
{'text': '2017', 'score': 10.00},
{'text': '2013', 'score': 2.47},
{'text': '2019', 'score': 2.35}
]
}
];

var _indexQuestion = 0;


double _totalScore = 0.00;

void _answerQuestion(double score) {


_totalScore += score;

setState(() {


_indexQuestion += 1;
});
}

void _restart() {


setState(() {
_indexQuestion = 0;
_totalScore = 0;
});
}

@override


Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: Align(
alignment: Alignment.center,
child: Text(
"Flutter Quiz App",
style: TextStyle(
color: HexColor("#F5FFF0"),
),
),
),
backgroundColor: Colors.green,
),
body: Align(
alignment: Alignment.center,
child: (_indexQuestion <= 4 && _indexQuestion >= 0)
? Quiz(
answerQuestion: _answerQuestion,
indexQuestion: _indexQuestion,
data: _data)
: Result(_totalScore, _restart))),
);
}
}


Download 81.05 Kb.

Do'stlaringiz bilan baham:
  1   2




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling