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
class ScaffoldRoute extends StatefulWidget { @override _ScaffoldRouteState createState() => _ScaffoldRouteState(); } class _ScaffoldRouteState extends State<ScaffoldRoute> { int _selectedIndex = 1; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( //导航栏 title: Text("App Name"), actions: <Widget>[ //导航栏右侧菜单 IconButton(icon: Icon(Icons.share), onPressed: () {}), ], ), drawer: MyDrawer(), //抽屉 bottomNavigationBar: BottomNavigationBar( // 底部导航 items: <BottomNavigationBarItem>[ BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('Home')), BottomNavigationBarItem(icon: Icon(Icons.business), title: Text('Business')), BottomNavigationBarItem(icon: Icon(Icons.school), title: Text('School')), ], currentIndex: _selectedIndex, fixedColor: Colors.blue, onTap: _onItemTapped, ), floatingActionButton: FloatingActionButton( //悬浮按钮 child: Icon(Icons.add), onPressed:_onAdd ), ); } void _onItemTapped(int index) { setState(() { _selectedIndex = index; }); } void _onAdd(){ } }
import 'package:flutter/material.dart'; class MyScaffold extends StatefulWidget { const MyScaffold({super.key}); @override State<MyScaffold> createState() => _MyScaffoldState(); } class _MyScaffoldState extends State<MyScaffold> { int _selectedIndex = 1; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('App Name'), actions: [IconButton(onPressed: () {}, icon: const Icon(Icons.share))], ), drawer: const Drawer(), // 抽屉 bottomNavigationBar: BottomNavigationBar( items: const [ BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'), BottomNavigationBarItem( icon: Icon(Icons.business), label: 'Business'), BottomNavigationBarItem(icon: Icon(Icons.school), label: 'School') ], currentIndex: _selectedIndex, fixedColor: Colors.blue, onTap: _onItemTapped, ), floatingActionButton: FloatingActionButton( // 悬浮按钮 onPressed: _onAdd, // 悬浮按钮 child: const Icon(Icons.add), ), ); } void _onItemTapped(int index) { setState(() { _selectedIndex = index; }); } void _onAdd() {} }
MyDrawer
Drawer
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原代码
更正后代码
更改的部分
MyDrawer
->Drawer
抽屉菜单The text was updated successfully, but these errors were encountered: