We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SwitchAndCheckBoxTestRoute
mart.dart
MateriaApp
import 'package:flutter/material.dart'; class SwitchAndCheckBoxTestRoute extends StatefulWidget { const SwitchAndCheckBoxTestRoute({super.key}); @override State<SwitchAndCheckBoxTestRoute> createState() => _SwitchAndCheckBoxTestRouteState(); } class _SwitchAndCheckBoxTestRouteState extends State<SwitchAndCheckBoxTestRoute> { bool _switchSelected = true; // 维护单选开关状态 bool _checkboxSelected = true; // 维护复选框状态 @override Widget build(BuildContext context) { return Scaffold( // 要引入 Material 小部件,您可以直接包含一个小部件,或者使用包含 Material 本身的小部件,例如 Card ,Dialog , Drawer 或 Scaffold 。 body: Column( children: [ Switch( value: _switchSelected, onChanged: (value) { setState(() { _switchSelected = value; }); }), Checkbox( value: _checkboxSelected, onChanged: (value) { setState(() { _checkboxSelected = value!; }); }) ], ), ); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
书中代码示例歧义的地方
问题描述
SwitchAndCheckBoxTestRoute
放在mart.dart
中的MateriaApp
中的home属性的话,会报错。报错信息为: No Material widget foundThe text was updated successfully, but these errors were encountered: