import ‘HomePage.dart’;
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
//关闭右上角的debug符号
debugShowCheckedModeBanner: false,
title: ‘OpenSource China’,
theme: ThemeData(
primaryColor: Color(AppColors.APP_THEME), //主题色
),
home: HomePage(),
);
}
}
HomePage.dart主界面内容的布局分为titleBar, body和底部的NavagationBar,body部分使用pager填充,增加了MyDrawer自定义Drawer的交互
import ‘package:flutter/material.dart’;
import ‘package:flutterapp2/constants/Constants.dart’;
import ‘package:flutterapp2/pages/discovery_page.dart’;
import ‘package:flutterapp2/pages/news_list_page.dart’;
import ‘package:flutterapp2/pages/profile_page.dart’;
import ‘package:flutterapp2/pages/tweet_page.dart’;
import ‘package:flutterapp2/widgets/my_drawer.dart’;
import ‘package:flutterapp2/widgets/navigation_icon_view.dart’;
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State {
//底部导航栏的四个title
final _appBarTitle = [‘News’, ‘Updates’, ‘Find’, ‘My’];
//底部四个导航栏的view
List _navigationIconView;
//当前条目
var _currentIndex = 0;
//底部导航栏对应的四个page
List _pages;
PageController _pageController;
@override
void initState() {
// TODO: implement initState