Flutter Animated Radial Menus With Example Using Android

admin_img Posted By Bajarangi soft , Posted On 23-09-2020

The following lesson will teach you how to compose flutter animations into a cool rotating Circular Menu Button, which can easily maintain 60FPS on modern smartphones.

Circular Menu Button  At Center In Flutter Android App

As a starting point, we will create a simple app with a StackStack is a container Widget, that places widgets on top of each other. All of our widgets will be placed in it.Building a flashy Circular Menu Button Center in Flutter can be done with ease thanks to the Transform widget and staggered animations.

You can add this Circular Menu Center Icon  code :

CircularMenu(
  alignment: Alignment.center,
  toggleButtonColor: Colors.indigo,
  items: [
    CircularMenuItem(
        icon: Icons.mic,
        color: Colors.green,
        onTap: () {
          setState(() {
            _color = Colors.green;
            _colorName = 'MIC';
          });
        }),
    CircularMenuItem(
        icon: Icons.music_note,
        color: Colors.yellow,
        onTap: () {
          setState(() {
            _color = Colors.yellow;
            _colorName = 'MUSIC';
          });
        }),
    CircularMenuItem(
        icon: Icons.share,
        color: Colors.pink,
        onTap: () {
          setState(() {
            _color = Colors.pink;
            _colorName = 'SHARE';
          });
        }),
    CircularMenuItem(
        icon: Icons.movie,
        color: Colors.purple,
        onTap: () {
          setState(() {
            _color = Colors.purple;
            _colorName = 'MOVIES';
          });
        }),
    CircularMenuItem(
        icon: Icons.monochrome_photos,
        color: Colors.brown,
        onTap: () {
          setState(() {
            _color = Colors.brown;
            _colorName = 'PHOTOS';
          });
        })
  ],
),

Complete Code Circular Menu Center Icon  in flutter
Main.dart
import 'package:flutter/material.dart';
import 'package:circular_menu/circular_menu.dart';

void main()=> runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: "My App",
      home: MyHomePage(),
    );
  }
}


class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin {

  String _colorName = 'No';
  Color _color = Colors.black;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          centerTitle: true,
          backgroundColor: Colors.indigo,
          title: Text('Flutter Circular Menu'),
        ),
        body: CircularMenu(
          alignment: Alignment.center,
          toggleButtonColor: Colors.indigo,
          items: [
            CircularMenuItem(
                icon: Icons.mic,
                color: Colors.green,
                onTap: () {
                  setState(() {
                    _color = Colors.green;
                    _colorName = 'MIC';
                  });
                }),
            CircularMenuItem(
                icon: Icons.music_note,
                color: Colors.yellow,
                onTap: () {
                  setState(() {
                    _color = Colors.yellow;
                    _colorName = 'MUSIC';
                  });
                }),
            CircularMenuItem(
                icon: Icons.share,
                color: Colors.pink,
                onTap: () {
                  setState(() {
                    _color = Colors.pink;
                    _colorName = 'SHARE';
                  });
                }),
            CircularMenuItem(
                icon: Icons.movie,
                color: Colors.purple,
                onTap: () {
                  setState(() {
                    _color = Colors.purple;
                    _colorName = 'MOVIES';
                  });
                }),
            CircularMenuItem(
                icon: Icons.monochrome_photos,
                color: Colors.brown,
                onTap: () {
                  setState(() {
                    _color = Colors.brown;
                    _colorName = 'PHOTOS';
                  });
                })
          ],
        ),
      ),
    );
  }
}

Related Post