Answers for "rotate IconButton flutter"

2

rotate IconButton flutter

import 'dart:math' as math;

Transform.rotate(
  angle: 180 * math.pi / 180,
  child: IconButton(
    icon: Icon(
      Icons.play,
      color: Colors.white,
    ),
    onPressed: null,
  ),
),
Posted by: Guest on April-18-2022
0

flutter rotate animation icon on press

@override
  void initState() {
    super.initState();

    _controller = AnimationController(
      vsync: this,
      duration: Duration(milliseconds: 300),
      upperBound: 0.5,
    );
  }
  
  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }
  
  RotationTransition(
              turns: Tween(begin: 0.0, end: 0.5).animate(_controller),
              child: IconButton(
                icon: Icon(Icons.expand_less),
                onPressed: () {
                  setState(() {
                    if (_expanded) {
                      _controller..reverse(from: 0.5);
                    } else {
                      _controller..forward(from: 0.0);
                    }
                    _expanded = !_expanded;
                  });
                },
              ),
            )
Posted by: Guest on January-22-2022

Code answers related to "Dart"

Browse Popular Code Answers by Language