uni_selected_button
provides a group of buttons where only one button can be selected at a time.
Add the following line to your pubspec.yaml
file:
dependencies:
uni_selected_button: ^0.0.1
- Import the package in your Dart file
import 'package:uni_selected_button/uni_selected_button.dart';
- Use
UniSelectedButton
widget, and provide a list ofSelectedButton
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) => {},
),
],
),