power_switch_button 0.0.1
power_switch_button: ^0.0.1 copied to clipboard
PowerSwitchButton is a versatile and customizable switch widget for Flutter that allows you to easily add a stylish toggle switch to your applications. With adjustable parameters for size, stroke wid [...]
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:power_switch_button/power_switch_button.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: Colors.white,
body: Center(
child: PowerSwitchButton(
size: 200,
strokeWidth: 4,
dashWidth: 1,
dashSpace: 2,
onColor: Colors.red,
offColor: Colors.grey,
backgroundColor: Colors.black,
onToggle: (bool isOn) {
print('Switch is ${isOn ? 'On' : 'Off'}');
},
),
),
),
);
}
}