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
16 changes: 11 additions & 5 deletions lib/swipebuttonflutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class SwipingButton extends StatefulWidget {
final Color backgroundColor;
final Color iconColor;
TextStyle? buttonTextStyle;
TextStyle? insideTextStyle;
final EdgeInsets padding;

/// The decimal percentage of swiping in order for the callbacks to get called, defaults to 0.75 (75%) of the total width of the children.
Expand All @@ -35,6 +36,7 @@ class SwipingButton extends StatefulWidget {
this.padding = const EdgeInsets.fromLTRB(0, 0, 0, 0),
this.iconColor = Colors.white,
this.buttonTextStyle,
this.insideTextStyle,
this.swipePercentageNeeded,
}) : super(key: key);

Expand All @@ -47,7 +49,8 @@ class SwipingButton extends StatefulWidget {
swipeButtonColor: this.swipeButtonColor,
backgroundColor: this.backgroundColor,
iconColor: this.iconColor,
buttonTextStyle: this.buttonTextStyle);
buttonTextStyle: this.buttonTextStyle,
insideTextStyle: this.insideTextStyle);
}

class StateSwipingButton extends State<SwipingButton> {
Expand All @@ -63,6 +66,7 @@ class StateSwipingButton extends State<SwipingButton> {
final Color backgroundColor;
final Color iconColor;
TextStyle? buttonTextStyle;
TextStyle? insideTextStyle;
final EdgeInsets padding;

StateSwipingButton({
Expand All @@ -75,6 +79,7 @@ class StateSwipingButton extends State<SwipingButton> {
this.backgroundColor = Colors.black,
this.iconColor = Colors.white,
this.buttonTextStyle,
this.insideTextStyle,
});

@override
Expand All @@ -83,6 +88,10 @@ class StateSwipingButton extends State<SwipingButton> {
buttonTextStyle = TextStyle(
fontSize: 16.0, fontWeight: FontWeight.w800, color: Colors.white);
}
if (insideTextStyle == null) {
insideTextStyle = TextStyle(
fontSize: 16.0, fontWeight: FontWeight.w800, color: Colors.white);
}
return Container(
width: MediaQuery.of(context).size.width,
padding: padding,
Expand All @@ -96,10 +105,7 @@ class StateSwipingButton extends State<SwipingButton> {
child: new Center(
child: Text(
text.toUpperCase(),
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w800,
color: Colors.white),
style: insideTextStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Expand Down
10 changes: 5 additions & 5 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
version: "2.8.1"
boolean_selector:
dependency: transitive
description:
Expand All @@ -28,7 +28,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 @@ -73,7 +73,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.7.0"
path:
dependency: transitive
description:
Expand All @@ -92,7 +92,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -127,7 +127,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19"
version: "0.4.2"
typed_data:
dependency: transitive
description:
Expand Down