import 'package:flutter/material.dart'; class SettingsPage extends StatefulWidget { @override _SettingsPageState createState() => _SettingsPageState(); } class _SettingsPageState extends State { bool _openNotification = true; @override void initState() { super.initState(); } @override void dispose() { super.dispose(); } @override Widget build(BuildContext context) { return Theme( data: ThemeData(primaryColor: Colors.pink, iconTheme: IconThemeData(color: Colors.pink)), child: Scaffold( appBar: AppBar( title: Text('设置'), ), body: ListView( children: [ SwitchListTile( activeColor: Colors.pink, title: Text('是否接收通知'), value: _openNotification, onChanged: (value) { setState(() { this._openNotification = value; }); }) ], ), )); } }