bouncing_call_slider 2.0.0
bouncing_call_slider: ^2.0.0 copied to clipboard
A customizable Flutter widget that mimics an incoming call slider with bounce animation, swipe-to-accept or decline, and haptic feedback. Ideal for call UI.
import 'package:bouncing_call_slider/bouncing_call_slider.dart';
import 'package:material_ui/material_ui.dart';
void main() => runApp(const MyApp());
/// Example app showcasing [BouncingCallSlider].
class MyApp extends StatelessWidget {
/// Creates the example app.
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Bouncing Call Slider Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.green),
),
home: const CallSliderDemoScreen(),
);
}
}
/// A demo screen with a single incoming-call slider.
class CallSliderDemoScreen extends StatelessWidget {
/// Creates the demo screen.
const CallSliderDemoScreen({super.key});
void _showMessage(BuildContext context, String message) {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(SnackBar(content: Text(message)));
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xffF2F2F2),
body: Center(
child: BouncingCallSlider(
onAccept: () => _showMessage(context, 'Call Accepted'),
onDecline: () => _showMessage(context, 'Call Declined'),
acceptIcon: const Icon(Icons.call, size: 30, color: Colors.white),
declineIcon: const Icon(
Icons.call_end,
size: 30,
color: Colors.white,
),
height: 240,
width: 80,
iconSize: 30,
buttonSize: 80,
),
),
);
}
}