用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/G1Joshi/Agent-Skills --skill flutter命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | flutter |
| description | Flutter cross-platform UI toolkit with Dart. Use for mobile/web/desktop. |
Flutter is Google's UI toolkit for building natively compiled applications for mobile, web, and desktop from a single codebase. It uses the Dart programming language and the Skia/Impeller graphics engine to render high-performance, pixel-perfect UIs.
// main.dart
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
void main() {
runApp(const MyApp());
}
// Router configuration
final _router = GoRouter(
routes: [
GoRoute(
path: '/',
builder: (context, state) => const HomePage(),
),
],
);
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (_) => CounterCubit(),
child: MaterialApp.router(
routerConfig: _router,
theme: ThemeData(useMaterial3: true, colorSchemeSeed: Colors.blue),
),
);
}
}
// Bloc/Cubit Logic
class CounterCubit extends Cubit<int> {
CounterCubit() : super(0);
void increment() => emit(state + 1);
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
// Access state via context.read/watch or BlocBuilder
final count = context.select((CounterCubit cubit) => cubit.state);
return Scaffold(
appBar: AppBar(title: const Text('Flutter & Bloc')),
body: Center(
child: Text(
'Count: $count',
style: Theme.of(context).textTheme.headlineMedium,
),
),
floatingActionButton: FloatingActionButton(
onPressed: () => context.read<CounterCubit>().increment(),
child: const Icon(Icons.add),
),
);
}
}
Flutter uses a reactive style where the UI is built from a tree of immutable Widgets.
Modern Flutter apps often use the Bloc (Business Logic Component) pattern for separation of concerns and predictable state.
Dart is single-threaded but event-driven. Heavy computations should be moved to background Isolates to avoid blocking the UI thread (jank).
Organize files by feature rather than by layer.
lib/
src/
features/
auth/
data/
domain/
presentation/
bloc/
views/
products/
shared/
components/
constants/
app.dart
main.dart
Do:
const constructors everywhere possible to optimize rebuilds.GoRouter for deep linking and declarative navigation.flutter_bloc to separate business logic from UI.ThemeData and TextTheme for consistent styling.Don't:
build() methods.setState for complex global state.compute() for heavy JSON parsing or calculations.| Error | Cause | Solution |
140: | :--------------------------------------------- | :--------------------------------------------- | :----------------------------------------------------------- |
141: | RenderFlex overflowed by ... pixels | Content is too wide/tall for the parent. | Wrap in Expanded, Flexible, or SingleChildScrollView. |
142: | ProviderNotFoundException | Reading a Bloc without a provider up the tree. | Ensure BlocProvider wraps the widget trying to access it. |
143: | LateInitializationError | Accessing a late variable before assignment. | Ensure generic initialization or use nullable types locally. |
144: | Vertical viewport was given unbounded height | ListView inside Column without constraints. | Wrap ListView in Expanded or SizedBox. |