Skip to content

Flutter widget provides a group of buttons where only one button can be selected at a time.

License

Notifications You must be signed in to change notification settings

huynguyennovem/uni_selected_button

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

uni_selected_button provides a group of buttons where only one button can be selected at a time.

Getting started

Add dependency

Add the following line to your pubspec.yaml file:

dependencies:
  uni_selected_button: ^0.0.1

Usage

  1. Import the package in your Dart file
import 'package:uni_selected_button/uni_selected_button.dart';
  1. Use UniSelectedButton widget, and provide a list of SelectedButton widgets as children.
UniButtonGroup(
  children: [
    SelectedButton(
        label: const Text('Light'),
        icon: const Icon(Icons.light_mode),
        value: ThemeMode.light,
        groupValue: _themeMode,
        onPressed: (value) => {},
    ),
    SelectedButton(
        label: const Text('Dark'),
        icon: const Icon(Icons.dark_mode),
        value: ThemeMode.dart,
        groupValue: _themeMode,
        onPressed: (value) => {},
    ),
    SelectedButton(
        label: const Text('System'),
        icon: const Icon(Icons.laptop),
        value: ThemeMode.system,
        groupValue: _themeMode,
        onPressed: (value) => {},
    ),
  ],
),

Demo

Demo example