diamond_fab 0.1.1

diamond_fab #

A simple package for adding a Diamond Floating Action Button or FAB to a flutter application. This FAB also allows for a notch to be made inside of the Bottom Application Bar or Bottom Navigation Bar based on the positioning.

FAB code is based on the original Floating Action Button Source code and the Material Design specification.

Getting Started #

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

dependencies:
  diamond_fab: "^0.1.0"

Screenshots #

Center docked with wider margin Center Float with normal margin End docked with narrow margin

[0.0.1] - First Release.

[0.1.0] - Updated properties and button drawing method

Added new properties for foreground color, background color, heroTag, highlightElevation, mini (miniMode), and tooltip. Added more documentation (again based on the original Floating Action Button code).

[0.1.1] - Changed normal size based on Material design Spec

Diamond Shaped FAB is 68 logical pixels in size on the material design spec compared to the normal 56.0 logical pixels. Also changed mini size to 52 rather then 40.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData.dark(),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Diamond Fab Example'),
      ),
      body: Container(),
      floatingActionButton: DiamondFab(
        child: Icon(Icons.home),
        onPressed: () {},
        mini: true,
        tooltip: 'Testing on long press',
        notchMargin: 20.0,
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
      bottomNavigationBar: BottomAppBar(
        child: Container(
          height: 60.0,
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  diamond_fab: ^0.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:diamond_fab/diamond_fab.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
55
Health:
Code health derived from static analysis. [more]
75
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
67
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Fix lib/diamond_fab.dart. (-25 points)

Analysis of lib/diamond_fab.dart failed with 1 error:

line 203 col 18: The method 'setFloatingActionButtonNotchFor' isn't defined for the class 'Scaffold'.

Maintenance suggestions

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.

Package is getting outdated. (-13.15 points)

The package was last published 59 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test

Admin