jars 0.0.1 copy "jars: ^0.0.1" to clipboard
jars: ^0.0.1 copied to clipboard

JARS is a super-effective and lightweight solution for Flutter. It combines front-end flutter widgets, intelligent dependency injection, and provider solutions like timeago, datetime format, multiling [...]

JARS

Leave a 👍 like if you like it

JARS is a super-effective and lightweight solution for Flutter. It combines front-end flutter widgets, intelligent dependency injection, and provider solutions like timeago, datetime format, multilingual support, textplus, rsnackbars, rtoast, and many others with high-performance.

Supported platforms #

Feature Android iOS Web MacOs Windows Linux
Get accent color ✔️ ✔️ ✔️ ✔️ ✔️ ✔️
Get dark mode ✔️ ✔️ ✔️ ✔️ ✔️ ✔️

Installing #

Add Get to your pubspec.yaml file:

dependencies:
  jars:
    git: https://github.com/rahulsharmadev-community/jars.git

Import get in files that it will be used:

import 'package:jars/jars.dart';

PlatformQuery APIs #

  /// Device's Orientation
  /// Similar to MediaQuery.of(context).orientation;
  PlatformQuery.orientation;

  // Platform display/screen Height
  // Equivalent to : MediaQuery.of(context).size.height,
  // but immutable.
  PlatformQuery.height;


  // Platform display/screen Width
  // Equivalent to : MediaQuery.of(context).size.height,
  // but immutable.
  PlatformQuery.width

  // The aspect ratio of platform display/screen size.
  // Equivalent to : MediaQuery.of(context).aspectRatio,
  // but immutable.
  PlatformQuery.aspectRatio

  // Platform display/screen Pixel Ratio
  // Equivalent to : MediaQuery.of(context).pixelRatio,
  // but immutable.
  PlatformQuery.pixelRatio

  /// Respective percentage of the viewport's smaller dimension.
  20.vmin;

  /// Respective percentage of the viewport's larger dimension.
  20.vmax;

  /// Calculates the height depending on the device's screen size
  20.h; // -> will return 20% of the screen's height

  /// Calculates the width depending on the device's screen size
  20.w // -> will return 20% of the screen's width

  /// Calculates the sp (Scalable Pixel) depending on the device's pixel
  /// density and aspect ratio
  14.sp // general use for fontsize

  /// Calculates the material dp (Pixel Density)
  /// (https://material.io/design/layout/pixel-density.html#pixel-density-on-android))
  16.dp // generally use for font, image and icons size.

  //Check in what platform the app is running
  PlatformQuery.isAndroid
  PlatformQuery.isIOS
  PlatformQuery.isMacOS
  PlatformQuery.isWindows
  PlatformQuery.isLinux
  PlatformQuery.isFuchsia

  //Check the device type
  PlatformQuery.isMobileorTablet
  PlatformQuery.isDesktop

  // Return an current platform, any one of them
  // web,
  // android,
  // fuchsia,
  // iOS,
  // linux,
  // macOS,
  // windows
  PlatformQuery.activePlatform

  /* [Window size](https://medium.com/@rahulsharmadev/responsive-design-theory-b8f18b257295)
Window size classes categorize the display area available to your app as compact,medium, or expanded. Available width and height are classified separately,so at any point in time, your app has two window size classes — one for width, one for /height. */
  //
  // Retun any one of them { compact, medium, expanded }
  PlatformQuery.activeWindowSize

  /// How to use?
  /// -------------------------------
  /// PlatformQueryBuilder(
  ///     builder: (ctx) {
  ///       String string =
  ///           'Hello <${TextStyle(color: Colors.red, fontSize: 20.sp,
  ///            backgroundColor: Colors.orange).toTextPlusStyle} = "World 😂"> I am hear.';
  ///       return TextPlus(string);
  ///     },
  ///   ),
  /// );
  ///--------------------------------
  /// **Recommendation to use it LESS**
  PlatformQueryBuilder(builder: (context) {
          return Widget;
        });

DateTimeFormat APIs #

It allows the user to choose from a set of standard date time formats with customized syntex.

Easy to use

 var date= DateTimeFormat(DateTime.now(),seprator: '/');
 print(date.yMMMd());

 Output ___________________
 |                         |
 |  Oct 30, 2022           |
 |_________________________|

For make it more easy to use, now you don't need to create a DateTimeFormat class object before using. look at the example below.


  var today = DateTime.now(); // Create an Object

  // Whether this time of day is before or after noon.
  // return DayPeriod.am | DayPeriod.pm;
  today.period;

  /// Which hour of the current period (e.g., am or pm) this time is.
  ///
  /// For 12AM (midnight) and 12PM (noon) this returns 12.
  today.hourOfPeriod ;

  /// The hour at which the current period starts.
  today.periodOffset;


  /// Equal to: (month / 4).round();
  /// eg. (6/4).round() = 2
  today.quarter;

  /// Example:
  //   yMEd()=> Sun, 10/30/2022
  //   yMEd(isFull: true) => Sunday, 10/30/2022
  today.format('/').yMEd();
Pattern Result
yM() -> 10/2022
yMd() -> 10/30/2022
yMEd() -> Sun, 10/30/2022
yMEd(isFull: true) -> Sunday, 10/30/2022
yMMM() -> Oct 2022
yMMM(isFull: true) -> October 2022
yMMMd() -> Oct 30, 2022
yMMMd(isFull: true) -> October 30, 2022
yMMMEd() -> Sun, Oct 30, 2022
yMMMEd(isFull: true) -> Sunday, October 30, 2022
yQQQ() -> Q4 2022
yQQQ(isFull: true) -> 4th quarter 2022
hm() -> 02:37
hm() -> 2:37 AM
hms() -> 02:37:31
hms(isFull: true) -> 2:37:31 AM

How to contribute #

Want to contribute to the project? We will be proud to highlight you as one of our collaborators. Here are some points where you can contribute and make Get (and Flutter) even better.

  • Adding documentation to the readme (a lot of Jars features haven't been documented yet).
  • Write articles or make videos teaching how to use Jars.
  • Including new functions class.

Any contribution is welcome!

10
likes
0
pub points
24%
popularity

Publisher

unverified uploader

JARS is a super-effective and lightweight solution for Flutter. It combines front-end flutter widgets, intelligent dependency injection, and provider solutions like timeago, datetime format, multilingual support, textplus, rsnackbars, rtoast, and many others with high-performance.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (LICENSE)

Dependencies

flutter, http

More

Packages that depend on jars