Aus öffentlichen Paketdaten erstellte Orientierung.
Ein Flutter-Plugin für macOS, das Zugriff auf die integrierten UI-Element-Farben von AppKit bietet und eine konsistente native Darstellung in Flutter-Anwendungen auf macOS ermöglicht. Es mappt Systemfarbkonstanten aus dem AppKit-Framework von Apple wie Fensterhintergrund, Steuerelementtönung und Textfarben ab, um eine Übereinstimmung mit den macOS-Designrichtlinien sicherzustellen. Dieses Paket vereinfacht das Thema durch direkten Zugriff auf plattformspezifische Farbwerte ohne manuelle Konfiguration.
Anwendungsfälle
Übereinstimmende macOS-System-UI-Asthetik
Native aussehende Flutter-Apps auf macOS erstellen
Vereinfachung der Thema-Implementierung für macOS
Konsistenz mit Systemfarbschemata sicherstellen
Entwicklung von plattformübergreifenden Anwendungen mit macOS-spezifischen Stilen
Hauptmerkmale
Zugriff auf native UI-Element-Farben von AppKit
Nahtlose Integration mit macOS Flutter-Apps
Automatische Synchronisierung mit Systemthemen
Minimale Einrichtung erforderlich
Unterstützt dynamische Farbaktualisierungen
Geeignet für
Flutter-Entwickler, die auf macOS abzielen
Apps, die native macOS-Visuelle Konsistenz erfordern
Designer konzentrierten sich auf die plattformspezifische UI-Fidelity
Projekte mit macOS-spezifischer Thematisierung
Hinweise
Nur auf die macOS-Plattform beschränkt
Abhängig von der verfügbaren AppKit-Unterstützung
Kann zusätzliche Behandlung für Dunkelmodusübergänge erfordern
Nicht anwendbar auf nicht-macOS-Plattformen
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
appkit_ui_element_colors
A Flutter plugin that exposes AppKit’s “UI Element Colors” to facilitate the
retrieval of standard color objects for use with windows, controls, labels, text,
selections and other content in your app.
Each color can be retrieved as a Color object using the AppkitUiElementColors.getColor method:
final darkWindowBackgroundColor = awaitAppkitUiElementColors.getColor(
uiElementColor: UiElementColor.windowBackgroundColor,
appearance: NSAppearanceName.darkAqua,
);
Alternatively, it can also be converted to any available NSColorSpace and retrieved as a map of requested NSColorComponents using AppkitUiElementColors.getColorComponents:
Certain events, such as the user changing their preferred accent color, can trigger system color changes. Such changes can be observed using the SystemColorObserver class. The AppkitUiElementColors class provides a global shared instance of SystemColorObserver that can be accessed as follows:
By default, UiElementColorBuilder uses a
SharedUiElementColorContainerInstanceProvider to provide a global
shared instance of UiElementColorContainer.
SharedUiElementColorContainerInstanceProvider uses an instance of
MediaQueryData derived from the current BuildContext and assumes it to
be the same across all UiElementBuilders which use it.
If your app contains surfaces with different MediaQueryData overrides,
use OwnedUiElementColorContainerInstanceProvider instead:
// A dark cupertino theme.CupertinoTheme(
data: constCupertinoThemeData(
brightness: Brightness.dark,
),
// Override the MediaQueryData so that platformBrightness is dark.
child: MediaQuery(
data: MediaQuery.of(context).copyWith(
platformBrightness: Brightness.dark,
),
child: UiElementColorBuilder(
// Since there may be surfaces within the app that do not override the// brightness, use an OwnedUiElementColorContainerInstanceProvider.
uiElementColorContainerInstanceProvider:
OwnedUiElementColorContainerInstanceProvider(),
builder: (context, colorContainer) => Container(
color: colorContainer.windowBackgroundColor,
),
),
),
);
Incorrect usage of SharedUiElementColorContainerInstanceProvider throws the following assertion error:
“Found conflicting MediaQueryData in SharedUiElementColorContainerInstanceProvider. If you are using UiElementColorBuilder within widget subtrees with differing MediaQueryData (such as different theme brightness or accessibility settings), please use OwnedUiElementColorContainerInstanceProvider instead.”