flutter_numkit 0.0.3 copy "flutter_numkit: ^0.0.3" to clipboard
flutter_numkit: ^0.0.3 copied to clipboard

A collection of handy numeric extensions for Flutter (Angles, Bool, Duration, EdgeInsets, Gap, Radius, Percentages, Radius, ScreenSizes, Tween.)

Flutter NumKit #

flutter_numkit 0.0.1 repo 0.0.1

A collection of handy numeric extensions for Flutter that makes working with numbers more intuitive and reduces boilerplate code.

✨ Features #

  • Angles: Convert between degrees and radians
  • Boolean Checks: Check if a number is odd, even, or between values
  • Durations: Create durations from numbers with different time units
  • Edge Insets: Create EdgeInsets with less code
  • Gaps: Easily add spacing in your layouts
  • Percentages: Calculate percentages of numbers
  • Radius: Create circular and rounded rectangles easily
  • Screen Sizes: Responsive sizing based on screen dimensions
  • Tweens: Simple linear interpolation between values

Installation #

Add the following to your pubspec.yaml file:

dependencies:
  flutter_numkit: ^0.0.1

Then run:

flutter pub get

Usage #

Import the package:

import 'package:flutter_numkit/flutter_numkit.dart';

Angle Extensions #

final radians = 45.degToRad; // Convert degrees to radians (0.785)
final degrees = 3.14.radToDeg; // Convert radians to degrees (179.9087)

Boolean Extensions #

print(4.isEvenNum); // true
print(5.isOddNum); // true
print(7.isBetween(5, 10)); // true

Gap Extensions #

Column(
  children: [
    const Text('Hello'),
    10.verticalGap, // SizedBox with height 10
    const Text('World!'),
    1.spacer, // Flexible spacer with flex 1
  ],
)

Screen Size Extensions #

final halfScreenWidth = 50.ofWidth(context); // 50% of screen width
final quarterScreenHeight = 25.ofHeight(context); // 25% of screen height

Tween Extensions #

final value = 0.5.lerp(0, 100); // 50.0 (50% between 0 and 100)
final value2 = 0.25.lerp(50, 150); // 75.0 (25% between 50 and 150)

Duration Extensions #

await 2.seconds.delay; // Waits for 2 seconds
await 500.millis.delay; // Waits for 500 milliseconds

Percentage Extensions #


final result = 50.percentOf(200); // 100.0 (50% of 200)
2
likes
0
points
114
downloads

Publisher

unverified uploader

Weekly Downloads

A collection of handy numeric extensions for Flutter (Angles, Bool, Duration, EdgeInsets, Gap, Radius, Percentages, Radius, ScreenSizes, Tween.)

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_numkit