This commit is contained in:
Levi committed 2025-11-16 19:36:39 +08:00
1 parent 8835c2855a
commit 5303e44ead
17 files changed
+293 -51

No files matched your search

+169
View File
@@ -0,0 +1,169 @@
# Gopeed Flutter V2 UI - AI Coding Instructions
## Response Rules
Respond in the same language as user's question
## Project Overview
This is the Flutter V2 UI for **Gopeed** (Go Speed), a high-speed download manager built with Golang + Flutter. This Flutter app is a **desktop-focused UI redesign** with cross-platform support (macOS, Windows, Linux, iOS, Android, Web).
**Critical Context**: This Flutter UI communicates with a Go backend REST API (not in this workspace). The backend handles download operations, task management, and file I/O. The UI is purely presentational with future API integration planned.
## Architecture & Structure
### Module Organization (Feature-First)
```
lib/
├── main.dart # App entry, window config, router setup
├── routes/ # Centralized routing
│ ├── app_routes.dart # go_router configuration
│ └── route_names.dart # Route path constants
├── modules/ # Feature modules (screens + widgets)
│ ├── home/ # Shell layout with sidebar
│ ├── task/ # Download task management UI
│ └── settings/ # Settings screen
└── components/ # Shared UI components (gp_* prefix)
```
**Key Pattern**: Features are organized in `modules/` with `screens/` and `widgets/` subdirectories. Shared components use `gp_` prefix (e.g., `GpGradientButton`, `GpIconButton`).
### Routing Architecture
- Uses `go_router` with `ShellRoute` for persistent sidebar navigation
- `HomeScreen` wraps all routes and provides the sidebar layout
- Route paths defined in `RouteNames` class (prevents magic strings)
- Current route detection via `GoRouterState.of(context).matchedLocation`
## Critical Patterns & Conventions
### Component Design System
1. **Gradient Buttons** (`GpGradientButton`): Primary actions, teal-to-green gradient (Colors: `0xFF3ACBBE` → `0xFF2CDB90`)
2. **Outline Buttons** (`GpOutlineButton`): Secondary actions, border-only with teal accent (`0xFF39CDB9`)
3. **Icon Buttons** (`GpIconButton`): Tertiary actions with hover effects (`0xFF4883A2` on hover)
### Design Implementation
- **Glass Morphism**: `TaskItem` widget uses `BackdropFilter` with blur (24px) and layered gradients
- **Color Palette**: Dark blue theme (`0xFF131956` background, `0xFF000E4B` sidebar, teal/green accents)
- **Comments Reference Design Specs**: Many widgets have detailed comments like "Rectangle 82: 主容器" mapping to Figma/design files
### Widget Documentation Style
Components use triple-slash (`///`) documentation:
```dart
/// TaskItem - 任务项组件
///
/// 一个带有毛玻璃效果和渐变边框的任务项容器
class TaskItem extends StatelessWidget {
/// 左侧图标
final dynamic icon;
```
**Convention**: Document widget purpose, parameters, and design intent in Chinese. Keep inline comments for implementation details.
### State Management
- Currently uses `StatefulWidget` with local state (e.g., `TaskScreen._selectedTabIndex`)
- **Future Integration**: Will integrate with backend API - prepare for state management library (GetX/Riverpod likely based on Gopeed ecosystem)
### Window Management
Desktop apps use `window_manager` package:
- Initial size: 1024x768, minimum: 800x600
- Hidden title bar (`TitleBarStyle.hidden`) for custom UI
- Configured in `main.dart` before `runApp()`
## Development Workflows
### Running the App
```bash
# Desktop (macOS/Windows/Linux)
flutter run -d macos # or windows/linux
# Mobile
flutter run -d ios # requires Xcode
flutter run -d android
# Web
flutter run -d chrome
```
### Building
```bash
flutter build macos --release
flutter build windows --release
flutter build linux --release
```
### Dependencies
Key packages in `pubspec.yaml`:
- `window_manager: ^0.4.3` - Desktop window control
- `flutter_svg: ^2.0.17` - SVG asset support
- `go_router: ^14.8.1` - Declarative routing
Assets in `assets/icons/` (e.g., `gopeed_sidebar.svg`, `pause.png`)
## Backend Integration (Future)
**Not Yet Implemented**: Based on parent project structure, this UI will connect to Go REST API:
- API endpoints: `/api/task`, `/api/resolve`, `/api/config` (reference: `pkg/rest/api.go` in parent)
- Task operations: create, pause, continue, delete
- Real-time progress updates via events/WebSocket
**When Implementing API**:
1. Create `lib/api/` or `lib/services/` directory
2. Use `http` or `dio` package for REST calls
3. Models should match Go backend structs (e.g., `Task`, `Progress`)
4. Replace mock data in `TaskScreen._buildTaskList()` with API calls
## Testing & Quality
- Lints: Uses `package:flutter_lints/flutter.yaml` (standard Flutter best practices)
- No tests currently - **add tests when backend integration begins**
- Desktop focus: Prioritize macOS/Windows, mobile is secondary
## Common Tasks
### Adding a New Screen
1. Create `lib/modules/[feature]/screens/[screen_name].dart`
2. Add route to `RouteNames` constant
3. Register route in `AppRoutes.getRouter()` under `ShellRoute.routes`
### Adding Shared Component
1. Create `lib/components/gp_[component_name].dart`
2. Follow naming: `Gp` prefix + PascalCase
3. Document with `///` comments
4. Support flexible sizing/theming via parameters
### Design-to-Code Workflow
When implementing from design files:
- Preserve design layer names in comments (e.g., "Rectangle 82")
- Use exact hex colors from specs
- Document gradient stops and blur sigma values
- Stack layers match design hierarchy (bottom-to-top)
## Important Notes
- **Language**: UI text is in Chinese (e.g., "下载中", "已完成", "任务失败")
- **Branch Context**: Current branch is `feat/new_ui` - this is a redesign
- **Desktop First**: Window management, mouse hover states prioritized
- **Parent Project**: Part of larger Gopeed monorepo with Go backend (outside this workspace)
---
**When uncertain**: Check `lib/modules/task/widgets/task_item.dart` for complex widget patterns, `lib/routes/app_routes.dart` for routing examples, or `lib/main.dart` for app initialization.
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><defs><clipPath id="master_svg0_1_4784"><rect x="0" y="0" width="16" height="16" rx="0"/></clipPath><clipPath id="master_svg1_1_4785"><rect x="1" y="1" width="14" height="13.98634147644043" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_1_4784)"><g clip-path="url(#master_svg1_1_4785)"><g></g><g></g><g><path d="M14.407077875,3.7902927L11.616782875,3.7902927L11.616782875,2.3951464C11.616782875,1.62781584,10.995943075,1,10.221636775,1L5.757169675,1C4.989839275,1,4.362023375,1.62781584,4.362023375,2.3951464L4.362023375,3.7902927L1.5717306149999999,3.7902927C1.4182645649999999,3.7902927,1.2787498849999999,3.8530741,1.174113885,3.9507344C1.076453455,4.048394699999999,1.013671875,4.187909400000001,1.013671875,4.3483515C1.013671875,4.655283,1.264798195,4.90641,1.571730435,4.90641L2.4646240749999997,4.90641L2.938973775,13.556316C2.938973775,14.330623,3.531911175,14.951464,4.271338975,14.951464L11.714442875,14.951464C12.446894875,14.951464,13.039831875,14.330623,13.039831875,13.556316L13.514181875,4.90641L14.414048875,4.90641C14.567516875,4.90641,14.707032875,4.8436277,14.811668875,4.7459674C14.909328875,4.6413317,14.972110875,4.5018167,14.972110875,4.3483505000000005C14.965135875,4.0414186,14.714007875,3.790292,14.407077875,3.7902927ZM5.478140375,2.3951464C5.478140375,2.2416803,5.603702975,2.1161171000000003,5.757169675,2.1161171000000003L10.221636775,2.1161171000000003C10.375103975,2.1161171000000003,10.500666575,2.2416803,10.500666575,2.3951464L10.500666575,3.7902927L5.478140375,3.7902927L5.478140375,2.3951464ZM11.923715875,13.50051L11.923715875,13.563292C11.923715875,13.730709,11.812103875,13.84232,11.714442875,13.84232L4.264363075,13.84232C4.159727075,13.84232,4.048114975,13.730709,4.048114975,13.563292L4.048114975,13.50051L3.587716775,4.90641L3.587716775,4.8994339L12.391089875,4.8994339L12.391089875,4.90641L11.923715875,13.50051Z" fill="#39CDB9" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M6.587355315,11.819402199999999C6.280422925,11.819402199999999,6.029296875,11.5682764,6.029296875,11.261343499999999L6.029296875,7.3549335C6.029296875,7.04800108,6.280422925,6.796875,6.587355315,6.796875C6.894287705,6.796875,7.145413775,7.04800162,7.145413775,7.3549335L7.145413775,11.261343499999999C7.145413775,11.568275,6.901263175,11.819402199999999,6.587355315,11.819402199999999ZM9.377648075,11.819402199999999C9.070715675,11.819402199999999,8.819589575,11.5682764,8.819589575,11.261343499999999L8.819589575,7.3549335C8.819589575,7.04800108,9.070715675,6.796875,9.377648075,6.796875C9.684580375,6.796875,9.935706875000001,7.04800162,9.935706875000001,7.3549335L9.935706875000001,11.261343499999999C9.935706875000001,11.568275,9.691555975,11.819402199999999,9.377648075,11.819402199999999Z" fill="#39CDB9" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></g></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="20" height="20" viewBox="0 0 20 20"><defs><clipPath id="master_svg0_1_4880"><rect x="2" y="2" width="16" height="16" rx="0"/></clipPath><clipPath id="master_svg1_1_4881"><rect x="3" y="3" width="14" height="13.98634147644043" rx="0"/></clipPath></defs><g><g></g><g clip-path="url(#master_svg0_1_4880)"><g clip-path="url(#master_svg1_1_4881)"><g><path d="M5.587890625,6.90625L14.391263925,6.90625L14.391263925,6.9132257244L5.587890625,6.9132257244L5.587890625,6.90625Z" fill="#000000" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M6.3623846875000005,6.90678420625L13.6171445875,6.91375980625L13.6171445875,6.90678420625L6.3623846875000005,6.90678420625ZM4.4091796875,5.79066713065L6.3623846875000005,5.79764285525L6.3623846875000005,5.79066713065L4.4091796875,5.79066713065ZM13.6171445875,5.79066713065L15.5703506875,5.79764285525L15.5703506875,5.79066713065L13.6171445875,5.79066713065ZM7.4785015875,5.79066713065L12.5010289875,5.79066713065L12.5010289875,5.78369140625L7.4785015875,5.79066713065Z" fill="#000000" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M16.407077875,5.7902927L13.616782875,5.7902927L13.616782875,4.3951464C13.616782875,3.6278158400000002,12.995943075,3,12.221636775,3L7.757169675,3C6.989839275,3,6.362023375,3.6278158400000002,6.362023375,4.3951464L6.362023375,5.7902927L3.571730615,5.7902927C3.418264565,5.7902927,3.278749885,5.853074100000001,3.174113885,5.9507344C3.0764534550000002,6.048394699999999,3.013671875,6.187909400000001,3.013671875,6.3483515C3.013671875,6.655283,3.264798195,6.90641,3.571730435,6.90641L4.464624075,6.90641L4.938973775,15.556316C4.938973775,16.330623,5.531911174999999,16.951464,6.271338975,16.951464L13.714442875,16.951464C14.446894875,16.951464,15.039831875,16.330623,15.039831875,15.556316L15.514181875,6.90641L16.414048875,6.90641C16.567516875000003,6.90641,16.707032875,6.8436277,16.811668875000002,6.7459674C16.909328875,6.6413317,16.972110875,6.5018167,16.972110875,6.3483505000000005C16.965135875,6.0414186,16.714007875,5.790292,16.407077875,5.7902927ZM7.478140375,4.3951464C7.478140375,4.2416803000000005,7.603702975,4.1161171,7.757169675,4.1161171L12.221636775,4.1161171C12.375103975,4.1161171,12.500666575,4.2416803000000005,12.500666575,4.3951464L12.500666575,5.7902927L7.478140375,5.7902927L7.478140375,4.3951464ZM13.923715875,15.50051L13.923715875,15.563292C13.923715875,15.730709,13.812103875,15.84232,13.714442875,15.84232L6.264363075,15.84232C6.159727075,15.84232,6.048114975,15.730709,6.048114975,15.563292L6.048114975,15.50051L5.5877167750000005,6.90641L5.5877167750000005,6.8994339L14.391089875,6.8994339L14.391089875,6.90641L13.923715875,15.50051Z" fill="#FFFFFE" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M8.587355315,13.819402199999999C8.280422925,13.819402199999999,8.029296875,13.5682764,8.029296875,13.261343499999999L8.029296875,9.3549335C8.029296875,9.04800108,8.280422925,8.796875,8.587355315,8.796875C8.894287705,8.796875,9.145413775,9.04800162,9.145413775,9.3549335L9.145413775,13.261343499999999C9.145413775,13.568275,8.901263175,13.819402199999999,8.587355315,13.819402199999999ZM11.377648075,13.819402199999999C11.070715675,13.819402199999999,10.819589575,13.5682764,10.819589575,13.261343499999999L10.819589575,9.3549335C10.819589575,9.04800108,11.070715675,8.796875,11.377648075,8.796875C11.684580375,8.796875,11.935706875000001,9.04800162,11.935706875000001,9.3549335L11.935706875000001,13.261343499999999C11.935706875000001,13.568275,11.691555975,13.819402199999999,11.377648075,13.819402199999999Z" fill="#FFFFFE" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></g><g></g></g></svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="20" height="20" viewBox="0 0 20 20"><g><g></g><g><path d="M16.84375,10C16.84375,6.1340067000000005,13.744721,3,9.921875,3C6.0990286000000005,3,3,6.1340067000000005,3,10C3,13.865993,6.0990286000000005,17,9.921875,17C13.744721,17,16.84375,13.865993,16.84375,10ZM3.95474136,10C3.95474136,6.6672468,6.6263176999999995,3.9655172199999997,9.921875,3.9655172199999997C13.217431,3.9655172199999997,15.889008,6.6672468,15.889008,10C15.889008,13.332752,13.217431,16.034482,9.921875,16.034482C6.6263176999999995,16.034482,3.95474136,13.332752,3.95474136,10ZM9.921875,7.3448277C10.317341299999999,7.3448277,10.6379309,7.0206199,10.6379309,6.6206894C10.6379309,6.2207594,10.317341299999999,5.8965516000000004,9.921875,5.8965516000000004C9.5264077,5.8965516000000004,9.2058191,6.2207594,9.2058191,6.6206894C9.2058191,7.0206199,9.5264077,7.3448277,9.921875,7.3448277ZM9.4445038,13.862068C9.4445038,14.128689,9.6582303,14.344828,9.921875,14.344828C10.1855187,14.344828,10.3992457,14.128689,10.3992457,13.862068L10.3992457,8.551724400000001C10.3992457,8.2851038,10.1855187,8.0689659,9.921875,8.0689659C9.6582303,8.0689659,9.4445038,8.2851038,9.4445038,8.551724400000001L9.4445038,13.862068Z" fill="#FFFFFE" fill-opacity="1" style="mix-blend-mode:passthrough"/><path d="M7.2079058,16.495876000000003Q8.5033803,17.050001,9.921875499999999,17.050001Q11.3403711,17.050001,12.6358452,16.495876000000003Q13.887032,15.960696,14.851933,14.984904Q15.816778,14.009171,16.345923,12.744009Q16.893751,11.4341812,16.893751,10.000000499999999Q16.893751,8.565819699999999,16.345923,7.2559915Q15.816778,5.9908307,14.851933,5.0150959Q13.887032,4.0393038,12.6358452,3.50412351Q11.3403721,2.949999996,9.921875499999999,2.949999996Q8.503378900000001,2.949999996,7.2079053,3.50412363Q5.9567192,4.0393038,4.9918171000000005,5.0150962Q4.0269737,5.9908297,3.49782753,7.2559919Q2.949999966,8.5658207,2.949999996,10.000000499999999Q2.949999996,11.4341822,3.4978272,12.74401Q4.0269725,14.009171,4.991817,14.984904Q5.9567177000000004,15.960696,7.2079058,16.495876000000003ZM12.5965185,16.403935Q11.3198843,16.950001,9.921875499999999,16.950001Q8.5238671,16.950001,7.2472324,16.403935Q6.0140541,15.876458,5.0629234,14.914592Q4.1117355,13.952669,3.59008318,12.7054234Q3.050000004,11.4141111,3.050000004,10.000000499999999Q3.049999937,8.585890299999999,3.59008348,7.2945771Q4.1117356,6.0473327999999995,5.0629234,5.0854089Q6.0140541,4.1235434,7.2472324,3.5960658800000003Q8.5238681,3.050000004,9.921875499999999,3.050000004Q11.3198833,3.050000004,12.5965185,3.59606576Q13.829698,4.1235434,14.780828,5.0854087Q15.732015,6.0473313,16.253667,7.2945766Q16.793751,8.5858908,16.793751,10.000000499999999Q16.793751,11.4141083,16.253667,12.7054224Q15.732014,13.952671,14.780828,14.914592Q13.829698,15.876457,12.5965185,16.403935ZM7.5795341,15.606234Q8.697622800000001,16.084482,9.921875499999999,16.084482Q11.1461277,16.084482,12.2642155,15.606234Q13.344068,15.14434,14.176828,14.302179Q15.009533,13.460075,15.466209,12.368187Q15.939009,11.2377491,15.939009,10.000000499999999Q15.939009,8.762252799999999,15.466209,7.6318145Q15.009533,6.5399244,14.176827,5.6978199Q13.344066,4.8556588000000005,12.2642155,4.3937656Q11.1461296,3.91551727,9.921875499999999,3.9155177500000002Q8.6976199,3.91551763,7.5795336,4.3937658Q6.4996829,4.8556592,5.6669211,5.6978199Q4.8342174,6.539922,4.3775403,7.6318145Q3.9047414099999997,8.762253300000001,3.9047404500000003,10.000000499999999Q3.90474069,11.2377472,4.37754,12.368187Q4.8342161,13.460076,5.6669209,14.302179Q6.4996817,15.14434,7.5795341,15.606234ZM12.2248888,15.514292Q11.1256399,15.984483,9.921875499999999,15.984483Q8.7181096,15.984483,7.6188612,15.514292Q6.5570183,15.060101,5.738027300000001,14.231867Q4.9189789,13.403574,4.4697959,12.3296003Q4.0047406,11.2176771,4.0047405000000005,10.000000499999999Q4.0047414,8.7823229,4.4697963000000005,7.6703997Q4.9189793,6.5964255000000005,5.738027600000001,5.7681328999999995Q6.5570183,4.9398985,7.6188607,4.4857081999999995Q8.7181096,4.0155177,9.921875499999999,4.0155177Q11.1256399,4.0155172,12.2248888,4.4857078999999995Q13.286732,4.9398986,14.105721,5.7681328999999995Q14.924769,6.5964255000000005,15.373953,7.6703997Q15.839008,8.7823238,15.839008,10.000000499999999Q15.839008,11.2176762,15.373953,12.3296003Q14.924768,13.403576,14.105722,14.231867Q13.286733,15.060101,12.2248888,15.514292ZM9.379993899999999,6.0734905999999995Q9.1558194,6.3001955,9.1558194,6.6206896Q9.1558194,6.9411843,9.379993899999999,7.1678891Q9.6044002,7.3948278,9.921875499999999,7.3948278Q10.2393503,7.3948278,10.463756100000001,7.1678886Q10.6879311,6.9411831,10.6879311,6.6206887000000005Q10.6879311,6.3001955,10.463756100000001,6.0734904Q10.2393503,5.8465517,9.921875499999999,5.8465517Q9.6044002,5.8465517,9.379993899999999,6.0734905999999995ZM9.451099899999999,7.0975766Q9.255819299999999,6.9000916,9.255819299999999,6.6206896Q9.255819299999999,6.341287599999999,9.451099Line truncated

After

Width:  |  Height:  |  Size: 6.3 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="20" height="20" viewBox="0 0 20 20"><defs><clipPath id="master_svg0_1_4866"><rect x="0" y="0" width="20" height="20" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_1_4866)"><g><path d="M6.458075525,9.999704725Q6.458075525,10.071365625,6.451051425,10.142681225Q6.444027425,10.213996925,6.430046325,10.284280625000001Q6.416065925,10.354564525,6.395263225,10.423139525Q6.3744607250000005,10.491714725,6.3470363249999995,10.557920424999999Q6.319612525,10.624126425,6.285830725,10.687325725Q6.252049425,10.750525025,6.212235424999999,10.810108625Q6.172421925,10.869692525,6.126959825,10.925087225Q6.081497425,10.980481625,6.030824225,11.031153425Q5.980151225,11.081825225,5.924755125,11.127286425Q5.869359025,11.172747625,5.8097737249999994,11.212559925Q5.750188625,11.252372725,5.686987925,11.286153525Q5.623786925,11.319934325,5.557579325,11.347357525Q5.491371825,11.374781125,5.422794925,11.395583125Q5.354218225,11.416385125,5.283932425,11.430365525Q5.213646925,11.444345925,5.142329325,11.451370025Q5.071011825,11.458393825,4.999349125,11.458393825Q4.927686525,11.458393825,4.856369025,11.451370025Q4.785051425,11.444345925,4.714765625,11.430365325Q4.644480125,11.416385125,4.5759033250000005,11.395583125Q4.507326365,11.374781125,4.441118655,11.347357225Q4.374911065,11.319934125,4.311710235,11.286153325Q4.248509405,11.252372725,4.188924075,11.212560225Q4.129338865,11.172747625,4.073942895,11.127286425Q4.018546935,11.081825225,3.967873755,11.031153425Q3.917200655,10.980481625,3.871738345,10.925087225Q3.826276065,10.869692525,3.786462415,10.810108625Q3.746648805,10.750525025,3.712867255,10.687325725Q3.679085735,10.624126425,3.651661625,10.557920424999999Q3.624237537,10.491714725,3.603434969,10.423139525Q3.582632408,10.354564625,3.568651723,10.284280825Q3.554671041,10.213997025,3.547646876,10.142681325Q3.54062271118,10.071365625,3.54062271118,9.999704725Q3.54062271118,9.928043825,3.5476468774,9.856728125Q3.554671044,9.785412325,3.568651728,9.715128425Q3.582632415,9.644844625,3.60343498,9.576269525Q3.624237545,9.507694485,3.651661645,9.441488445Q3.679085745,9.375282525,3.712867285,9.312083365Q3.746648815,9.248884205,3.786462425,9.189300415Q3.826276095,9.129716695,3.871738375,9.074322165Q3.917200685,9.018927635,3.967873785,8.968255725Q4.018546935,8.917583945,4.073942895,8.872122795Q4.129338865,8.826661645,4.188924075,8.786849035Q4.248509405,8.747036444999999,4.311710175,8.713255765Q4.374911015,8.679475115,4.441118595,8.652051705Q4.507326245,8.624628313,4.575903225,8.603826277Q4.644480025,8.583024248,4.714765625,8.569043921Q4.785051425,8.555063596,4.856369025,8.5480396105Q4.927686525,8.541015625,4.999349125,8.541015625Q5.071011825,8.541015625,5.142329325,8.5480396105Q5.213646925,8.555063596,5.283932425,8.569043921Q5.354218225,8.583024248,5.422795025,8.603826277Q5.491371825,8.624628313,5.557579325,8.652051705Q5.623786925,8.679475115,5.686987925,8.713255775Q5.750188625,8.747036444999999,5.8097737249999994,8.786849035Q5.869359025,8.826661645,5.924755125,8.872122795Q5.980151225,8.917583945,6.030824225,8.968255725Q6.081497425,9.018927635,6.126959825,9.074322165Q6.172421925,9.129716695,6.212235424999999,9.189300415Q6.252049425,9.248884205,6.285830725,9.312083365Q6.319612525,9.375282525,6.3470363249999995,9.441488445Q6.3744607250000005,9.507694485,6.395263425,9.576269525Q6.416066125,9.644844625,6.430046525,9.715128425Q6.444027425,9.785412325,6.451051425,9.856728125Q6.458075525,9.928043825,6.458075525,9.999704725Z" fill="#FFFFFE" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M11.457681925,10.0003252875Q11.457681925,10.0719686875,11.450659725,10.1432669875Q11.443637325000001,10.2145652875,11.429660325,10.2848318875Q11.415683525,10.3550986875,11.394886525,10.4236569875Q11.374089525,10.4922152875,11.346672524999999,10.5584048875Q11.319256025,10.624594887499999,11.285483625,10.6877786875Q11.251711325,10.7509624875,11.211908325,10.8105315875Q11.172105825,10.870100987499999,11.126655625,10.9254819875Q11.081205825,10.9808630875,11.030545925,11.0315222875Q10.979886525,11.082181887499999,10.924505425,11.1276318875Q10.869124424999999,11.1730818875,10.809555025,11.2128846875Q10.749985925,11.2526876875,10.686802125,11.2864601875Q10.623618324999999,11.3202325875,10.557428325,11.347649087499999Q10.491238725,11.3750660875,10.422680425,11.3958630875Q10.354122125,11.4166600875,10.283855425,11.4306368875Q10.213588825,11.444613887500001,10.142290625,11.4516362875Q10.070992125,11.4586584875,9.999348725,11.4586584875Q9.927705525,11.4586584875,9.856407125,11.4516362875Q9.785108825,11.444613887500001,9.714842125,11.4306368875Q9.644575325,11.4166600875,9.576017025,11.3958630875Q9.507458685,11.3750660875,9.441268805,11.347649087499999Q9.375079035,11.3202325875,9.311895315,11.2864601875Q9.248711525000001,11.2526878875,9.189142225,11.2128848875Q9.129572985,11.1730823875,9.074191985,11.1276321875Q9.018810955,11.08218238Line truncated

