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 #
[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.
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]
|
63
|
Health:
Code health derived from static analysis.
[more]
|
75
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
25
|
Overall:
Weighted score of the above.
[more]
|
59
|
We analyzed this package on Dec 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.0
- pana: 0.13.1+4
- Flutter: 1.12.13+hotfix.4
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
Package is getting outdated. (-54.52 points)
The package was last published 80 weeks ago.
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.0.0-dev.28.0 <3.0.0 | ||
flutter | 0.0.0 | ||
Transitive dependencies | |||
collection | 1.14.11 | 1.14.12 | |
meta | 1.1.8 | ||
sky_engine | 0.0.99 | ||
typed_data | 1.1.6 | ||
vector_math | 2.0.8 | ||
Dev dependencies | |||
flutter_test |