control_button 0.0.1 copy "control_button: ^0.0.1" to clipboard
control_button: ^0.0.1 copied to clipboard

outdated

Control button with adjustable sections

example/example.dart

// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:flutter/material.dart';

import 'package:control_button/control_button.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Control Button Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

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

class _MyHomePageState extends State<MyHomePage> {
  String text = '';

  void updateState(String showText) {
    setState(() {
      text = showText;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Control Button'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            ControlButton(
              sectionOffset: 45,
              externalDiameter: 300,
              internalDiameter: 120,
              mainAction: () => updateState('Selected Center'),
              sections: [
                () => updateState('Selected 1'),
                () => updateState('Selected 2'),
                () => updateState('Selected 3'),
                () => updateState('Selected 4'),
              ],
            ),
            Text(
              text,
              style: TextStyle(
                fontSize: 24,
                color: Theme.of(context).accentColor,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
7
likes
30
pub points
72%
popularity

Publisher

verified publisherversion-one.com

Control button with adjustable sections

Homepage

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on control_button