material_segmented_control 2.0.10 copy "material_segmented_control: ^2.0.10" to clipboard
material_segmented_control: ^2.0.10 copied to clipboard

outdated

A segmented control widget like the one for iOS, but in Material design.

example/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  int _currentSelection = 0;

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Center(
        child: MaterialSegmentedControl(
          children: _children,
          selectionIndex: _currentSelection,
          borderColor: Colors.grey,
          selectedColor: Colors.redAccent,
          unselectedColor: Colors.white,
          borderRadius: 24.0,
          disabledChildren: [
            3,
          ],
          onSegmentChosen: (index) {
            setState(() {
              _currentSelection = index;
            });
          },
        ),
      ),
    );
  }

  Map<int, Widget> _children = {
    0: Text('Hummingbird'),
    1: Text('Kiwi'),
    2: Text('Rio'),
    3: Text('Telluraves')
  };
}
91
likes
0
pub points
96%
popularity

Publisher

unverified uploader

A segmented control widget like the one for iOS, but in Material design.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on material_segmented_control