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

पैकेज विवरणv0.1.1

dimensions_theme

फ्लटर थीम के भीतर एप्लिकेशन आयामों को परिभाषित करें।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
148
लाइक
24
Pub अंक
150

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

flutter pub add dimensions_theme

पैकेज अवलोकन

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

dimensions_theme पैकेज डेवलपर्स को एफ्लटर थीम में ऐप आयामों को सीधे परिभाषित और प्रबंधित करने की अनुमति देता है, जिससे विभिन्न स्क्रीन आकारों पर स्थिर और प्रतिक्रियाशील UI डिज़ाइन सुनिश्चित होता है। थीम में आयाम स्थिरांक को एकीकृत करके, इससे बाहरी कॉन्फ़िगरेशन या कड़े मूल्यों पर निर्भरता के बिना लेआउट समायोजन सरल हो जाता है। यह दृष्टिकोण विशेष रूप से जटिल लेआउट वाले बड़े एप्लिकेशन में रखरखाव और स्केलेबिलिटी को बढ़ाता है। पैकेज सभी प्रमुख प्लेटफॉर्म का समर्थन करता है, जिससे क्रॉस-प्लेटफॉर्म सुसंगतता सुनिश्चित होती है।

उपयोग

  • प्रतिक्रियाशील लेआउट प्रबंधन
  • केंद्रीकृत आयाम विन्यास
  • क्रॉस-प्लेटफ़ॉर्म यूआई सामंजस्य
  • थीम-आधारित स्पेसिंग और साइज़िंग
  • UI स्केलिंग को सरल बनाना
  • डिज़ाइन सिस्टम अखंडता बनाए रखना

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

  • ThemeData में आयामों को एकीकृत करता है
  • प्लेटफॉर्म-अनुकूल आकार का समर्थन करता है
  • गतिशील थीम-आधारित आयाम सक्षम करता है
  • कठोर मानों पर निर्भरता कम करता है
  • डिज़ाइन सिस्टम संरेखण में सहायता करता है
  • मौजूदा थीम्स के साथ बिना किसी दिक्कत के काम करता है

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

  • बड़े पैमाने पर Flutter एप्लिकेशन
  • डिज़ाइन सिस्टम कार्यान्वयन
  • क्रॉस-प्लेटफॉर्म विकास
  • UI सुसंगतता को प्राथमिकता देने वाली टीमें
  • थीम-आधारित स्टाइलिंग का उपयोग करने वाले डेवलपर्स

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

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

मूल README

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

📏 dimensions_theme

dimensions_theme provides a theme extension to easily define and access app dimensions such as blank spaces, padding, border radius, and other dimensions within the Flutter theme.

Define your dimensions

// Uses tokens that best fit your project needs. You can also use multiple enums
enum Dimension {
  xlarge,
  large,
  medium,
  small,
  xsmall,
}

...

MaterialApp(
  theme: ThemeData(
    extensions: const [
      DimensionsTheme({
        Dimension.xlarge: 20,
        Dimension.large: 16,
        Dimension.medium: 12,
        Dimension.small: 8,
        Dimension.xsmall: 4,
      }),
    ],
  ),
);
Uses multiple enum for dimensions

The Dimensions theme extension supports using multiple enums as dimension tokens. This can be useful if you want to give different kinds of dimensions value their own enum.

enum Space {
  xlarge,
  large,
  medium,
  small,
  xsmall,
}

enum Padding {
  xlarge,
  large,
  medium,
  small,
  xsmall,

  screen,
}

...

MaterialApp(
  theme: ThemeData(
    extensions: const [
      DimensionsTheme({
        Space.xlarge: 20,
        Space.large: 16,
        Space.medium: 12,
        Space.small: 8,
        Space.xsmall: 4,

        Padding.xlarge: 20,
        Padding.large: 16,
        Padding.medium: 12,
        Padding.small: 8,
        Padding.xsmall: 4,
        Padding.screen: 20,
      }),
    ],
  ),
);

Consume dimensions values

You can access any dimension value using the get:

Dimensions.of(context).get(Dimension.small);

Additionally, this package provides helpers to make it easier to work with defined dimensions.

Padding

The padding context extension constructs EdgeInsets using the values defined in the dimensions theme for a given dimension token.

Padding(
  padding: context.padding.all(Dimension.small)
  child: ...
)

This extension provides counterparts to all EdgeInsets constructors but uses Dimension tokens instead of raw double values.

context.padding.all(Dimension.small)

context.padding.symmetric(
  horizontal: Dimension.medium,
  vertical: Dimensions.small,
)

context.padding.only(
  left: Dimension.large
  top: Dimension.large,
)
Blank spaces

The Space widget creates a SizedBox with the values defined in the dimensions theme for a given dimension token.

Column(
  children: [
    SomeWidget(),
    Space(Dimensions.small),
    SomeWidget(),
  ]
)

Alternatively, you can use the SpaceDimensionsMixin to construct Space widgets directly from your tokens:

/// Add `SpaceDimensionsMixin` to your dimension token responsible for spaces
enum Spaces with SpaceDimensionsMixin {
  large,
  medium
  small,
}

...

Column(
  children: [
    SomeWidget(),
    Spaces.small(),
    SomeWidget(),
  ]
)

All space widgets come with .w and .h constructors to restrict the blank space in one axis, respectively width and height.

Space.h(Dimensions.small)
Space.w(Dimensions.small)

Spaces.small.h()
Spaces.small.w()
Border radius

The radius context extension constructs Radius using the values defined in the dimensions theme for a given dimension token.

Container(
  decoration: BoxDecoration(
    borderRadius: BorderRadius.all(
      context.radius.circular(Dimensions.large),
    ),
  ),
)

This extension provides counterparts to all Radius constructors but uses Dimension tokens instead of raw double values.

context.radius.elliptical(Dimensions.large);
context.radius.circular(Dimensions.small, Dimensions.large);

The extension also provides a counterpart to BorderRadius.circular().

Container(
  decoration: BoxDecoration(
    borderRadius: borderRadius.circular(Dimensions.large),
  ),
)

श्रेणियाँ

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

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

अभी कोई डेटा उपलब्ध नहीं है।