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
// main.dart | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const ZakatCalculatorApp()); | |
} | |
class ZakatCalculatorApp extends StatelessWidget { | |
const ZakatCalculatorApp({super.key}); |
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(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override |
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(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override |
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
// This function calculates the average of a list of scores. | |
double calculateAverage(List<int> scores) { | |
if (scores.isEmpty) { | |
return 0; // Avoid division by zero if the list is empty. | |
} | |
int total = 0; | |
for (int score in scores) { | |
total = total + score; | |
} |
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() { | |
int userAge = 20; | |
int votingAge = 18; | |
print("Your age is: $userAge"); | |
if (userAge >= votingAge) { | |
print("You are old enough to vote!"); | |
} else { | |
print("You are not old enough to vote yet."); |
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
// A function is a named block of code that performs a task. | |
// This function takes two numbers and returns their sum. | |
double addNumbers(double num1, double num2) { | |
return num1 + num2; | |
} | |
// This is the main function where our program starts. | |
void main() { | |
double result = addNumbers(10.5, 20.0); | |
print("The result of the function is: $result"); |
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() { | |
// A List holds an ordered collection of items. | |
// The type of item is specified in the angle brackets < >. | |
// A List of Strings | |
List<String> shoppingList = ["Apples", "Milk", "Bread"]; | |
print("Shopping List:"); | |
for (String item in shoppingList) { | |
print("- $item"); | |
} |
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() { | |
double userWealth = 5000.0; | |
double nisab = 3000.0; // The minimum threshold for Zakat | |
print("Your wealth is: $userWealth"); | |
print("The Nisab threshold is: $nisab"); | |
// The 'if' statement checks if a condition is true. | |
if (userWealth > nisab) { | |
// This code runs ONLY if the condition is true. |
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() { | |
int a = 10; | |
int b = 5; | |
// Math | |
print("a + b = ${a + b}"); // Addition | |
print("a - b = ${a - b}"); // Subtraction | |
print("a * b = ${a * b}"); // Multiplication | |
print("a / b = ${a / b}"); // Division | |
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() { | |
// Variables are like labeled boxes to store information. | |
// String: For text | |
String name = "Ahmed"; | |
// int: For whole numbers | |
int age = 28; | |
// double: For numbers with decimals |
NewerOlder