Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@

* Added description

* Removed dependency from Dart-dev
* Removed dependency from Dart-dev

## [0.2.1] - 08/03/2021

* Migrate to dart null safety
6 changes: 3 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MyApp extends StatelessWidget {
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
MyHomePage({Key? key, this.title}) : super(key: key);

// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
Expand All @@ -37,7 +37,7 @@ class MyHomePage extends StatefulWidget {
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".

final String title;
final String? title;

@override
_MyHomePageState createState() => new _MyHomePageState();
Expand Down Expand Up @@ -93,7 +93,7 @@ class _MyHomePageState extends State<MyHomePage> {

return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
title: new Text(widget.title!),
),
//Using a Stack will assure that the Dialer will appear at the end of your layout
body: new Stack(
Expand Down
6 changes: 3 additions & 3 deletions lib/src/fab_dialer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class FabDialerState extends State<FabDialer> with TickerProviderStateMixin {
final Color _fabColor;
final Icon _fabIcon;
final AnimationStyle _fabAnimationStyle;
List<FabMenuMiniItemWidget> _fabMenuItems;
late List<FabMenuMiniItemWidget> _fabMenuItems;

AnimationController _controller;
late AnimationController _controller;

@override
void initState() {
Expand All @@ -43,7 +43,7 @@ class FabDialerState extends State<FabDialer> with TickerProviderStateMixin {
}

void setFabMenu(List<FabMiniMenuItem> fabMenuList) {
List<FabMenuMiniItemWidget> fabMenuItems = new List();
List<FabMenuMiniItemWidget> fabMenuItems = new List.empty();
for (int i = 0; i < _fabMiniMenuItemList.length; i++) {
fabMenuItems.add(new FabMenuMiniItemWidget(
tooltip: _fabMiniMenuItemList[i].tooltip,
Expand Down
78 changes: 39 additions & 39 deletions lib/src/fab_menu_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ typedef void HideWidget();

class FabMiniMenuItem {
double elevation;
String text;
Icon icon;
ImageProvider image;
Color fabColor;
Color chipColor;
String? text;
Icon? icon;
ImageProvider? image;
Color? fabColor;
Color? chipColor;
String tooltip;
Color textColor;
AnimationStyle animationStyle;
Color? textColor;
AnimationStyle? animationStyle;
OnFabMiniMenuItemPressed onPressed;
bool hideOnClick;

Expand Down Expand Up @@ -59,7 +59,7 @@ class FabMiniMenuItem {

class FabMenuMiniItemWidget extends StatelessWidget {
const FabMenuMiniItemWidget(
{Key key,
{Key? key,
this.elevation,
this.text,
this.icon,
Expand All @@ -75,22 +75,22 @@ class FabMenuMiniItemWidget extends StatelessWidget {
this.animationStyle,
this.itemCount})
: super(key: key);
final double elevation;
final String text;
final Icon icon;
final ImageProvider image;
final Color fabColor;
final Color chipColor;
final String tooltip;
final Color textColor;
final int index;
final int itemCount;
final OnFabMiniMenuItemPressed onPressed;
final HideWidget hideWidget;
final AnimationController controller;
final AnimationStyle animationStyle;
final double? elevation;
final String? text;
final Icon? icon;
final ImageProvider? image;
final Color? fabColor;
final Color? chipColor;
final String? tooltip;
final Color? textColor;
final int? index;
final int? itemCount;
final OnFabMiniMenuItemPressed? onPressed;
final HideWidget? hideWidget;
final AnimationController? controller;
final AnimationStyle? animationStyle;

Widget _buildAnimation(BuildContext context, Widget child) {
Widget _buildAnimation(BuildContext context, Widget? child) {
final double deviceHeight = MediaQuery.of(context).size.height;

switch (animationStyle) {
Expand All @@ -103,7 +103,7 @@ class FabMenuMiniItemWidget extends StatelessWidget {
)
.animate(
new CurvedAnimation(
parent: controller,
parent: controller!,
curve: new Interval(
0.100,
0.900,
Expand All @@ -130,11 +130,11 @@ class FabMenuMiniItemWidget extends StatelessWidget {
return new Container(
padding: new EdgeInsetsTween(
end: const EdgeInsets.only(bottom: 0.0),
begin: EdgeInsets.only(top: deviceHeight / itemCount / 3),
begin: EdgeInsets.only(top: deviceHeight / itemCount! / 3),
)
.animate(
new CurvedAnimation(
parent: controller,
parent: controller!,
curve: new Interval(
0.100,
0.600,
Expand All @@ -150,7 +150,7 @@ class FabMenuMiniItemWidget extends StatelessWidget {
)
.animate(
new CurvedAnimation(
parent: controller,
parent: controller!,
curve: new Interval(
0.100,
0.600,
Expand Down Expand Up @@ -182,17 +182,17 @@ class FabMenuMiniItemWidget extends StatelessWidget {
margin: new EdgeInsets.symmetric(horizontal: 8.0),
child: new ScaleTransition(
scale: new CurvedAnimation(
parent: controller,
curve: new Interval(((index + 1) / 10), 1.0,
parent: controller!,
curve: new Interval(((index! + 1) / 10), 1.0,
curve: Curves.linear),
),
child: _getChip(),
),
),
new ScaleTransition(
scale: new CurvedAnimation(
parent: controller,
curve: new Interval(((index + 1) / 10), 1.0,
parent: controller!,
curve: new Interval(((index! + 1) / 10), 1.0,
curve: Curves.linear),
),
child: _getFloatingActionButton(),
Expand All @@ -203,12 +203,12 @@ class FabMenuMiniItemWidget extends StatelessWidget {
}
}

Widget _getChip() {
Widget? _getChip() {
return chipColor != null
? new Chip(
backgroundColor: chipColor,
label: new Text(
text,
text!,
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
style:
Expand All @@ -228,8 +228,8 @@ class FabMenuMiniItemWidget extends StatelessWidget {
child: icon,
heroTag: "$index",
onPressed: () {
onPressed();
hideWidget == null ? null : hideWidget();
onPressed!();
hideWidget == null ? null : hideWidget!();
})
: new FloatingActionButton(
elevation: elevation,
Expand All @@ -241,16 +241,16 @@ class FabMenuMiniItemWidget extends StatelessWidget {
decoration: new BoxDecoration(
shape: BoxShape.circle,
image: new DecorationImage(
image: image,
image: image!,
fit: BoxFit.cover,
),
),
),
),
heroTag: "$index",
onPressed: () {
onPressed();
hideWidget == null ? null : hideWidget();
onPressed!();
hideWidget == null ? null : hideWidget!();
});
}

Expand All @@ -263,7 +263,7 @@ class FabMenuMiniItemWidget extends StatelessWidget {
children: <Widget>[
new AnimatedBuilder(
builder: _buildAnimation,
animation: controller,
animation: controller!,
),
],
),
Expand Down
10 changes: 5 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: flutter_fab_dialer
description: Flutter plugin for using a Fab Dialer / Fab Speed Dial to use it as a menu.
It uses material design library as the FAB is originated from Android.
version: 0.1.1
version: 0.2.1
author: Leondev7 <leondev7jgt@gmail.com>
homepage: https://github.com/Leondev7/flutter_fab_dialer

environment:
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
sdk: flutter

dev_dependencies:
test: ^1.3.3

environment:
sdk: ">=2.0.0 <3.0.0"
test: ^1.16.5