iconswitcher 1.0.2 copy "iconswitcher: ^1.0.2" to clipboard
iconswitcher: ^1.0.2 copied to clipboard

outdated

A plugin to create an icon switcher to put on the AppBar Widget

IconSwitcher #

A Flutter plugin that allows you to create an icon switcher on the AppBar Widget

EXAMPLE OF USAGE

You can use it to create multiple screen views inside a same Widget using all the Flutter Animated Widgets

CODE:

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:iconswitcher/iconswitcher.dart';

class screen extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _screen();
  }
}

class _screen extends State<screen> with TickerProviderStateMixin {
  bool left = true;
  Duration duration = Duration(milliseconds: 400);

  @override
  Widget build(BuildContext context) {
    double marginTop = 1.5;
    double height = kToolbarHeight - marginTop * 2;
    double width = height * 2;

    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.white,
        title: Text(
          "prova",
        ),
        actions: <Widget>[
          IconSwitcher(
            width: width,
            height: height,
            marginTop: marginTop,
            color1: Colors.purple,
            color2: Colors.white,
            icon1: Icons.satellite,
            icon2: Icons.content_copy,
            backgroundColor: Colors.black,
            duration: duration,
            onChange: (bool result) {
              setState(() {
                left = result;
              });
            },
          )
        ],
      ),
      body: AnimatedCrossFade(
        firstChild: Container(
          color: Colors.black54,
        ),
        secondChild: Container(
          color: Colors.orange,
        ),
        duration: duration,
        crossFadeState:
            left ? CrossFadeState.showFirst : CrossFadeState.showSecond,
        firstCurve: Curves.bounceOut,
        secondCurve: Curves.bounceOut,
      ),
    );
  }
}


0
likes
0
pub points
15%
popularity

Publisher

unverified uploader

A plugin to create an icon switcher to put on the AppBar Widget

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on iconswitcher