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
| //Integer | |
| int x = 1; // Acesta e un număr întreg (integer) | |
| var x = 2; // Deși nu am specificat tipul variabilei, Dart va considera că este un integer | |
| //Double | |
| double x = 2.1; // Acestea sunt numere cu zecimale | |
| //Boolean | |
| bool isCold = false; // Aceasta este o variabilă de tip boolean, care poate fi adevărată sau falsă |
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
| // Null înseamnă că o variabilă nu a fost inițializată, nu are o valoare. | |
| int numarA; | |
| int numarB = o; | |
| String numeA; | |
| String numeB = ''; | |
| // În acest moment variabilele numarA și numeA nu au o valoare. | |
| // Variabila numarB are valoarea 0, iar variabila numeB are o valoare, este un string gol. |
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
| // Crearea a două clase, House și Scaun | |
| class House{} | |
| class Scaun{} | |
| void main() { | |
| // Acum vom crea instanțe a trei obiecte, două de tip House și unul de tip Scaun | |
| var house1 = House(); | |
| var house2 = House(); | |
| var scaun1 = Scaun(); | |
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
| // Comentariile de un rând se scriu după // | |
| void main(){ | |
| // Putem printa ceva cu: | |
| print('Alo!'); | |
| // Sau putem invoca o funcție/metodă | |
| Hello(); |
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
| void main(){ | |
| // Dart ne permite să inițializăm un obiect specificându-i tipul | |
| String nume = 'Ion'; | |
| // Dar putem și să omitem tipul, iar Dart îl va infera | |
| Object prenume = 'Pavel'; | |
| Object numar = 15; | |
| print('Numele este $nume $prenume și am $numar ani'); |
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 Responsive { | |
| final Widget mobile; | |
| final Widget tablet; | |
| final Widget desktop; | |
| const Responsive({ | |
| Key? key, | |
| required this.mobile, |
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 ResponsiveLayout { | |
| static bool isSmallScreen(BuildContext context) { | |
| return MediaQuery.of(context).size.width < 800; | |
| } | |
| static bool isMediumScreen(BuildContext context) { | |
| return MediaQuery.of(context).size.width > 800 && | |
| MediaQuery.of(context).size.width < 1200; |
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:google_fonts/google_fonts.dart'; | |
| // ziua = string de 2 caractere reprezentând ziua | |
| // luna_an = string de formatul: Oct. 2022 | |
| class DataBox extends StatelessWidget { | |
| const DataBox( | |
| this.ziua, | |
| this.luna_anul, |
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 WaitingPage extends StatefulWidget { | |
| const WaitingPage({Key? key}) : super(key: key); | |
| @override | |
| State<StatefulWidget> createState() => WaitingPageState(); | |
| } | |
| class WaitingPageState extends State<WaitingPage> { |
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
| // Crearea a două clase, House și Scaun | |
| class House{} | |
| class Scaun{} | |
| void main() { | |
| // Instanțierea a trei obiecte (variabile), două de tip House și unul de tip Scaun | |
| var house1 = House(); | |
| var house2 = House(); | |
| var scaun1 = Scaun(); | |
NewerOlder