You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
samples/cupertino_gallery/lib/widgets/switch_page.dart

32 lines
673 B

import 'package:flutter/cupertino.dart';
class SwitchPage extends StatefulWidget {
const SwitchPage({super.key});
@override
State<SwitchPage> createState() => _SwitchPageState();
}
class _SwitchPageState extends State<SwitchPage> {
bool _value = true;
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
middle: Text('Switch'),
),
child: Center(
child: CupertinoSwitch(
value: _value,
onChanged: (bool value) {
setState(() {
_value = value;
});
},
),
),
);
}
}