पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv3.3.0

system_theme

एक फ्लटर प्लगइन जो सिस्टम के एक्सेंट रंग को प्राप्त करने और सुनने के लिए है। इसमें एंड्रॉइड, आईओएस, वेब, विंडोज, मैकओएस और लिनक्स का समर्थन है।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
8.3 हज़ार
लाइक
123
Pub अंक
160

पैकेज इंस्टॉल करें

flutter pub add system_theme

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

system_theme पैकेज फ्लटर एप्लिकेशन को एंड्रॉइड, आईओएस, वेब, मैकओएस, विंडोज और लिनक्स सहित कई प्लेटफॉर्म पर सिस्टम के एक्सेंट कलर को एक्सेस और प्रतिक्रिया करने की अनुमति देता है। यह वर्तमान सिस्टम एक्सेंट कलर को प्राप्त करने और बदलावों को सुनने का एक सरल तरीका प्रदान करता है, जिससे डिवाइस-लेवल थीम के साथ ऐप यूआई की सुसंगतता बढ़ती है। मैन्युअल थीम मैनेजमेंट के बिना मूल नेटिव सिस्टम अस्तर के अनुकूल बनाने के लिए आदर्श है।

उपयोग

  • एप्लिकेशन यूआई में सिस्टम एक्सेंट रंग को मैच करें
  • सिस्टम प्राथमिकताओं के आधार पर डायनामिक थीम बनाना
  • मूल दिखावट और महसूस के साथ क्रॉस-प्लेटफ़ॉर्म ऐप्स बनाना
  • जब सिस्टम थीम बदलती है तो रंग स्वचालित रूप से अपडेट होते हैं
  • प्रणाली-निर्धारित रंग योजनाओं के साथ पहुँच को बढ़ावा देना

मुख्य विशेषताएँ

  • तत्काल प्रणाली एक्सेंट रंग परिवर्तनों का सुनना
  • सभी प्रमुख ऑपरेटिंग सिस्टम के लिए क्रॉस-प्लेटफॉर्म समर्थन
  • वर्तमान एक्सेंट रंग प्राप्त करने के लिए सरल API
  • जब सिस्टम थीम बदलती है तो स्वचालित अपडेट
  • हल्का और एकीकरण में आसान

इनके लिए उपयुक्त

  • मूल जैसे UI का लक्ष्य बनाने वाले विकासकर्ता
  • गतिशील थीम अनुकूलन की आवश्यकता वाले ऐप्स
  • प्राप्त करने और उपयोगकर्ता अनुभव पर केंद्रित परियोजनाएं
  • क्रॉस-प्लेटफॉर्म Flutter एप्लिकेशन
  • निर्माता जो निरंतर प्रणाली एकीकरण चाहते हैं

विचार योग्य बातें

  • सीमित एक्सेंट रंग; पूर्ण थीम मोड का प्रबंधन नहीं करता
  • प्लेटफॉर्म के बीच व्यवहार में थोड़ा अंतर हो सकता है
  • कुछ ओएस पर प्लेटफॉर्म-विशिष्ट अनुमतियाँ आवश्यक हैं
  • एक्सेंट रंगों से आगे की जटिल थीम प्रबंधन के लिए उपयुक्त नहीं
  • प्रणाली-स्तरीय रंग उपलब्धता पर निर्भर करता है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

system_theme

A flutter plugin to retrieve the current system theme information

Supported platforms
Platform Accent Color Listen to Color Changes Minimum Version
Android ✔️ Android 10+
iOS ✔️ iOS 14+
Windows ✔️ ✔️ Windows 10+
macOS ✔️ ✔️ Mojave 10.14+
Linux ✔️ GTK 3+
Web ✔️ All modern browsers

Usage

Import it:

import 'package:system_theme/system_theme.dart';
Get system accent color

Use the getter SystemTheme.accentColor.accent to get the accent color.

final accentColor = SystemTheme.accentColor.accent;

To reload the accent colors, use the method load():

await SystemTheme.accentColor.load();

You can load the colors before running the app, so the colors can't be wrong at runtime:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await SystemTheme.accentColor.load();
  runApp(MyApp());
}
Configure a fallback accent color

To avoid unexpected outcomes at runtime, it's recommended to configure your own fallback color. The fallback color is used if the system is not able to provide the color.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  SystemTheme.fallbackColor = const Color(0xFF865432);
  await SystemTheme.accentColor.load();

  runApp(MyApp());
}
Listen to changes on the system accent color

To simply listen to changes on the system accent color, use the SystemTheme.onChange stream:

SystemTheme.onChange.listen((event) {
  debugPrint('Accent color changed to ${event.accentColor}');
});

Alteratively, you can the SystemThemeBuilder widget to listen to changes on the system accent color:

SystemThemeBuilder(
  builder: (context, color) {
    return ColoredBox(
      color: color.accent, // Automatically updates when system theme changes
      child: const Center(
        child: Text('System Accent Color'),
      ),
    );
  },
);
Notes

On iOS 14 and later, this is the application's SwiftUI accent color (for example, the accent configured in the app's asset catalog), or the platform's app-level default when none is configured. Unlike Windows and macOS, iOS does not expose an equivalent global user-selected system accent color. If the app accent is unavailable or cannot be converted, the existing fallback or last loaded palette is retained. iOS does not automatically report accent changes; call load() to refresh it.

Contribution

See native testing for platform test commands and manual verification steps.

Feel free to open an issue if you find an error or make pull requests.

Acknowlegments

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 1 आइटम

  • system_theme_web^0.0.5

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट