我无法找到让我的 appbar 启动和运行的信息,您能帮帮我吗?当我单击另一个图标时,屏幕保持不变!
import 'package:flutter/material.dart';
import 'package:curved_navigation_bar/curved_navigation_bar.dart';
void main() => runApp(MaterialApp(home: BottomNavBar()));
class BottomNavBar extends StatefulWidget {
@override
_BottomNavBarState createState() => _BottomNavBarState();
}
bool selected = false;
class _BottomNavBarState extends State<BottomNavBar> {
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: CurvedNavigationBar(
index: 0,
height: 50.0,
items: <Widget>[
Icon(Icons.home, size: 30, color: Colors.white),
Icon(Icons.camera, size: 30, color: Colors.white),
Icon(Icons.remove_red_eye, size: 30, color: Colors.white),
],
color: selected ? Colors.green.withOpacity(0.90) : Colors.red.withOpacity(0.90),
buttonBackgroundColor: selected ? Colors.green.withOpacity(0.90) : Colors.red.withOpacity(0.90),
backgroundColor: Colors.black12,
animationCurve: Curves.easeInOut,
animationDuration: Duration(
milliseconds: 550),
),