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
| import 'dart:async'; | |
| abstract class MyEvent {} | |
| class DoOneThingEvent extends MyEvent {} | |
| class DoSecondThingEvent extends MyEvent {} | |
| // |
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
| import 'package:flutter/material.dart'; | |
| import 'package:provider/provider.dart'; | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { |
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
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( |
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
| import 'package:flutter/material.dart'; | |
| /// | |
| /// Внешний виджет | |
| /// | |
| class ExternalWidget extends StatefulWidget { | |
| const ExternalWidget({Key? key}) : super(key: key); | |
| @override | |
| _ExternalWidgetState createState() => _ExternalWidgetState(); | |
| } |
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
| import 'package:flutter/material.dart'; | |
| import 'package:dio/dio.dart'; | |
| // | |
| // Dio start | |
| // | |
| BaseOptions baseOptions = BaseOptions( | |
| baseUrl: 'http://jsonplaceholder.typicode.com', | |
| connectTimeout: 2000, |
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
| // Задание 2.11 | |
| import 'dart:io'; | |
| import 'dart:async'; | |
| import 'dart:convert'; | |
| void main() { | |
| go(); | |
| } |
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
| // Задание 2.10 - 3 | |
| // 3. Используя обобщения написать класс с методом, | |
| // приводящим полученное значение в строку. | |
| class MyClass<T> { | |
| String method (T value) { | |
| return value.toString(); | |
| } | |
| } |
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
| // Задание 2.10 - 2 | |
| // 2. Велосипеды и автомобили являются разными видами транспорта, с различными свойствами. | |
| // Но, и велосипед и автомобили можно покрасить краской! Необходимо написать миксин, | |
| // устанавливающий на выбор один из трех цветов для транспортного средства: | |
| // Создайте enum Colors с цветами red, green, blue | |
| // Создайти миксин Painter с свойством colorName:String и методом | |
| // setColor(Colors color). В зависимости от значения enum, метод устанавливает | |
| // название цвета 'red', 'green', 'blue' |
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
| // Задание 2.10 - 1 | |
| // 1. Реализуйте класс Student (Студент), который будет наследоваться от класса User. | |
| // Класс должен иметь следующие свойства: | |
| // yearOfAdmission:DateTime (год поступления в вуз): инициализируется в конструкторе | |
| // currentCourse:int (текущий курс): рассчитывается след. образом - | |
| // из текущего года вычесть год поступления. чтобы получить годы из DateTime, | |
| // воспользуйтесь свойством DateTime.year | |
| class 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
| import 'dart:math'; // для рандомности массива | |
| main() { | |
| // | |
| // 1. Создайте текстовую переменную a = ‘hello world’; | |
| // Напишите функцию, без возвращаемого значения. Функция меняет порядок | |
| // слов на обратный. Например было ‘hello world’, стало ‘world hello’ | |
| var a = 'hello world'; | |
| void rever() { |
NewerOlder