Moon Design System for Flutter 提供了一組協調一致的可主題化與可擴展元件,符合 Moon Design System 的標準。專為跨平台一致性設計,讓開發者能在 Android、iOS、Web、macOS、Windows 與 Linux 上建立視覺統一的應用程式。系統支援自訂主題,並透過簡單的 pub 命令輕鬆整合。具備完善的元件文件與對可存取性及可擴展性的重視,簡化 UI 開發流程,同時維持設計完整性。
The current major release, v1.0.0, will be maintained as-is and will not receive further updates, except for patches. The v1 theming is based on the soon-to-be deprecated Moon Design Figma v1 and lacks flexibility. For greater control over theming with v1 of moon_flutter, it is recommended to create custom wrapper widgets around the moon_flutter widgets that align with your project's specific theming requirements.
There is ongoing background work for v2 which aims to be more modular, scalable and themable.
Declare tokens variable and optionally override values:
final lightTokens = MoonTokens.light.copyWith(
colors: MoonColors.light.copyWith(
piccolo: Colors.blue,
textPrimary: Colors.amber,
),
typography: MoonTypography.typography.copyWith(
heading: MoonTypography.typography.heading.apply(
// Using variable font and bumping down the font weight compared to the// baseline 600 for heading.
fontFamily: "DMSans",
fontWeightDelta: -1,
fontVariations: [constFontVariation('wght', 500)],
),
),
);
final lightTheme = ThemeData.light().copyWith(
extensions: <ThemeExtension<dynamic>>[MoonTheme(tokens: lightTokens)],
);