Build a Radial Menu in Flutter with This Step-by-Step Tutorial

flutter_radial_menu

A radial menu widget for Flutter.

demo.gif.

Installation

Install the latest version from pub.

Quick Start

Import the package, create a RadialMenu and pass it your RadialMenuItems.

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

void main() {
  runApp(
    new MaterialApp(
      home: new Scaffold(
        body: new Center(
          child: new RadialMenu(
            items: <RadialMenuItem<int>>[
              const RadialMenuItem<int>(
                value: 1,
                child: const Icon(Icons.add),
              ),
              const RadialMenuItem<int>(
                value: -1,
                child: const Icon(Icons.remove),
              )
            ],
            radius: 100.0,
            onSelected: print,
          ),
        ),
      ),
    ),
  );
}


Take a look at the demo for a more elaborate example.


Customization

RadialMenuItem

ParameterDefaultDescription
childnullUsually an Icon widget, gets placed in the center of the button.
valuenullValue that gets returned when this item is selected.
tooltipnullTooltip displayed when the button is long-pressed.
size48.0Size of the button.
backgroundColorTheme.of(context).primaryColorBackground fill color of the button.
iconColorTheme.of(context).primaryIconTheme.colorThe color of the child icon.

RadialMenu

ParameterDefaultDescription
itemsnullThe list of possible items to select from.
onSelectednullCalled when the user selects an item.
radius100.0The radius of the arc used to lay out the items and draw the progress bar.
menuAnimationDuration1000 millisecondsDuration of the menu opening/closing animation.
progressAnimationDuration1000 millisecondsDuration of the action activation progress arc animation.

Download details:

Author: xqwzts
Source: https://github.com/xqwzts/flutter_radial_menu

License: MIT license

#flutter #dart 

Build a Radial Menu in Flutter with This Step-by-Step Tutorial
1.00 GEEK