mirror of
https://github.com/flutter/samples.git
synced 2025-11-11 15:28:44 +00:00
initial gallery
This commit is contained in:
31
cupertino_gallery/lib/widgets/switch_page.dart
Normal file
31
cupertino_gallery/lib/widgets/switch_page.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
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;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user