After

Width:  |  Height:  |  Size: 11 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="20" height="20" viewBox="0 0 20 20"><defs><clipPath id="master_svg0_1_4888"><rect x="2" y="2" width="16" height="16" rx="0"/></clipPath></defs><g><g></g><g clip-path="url(#master_svg0_1_4888)"><g><path d="M12.8443293375,4.57733953C12.8443293375,4.13566598,13.2034464375,3.77734375,13.644324337499999,3.77734375C14.0861249375,3.77734375,14.4443359375,4.13775983,14.4443359375,4.57733953L14.4443359375,15.24397675C14.4443359375,15.68563775,14.085217937500001,16.043972750000002,13.644324337499999,16.043972750000002C13.2025399375,16.043972750000002,12.8443293375,15.68357175,12.8443293375,15.24397675L12.8443293375,4.57733953ZM6.4443359375,4.57733953C6.4443359375,4.13566598,6.8034537475,3.77734375,7.2443456675,3.77734375C7.6861306375,3.77734375,8.0443413375,4.13775983,8.0443413375,4.57733953L8.0443413375,15.24397675C8.0443413375,15.68563775,7.6852232375,16.043972750000002,7.2443456675,16.043972750000002C6.8025606575,16.043972750000002,6.4443359375,15.68357175,6.4443359375,15.24397675L6.4443359375,4.57733953Z" fill="#FFFFFE" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g><g></g></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="12" height="13.508296966552734" viewBox="0 0 12 13.508296966552734"><g><path d="M1.1323885,13.508297C0.93743527,13.508297,0.74248183,13.456448,0.56619424,13.354822C0.21154511,13.149499,0,12.782407,0,12.373834L0,1.1349809C0,0.7243346,0.21154511,0.3593156,0.56619424,0.1539924C0.92084342,-0.051330797,1.3439337,-0.051330797,1.7006568,0.1539924L11.433805,5.7723818C11.788455,5.9777055,12,6.3447976,12,6.7533703C12,7.1640162,11.788455,7.5290356,11.433805,7.7343583L1.7006568,13.354822C1.5222954,13.456448,1.3273419,13.508297,1.1323885,13.508297ZM1.3273419,1.4709644L1.3273419,12.037849L10.477705,6.7533703L1.3273419,1.4709644Z" fill="#FFFFFE" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></svg>

