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

A custom Cupertino-style switcher widget with animated transitions and optional rotation.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'CustomCupertinoSwitcher Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

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

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

class _MyHomePageState extends State<MyHomePage> {
  bool _switcherValue = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('CustomCupertinoSwitcher Example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            RotatedAnimatedSwitcher(
              initialValue: _switcherValue,
              width: 60.0,
              height: 30.0,
              activeColor: Colors.green,
              disabledColor: Colors.red,
              duration: const Duration(milliseconds: 300),
              shouldRotate: true,
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () {
                setState(() {
                  _switcherValue = !_switcherValue;
                });
              },
              child: const Text('Toggle Switcher'),
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
160
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

A custom Cupertino-style switcher widget with animated transitions and optional rotation.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on rotated_animated_switcher