thumper 2.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 58

Thumper #

A Thumper is a flutter widget that controls an Iterable.

widget screen shot

Buttons allow reset, forward step, and play/pause. A slider controls the thumper's frequency (the iteration speed).

There's no backward step, as the basic Iterator interface doesn't require a reversible state generator.

Example #

The example iterates through a list of fruits.

initialplaying
example widget use 1example widget use 1

To try it in chrome, install beta channel flutter then:

# Confirm you have some devices.
flutter devices

# Get the code
git clone git@github.com:monopole/thumper.git
cd thumper

# then either
make demo-chrome
# or
make demo-android

For a more complex Thumper demo see the GolGrid widget.

2.1.1 #

  • Upgrade to bloc 4.0.0

2.1.0 #

  • Expose autoThumpLimit parameter in ThumperBloc constructor.

2.0.0 #

  • Improve terminology in API. This is a backward incompatible change.

1.0.2 #

  • fix the real performance bug :P

1.0.1 #

  • fix performance bug

1.0.0 #

  • Stabilize API. Impose strict linting.

0.1.10 #

  • Added screenshots. Haven't figured out how to fix docs w/o bumping version.

0.1.9 #

  • Fix doc

0.1.8 #

  • Remove typo. Really need a precommit here.

0.1.7 #

  • Expose fixed dimensions.

0.1.6 #

  • Removed width parameter.

0.1.5 #

  • Add link to gol_grid.

0.1.4 #

  • Fix descript.

0.1.3 #

  • Fixed bug.

0.1.2 #

  • Example in full app form, still buggy

0.1.1 #

  • Nits

0.1.0 #

  • Initial package commit.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:thumper/data/fruit.dart';
import 'package:thumper/thumper.dart';

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

/// A toy app to demonstrate Thumper use.
class DemoApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'Thumper Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: Scaffold(
            backgroundColor: Colors.black,
            appBar: AppBar(
              title: const Text('Fruit Thumper'),
              leading: Icon(Icons.menu),
            ),
            body: ThumperDemo()),
      );
}

/// A demo widget containing a [Thumper] and associated [ThumperBloc].
///
/// The demo widget is a centered text widget showing a [Fruit] name
/// above a Thumper widget that provides iteration controls through
/// a [Fruit] list.
///
/// The [Fruit] comes from a bloc state, so the text widget must be
/// wrapped in a [BlocBuilder] to make the bloc state available to it.
///
/// Above both the Thumper and any use of ThumperBloc state, a
/// [BlocProvider] is needed to 1) construct a ThumperBloc instance,
/// 2) make bloc states available to [BlocBuilder]s in the widget
/// tree below the [BlocProvider], and 3) dispose of the bloc and its
/// associated streams when the encapsulating widget (in this
/// case [ThumperDemo]) is disposed.
class ThumperDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) => BlocProvider(
        create: (ctx) =>
            ThumperBloc<Fruit>.fromIterable(List.from(Fruit.values)),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Expanded(
              child: Center(
                child: BlocBuilder<ThumperBloc<Fruit>, ThumperState>(
                  builder: (ctx, state) =>
                      _textElement(state.thing.toString().substring(6)),
                ),
              ),
            ),
            const Thumper<Fruit>(),
          ],
        ),
      );

  Widget _textElement(String text) => Text(text,
      style: TextStyle(
        fontSize: 64,
        color: Colors.greenAccent,
      ));
}

Use this package as a library

1. Depend on it

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


dependencies:
  thumper: ^2.1.1

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:thumper/thumper.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
24
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • thumper that is a package requiring null.

Health suggestions

Format lib/src/frequency.dart.

Run flutter format to format lib/src/frequency.dart.

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (bloc, flutter_bloc).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
bloc ^4.0.0 4.0.0 5.0.1
flutter 0.0.0
flutter_bloc ^4.0.0 4.0.1 5.0.1
meta ^1.1.8 1.1.8 1.2.2
pedantic ^1.9.0 1.9.0 1.9.2
test ^1.14.2 1.15.2
tuple ^1.0.3 1.0.3
Transitive dependencies
_fe_analyzer_shared 5.0.0
analyzer 0.39.12
args 1.6.0
async 2.4.2
boolean_selector 2.0.0
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
coverage 0.14.0
crypto 2.1.5
csslib 0.16.1
glob 1.2.0
html 0.14.0+3
http 0.12.1
http_multi_server 2.2.0
http_parser 3.1.4
io 0.3.4
js 0.6.2
logging 0.11.4
matcher 0.12.8
mime 0.9.6+3
nested 0.0.4
node_interop 1.1.1
node_io 1.1.1
node_preamble 1.4.12
package_config 1.9.3
path 1.7.0
pool 1.4.0
provider 4.3.1
pub_semver 1.4.4
quiver 2.1.3
shelf 0.7.7
shelf_packages_handler 2.0.0
shelf_static 0.2.8
shelf_web_socket 0.2.3
sky_engine 0.0.99
source_map_stack_trace 2.0.0
source_maps 0.10.9
source_span 1.7.0
stack_trace 1.9.5
stream_channel 2.0.0
string_scanner 1.0.5
term_glyph 1.1.0
test_api 0.2.17
test_core 0.3.10
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
vm_service 4.1.0
watcher 0.9.7+15
web_socket_channel 1.1.0
webkit_inspection_protocol 0.7.3
yaml 2.2.1
Dev dependencies
flutter_test