initialRoute: ‘/’,
routes: {
‘/’: (context) => HomeIn(),
},
theme: ThemeData(
primarySwatch: Colors.blue,
highlightColor: Color.fromRGBO(255, 255, 255, 0.5),
splashColor: Colors.white70,
accentColor: Color.fromRGBO(178, 222, 225, 1.0),
),
);
}
}
class HomeIn extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Home();
}
}
class Home extends StatefulWidget {
_HomeState createState() => _HomeState();
}
class _HomeState extends State {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 4,
child: Scaffold(
drawer: DrawerHead() // 抽取控件
),
);
}
}
在展示的这段代码中,除与抽屉菜单无关的代码博主都已去除,以免影响同学们的阅读