Skip to content

Commit 3c39cca

Browse files
Merge branch 'CodeHarborHub:main' into main
2 parents 54bdbaa + aa408fe commit 3c39cca

File tree

31 files changed

+1232
-1320
lines changed

31 files changed

+1232
-1320
lines changed
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
---
2+
title: 'Developing Cross-Platform Apps Using Flutter and Dart'
3+
sidebar_label: Flutter and Dart Development
4+
authors: [nayanika-mukherjee]
5+
tags: [flutter, dart, cross-platform, mobile development, technology]
6+
date: 2024-07-27
7+
hide_table_of_contents: true
8+
---
9+
10+
## Introduction
11+
12+
Cross-platform development allows developers to build applications that can run on multiple operating systems with a single codebase. Flutter, paired with the Dart programming language, is a powerful framework for creating high-performance, visually attractive applications for both mobile and web platforms.
13+
14+
## What is Flutter?
15+
16+
Flutter is an open-source UI software development toolkit created by Google. It is used to develop applications for Android, iOS, Linux, Mac, Windows, Google Fuchsia, and the web from a single codebase. Flutter uses the Dart programming language and provides a rich set of pre-designed widgets.
17+
18+
## Introduction to Dart
19+
20+
Dart is a client-optimized programming language for apps on multiple platforms. It is developed by Google and is the primary language for Flutter development. Dart is designed for building mobile, desktop, server, and web applications.
21+
22+
## Setting Up the Development Environment
23+
24+
### Prerequisites
25+
26+
- Install Flutter SDK: [Flutter Installation Guide](https://flutter.dev/docs/get-started/install)
27+
- Install Dart SDK: Dart comes with Flutter, but can also be installed separately if needed.
28+
- IDE: Use Visual Studio Code, Android Studio, or IntelliJ IDEA with Flutter and Dart plugins.
29+
30+
### Initial Setup
31+
32+
1. **Install Flutter:**
33+
```bash
34+
flutter doctor
35+
```
36+
37+
2. **Create a New Flutter Project:**
38+
```bash
39+
flutter create my_app
40+
cd my_app
41+
```
42+
43+
## Flutter Architecture and Components
44+
45+
Flutter's architecture is based on reactive programming. It uses a widget tree to build the UI, and components include:
46+
47+
- Widgets: The building blocks of a Flutter app.
48+
- State: Manages the state of the app.
49+
- Rendering Engine: Handles rendering and compositing.
50+
51+
## UI Design in Flutter
52+
53+
Flutter provides a wide array of widgets for building UIs. Example:
54+
```dart
55+
import 'package:flutter/material.dart';
56+
57+
void main() => runApp(MyApp());
58+
59+
class MyApp extends StatelessWidget {
60+
@override
61+
Widget build(BuildContext context) {
62+
return MaterialApp(
63+
home: Scaffold(
64+
appBar: AppBar(title: Text('Flutter Demo')),
65+
body: Center(child: Text('Hello, Flutter!')),
66+
),
67+
);
68+
}
69+
}
70+
```
71+
72+
## State Management
73+
74+
State management is crucial in Flutter. Popular approaches include:
75+
76+
- setState: Built-in, simple state management.
77+
- Provider: Recommended for larger applications.
78+
- Riverpod, Bloc: Other advanced state management solutions.
79+
80+
## Working with APIs
81+
82+
To make network requests in Flutter:
83+
```dart
84+
import 'package:http/http.dart' as http;
85+
import 'dart:convert';
86+
87+
void fetchData() async {
88+
final response = await http.get(Uri.parse('https://api.example.com/data'));
89+
if (response.statusCode == 200) {
90+
var data = jsonDecode(response.body);
91+
print(data);
92+
} else {
93+
throw Exception('Failed to load data');
94+
}
95+
}
96+
```
97+
98+
## Database and Storage Solutions
99+
100+
Flutter supports various database solutions:
101+
102+
- SQLite: Using sqflite package.
103+
- Firebase: Using cloud_firestore package.
104+
Example using SQLite:
105+
```dart
106+
import 'package:sqflite/sqflite.dart';
107+
import 'package:path/path.dart';
108+
109+
void initDatabase() async {
110+
final database = openDatabase(
111+
join(await getDatabasesPath(), 'my_database.db'),
112+
onCreate: (db, version) {
113+
return db.execute(
114+
"CREATE TABLE items(id INTEGER PRIMARY KEY, name TEXT)",
115+
);
116+
},
117+
version: 1,
118+
);
119+
}
120+
```
121+
122+
## Animations and Advanced UI Techniques
123+
124+
Flutter provides powerful animation capabilities:
125+
```dart
126+
import 'package:flutter/material.dart';
127+
128+
class MyAnimatedWidget extends StatefulWidget {
129+
@override
130+
_MyAnimatedWidgetState createState() => _MyAnimatedWidgetState();
131+
}
132+
133+
class _MyAnimatedWidgetState extends State<MyAnimatedWidget> with SingleTickerProviderStateMixin {
134+
AnimationController _controller;
135+
136+
@override
137+
void initState() {
138+
super.initState();
139+
_controller = AnimationController(
140+
duration: const Duration(seconds: 2),
141+
vsync: this,
142+
)..repeat(reverse: true);
143+
}
144+
145+
@override
146+
void dispose() {
147+
_controller.dispose();
148+
super.dispose();
149+
}
150+
151+
@override
152+
Widget build(BuildContext context) {
153+
return Scaffold(
154+
body: Center(
155+
child: FadeTransition(
156+
opacity: _controller,
157+
child: FlutterLogo(size: 100.0),
158+
),
159+
),
160+
);
161+
}
162+
}
163+
```
164+
## Testing and Debugging
165+
166+
Testing in Flutter includes:
167+
168+
- Unit Testing: Using flutter_test package.
169+
- Widget Testing: Ensures widgets render correctly.
170+
- Integration Testing: Tests the complete app.
171+
Example of a unit test:
172+
```dart
173+
import 'package:flutter_test/flutter_test.dart';
174+
175+
void main() {
176+
test('adds one to input values', () {
177+
expect(addOne(1), 2);
178+
});
179+
}
180+
181+
int addOne(int value) => value + 1;
182+
```
183+
184+
## Deploying Flutter Applications
185+
Deploying to different platforms:
186+
187+
- Android: `flutter build apk`
188+
- iOS: `flutter build ios`
189+
- Web: `flutter build web`
190+
191+
## Performance Optimization
192+
193+
To optimize performance:
194+
195+
- Optimize Build Methods: Minimize the workload in the build method.
196+
- Use Const Constructors: Where possible, use const constructors.
197+
- Profile Mode: Use Flutter's profile mode to identify performance issues.
198+
199+
## Community and Resources
200+
201+
Engage with the Flutter community:
202+
- Flutter Community
203+
- Stack Overflow
204+
- Medium Articles
205+
206+
## Case Studies and Real-World Examples
207+
208+
Explore real-world applications built with Flutter:
209+
- Google Ads: High-performance app for managing ad campaigns.
210+
- Reflectly: Personal journaling app with rich UI and smooth animations.
211+
- Alibaba: Large-scale e-commerce app.
212+
213+
## Conclusion
214+
215+
Flutter and Dart provide a powerful platform for developing cross-platform applications with a single codebase. This documentation covers the essential aspects of Flutter development, from setting up the environment to deploying applications and optimizing performance.

blog/getting-started-with-microservices/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ date: 2024-06-17
77
hide_table_of_contents: true
88
---
99

10+
1011
## 1. Understanding the importance Microservices
1112

1213
- Microservices are an architectural style that structures an application as a collection of small, loosely coupled services. Each service is self-contained, focused on a specific business functionality, and can be developed, deployed, and scaled independently. This modular approach to software design offers several benefits, including increased agility, scalability, and resilience.
@@ -790,4 +791,4 @@ That’s it! We have successfully developed a microservices architecture with a
790791

791792
## Conclusion
792793

793-
Microservices architecture is a design pattern that structures an application as a collection of small, loosely coupled services. Each service is self-contained, focused on a specific business functionality, and can be developed, deployed, and scaled independently. This modular approach to software design offers several benefits, including increased agility, scalability, and resilience.
794+
Microservices architecture is a design pattern that structures an application as a collection of small, loosely coupled services. Each service is self-contained, focused on a specific business functionality, and can be developed, deployed, and scaled independently. This modular approach to software design offers several benefits, including increased agility, scalability, and resilience.

courses/html/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "HTML",
3+
"position": 3,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Getting started with HTML, the language that powers the web."
7+
}
8+
}

