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

outdated

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 = <String>['Male', 'Female'];
  String selectedSwitchOption = 'Male';
  String appTitle = 'Material Switch Demo';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(appTitle),
      ),
      body: Column(children: <Widget>[
        MaterialSwitch(
          padding: const EdgeInsets.all(5.0),
          margin: const EdgeInsets.all(5.0),
          selectedOption: selectedSwitchOption,
          options: switchOptions,
          selectedBackgroundColor: Colors.indigo,
          selectedTextColor: Colors.white,
          onSelect: (String 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