Skip to content

Commit

Permalink
migrated from pediatrics to flutter_lints, resolved flutter_lints war…
Browse files Browse the repository at this point in the history
…nings
  • Loading branch information
JasperEssienDro committed Oct 20, 2021
1 parent 9c94c17 commit 4951fd4
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 142 deletions.
5 changes: 4 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
include: package:pedantic/analysis_options.yaml
include: package:flutter_lints/flutter.yaml
linter:
rules:
constant_identifier_names: false
3 changes: 1 addition & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';

import 'package:another_flushbar/flushbar.dart';
import 'package:flutter/material.dart';

void main() {
runApp(MyApp());
Expand Down
15 changes: 4 additions & 11 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
version: "2.8.1"
boolean_selector:
dependency: transitive
description:
Expand All @@ -35,7 +35,7 @@ packages:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
clock:
dependency: transitive
description:
Expand Down Expand Up @@ -87,21 +87,14 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -148,7 +141,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.4.2"
typed_data:
dependency: transitive
description:
Expand Down
162 changes: 61 additions & 101 deletions lib/flushbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,104 +6,64 @@ import 'package:flutter/scheduler.dart';

import 'flushbar_route.dart' as route;

// ignore: constant_identifier_names
const String FLUSHBAR_ROUTE_NAME = '/flushbarRoute';

typedef FlushbarStatusCallback = void Function(FlushbarStatus? status);
typedef OnTap = void Function(Flushbar flushbar);

/// A highly customizable widget so you can notify your user when you fell like he needs a beautiful explanation.
// ignore: must_be_immutable
class Flushbar<T> extends StatefulWidget {
Flushbar(
{Key? key,
String? title,
Color? titleColor,
double? titleSize,
String? message,
double? messageSize,
Color? messageColor,
Widget? titleText,
Widget? messageText,
Widget? icon,
bool shouldIconPulse = true,
double? maxWidth,
EdgeInsets margin = const EdgeInsets.all(0.0),
EdgeInsets padding = const EdgeInsets.all(16),
BorderRadius? borderRadius,
TextDirection textDirection = TextDirection.ltr,
Color? borderColor,
double borderWidth = 1.0,
Color backgroundColor = const Color(0xFF303030),
Color? leftBarIndicatorColor,
List<BoxShadow>? boxShadows,
Gradient? backgroundGradient,
Widget? mainButton,
OnTap? onTap,
Duration? duration,
bool isDismissible = true,
FlushbarDismissDirection dismissDirection =
FlushbarDismissDirection.VERTICAL,
bool showProgressIndicator = false,
AnimationController? progressIndicatorController,
Color? progressIndicatorBackgroundColor,
Animation<Color>? progressIndicatorValueColor,
FlushbarPosition flushbarPosition = FlushbarPosition.BOTTOM,
double positionOffset = 0.0,
FlushbarStyle flushbarStyle = FlushbarStyle.FLOATING,
Curve forwardAnimationCurve = Curves.easeOutCirc,
Curve reverseAnimationCurve = Curves.easeOutCirc,
Duration animationDuration = const Duration(seconds: 1),
this.title,
this.titleColor,
this.titleSize,
this.message,
this.messageSize,
this.messageColor,
this.titleText,
this.messageText,
this.icon,
this.shouldIconPulse = true,
this.maxWidth,
this.margin = const EdgeInsets.all(0.0),
this.padding = const EdgeInsets.all(16),
this.borderRadius,
this.textDirection = TextDirection.ltr,
this.borderColor,
this.borderWidth = 1.0,
this.backgroundColor = const Color(0xFF303030),
this.leftBarIndicatorColor,
this.boxShadows,
this.backgroundGradient,
this.mainButton,
this.onTap,
this.duration,
this.isDismissible = true,
this.dismissDirection = FlushbarDismissDirection.VERTICAL,
this.showProgressIndicator = false,
this.progressIndicatorController,
this.progressIndicatorBackgroundColor,
this.progressIndicatorValueColor,
this.flushbarPosition = FlushbarPosition.BOTTOM,
this.positionOffset = 0.0,
this.flushbarStyle = FlushbarStyle.FLOATING,
this.forwardAnimationCurve = Curves.easeOutCirc,
this.reverseAnimationCurve = Curves.easeOutCirc,
this.animationDuration = const Duration(seconds: 1),
FlushbarStatusCallback? onStatusChanged,
double barBlur = 0.0,
bool blockBackgroundInteraction = false,
double? routeBlur,
Color? routeColor,
Form? userInputForm,
Offset? endOffset,
this.barBlur = 0.0,
this.blockBackgroundInteraction = false,
this.routeBlur,
this.routeColor,
this.userInputForm,
this.endOffset,
this.flushbarRoute // Please dont init this
})
: title = title,
titleSize = titleSize,
titleColor = titleColor,
message = message,
messageSize = messageSize,
messageColor = messageColor,
titleText = titleText,
messageText = messageText,
icon = icon,
shouldIconPulse = shouldIconPulse,
maxWidth = maxWidth,
margin = margin,
padding = padding,
borderRadius = borderRadius,
textDirection = textDirection,
borderColor = borderColor,
borderWidth = borderWidth,
backgroundColor = backgroundColor,
leftBarIndicatorColor = leftBarIndicatorColor,
boxShadows = boxShadows,
backgroundGradient = backgroundGradient,
mainButton = mainButton,
onTap = onTap,
duration = duration,
isDismissible = isDismissible,
dismissDirection = dismissDirection,
showProgressIndicator = showProgressIndicator,
progressIndicatorController = progressIndicatorController,
progressIndicatorBackgroundColor = progressIndicatorBackgroundColor,
progressIndicatorValueColor = progressIndicatorValueColor,
flushbarPosition = flushbarPosition,
positionOffset = positionOffset,
flushbarStyle = flushbarStyle,
forwardAnimationCurve = forwardAnimationCurve,
reverseAnimationCurve = reverseAnimationCurve,
animationDuration = animationDuration,
barBlur = barBlur,
blockBackgroundInteraction = blockBackgroundInteraction,
routeBlur = routeBlur,
routeColor = routeColor,
userInputForm = userInputForm,
onStatusChanged = onStatusChanged,
endOffset = endOffset,
this.flushbarRoute = null, // Please dont init this
// ignore: prefer_initializing_formals
: onStatusChanged = onStatusChanged,
super(key: key) {
onStatusChanged = onStatusChanged ?? (status) {};
}
Expand Down Expand Up @@ -297,29 +257,29 @@ class Flushbar<T> extends StatefulWidget {

/// Checks if the flushbar is visible
bool isShowing() {
if(flushbarRoute == null){
if (flushbarRoute == null) {
return false;
}
return flushbarRoute!.currentStatus == FlushbarStatus.SHOWING;
}

/// Checks if the flushbar is dismissed
bool isDismissed() {
if(flushbarRoute == null){
if (flushbarRoute == null) {
return false;
}
return flushbarRoute!.currentStatus == FlushbarStatus.DISMISSED;
}

bool isAppearing() {
if(flushbarRoute == null){
if (flushbarRoute == null) {
return false;
}
return flushbarRoute!.currentStatus == FlushbarStatus.IS_APPEARING;
}

bool isHiding() {
if(flushbarRoute == null){
if (flushbarRoute == null) {
return false;
}
return flushbarRoute!.currentStatus == FlushbarStatus.IS_HIDING;
Expand All @@ -345,7 +305,7 @@ class _FlushbarState<K extends Object?> extends State<Flushbar<K>>
FocusScopeNode? _focusNode;
late FocusAttachment _focusAttachment;
late Completer<Size> _boxHeightCompleter;

CurvedAnimation? _progressAnimation;

@override
Expand Down Expand Up @@ -438,17 +398,17 @@ class _FlushbarState<K extends Object?> extends State<Flushbar<K>>
color: widget.flushbarStyle == FlushbarStyle.FLOATING
? Colors.transparent
: widget.backgroundColor,
child: SafeArea(
child: SafeArea(
minimum: widget.flushbarPosition == FlushbarPosition.BOTTOM
? EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom)
bottom: MediaQuery.of(context).viewInsets.bottom)
: EdgeInsets.only(top: MediaQuery.of(context).viewInsets.top),
// ? EdgeInsets.only(
// bottom: (MediaQuery.of(context).padding.bottom +
// widget.positionOffset))
// : EdgeInsets.only(
// top: (MediaQuery.of(context).padding.top) +
// widget.positionOffset),
// ? EdgeInsets.only(
// bottom: (MediaQuery.of(context).padding.bottom +
// widget.positionOffset))
// : EdgeInsets.only(
// top: (MediaQuery.of(context).padding.top) +
// widget.positionOffset),
bottom: widget.flushbarPosition == FlushbarPosition.BOTTOM,
top: widget.flushbarPosition == FlushbarPosition.TOP,
left: false,
Expand Down Expand Up @@ -751,7 +711,7 @@ class _FlushbarState<K extends Object?> extends State<Flushbar<K>>
return Container(
width: 8.0,
height: snapshot.data!.height,
decoration: BoxDecoration(
decoration: BoxDecoration(
borderRadius: widget.borderRadius == null
? null
: widget.textDirection == TextDirection.ltr
Expand Down
Loading

0 comments on commit 4951fd4

Please sign in to comment.