vgv-ui-package
UI Package
Best practices for creating a Flutter UI package — a reusable widget library that builds on top of package:flutter/material.dart, extending it with app-specific components, custom design tokens via ThemeExtension, and a consistent API surface.
Theming foundation: This skill focuses on UI package structure, widget APIs, and testing. For foundational Material 3 theming (
ColorScheme,TextTheme, component themes, spacing constants, light/dark mode), see the Material Theming skill (/vgv-material-theming). The two skills are complementary — Material Theming covers how to set up and useThemeData; this skill covers how to extend it withThemeExtensiontokens and package reusable widgets around it.
Core Standards
Apply these standards to ALL UI package work:
- Build on Material — depend on
flutter/material.dartand compose Material widgets; do not rebuild primitives that Material already provides - One widget per file — each public widget lives in its own file named after the widget in snake_case (e.g.,
app_button.dart) - Barrel file for public API — expose all public widgets and theme classes through a single barrel file (e.g.,
lib/my_ui.dart) that also re-exportsmaterial.dart - Extend theming with
ThemeExtension— use Material'sThemeData,ColorScheme, andTextThemeas the base (see Material Theming skill); add app-specific tokens (spacing, custom colors) viaThemeExtension<T> - Every widget has a corresponding widget test — behavioral tests verify interactions, callbacks, and state changes
- Prefix all public classes — use a consistent prefix (e.g.,
App,Vg) to avoid naming collisions with Material widgets - Use
constconstructors everywhere possible — all widget constructors must beconstwhen feasible - Document every public member — every public class, constructor parameter, and method has a dartdoc comment
More from verygoodopensource/vgv-ai-flutter-plugin
vgv-accessibility
Flutter accessibility auditing and remediation with WCAG 2.1 level selection (A, AA, AAA) across mobile, desktop, and web platforms. Begins by asking the WCAG conformance level and target platform(s) before applying level-appropriate, platform-aware criteria.
3vgv-bloc
Best practices for Bloc state management in Flutter/Dart. Use when writing, modifying, or reviewing code that uses package:bloc, package:flutter_bloc, or package:bloc_test.
2vgv-testing
Best practices for Dart unit tests, Flutter widget tests, and golden file tests. Use when writing, modifying, or reviewing tests that use package:test, package:flutter_test, package:mocktail, or package:bloc_test.
2vgv-navigation
Best practices for navigation and routing in Flutter using GoRouter. Use when creating, modifying, or reviewing routes, deep links, redirects, or navigation logic that uses package:go_router or package:go_router_builder.
2vgv-static-security
>
2vgv-layered-architecture
Best practices for VGV layered monorepo architecture in Flutter. Use when structuring a multi-package Flutter app, creating data or repository packages, defining layer boundaries, or wiring dependencies between packages.
2