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

scaled_app कवर
पैकेज विवरणv2.3.2

scaled_app

सभी UI डिजाइन को अनुपात में स्केल करें, जब आपका UI डिजाइन निश्चित चौड़ाई के होता है तो उपयोगी होता है।

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

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

flutter pub add scaled_app

पैकेज अवलोकन

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

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

उपयोग

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

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

  • आनुपातिक UI स्केलिंग
  • संदर्भ डिज़ाइन चौड़ाई समर्थन
  • प्लेटफॉर्म के अनुकूलता
  • स्वचालित विजेट आकार समायोजन
  • आवश्यक न्यूनतम कॉन्फ़िगरेशन

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

  • निर्धारित चौड़ाई डिज़ाइन विशिष्टताओं वाले विकासकर्मी
  • डिज़ाइन प्रणाली का उपयोग करने वाली टीमें
  • कई स्क्रीन आकारों के लिए लक्षित ऐप्स
  • पिक्सेल-परफेक्ट UI प्रतिलिपि की आवश्यकता वाले प्रोजेक्ट्स
  • कठोर डिज़ाइन सीमाओं वाले Flutter ऐप्स

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

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

मूल README

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

Scale the entire UI design proportionally.

Button, image, font, every widget is scaled simultaneously.

Before:

  • 250x250 square is the same size across devices

Screenshots of the same design before scaling

After:

  • 250x250 square is two thirds the screen width across devices

Screenshots of the same design after scaling

  • if we resize the screenshots above to be the same width
  • then everything appears the same size as below

Resized screenshots of the same design after scaling

Sponsor

庞征博引 — 想学的,慢慢都会

This package is sponsored by 庞征博引, which breaks complex subjects into 5–10 minute reads you work through, and ask questions about, at your own pace.

Live demo

https://lastmonopoly.github.io/flutter_web_app/scaled_app_demo/

Features

Use this package in your Flutter app when:

  • your UI design is fixed-width
  • you want to scale the entire UI, not just part of it

Usage

Firstly, replace runApp with runAppScaled

void main() {
  // 1st way to use this package
  runAppScaled(const MyApp(), scaleFactor: (deviceSize) {
    // screen width used in your UI design
    const double widthOfDesign = 375;
    return deviceSize.width / widthOfDesign;
  });
}

Or, replace WidgetsFlutterBinding with ScaledWidgetsFlutterBinding

void main() {
  // 2nd way to use this package
  // Scaling will be applied based on [scaleFactor] callback.
  ScaledWidgetsFlutterBinding.ensureInitialized(
    scaleFactor: (deviceSize) {
      // screen width used in your UI design
      const double widthOfDesign = 375;
      return deviceSize.width / widthOfDesign;
    },
  );
  runApp(const MyApp());
}

Then, use MediaQueryData.scale to scale size, viewInsets, viewPadding, etc.

class PageRoute extends StatelessWidget {
  const PageRoute({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MediaQuery(
      data: MediaQuery.of(context).scale(),
      child: const Scaffold(...),
    );
  }
}

Optionally, update ScaledWidgetsFlutterBinding.instance.scaleFactor to enable / disable scaling on demand.

Reference

https://juejin.cn/post/7078816723666731021

श्रेणियाँ

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

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

रैंकिंग