0% found this document useful (0 votes)
9 views10 pages

Tojiboyev Jasur 1-Mustaqil Ish Moboil

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views10 pages

Tojiboyev Jasur 1-Mustaqil Ish Moboil

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

O‘ZBEKISTON RESPUBLIKASI

RAQAMLI TEXNOLOGIYALAR VAZIRLIGI


MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI
UNIVERSITETI
SAMARQAND FILIALI

KOMPYUTER INJINIRINGI FAKULTETI


“Kompyuter tizimlari “kafedrasi

“Mobil ilovalarni ishlab chiqish “ fanidan

1-Mustaqil ISH TOPSHIRIG‘I

Bajardi: KIS 21-05 guruh talabasi


Tojiboyev J.
Tekshirdi: Djumayev S.

SAMARQAND–2024
Original ko’rinishi Flutlabdagi

import 'package:flutter/material.dart';

void main() {
runApp(const CodingApp());
}

class CodingApp extends StatelessWidget {


const CodingApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: const CodingHomePage(),
);
}
}

class CodingHomePage extends StatefulWidget {


const CodingHomePage({super.key});

@override
State<CodingHomePage> createState() => _CodingHomePageState();
}

class _CodingHomePageState extends State<CodingHomePage> {


int _currentIndex = 0; // Bottom navigation index

final List<Widget> _pages = [


CodingPage(),
Center(child: Text('Community')),
Center(child: Text('Leaderboard')),
Center(child: Text('Create')),
Center(child: Text('Profile')),
];

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[900],
appBar: AppBar(
backgroundColor: Colors.blueAccent,
leading: const Icon(Icons.menu, color: Colors.white),
title: const Text(
'Coding for Data',
style: TextStyle(fontWeight: FontWeight.bold),
),
actions: const [
Icon(Icons.notifications, color: Colors.white),
SizedBox(width: 10),
Icon(Icons.more_vert, color: Colors.white),
SizedBox(width: 10),
],
),
body: _pages[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
selectedItemColor: Colors.blue,
unselectedItemColor: Colors.grey,
onTap: (index) {
setState(() {
_currentIndex = index;
});
},
items: const [
BottomNavigationBarItem(icon: Icon(Icons.school),
label: 'Learn'),
BottomNavigationBarItem(icon: Icon(Icons.people),
label: 'Community'),
BottomNavigationBarItem(
icon: Icon(Icons.emoji_events), label:
'Leaderboard'),
BottomNavigationBarItem(icon: Icon(Icons.create),
label: 'Create'),
BottomNavigationBarItem(icon: Icon(Icons.person),
label: 'Profile'),
],
),
);
}
}

class CodingPage extends StatelessWidget {


const CodingPage({super.key});

@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const CustomHeader(), // Yuqori qism
const SizedBox(height: 10),
const ListTile(
leading: Icon(Icons.play_circle_fill, color:
Colors.blue),
title: Text(
'Getting started with Python',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
_buildLessonCard(
title: 'Writing Code',
subtitle: 'Lesson',
xp: '+10',
completed: true,
),
_buildLessonCard(
title: 'AI-generated practice',
subtitle: 'Booster',
xp: '+20',
icon: Icons.extension,
),
_buildLessonCard(
title: 'Memory & Variables',
subtitle: 'Lesson',
xp: '+10',
learnButton: true,
),
],
),
);
}

Widget _buildLessonCard({
required String title,
required String subtitle,
required String xp,
bool completed = false,
IconData icon = Icons.note,
bool learnButton = false,
}) {
return Card(
color: Colors.black54,
elevation: 2,
margin: const EdgeInsets.symmetric(horizontal: 10,
vertical: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: ListTile(
leading: Icon(icon, color: Colors.purple),
title: Text(title,
style: const TextStyle(
fontWeight: FontWeight.bold, color:
Colors.white)),
subtitle: Text(subtitle, style: const TextStyle(color:
Colors.white70)),
trailing: completed
? const Icon(Icons.check_circle, color:
Colors.green)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('XP $xp', style: const TextStyle(color:
Colors.white)),
if (learnButton)
ElevatedButton(
onPressed: () {},
child: const Text('LEARN'),
),
],
),
),
);
}
}

class CustomHeader extends StatelessWidget {


const CustomHeader({super.key});

@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 10),
// Ballar ko'rsatiladigan qism
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
children: [
_buildStatusCard(Icons.favorite, '3', Colors.red),
const SizedBox(width: 8),
_buildStatusCard(Icons.bolt, '1', Colors.green),
const SizedBox(width: 8),
_buildStatusCard(Icons.diamond, '45',
Colors.purple),
],
),
),
const SizedBox(height: 10),
// Progress Bar
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 10,
decoration: BoxDecoration(
color: Colors.black,
borderRadius: BorderRadius.circular(10),
),
child: FractionallySizedBox(
alignment: Alignment.centerLeft,
widthFactor: 0.5, // 50% progress
child: Container(
decoration: BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.circular(10),
),
),
),
),
],
),
),
],
);
}

Widget _buildStatusCard(IconData icon, String text, Color


color) {
return Container(
decoration: BoxDecoration(
color: Colors.black54,
borderRadius: BorderRadius.circular(12),
),
padding: const EdgeInsets.symmetric(horizontal: 8,
vertical: 4),
child: Row(
children: [
Icon(icon, color: color, size: 20),
const SizedBox(width: 4),
Text(
text,
style: const TextStyle(
color: Colors.white, fontWeight:
FontWeight.bold),
),
],
),
);
}
}

You might also like