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

outdatedDart 1 only

A new flutter package project.

example/example.dart

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

class Example extends StatefulWidget {
  @override
  _ExampleState createState() => new _ExampleState();
}

class _ExampleState extends State<Example> {
  List<String> switchOptions = ["Male", "Female"];
  String selectedSwitchOption = "Male";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Material Switch Demo"),
      ),
      body: Column(children: <Widget>[
        MaterialSwitch(
            selectedOption: selectedSwitchOption,
            options: switchOptions,
            selectedBackgroundColor: Colors.indigo,
            selectedTextColor: Colors.white,
            onSelect: (selectedOption) {
              setState(() {
                selectedSwitchOption = selectedOption;
              });
            }),
      ]),
    );
  }
}
1
likes
0
pub points
34%
popularity

Publisher

unverified uploader

A new flutter package project.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on material_switch