spiffy_button 0.1.0

spiffy_button (not production-ready) #

Build Status Package

A spiffy little button widget for Flutter modeled after Material Design floating action buttons (FABs).

This software is considered to be at an alpha level of readiness. I have plenty more things to do (big and small), and I expect the API to go through at least one more overhaul. Version 1.0.0 will begin stability.

My primary motivations behind making this were

  1. to get a better-animated extended FAB (specifically, to animate the extended/retracted transition) and
  2. to get morphed popup menus (where the FAB morphs into a small menu).

tl;dr I've been working on a closed-source Android app on and off for a bit among schoolwork and I needed a yak to shave to keep myself sane.

example/main.dart

/*
 * Spiffy Button
 * Copyright (c) 2019 Tyler Filla
 *
 * This software is provided 'as-is', without any express or implied
 * warranty. In no event will the authors be held liable for any damages
 * arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must not
 *    claim that you wrote the original software. If you use this software
 *    in a product, an acknowledgment in the product documentation would
 *    be appreciated but is not required.
 *
 * 2. Altered source versions must be plainly marked as such, and must not
 *    be misrepresented as being the original software.
 *
 * 3. This notice may not be removed or altered from any source
 *    distribution.
 */

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

void main() {
  runApp(Example());
}

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'spiffy_button',
      theme: ThemeData(
        primaryColor: Colors.deepPurple,
        accentColor: Colors.amberAccent,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _HomePageState();
  }
}

class _HomePageState extends State<HomePage> {
  final _key = GlobalKey<SpiffyButtonState>();

  @override
  void initState() {
    super.initState();

    // Start the animation sequence
    animate();
  }

  void animate() async {
    final pause = const Duration(seconds: 1, milliseconds: 200);

    await Future.delayed(pause);
    _key.currentState.pose = SpiffyButtonPose.shownIconAndLabel;
    await Future.delayed(pause);
    _key.currentState.pose = SpiffyButtonPose.shownIcon;

    return animate();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('spiffy_button')),
      floatingActionButton: SpiffyButton(
        key: _key,
        icon: const Icon(Icons.add),
        initialPose: SpiffyButtonPose.shownIcon,
        label: const Text('CREATE'),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  spiffy_button: ^0.1.0

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

We analyzed this package on Nov 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/spiffy_button.dart.

Run flutter format to format lib/spiffy_button.dart.

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test