courses/html/basic/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "HTML Basics",
3+
"position": 2,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Learn the basics of HTML, the language that powers the web."
7+
}
8+
}

courses/html/basic/intro-html.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
id: introduction-to-html
3+
title: Introduction to HTML
4+
sidebar_label: Introduction to HTML
5+
sidebar_position: 1
6+
description: "Learn the basics of HTML, the foundation of web development, and create your first web page."
7+
tags: [html courses, web development in html courses, html basic]
8+
keywoards: [html courses, web development in html courses, html basic]
9+
author: [CodeHarborHub, Ajay Dhangar]
10+
---
11+
12+
<img src="/courses/html/intro-html.png" alt="Introduction HTML banner" />
13+
14+
<br />
15+
16+
In this section, you will learn the basics of HTML, the foundation of web development, and create your first web page. HTML stands for HyperText Markup Language. It is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScript.
17+
18+
## What is HTML?
19+
20+
HTML is the standard markup language for creating web pages. It stands for **Hyper Text Markup Language**. HTML describes the structure of a web page semantically and originally included cues for the appearance of the document.
21+
22+
HTML elements are the building blocks of HTML pages. With HTML constructs, images and other objects, such as interactive forms, may be embedded into the rendered page. HTML provides a means to create structured documents by denoting structural semantics for text such as headings, paragraphs, lists, links, quotes, and other items. HTML elements are delineated by tags, written using angle brackets. Tags such as `<img />` and `<input />` directly introduce content into the page. Other tags such as `<p>` surround and provide information about document text and may include other tags as sub-elements. Browsers do not display the HTML tags, but use them to interpret the content of the page.
23+
24+
## What is a Web Page?
25+
26+
A web page is a document that is suitable for the World Wide Web and web browsers. A web browser displays a web page on a monitor or mobile device. The web page is what displays, but the term also refers to a computer file, usually written in HTML or comparable markup language. Web browsers coordinate the various web resource elements for the written web page, such as style sheets, scripts, and images, to present the web page.
27+
28+
## Creating Your First Web Page
29+
30+
To create your first web page, you need to create an HTML file. An HTML file is a text file that contains the HTML code for your web page. You can create an HTML file using a text editor such as Notepad or a code editor such as **Visual Studio Code**.
31+
32+
Here is an example of a simple HTML file:
33+
34+
```html title="index.html"
35+
<!doctype html>
36+
<html>
37+
<head>
38+
<title>My First Web Page</title>
39+
</head>
40+
<body>
41+
<h1>Hello, World!</h1>
42+
<p>Welcome to my first web page.</p>
43+
</body>
44+
</html>
45+
```
46+
47+
<BrowserWindow url="http://127.0.0.1:5500/index.html">
48+
<h1>Hello, World!</h1>
49+
<p>Welcome to my first web page.</p>
50+
</BrowserWindow>
51+
52+
In this example, the HTML file contains the following elements:
53+
54+
- `<!DOCTYPE html>`: This declaration defines the document type and version of HTML.
55+
- `<html>`: This element is the root element of an HTML page.
56+
- `<head>`: This element contains meta-information about the HTML document.
57+
- `<title>`: This element specifies the title of the HTML document.
58+
- `<body>`: This element contains the content of the HTML document.
59+
- `<h1>`: This element defines a heading.
60+
- `<p>`: This element defines a paragraph.
61+
- The text between the opening and closing tags of each element is the content of that element.
62+
- The HTML file is saved with the `.html` extension, such as `index.html`.
63+
- You can open the HTML file in a web browser to view the web page.
64+
65+
Congratulations! You have created your first web page using HTML. In the next section, you will learn more about HTML elements and attributes.
66+
67+
## Why Learn HTML?
68+
69+
HTML is the foundation of web development. Learning HTML is essential for anyone who wants to create web pages and web applications. HTML is easy to learn and use, making it an ideal starting point for beginners. By learning HTML, you will gain a solid understanding of how web pages are structured and how content is displayed on the web.
70+
71+
:::tip Key Points
72+
73+
- First version of HTML was introduced in 1991 by **Tim Berners-Lee**.
74+
- HTML stands for **Hyper Text Markup Language**.
75+
- **Tim Berners-Lee** is the inventor of the World Wide Web. He is a British computer scientist who invented the World Wide Web in 1989 while working at CERN.
76+
- HTML is the standard markup language for creating web pages.
77+
- There are many versions of HTML such as HTML 4, HTML 5, and XHTML.
78+
79+
:::
80+
81+
## Summary
82+
83+
In this section, you learned the basics of HTML, the foundation of web development. You created your first web page using HTML and learned about HTML elements and attributes. HTML is the standard markup language for creating web pages, and it is essential for anyone who wants to create web pages and web applications. In the next section, you will learn more about HTML elements and attributes.

courses/html/basic/setting-up-html-environment.md

Whitespace-only changes.

docs/html/best-practices-and-optimization/Performance-optimization.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

docs/html/best-practices-and-optimization/_category_.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)