import 'package:flutter/material.dart'; import 'package:model_of_the_times/entities/ViewInformation.dart'; import 'package:model_of_the_times/icons/material_design_icons.dart'; import 'package:model_of_the_times/views/home.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: '时代楷模', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.white), useMaterial3: true, ), home: const MainPage(), ); } } class MainPage extends StatefulWidget { const MainPage({super.key}); @override State createState() => _MainPageState(); } class _MainPageState extends State { int _nowPageIndex = 0; final List _pages = [ ViewInformation(const HomeView(), "时代楷模") ]; @override Widget build(BuildContext context) { final page = _pages[_nowPageIndex]; return Scaffold( appBar: AppBar( title: Text( page.title, style: const TextStyle( color: Colors.red ), ), centerTitle: true, ), body: page.view, bottomNavigationBar: BottomNavigationBar( onTap: (newIndex){ setState(() { _nowPageIndex = newIndex; }); }, type: BottomNavigationBarType.fixed, items: const [ BottomNavigationBarItem( icon: Icon(MaterialDesign.home), label: "首页" ), BottomNavigationBarItem( icon: Icon(MaterialDesign.feedback), label: "公告" ), BottomNavigationBarItem( icon: Icon(MaterialDesign.favorite), label: "心得" ), BottomNavigationBarItem( icon: Icon(MaterialDesign.view_stream), label: "数据分析" ), ] ), ); } }