nb_utils 3.0.9+5

  • Readme
  • Changelog
  • Example
  • Installing
  • 91

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';

Examples #


    // Open a new screen
    HomePage().launch(context);

    // Remove all screens from back stack and opens new screen
    launchNewScreenWithNewTask(context, 'tag');

    // 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
    Center(child: CircularProgressIndicator()).visible(mIsLoading) 
    * mIsLoading is bool variable.
    
    // Center Widget
    CircularProgressIndicator().center() 
    
    // Apply Default Shadow to a Container Widget
    Container(
      height: 100,
      color: Colors.white,
    ).withShadow()
    
    // Apply Rounded Corner Radius to a Container Widget
    Container(
      height: 100,
      color: Colors.white,
    ).withRoundedCorners()
    
    // Click on ANY Widget
    Container(
      height: 100,
    ).onTap(() {
      // Handle Click
    })
    
    // Print a String
    'This is simple string to print'.log();
    
    // 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();
    

Bonus ( Android Studio (Eclipse Keymap) Most Needed Shortcuts) #

  1. ALT + INSERT -> To Create a new File -> Open Project Window on Left Sidebar and press ALT + INSERT key to where you want to create new file. (After opening a window you can also search by typing keyword)

  2. CTRL + H -> To find something anywhere in project

  3. Scroll from source -> Locate a file in project (GIF)

  1. SHIFT + ALT + R -> Rename any variable or file name everywhere you used the same

💰 Donations #

If you would like to support the creator of this library or the continuous maintenance of this library, feel free to donate. Your donation is highly appreciated. Thank you!

PayPal

  • Donate $5: Thank's for creating this project, here's a tea for you!
  • Donate $10: Wow, I am stunned. Let me take you to the movies!
  • Donate $15: I really appreciate your work, let's grab some lunch!
  • Donate $25: That's some awesome stuff you did right there, dinner is on me!
  • Donate $50: I really really want to support this project, great job!
  • Donate $100: You are the man! This project saved me hours of struggle and hard work, simply awesome!

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

3.0.9 - Added Extensions for SizedBox, Text, Container, ClipRRect, ShaderMask, ScrollView, AlertDialog widgets #

3.0.3 #

Added Extensions:

  • Screen Size
  • Check Network Available
  • Show Dialog
  • Copy to Clipboard

3.0.1 - Added Ready to use Shared Preference Functions and Toast #

2.0.9 - Styles added for Text and Container Widget #

2.0.0 - Added useful Extensions and basic colors #

1.0.4 - Updated documentation #

1.0.1 - Added examples and more optimized #

0.0.3 - Added more util functions #

0.0.1 - Release #

  • 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.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:nb_utils/nb_utils.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();

    // Subscribe to a channel
    LiveStream liveStream = LiveStream();
    liveStream.on('test_stream', (value) {
      // Do something with received value
    });
  }

  @override
  Widget build(BuildContext context) {
    //
    launchNewScreen(context, 'tag');
    launchNewScreenWithNewTask(context, 'tag');
    finish(context);
    Color color = getColorFromHex('#FFFFF');

    return MaterialApp(
      title: 'Flutter Utils Example',
      theme: ThemeData(
        primarySwatch: whiteColor,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  void initState() {
    super.initState();

    // Send anything to a channel
    LiveStream liveStream = LiveStream();
    liveStream.emit('test_stream', 'Second Page');
  }

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        HomePage().launch(context);
      },
      child: Container(
        child: Column(
          children: <Widget>[
            5.toString().text(),
            'Simple Text'.text(defaultValue: ''),
            createRichText([
              TextSpan(text: 'fff'),
              TextSpan(text: 'fe'),
            ]),
          ],
        ).withScroll(physics: BouncingScrollPhysics()),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  nb_utils: ^3.0.9+5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:nb_utils/nb_utils.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
82
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
91
Learn more about scoring.

We analyzed this package on Jun 5, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
connectivity ^0.4.8+2 0.4.8+6
flutter 0.0.0
fluttertoast ^4.0.0 4.0.1
shared_preferences ^0.5.6+2 0.5.7+3
Transitive dependencies
collection 1.14.12
connectivity_macos 0.1.0+3
connectivity_platform_interface 1.0.6
flutter_web_plugins 0.0.0
meta 1.1.8
plugin_platform_interface 1.0.2
shared_preferences_macos 0.0.1+10
shared_preferences_platform_interface 1.0.4
shared_preferences_web 0.1.2+7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test