Surf Util

Build Status Coverage Status Pub Version Pub Likes Pub popularity Flutter Platform

This package is part of the SurfGear toolkit made by Surf.

Surf Util

Description

A library with set of common classes and utilities used in different modules.

Main classes

  1. Bitmask - A generic implementation of the Bitmask type.

Bitmask

  1. Enum - Java-like enum.
  2. DisableOverscroll - Prevent glowing when scrolling over the edge.

DisableOverscroll

Installation

Add surf_util to your pubspec.yaml file:

dependencies:
  surf_util: $currentVersion$

At this moment, the current version of surf_util is surf_util version.

Example

DisableOverscroll

DisableOverscroll(
 child: ListView(
     ...
  ),
),

Bitmask

class ExampleBitmask extends Bitmask {
  const ExampleBitmask zeroBit = ExampleBitmask._(1);

  const ExampleBitmask firstBit = ExampleBitmask._(2);

  const ExampleBitmask._(int value) : super(value);

  static List<ExampleBitmask> getList() {
    return [zeroBit, firstBit];
  }
}
final listBitmask = ExampleBitmask.getList();

final mask = Bitmask.getMask(listBitmask);

bool isOn = Bitmask.isOn(listBitmask.first);

Enum

 class TransactionType extends Enum<String> {
   const TransactionType(String val) : super(val);

   static const TransactionType IN = TransactionType('in');
   static const TransactionType OUT = TransactionType('out');

   static TransactionType byValue(String value) {
     switch (value) {
       case 'in':
         return IN;
       case 'out':
         return OUT;
       default:
         return OUT;
     }
   }
 }

Changelog

All notable changes to this project will be documented in this file.

Issues

To report your issues, submit them directly in the Issues section.

Contribute

If you would like to contribute to the package (e.g. by improving the documentation, fixing a bug or adding a cool new feature), please read our contribution guide first and send us your pull request.

Your PRs are always welcome.

How to reach us

Please feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.

Telegram

License

Apache License, Version 2.0

Libraries

surf_util