call_slider_button 3.0.1
call_slider_button: ^3.0.1 copied to clipboard
Customizable incoming-call slider for Flutter: swipe right to accept, left to decline. Smooth animations, haptic feedback and screen-reader support.
๐ Call Slider Button #
A beautiful, fully customizable incoming-call slider for Flutter. Swipe right to accept, swipe left to decline โ with smooth animations, haptic feedback and built-in screen-reader support.
Slide to accept ยท Slide to decline
โจ Features #
- ๐ Swipe to accept / decline with a pulsing call button
- ๐จ Fully customizable โ text, colors, icons, size, radius and drag threshold
- ๐ณ Haptic feedback when the drag passes the threshold
- ๐ Smooth animations โ color glow while dragging, springs back to center on release
- โฟ Accessible โ TalkBack and VoiceOver users get Accept / Decline actions, no dragging needed
- ๐งฉ Material 3 ready โ built on Flutter's standalone
material_uipackage - ๐ฑ Every platform โ Android, iOS, web, macOS, Windows and Linux (pure Dart, no native code)
๐ Getting started #
Install #
flutter pub add call_slider_button
or add it to your pubspec.yaml manually:
dependencies:
call_slider_button: ^3.0.0
Requirements #
| call_slider_button | Flutter | Dart |
|---|---|---|
| 3.x | >=3.47.0 |
^3.13.0 |
| 2.x | >=3.27.0 <3.47.0 |
>=3.6.0 |
Version 3 works in apps that have migrated to material_ui and in apps
still using the SDK's built-in package:flutter/material.dart.
๐ฆ Usage #
import 'package:call_slider_button/call_slider_button.dart';
CallSliderButton(
onAccept: () => debugPrint('Call accepted'),
onDecline: () => debugPrint('Call declined'),
);
Customized #
CallSliderButton(
onAccept: () => debugPrint('Call accepted'),
onDecline: () => debugPrint('Call declined'),
acceptText: 'Answer',
declineText: 'Reject',
acceptColor: Colors.teal,
declineColor: Colors.orange,
backgroundColor: const Color(0xFF1E1E1E),
iconColor: Colors.tealAccent,
callBtnBackgroundColor: Colors.black87,
height: 80,
width: 320,
borderRadius: 40,
iconSize: 30,
iconRadius: 28,
dragThreshold: 100,
);
โ๏ธ Parameters #
Callbacks #
| Parameter | Type | Description | Default |
|---|---|---|---|
onAccept |
VoidCallback |
Called when the button is dragged right past dragThreshold. |
required |
onDecline |
VoidCallback |
Called when the button is dragged left past dragThreshold. |
required |
Text #
| Parameter | Type | Description | Default |
|---|---|---|---|
acceptText |
String |
Label on the right side while idle. | 'Accept' |
declineText |
String |
Label on the left side while idle. | 'Decline' |
textStyle |
TextStyle? |
Style for both labels. | white, 20 px, medium weight |
Colors #
| Parameter | Type | Description | Default |
|---|---|---|---|
acceptColor |
Color |
Track glow while dragging right. | Colors.green |
declineColor |
Color |
Track glow while dragging left. | Colors.red |
backgroundColor |
Color |
Track color while idle. | Color(0x33FFFFFF) (translucent white) |
iconColor |
Color |
Color of the default accept icon. | Colors.green |
borderColor |
Color |
Border color of the track. | Color(0xFFEBEBEB) |
callBtnBackgroundColor |
Color |
Background of the round call button. | Colors.white |
Icons #
| Parameter | Type | Description | Default |
|---|---|---|---|
acceptIcon |
Widget? |
Shown while idle or dragging right. | Icon(Icons.call) |
declineIcon |
Widget? |
Shown while dragging left. | Icon(Icons.call_end) |
Size & behavior #
| Parameter | Type | Description | Default |
|---|---|---|---|
width |
double? |
Track width. | 80 % of screen width |
height |
double |
Track height. | 70 |
borderRadius |
double |
Track corner radius. | 50 |
iconSize |
double |
Size of the icon inside the call button. | 35 |
iconRadius |
double |
Radius of the round call button. | 30 |
dragThreshold |
double |
Distance (logical px) needed to accept or decline. | 80.0 |
โฟ Accessibility #
The slider is exposed to screen readers as a single element with two custom
actions named after your acceptText and declineText:
- VoiceOver (iOS): select the slider, swipe up/down to pick Accept or Decline, then double-tap.
- TalkBack (Android): select the slider, open the TalkBack menu โ Actions, then choose Accept or Decline.
No extra code is needed โ the actions call your onAccept / onDecline.
โฌ๏ธ Upgrading from 2.x #
3.0.0 moves the package to Flutter's standalone
material_ui library. The widget API
is unchanged โ just make sure your project is on Flutter 3.47 or newer,
then bump the version:
dependencies:
call_slider_button: ^3.0.0
To migrate your own app to material_ui as well, run:
dart fix --apply --code=migrate_design_widgets
๐ Example #
A complete Android & iOS demo app lives in the
example
folder:
cd example
flutter run
๐ Issues & contributions #
Found a bug or have an idea? Please open an issue on GitHub โ pull requests are welcome.
๐ License #
MIT โ see the LICENSE file.
๐ Author #
Built with โค๏ธ by Omer Jahangir