mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

* Add cupertino to gallery and add CupertinoButto * Use single quotes * Add disabled state * Some review notes * Make button animation more responsive and tweak timing * Renamed things Cupertino * Button with background, move cupertino demos, move material demos * Move 2 level list too * Refactor various demo route names * Some review notes * More reviews and add test * Linter as * Move private constant up
38 lines
955 B
Dart
38 lines
955 B
Dart
// Copyright 2017 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class CupertinoSwitchDemo extends StatefulWidget {
|
|
static const String routeName = '/cupertino/switch';
|
|
|
|
@override
|
|
_CupertinoSwitchDemoState createState() => new _CupertinoSwitchDemoState();
|
|
}
|
|
|
|
class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
|
|
|
|
bool _switchValue = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return new Scaffold(
|
|
appBar: new AppBar(
|
|
title: new Text('Cupertino Switch'),
|
|
),
|
|
body: new Center(
|
|
child: new CupertinoSwitch(
|
|
value: _switchValue,
|
|
onChanged: (bool value) {
|
|
setState(() {
|
|
_switchValue = value;
|
|
});
|
|
}
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|