After

Width:  |  Height:  |  Size: 818 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="20" height="20" viewBox="0 0 20 20"><defs><clipPath id="master_svg0_1_4872"><rect x="2" y="2" width="16" height="16" rx="0"/></clipPath><clipPath id="master_svg1_1_4873"><rect x="1.9990234375" y="2" width="16" height="16" rx="0"/></clipPath></defs><g><g></g><g clip-path="url(#master_svg0_1_4872)"><g clip-path="url(#master_svg1_1_4873)"><g><path d="M15.5990234375,5.400390625C15.8193364375,5.400390625,15.9990244375,5.580078125,15.9990244375,5.800390725L15.9990244375,14.200390825C15.9990244375,14.420703625,15.8193364375,14.600391625,15.5990234375,14.600391625L4.3990235375,14.600391625C4.1787109375,14.600391625,3.9990234375,14.420703625,3.9990234375,14.200390825L3.9990234375,7.2003908249999995C3.9990234375,6.980078225,4.1787109375,6.800390725,4.3990235375,6.800390725L10.4130859375,6.800390725L10.7052741375,6.508203225L11.8130865375,5.400390625L15.5990234375,5.400390625ZM15.5990234375,4.400390625L11.6896486375,4.400390625C11.5037117375,4.400390625,11.3255863375,4.473828129,11.1943359375,4.605078135L9.999023937499999,5.800390725L4.3990235375,5.800390725C3.6255859775,5.800390725,2.9990234375,6.4269533249999995,2.9990234375,7.2003908249999995L2.9990234375,14.200390825C2.9990234375,14.973828625,3.6255859775,15.600391625,4.3990235375,15.600391625L15.5990234375,15.600391625C16.3724614375,15.600391625,16.999024437499997,14.973828625,16.999024437499997,14.200390825L16.999024437499997,5.800390725C16.999024437499997,5.026953165,16.3724614375,4.400390625,15.5990234375,4.400390625Z" fill="#FFFFFE" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M13.9990234375,13.583984375L5.9990234375,13.583984375C5.7224609575,13.583984375,5.4990234375,13.360546885,5.4990234375,13.083984375C5.4990234375,12.807421895,5.7224609575,12.583984375,5.9990234375,12.583984375L13.9990234375,12.583984375C14.2755861375,12.583984375,14.4990234375,12.807421895,14.4990234375,13.083984375C14.4990234375,13.360546885,14.2755861375,13.583984375,13.9990234375,13.583984375Z" fill="#FFFFFE" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></g><g></g></g></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><defs><clipPath id="master_svg0_1_4843"><rect x="0" y="0" width="16" height="16" rx="0"/></clipPath><linearGradient x1="0.9016574025154114" y1="0.22865968942642212" x2="0.5879987791120295" y2="0.524962739843075" id="master_svg1_1_3423"><stop offset="5.714285746216774%" stop-color="#2EDA94" stop-opacity="1"/><stop offset="100%" stop-color="#39CDB9" stop-opacity="1"/></linearGradient></defs><g clip-path="url(#master_svg0_1_4843)"><g><path d="M6.1838849,9.1654915875L3.50055146,9.1654915875C3.1502182,9.1654915875,2.908551335,8.814825087500001,3.033218078,8.4876584875L5.6995512999999995,1.4889922174999999C5.7734466,1.2951097775,5.9593232,1.1669921875,6.1667179999999995,1.1669921875L10.6660509,1.1669921875C11.0210505,1.1669921875,11.2630501,1.5266588675000001,11.1290512,1.8554921775L9.5765514,5.6661586875L12.4992189,5.6661586875C12.9290514,5.6661586875,13.158384,6.1728252875,12.8748846,6.4958252875L5.7092187,14.6608261875C5.3608856,15.0578261875,4.7150521,14.7138261875,4.8502188,14.2033261875L6.1838849,9.1654915875Z" fill="url(#master_svg1_1_3423)" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><defs><clipPath id="master_svg0_1_5108"><rect x="0" y="0" width="16" height="16" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_1_5108)"><g><path d="M10.3999934,2.79999578C10.3999934,2.35832223,10.7591105,2,11.199988399999999,2C11.641789,2,12,2.3604160800000002,12,2.79999578L12,13.466633C12,13.908294,11.640882000000001,14.266629,11.199988399999999,14.266629C10.758204,14.266629,10.3999934,13.906228,10.3999934,13.466633L10.3999934,2.79999578ZM4,2.79999578C4,2.35832223,4.35911781,2,4.80000973,2C5.2417947,2,5.6000054,2.3604160800000002,5.6000054,2.79999578L5.6000054,13.466633C5.6000054,13.908294,5.2408873,14.266629,4.80000973,14.266629C4.35822472,14.266629,4,13.906228,4,13.466633L4,2.79999578Z" fill="#39CDB9" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>

