cc
This commit is contained in:
parent
80b08dafb4
commit
8e56af8bd0
1 changed files with 8 additions and 12 deletions
20
README.md
20
README.md
|
|
@ -55,7 +55,6 @@ Start Extension in right corner
|
|||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
- [online documentation](https://docs.flutter.dev/)
|
||||
# 🧠 Browser Tab Manager - Complete Code Study Guide
|
||||
|
||||
## 📋 Table of Contents
|
||||
1. [App Architecture Overview](#architecture)
|
||||
|
|
@ -110,8 +109,6 @@ void main() {
|
|||
runApp(const BrowserTabManagerApp());
|
||||
}
|
||||
```
|
||||
|
||||
**WHAT HAPPENS HERE:**
|
||||
1. `main()` is the entry point of every Dart/Flutter app
|
||||
2. `runApp()` tells Flutter to start the app with our root widget
|
||||
3. Creates the widget tree and starts the rendering engine
|
||||
|
|
@ -143,14 +140,14 @@ class BrowserTabManagerApp extends StatelessWidget {
|
|||
|
||||
```dart
|
||||
class TabData {
|
||||
String id; // Unique identifier
|
||||
String title; // Display name
|
||||
String url; // Web address
|
||||
String favicon; // Icon URL
|
||||
String id;
|
||||
String title;
|
||||
String url;
|
||||
String favicon;
|
||||
DateTime lastAccessed; // When last used
|
||||
bool isPinned; // Pinned status
|
||||
bool isPinned;
|
||||
String type; // 'tab', 'bookmark', or 'history'
|
||||
int? visitCount; // Number of visits (nullable)
|
||||
int? visitCount; // (nullable)
|
||||
String? folder; // Bookmark folder (nullable)
|
||||
}
|
||||
```
|
||||
|
|
@ -158,7 +155,6 @@ class TabData {
|
|||
**PURPOSE:**
|
||||
- **Data Structure**: Represents all types of browser items uniformly
|
||||
- **Type Safety**: Dart ensures correct data types
|
||||
- **Nullable Fields**: `?` means the field can be null
|
||||
|
||||
### Factory Constructor:
|
||||
```dart
|
||||
|
|
@ -243,7 +239,7 @@ void initState() {
|
|||
}
|
||||
```
|
||||
|
||||
**setState()** - The magic that updates UI:
|
||||
**setState()** updates UI:
|
||||
```dart
|
||||
setState(() {
|
||||
allItems = newData; // Change state
|
||||
|
|
@ -361,7 +357,7 @@ SearchBar(onChanged: (text) => {
|
|||
// 3. Parent filters data and updates state
|
||||
void _filterItems() {
|
||||
setState(() => {
|
||||
filteredItems = // ... filter logic
|
||||
filteredItems = //filter logic
|
||||
});
|
||||
// 4. Flutter rebuilds UI with new filteredItems
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue