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

spaces कवर
पैकेज विवरणv0.5.0

spaces

सुसंगत और प्रतिक्रियाशील ऐप्स बनाने के लिए वैश्विक स्पेसिंग स्थिरांक परिभाषित करना।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
31
लाइक
18
Pub अंक
130

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

flutter pub add spaces

पैकेज अवलोकन

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

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

उपयोग

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

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

  • पूर्वनिर्धारित अंतराल स्थिरांक
  • प्रतिक्रियाशील स्पेसिंग समर्थन
  • प्लेटफॉर्म-अनुकूल डिज़ाइन
  • pub के माध्यम से आसान एकीकरण
  • साफ, पुनर्उपयोगी अंतराल मान

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

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

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

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

मूल README

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

logo

Spaces

Defining global spacing constants for building consistent and responsive apps.

Install

Add the dependency to your pubspec.yaml :

dependencies:
    spaces: <version>

Quick start

return MaterialApp(
    // Defining
    builder: (context, child) => Spacing(
        dataBuilder: (context) {
          final mediaQuery = MediaQuery.of(context);
          if (mediaQuery.size.width > 500) {
            return SpacingData.generate(30);
          }
          return SpacingData.generate(10);
        },
        child: child,
    ),
    home:Builder(builder: (context) {
        // Using
        final spacing = Spacing.of(context);
        return SpacedColumn.normal(
            padding: spacing.insets.all.semiBig,
            children: <Widget>[
                Text('hello'),
                Space.big(),
                Text('world'),
            ],
        );
      })
    ),
)

Usage

Configuring spacing

A Spacing widget should declare a global spacing configuration for your application.

return MaterialApp(
    builder: (context, child) => Spacing.fixed(
        data: SpacingData.generate(10.0), // This generates a set of spacing constants for your apps, from a base space of `10.0`.
        child: child,
    ),
    /// ...
)
Generate

By calling the Spacing.generate constructor, a set of constants are automatically generated from a single base value.

The generated values are :

  • extraSmall : value * 0.2
  • small : value * 0.4
  • semiSmall : value * 0.6
  • normal : value
  • semiBig : value * 1.5
  • big : value * 2.5
  • extraBig : value * 5.0
SpacingData.generate(10.0)
From spaces

If you want to define the various spacing values, you can use the

SpacingData.fromSpaces(
    extraSmall: 1.0,
    small: 2.0,
    semiSmall: 4.0,
    normal: 8.0,
    semiBig: 12.0,
    big: 20.0,
    extraBig: 100.0,
)

Responsive spacing

You can define the dataBuilder property of the Spacing constructor to generate a configuration from the given context.

Spacing(
    dataBuilder: (context) {
        final mediaQuery = MediaQuery.of(context);
        return SpacingData.generate(mediaQuery.size.width > 300.0 ? 20.0 : 10.0),
    },
    child: child,
)

Using constants

To access various spacing constants, simply use the Spacing.of(context) getter, or the context.spacing() extension method.

final spacing = Spacing.of(context);
// spacing.spaces.semiBig
Size variants

There are seven availables spacing constants : extraSmall, small, semiSmall, normal, semiBig, big, extraBig;

final spacing = Spacing.of(context);
return SizedBox(
    width: spacing.spaces.semiSmall,
);
Insets helpers

You have EdgeInsets presets available from <spacing>.insets.<selector>.<size>.

The available selectors are : all, horizontal, vertical, onlyLeft, onlyTop, onlyRight, onlyBottom, exceptLeft, exceptRight, exceptTop, exceptBottom.

final spacing = Spacing.of(context);
return Padding(
    padding: spacing.insets.exceptLeft.semiBig,
    child: Text('Hello'),
);

Widgets

Space

The Space widget uses gap under the hood to define a space in a Flex, Column, Row or Scrollable (such as ListView).

return Column(
    children: [
        Text('hello'),
        const Space.semiSmall(),
        Text('world'),
    ],
);
SpacedFlex / SpacedColumn / SpacedRow

Like Flex / Column / Row, but with additional padding and spaceBetween properties.

final spacing = Spacing.of(context);
return SpacedColumn.small(
    padding: spacing.insets.all.normal,
    children: [
        Text('hello'),
        Text('world'),
    ],
);

श्रेणियाँ

निर्भरताएँ

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

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

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

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