apptomate_custom_toggle_button 0.0.2 copy "apptomate_custom_toggle_button: ^0.0.2" to clipboard
apptomate_custom_toggle_button: ^0.0.2 copied to clipboard

A customizable toggle button widget with smooth animations and flexible styling options.

example/lib/main.dart

import 'package:apptomate_custom_toggle_button/apptomate_custom_toggle_button.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  _CustomToggleButtonExampleState createState() =>
      _CustomToggleButtonExampleState();
}

class _CustomToggleButtonExampleState extends State<MyHomePage> {
  bool isToggled = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Center(
          child: CustomToggleButton(
            value: isToggled,
            onChanged: (newValue) {
              setState(() {
                isToggled = newValue;
              });
            },
            activeText: "ON",
            inactiveText: "OFF",
            activeColor: Colors.green,
            inactiveColor: Colors.red,
          ),
        ),
      ),
    );
  }
}
1
likes
150
points
43
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A customizable toggle button widget with smooth animations and flexible styling options.

Homepage

License

MIT (license)

Dependencies

flutter

More

Packages that depend on apptomate_custom_toggle_button