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

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

build_context

एक पैकेज जो BuildContext में सबसे अधिक उपयोग किए जाने वाले गुणों/फ़ंक्शन्स को आसानी से प्राप्त करने में सहायता करता है।

30-दिन डाउनलोड
169
लाइक
145
Pub अंक
60

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

flutter pub add build_context

पैकेज अवलोकन

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

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

उपयोग

  • विजेट्स में थीम पहुँच को सरल बनाना
  • संदर्भ के साथ त्वरित नेविगेशन
  • मीडिया क्वेरी डेटा एक्सेस करना
  • पुनरावृत्ति संदर्भ खोजों को कम करना
  • विजेट पठनीयता में सुधार करना

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

  • उपयोगी विधियों के साथ BuildContext का विस्तार करें
  • बॉलरप्लेट कोड कम करता है
  • थीम और मीडिया क्वेरी शॉर्टकट प्रदान करता है
  • नेविगेशन सहायता शामिल है
  • हल्का और एकीकरण के लिए आसान

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

  • स्पष्ट कोड चाहने वाले विकासकर्ता
  • अक्सर संदर्भ का उपयोग करने वाले प्रोजेक्ट
  • कोड रखरखाव के प्रति ध्यान देने वाली टीमें
  • Flutter शुरुआती लोग संदर्भ पैटर्न सीख रहे हैं
  • जटिल UI लेआउट वाले ऐप्स

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

  • बंडल के आकार में थोड़ा वृद्धि हो सकती है
  • मूलभूत उपयोगिता विस्तार तक सीमित
  • उन्नत कस्टम संदर्भ तर्क के लिए उपयुक्त नहीं
  • BuildContext के मूल बातों को समझने की आवश्यकता है
  • उचित राज्य प्रबंधन के साथ उपयोग करना सबसे अच्छा है

मूल README

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

Languages: English | Brazilian Portuguse

Logo

BuildContext

Access most used properties in your BuildContext instance. This package relies on Dart's extension to provide easy access for the most used properties and functions that depends on the BuildContext instance.

Available Extensions

I update this package frequently to add more extensions, bellow you can see the currently available extensions in the latest version.

From the MediaQuery. Access properties right in the context instance. Available extensions:
  • context.mediaQuerySize

  • context.orientation

  • context.mediaQueryPadding

  • context.alwaysUse24HourFormat

  • context.devicePixelRatio

  • context.platformBrightness

  • context.textScaleFactor

  • context.isLandscape

  • context.isPortrait

  • context.mediaQueryViewPadding

  • context.mediaQueryViewInsets

  • context.mediaQueryShortestSide

  • context.isPhone

  • context.isTablet

  • context.isSmallTablet

  • context.isLargeTablet

From the Navigator class. Navigate with ease. Available extensions:
  • context.push()
  • context.pop()
  • context.canPop()
  • context.pushNamed()
  • context.popUntil()
From the Theme class. Access your themes right in the context instance. Available extensions:
  • context.theme
  • context.textTheme
  • context.primaryTextTheme
  • context.accentTextTheme
  • context.bottomAppBarTheme
  • context.bottomSheetTheme
  • context.appBarTheme
  • context.backgroundColor
  • context.primaryColor
  • context.buttonColor
  • context.scaffoldBackgroundColor
  • context.platform
  • context.isAndroid
  • context.isIOS
  • context.isWindows
  • context.isMacOS
  • context.isLinux
  • context.isFuchsia
  • context.headline1
  • context.headline2
  • context.headline3
  • context.headline4
  • context.headline5
  • context.headline6
  • context.subtitle1
  • context.bodyText1
  • context.bodyText2
  • context.caption
  • context.button
  • context.subtitle2
  • context.overline
From Scaffold class. Handle your scaffold in their context.

Note: those must be called in the context of a Scaffold widget otherwise you might have errors.

  • context.openDrawer()
  • context.openEndDrawer()
  • context.showSnackBar()
  • context.hideCurrentSnackBar()
  • context.removeCurrentSnackBar()
  • context.showBottomSheet()
From Form.of(context) class.

Note: those must be called in the context of a Scaffold widget otherwise you might have errors.

  • context.form.validate()
  • context.form.reset()
  • context.form.save()
From FocusScope.of(context) class.
  • context.focusScope.hasFocus

  • context.focusScope.isFirstFocus

  • context.focusScope.canRequestFocus

  • context.focusScope.hasPrimaryFocus

  • context.focusScope.unfocus()

  • context.focusScope.nextFocus()

  • context.focusScope.requestFocus()

  • context.focusScope.previousFocus()

  • context.focusScope.setFirstFocus()

  • context.focusScope.consumeKeyboardToken()

  • context.closeKeyboard()

From ModalRoute.of(context) class.
  • context.modalRoute
  • context.routeSettings

Install

Add it in your pubspec.yaml:

dependencies:
  build_context: ^3.0.0

Import it where you want to use it e.g, in your widget's file.

import "package:build_context/build_context.dart";

Here is a usage example:

import 'package:flutter/material.dart';
import "package:build_context/build_context.dart";

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: context.scaffoldBackgroundColor, // There is no Theme.of(context)
      body: Center(
        child: GestureDetector(
          onTap: () => context.pushNamed('/detailsPage'), // we use only context not Navigator.of(context)
          child: Text(
            'Press Me',
            style: context.primaryTextTheme.title, // we use only context not Theme.of(context)
          ),
        ),
      ),
    );
  }
}

Support

You liked this package? then give it a star. If you want to help then:

  • Start this repository
  • Send a Pull Request with new features
  • Share this package
  • Create issues if you find a Bug or want to suggest something

श्रेणियाँ

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

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