class part 1
// Some code
port 'package:flutter/material.dart';
class OopLesson01 extends StatefulWidget {
const OopLesson01({super.key});
@override
State<OopLesson01> createState() => _OopLesson01State();
}
class _OopLesson01State extends State<OopLesson01> {
String name = 'Baiastan';
List<String> names = [
'Baiastan', // 0
'Elmirbek', // 1
'Yasin', // 2
'Nuskayim', // 3
];
String potato = 'Картошка';
Map<String, dynamic> person = {
'name': 'Baiastan',
'surname': 'Aitmatov',
'age': 26,
'weight': 76,
'isMarried': false,
'hobbies': ['It', 'Lang', 'Money'],
'address': {
'country': 'Kyrgyzsatan',
'city': 'Bishkek',
'house': 108,
},
};
List<Map<String, dynamic>> data = [
{
'name': 'Baiastan',
'age': 18,
'isMarried': true,
'weight': 19.00,
},
{
'name': 'Elmirbek',
'age': 18,
'isMarried': true,
'weight': 19.00,
},
{
'name': 'Yasin',
'age': 18,
'isMarried': true,
'weight': 19.00,
},
{
'name': 'Nuskyim',
'age': 18,
'isMarried': true,
'weight': 19.00,
},
];
List<Map<String, dynamic>> people = [
{
'name': 'Baiastan',
'surname': 'Aitmatov',
'age': 26,
'weight': 76,
'isMarried': false,
'hobbies': ['It', 'Lang', 'Money'],
'address': {
'country': 'Kyrgyzsatan',
'city': 'Bishkek',
'house': 108,
},
}, // 0
{
'name': 'Baiastan',
'surname': 'Aitmatov',
'age': 26,
'weight': 76,
'isMarried': false,
'hobbies': ['It', 'Lang', 'Money'],
'address': {
'country': 'Kyrgyzsatan',
'city': 'Bishkek',
'house': 108,
},
}, // 1
{
'name': 'Baiastan',
'surname': 'Aitmatov',
'age': 26,
'weight': 76,
'isMarried': false,
'hobbies': ['It', 'Lang', 'Money'],
'address': {
'country': 'Kyrgyzsatan',
'city': 'Bishkek',
'house': 108,
},
}, // 2
{
'name': 'Baiastan',
'surname': 'Aitmatov',
'age': 26,
'weight': 76,
'isMarried': false,
'hobbies': [
'It', // 0
'Lang', // 1
'Money', // 2
],
'address': {
'country': 'Kyrgyzsatan',
'city': 'Bishkek',
'house': 108,
},
}, // 3
{},
];
List<Person> peopleData = [
Person(
name: 'Baiastan',
surname: 'Aitmatov',
age: 26,
weight: 75.90,
isMarried: false,
hobbies: ['', ''],
numbers: [0, 1, 2],
shirt: [Colors.black, Colors.white, Colors.green],
address: {
'country': 'Kyrgyzsatan',
'city': 'Bishkek',
'house': 108,
},
),
Person(
name: 'Elmirbek',
surname: '',
age: 20,
weight: 109,
isMarried: true,
hobbies: [],
numbers: [],
shirt: [],
address: {},
),
];
List<Category> categories = [
Category(
backgroundColor: Colors.orange,
icon: '',
secondIcon: '',
title: 'Презентация',
subtitle: 'создать',
),
Category(
backgroundColor: Colors.red,
icon: '',
secondIcon: '',
title: 'Соц сеть',
subtitle: 'посмотреть',
),
Category(
backgroundColor: Colors.pinkAccent,
icon: '',
secondIcon: '',
title: 'видео',
subtitle: 'посмотреть',
),
];
Container exmaple1 = Container(
padding: EdgeInsets.only(),
height: 100,
);
ContainerWidget example2 = ContainerWidget(
padding: EdgeInsets.only(),
height: 100
);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
children: [
Text(
'${people[3]['address']['house']}',
style: TextStyle(fontSize: 30),
),
Text(
person['name'],
style: TextStyle(fontSize: 30),
),
Text(
'${person['age']}',
style: TextStyle(fontSize: 30),
),
SizedBox(
height: 30,
),
Text(
'${people[3]['name']}',
style: TextStyle(fontSize: 30),
),
Text(
'${people[3]['hobbies'][2]}',
style: TextStyle(fontSize: 30),
),
Container(),
],
),
),
);
}
}
// String, int, double, bool -
// Color, IconData, Widget,
Map<String, dynamic> person = {
'name': 'Baiastan',
'surname': 'Aitmatov',
'age': 26,
'weight': 76,
'isMarried': false,
'hobbies': ['It', 'Lang', 'Money'],
'address': {
'country': 'Kyrgyzsatan',
'city': 'Bishkek',
'house': 108,
},
};
class Person {
final String name;
final String surname;
final int age;
final double weight;
final bool isMarried;
final List<String> hobbies;
final List<int> numbers;
final List<Color> shirt;
final Map<String, dynamic> address;
Person({
required this.name,
required this.surname,
required this.age,
required this.weight,
required this.isMarried,
required this.hobbies,
required this.numbers,
required this.shirt,
required this.address,
});
}
class Category {
final Color backgroundColor;
final String icon;
final String secondIcon;
final String title;
final String subtitle;
Category({
required this.backgroundColor,
required this.icon,
required this.secondIcon,
required this.title,
required this.subtitle,
});
}
class ContainerWidget {
final Key? key;
final AlignmentGeometry? alignment;
final EdgeInsetsGeometry? padding;
final Color? color;
final Decoration? decoration;
final Decoration? foregroundDecoration;
final double? width;
final double? height;
final BoxConstraints? constraints;
final EdgeInsetsGeometry? margin;
final Matrix4? transform;
final AlignmentGeometry? transformAlignment;
final Widget? child;
final Clip clipBehavior = Clip.none;
ContainerWidget({
this.key,
this.alignment,
this.padding,
this.color,
this.decoration,
this.foregroundDecoration,
this.width,
this.height,
this.constraints,
this.margin,
this.transform,
this.transformAlignment,
this.child,
});
}Last updated