सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
Helpers एक Flutter/Dart पैकेज है जो आम कार्यों के लिए सहज, पठनीय विस्तार प्रदान करके दोहराए जाने वाले और विस्तृत कोड को सरल बनाने के लिए डिज़ाइन किया गया है। यह जटिल या मुश्किल विधियों को साफ, व्यक्तिगत वाक्य रूप में बदलकर विकासकर्मियों की उत्पादकता को बढ़ाता है। विशेष रूप से widget निर्माण, राज्य प्रबंधन और UI तर्क को सरल बनाने के लिए उपयुक्त है, जो कोड की स्पष्टता और रखरखाव को बढ़ावा देता है। पैकेज हल्का है और अतिरिक्त भार नहीं जोड़े बिना विकासकर्मी के अनुभव को सुधारने पर केंद्रित है।
उपयोग
विजेट निर्माण को सरल बनाना
शर्ती तर्क की पठनीयता में सुधार
राज्य प्रबंधन को सुगम बनाना
UI कोड में बॉयलरप्लेट कम करना
कोड रखरखाव में सुधार करना
मुख्य विशेषताएँ
स्पष्ट विस्तार विधियाँ
कोड की बहुलता को कम करता है
पठनीयता में सुधार
हल्का डिज़ाइन
डेवलपर अनुभव पर ध्यान केंद्रित करें
इनके लिए उपयुक्त
स्पष्ट कोड चाहने वाले Flutter विकासकर्ता
कोड पठनीयता को प्राथमिकता देने वाली टीमें
UI तर्क में उच्च पुनरावृत्ति वाले प्रोजेक्ट्स
कार्यात्मक-शैली कोडिंग का उपयोग करने वाले विकासकर्ता
विचार योग्य बातें
सीमित प्लेटफॉर्म समर्थन (कोई निर्दिष्ट प्लेटफॉर्म नहीं)
बाहरी स्रोत कोड पर निर्भर करता है
नए सिंटैक्स पैटर्न सीखने की आवश्यकता हो सकती है
कोड स्पष्टता को प्राथमिकता देने वाले परियोजनाओं के लिए सबसे उपयुक्त
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
printPink("I'm an error 凸-_-凸", true);
printYellow("I'm an alert (¯―¯٥)");
printCyan("I'm an info (✿◠‿◠)");
printColor(
"I'm a weird boy ¯\\(°_o)/¯",
PrintColorStyle(
prefix: "Hola baby!",
foreground: Colors.green,
background: Colors.black,
underline: true,
bold: true,
italic: true,
),
);
printColor(
"Controller disposed!",
PrintColorStyle(
bold: true,
prefix: "HELPERS",
foreground: Colors.orangeAccent,
),
);
Misc Helpers
Misc Class:
It is a simplification of many instructions.
double milliseconds = 200;
//CALLBACKSMisc.onLayoutRendered(() {}); //HelperWidgetsBinding.instance.addPostFrameCallback((_) {});
//TIMER-ASYNCMisc.delayed(milliseconds, () {}); //HelperFuture.delayed(Duration(milliseconds: milliseconds), () {});
Misc.timer(milliseconds, () {}); //HelperTimer(Duration(milliseconds: milliseconds), () {});
Misc.periodic(milliseconds, () {}); //HelperTimer.periodic(Duration(milliseconds: milliseconds), () {});
awaitMisc.wait(milliseconds); //HelperawaitFuture.delayed(Duration(milliseconds: milliseconds), () {});
//TEXTText(Misc.loremIpsum());
Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
Text(Misc.extendedLoremIpsum());
Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." +
"Ut enim ad minim veniam, quis nostrud exercitation " +
"ullamco laboris nisi ut aliquip ex ea commodo consequat.");
//SYSTEM (NOTE: SystemChrome NEED IMPORT FLUTTER SERVICES)Misc.setSystemOverlayStyle(...); //HelperSystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(...));
Misc.setSystemOverlay(SystemOverlay.portraitUp); //HelperSystemChrome.setSystemUIOverlay([SystemUiOverlay.portraitUp]);
Misc.setSystemOrientation(SystemOrientation.values); //HelperSystemChrome.setPreferredOrientations(DeviceOrientation.values)
SystemOverlay Class:
This is a simplification of the List type: SystemUiOverlay statement. It is used for the Misc.setSystemOverlayStyle() statement.
IMPROVEMENT: By using the SystemOverlay you will not need to import SystemChrome, DeviceOrientation from the flutter services.
This is a simplification of the List type: DeviceOrientation statement. It is used for the Misc.setSystemOrientation() statement.
IMPROVEMENT: By using the SystemOrientation you will not need to import SystemChrome, DeviceOrientation from the flutter services.
It is a simplification of Navigator without BuildContext statement.
//If you will use BuildRoute, then need navigatorKeyMaterialApp(
navigatorKey: BuildRoute.key,
home: App(),
);
BuildRoute.to(page);
BuildRoute.goBack();
BuildRoute.toReplacement(page);
BuildRoute.toAndRemoveUntil(page);
BuildRoute.toTransparentPage(page); //NOTE: Push a Route with transparent backgroundBuildRoute.toNamedAndRemoveUntil("/");
BuildRoute.toNamed("/");
---
Size Helpers
Margin Class:
It is a simplification of the EdgeInsets statement.
It is an AnimatedBuilder. If it is TRUE, it will execute the Tween from begin to end (controller.forward()), if it is FALSE it will execute the Tween from end to begin (controller.reverse())