settings_page.dart 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import 'package:flutter/material.dart';
  2. class SettingsPage extends StatefulWidget {
  3. @override
  4. _SettingsPageState createState() => _SettingsPageState();
  5. }
  6. class _SettingsPageState extends State<SettingsPage> {
  7. bool _openNotification = true;
  8. @override
  9. void initState() {
  10. super.initState();
  11. }
  12. @override
  13. void dispose() {
  14. super.dispose();
  15. }
  16. @override
  17. Widget build(BuildContext context) {
  18. return Theme(
  19. data: ThemeData(primaryColor: Colors.pink, iconTheme: IconThemeData(color: Colors.pink)),
  20. child: Scaffold(
  21. appBar: AppBar(
  22. title: Text('设置'),
  23. ),
  24. body: ListView(
  25. children: [
  26. SwitchListTile(
  27. activeColor: Colors.pink,
  28. title: Text('是否接收通知'),
  29. value: _openNotification,
  30. onChanged: (value) {
  31. setState(() {
  32. this._openNotification = value;
  33. });
  34. })
  35. ],
  36. ),
  37. ));
  38. }
  39. }