After

Width:  |  Height:  |  Size: 944 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="12" height="13.508296966552734" viewBox="0 0 12 13.508296966552734"><g><path d="M1.1323885,13.508297C0.93743527,13.508297,0.74248183,13.456448,0.56619424,13.354822C0.21154511,13.149499,0,12.782407,0,12.373834L0,1.1349809C0,0.7243346,0.21154511,0.3593156,0.56619424,0.1539924C0.92084342,-0.051330797,1.3439337,-0.051330797,1.7006568,0.1539924L11.433805,5.7723818C11.788455,5.9777055,12,6.3447976,12,6.7533703C12,7.1640162,11.788455,7.5290356,11.433805,7.7343583L1.7006568,13.354822C1.5222954,13.456448,1.3273419,13.508297,1.1323885,13.508297ZM1.3273419,1.4709644L1.3273419,12.037849L10.477705,6.7533703L1.3273419,1.4709644Z" fill="#39CDB9" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></svg>

After

Width:  |  Height:  |  Size: 818 B

@@ -1,11 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
/// GpIconButton - 简单的图标按钮组件
///
/// 用于TaskItem的操作按钮,支持鼠标悬浮效果
class GpIconButton extends StatefulWidget {
/// 图标
final IconData icon;
/// 图标(支持 IconData 或 String 路径)
final dynamic icon;
/// 点击回调
final VoidCallback? onTap;
@@ -53,13 +54,57 @@ class _GpIconButtonState extends State<GpIconButton> {
? const Color(0xFF4883A2)
: Colors.transparent, // 悬浮背景色
),
child: Icon(
widget.icon,
color: widget.color ?? Colors.white,
size: widget.size ?? 20.0,
),
child: _buildIcon(),
),
),
);
}
Widget _buildIcon() {
// 如果是字符串,认为是资源路径
if (widget.icon is String) {
final String path = widget.icon as String;
// 支持 svg 资源
if (path.toLowerCase().endsWith('.svg')) {
return Center(
child: SvgPicture.asset(
path,
width: widget.size ?? 20.0,
height: widget.size ?? 20.0,
fit: BoxFit.contain,
colorFilter: ColorFilter.mode(
widget.color ?? Colors.white,
BlendMode.srcIn,
),
),
);
}
return Center(
child: Image.asset(
path,
width: widget.size ?? 20.0,
height: widget.size ?? 20.0,
color: widget.color,
fit: BoxFit.contain,
),
);
}
// 如果是IconData,使用Icon组件
if (widget.icon is IconData) {
return Icon(
widget.icon as IconData,
color: widget.color ?? Colors.white,
size: widget.size ?? 20.0,
);
}
// 如果是Widget,直接使用
if (widget.icon is Widget) {
return Center(child: widget.icon as Widget);
}
return const SizedBox.shrink();
}
}
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
/// GpOutlineButton - 线框按钮组件
///
@@ -74,9 +75,26 @@ class GpOutlineButton extends StatelessWidget {
// 如果是字符串,认为是资源路径
if (icon is String) {
final String path = icon as String;
// 支持 svg 资源
if (path.toLowerCase().endsWith('.svg')) {
return Center(
child: SvgPicture.asset(
path,
width: iconSize,
height: iconSize,
fit: BoxFit.contain,
colorFilter:
iconColor != null
? ColorFilter.mode(iconColor!, BlendMode.srcIn)
: null,
),
);
}
return Center(
child: Image.asset(
icon as String,
path,
width: iconSize,
height: iconSize,
color: iconColor,
@@ -60,21 +60,21 @@ class _TaskScreenState extends State<TaskScreen> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
GpOutlineButton(
icon: 'assets/icons/pause.png',
icon: 'assets/icons/resume.svg',
onTap: () {
// 处理开始按钮点击事件
},
),
const SizedBox(width: 12),
GpOutlineButton(
icon: 'assets/icons/pause.png',
icon: 'assets/icons/pause.svg',
onTap: () {
// 处理暂停按钮点击事件
},
),
const SizedBox(width: 12),
GpOutlineButton(
icon: 'assets/icons/pause.png',
icon: 'assets/icons/delete.svg',
onTap: () {
// 处理删除按钮点击事件
},
@@ -109,23 +109,23 @@ class _TaskScreenState extends State<TaskScreen> {
bottomRightStatusText: '下载中', // 状态文本
actionButtons: [
GpIconButton(
icon: Icons.pause,
icon: 'assets/icons/item_pause.svg',
onTap: () => print('暂停任务 $index'),
),
GpIconButton(
icon: Icons.delete,
icon: 'assets/icons/item_delete.svg',
onTap: () => print('删除任务 $index'),
),
GpIconButton(
icon: Icons.folder_open,
onTap: () => print('打开所在位置 $index'),
icon: 'assets/icons/item_reveal.svg',
onTap: () => print('打开所在·位置 $index'),
),
GpIconButton(
icon: Icons.info,
icon: 'assets/icons/item_info.svg',
onTap: () => print('查看信息 $index'),
),
GpIconButton(
icon: Icons.more_vert,
icon: 'assets/icons/item_more.svg',
onTap: () => print('更多操作 $index'),
),
],
@@ -149,23 +149,23 @@ class _TaskScreenState extends State<TaskScreen> {
bottomRightStatusText: '已完成', // 状态文本
actionButtons: [
GpIconButton(
icon: Icons.pause,
onTap: () => print('暂停任务 $index'),
icon: 'assets/icons/item_resume.svg',
onTap: () => print('重新下载任务 $index'),
),
GpIconButton(
icon: Icons.delete,
icon: 'assets/icons/item_delete.svg',
onTap: () => print('删除任务 $index'),
),
GpIconButton(
icon: Icons.folder_open,
icon: 'assets/icons/item_reveal.svg',
onTap: () => print('打开所在位置 $index'),
),
GpIconButton(
icon: Icons.info,
icon: 'assets/icons/item_info.svg',
onTap: () => print('查看信息 $index'),
),
GpIconButton(
icon: Icons.more_vert,
icon: 'assets/icons/item_more.svg',
onTap: () => print('更多操作 $index'),
),
],
@@ -189,23 +189,23 @@ class _TaskScreenState extends State<TaskScreen> {
bottomRightStatusText: '失败', // 状态文本
actionButtons: [
GpIconButton(
icon: Icons.pause,
onTap: () => print('暂停任务 $index'),
icon: 'assets/icons/item_resume.svg',
onTap: () => print('重试任务 $index'),
),
GpIconButton(
icon: Icons.delete,
icon: 'assets/icons/item_delete.svg',
onTap: () => print('删除任务 $index'),
),
GpIconButton(
icon: Icons.folder_open,
icon: 'assets/icons/item_reveal.svg',
onTap: () => print('打开所在位置 $index'),
),
GpIconButton(
icon: Icons.info,
icon: 'assets/icons/item_info.svg',
onTap: () => print('查看信息 $index'),
),
GpIconButton(
icon: Icons.more_vert,
icon: 'assets/icons/item_more.svg',
onTap: () => print('更多操作 $index'),
),
],
+1 -1
View File
@@ -19,7 +19,7 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos
SPEC CHECKSUMS:
FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
screen_retriever_macos: 776e0fa5d42c6163d2bf772d22478df4b302b161
window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8
+21 -21
View File
@@ -13,10 +13,10 @@ packages:
dependency: transitive
description:
name: async
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
url: "https://pub.dev"
source: hosted
version: "2.13.0"
version: "2.12.0"
boolean_selector:
dependency: transitive
description:
@@ -61,10 +61,10 @@ packages:
dependency: transitive
description:
name: fake_async
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
url: "https://pub.dev"
source: hosted
version: "1.3.3"
version: "1.3.2"
flutter:
dependency: "direct main"
description: flutter
@@ -132,26 +132,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
url: "https://pub.dev"
source: hosted
version: "11.0.2"
version: "10.0.8"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
url: "https://pub.dev"
source: hosted
version: "3.0.10"
version: "3.0.9"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "3.0.1"
lints:
dependency: transitive
description:
@@ -212,10 +212,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1"
sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
url: "https://pub.dev"
source: hosted
version: "7.0.1"
version: "6.1.0"
plugin_platform_interface:
dependency: transitive
description:
@@ -313,10 +313,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
url: "https://pub.dev"
source: hosted
version: "0.7.6"
version: "0.7.4"
typed_data:
dependency: transitive
description:
@@ -353,18 +353,18 @@ packages:
dependency: transitive
description:
name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
url: "https://pub.dev"
source: hosted
version: "15.0.2"
version: "14.3.1"
web:
dependency: transitive
description:
@@ -385,10 +385,10 @@ packages:
dependency: transitive
description:
name: xml
sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted
version: "6.6.1"
version: "6.5.0"
sdks:
dart: ">=3.8.0 <4.0.0"
dart: ">=3.7.2 <4.0.0"
flutter: ">=3.29.0"