nb_utils 4.2.3  nb_utils: ^4.2.3 copied to clipboard
nb_utils: ^4.2.3 copied to clipboard
This package helps you daily usable function with ease. Just add nb_utils with its latest version and that's it you are ready to use.
Show some love and like to support the project #
Intro #
This package helps you daily usable function with ease. Just add nb_utils with its latest version and that's it you are ready to use.
Documentation #
API Docs are available.
Installation #
add this line to pubspec.yaml
   dependencies:
     nb_utils: <latest_version>
import package
    import 'package:nb_utils/nb_utils.dart';
initialize nb_utils in main.dart file
    await initialize();
Examples #
    // Add a Google Logo
    // Add size parameter for custom size
    // Default is 24
    GoogleLogoWidget()
    // Open a new screen
    HomePage().launch(context);
    // Remove all screens from back stack and opens new screen
    HomePage().launch(context, isNewTask: true);
    // Back to previous screen
    finish(context);
    // Get Color from hex string
    Color color = getColorFromHex('#FFFFF');
    
    // Hide soft keyboard
    hideKeyboard(context);
    
    // Padding All, Apply TextStyle
    Column(
      children: <Widget>[
         Text(item.title.validate(), style: boldTextStyle()),
      ],
    ).paddingAll(16)
    
    // Check given String is not null
    // validate() function verifies weather given String is null or not. if null then it returns blank String
    // validate() function prevents null object
    Text(item.title.validate()),
      
    // Apply Bold TextStyle
    Text(item.title.validate(), style: boldTextStyle())
    
    // Apply Primary TextStyle
    Text(item.title.validate(), style: primaryTextStyle())
    
    // Apply Secondary TextStyle
    Text(item.title.validate(), style: secondaryTextStyle())
    
    // Rounded Image
    Image.network(item.image, height: 250).cornerRadiusWithClipRRect(20)
    
    // Show a Widget (for ex here Circular Progress Bar) only if data is loading or doing some background task
    Loader().visible(mIsLoading)
    * mIsLoading is bool variable.
    
    // Center Widget
    Text('Centered Text').center()
    // Click on ANY Widget
    Container(
      height: 100,
    ).onTap(() {
      // Handle Click
    })
    // Check Email Validation
    if(!emailController.text.validateEmail()) { 
      // Handle Email not valid
    } 
    
    // Check Phone Number Validation
    if(!phoneController.text.validatePhone()) {
      // Handle Phone Number not valid
    }
    
    // Capitalize First Letter
    'this is simple string'.capitalizeFirstLetter();
    // Toast a String
    toast('This is a string');
    // Toast a String for a long duration
    toastLong('This is a string');
    /// Prints only if in debug or profile mode - (parameter is Object)
    log('Your string');
    /// Change status bar Color and Brightness
    setStatusBarColor(Colors.blue);
    /// Set orientation to portrait
    setOrientationPortrait();
    /// Set orientation to landscape
    setOrientationLandscape();
    /// Get current PlatformName as a String
    platformName();
    /// Invoke Native method and get result
    invokeNativeMethod(CHANNEL_NAME, METHOD_NAME, [dynamic arguments]);
    /// return screen width
    context.width();
    /// return screen height
    context.height();