新增导航
This commit is contained in:
parent
bd8eee3bdc
commit
e387a8db03
@ -1,5 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import './pages/home_page.dart';
|
||||
import './pages/statistics_page.dart';
|
||||
import './pages/profile_page.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@ -10,14 +12,63 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 移除debug标签
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: '记账本',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
primaryColor: const Color(0xFF9FE2BF),
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: const Color(0xFF9FE2BF),
|
||||
),
|
||||
),
|
||||
home: const MainPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MainPage extends StatefulWidget {
|
||||
const MainPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<MainPage> createState() => _MainPageState();
|
||||
}
|
||||
|
||||
class _MainPageState extends State<MainPage> {
|
||||
int _currentIndex = 0;
|
||||
|
||||
// 页面列表
|
||||
final List<Widget> _pages = [
|
||||
const HomePage(),
|
||||
const StatisticsPage(),
|
||||
const ProfilePage(),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: _pages[_currentIndex],
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
currentIndex: _currentIndex,
|
||||
onTap: (index) {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
});
|
||||
},
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.account_balance_wallet),
|
||||
label: '记账',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.insert_chart),
|
||||
label: '统计',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.person),
|
||||
label: '我的',
|
||||
),
|
||||
],
|
||||
),
|
||||
home: const HomePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import 'dart:async';
|
||||
import '../models/record.dart';
|
||||
import './record_page.dart';
|
||||
import '../widgets/record_list.dart';
|
||||
import '../data/mock_data.dart'; // 暂时使用模拟数据
|
||||
import '../services/database_service.dart';
|
||||
import '../widgets/weekly_spending_chart.dart';
|
||||
import '../widgets/monthly_summary_card.dart';
|
||||
|
||||
17
lib/pages/profile_page.dart
Normal file
17
lib/pages/profile_page.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ProfilePage extends StatelessWidget {
|
||||
const ProfilePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('我的'),
|
||||
),
|
||||
body: const Center(
|
||||
child: Text('个人中心开发中...'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
17
lib/pages/statistics_page.dart
Normal file
17
lib/pages/statistics_page.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StatisticsPage extends StatelessWidget {
|
||||
const StatisticsPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('统计'),
|
||||
),
|
||||
body: const Center(
|
||||
child: Text('统计功能开发中...'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user