This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
LocalSpend-Tracker/lib/pages/home_page.dart

77 lines
1.9 KiB
Dart
Raw Permalink Normal View History

import 'package:flutter/material.dart';
2019-08-05 08:33:39 +00:00
import 'package:local_spend/pages/receipt_page_2.dart';
import 'package:local_spend/pages/more_page.dart';
import 'package:local_spend/pages/stats_page.dart';
2019-08-21 11:35:21 +00:00
import 'package:local_spend/pages/map_page.dart';
class HomePage extends StatelessWidget {
static String _title = 'SpendTracker';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: HomePageWidget(),
);
}
}
class HomePageWidget extends StatefulWidget {
HomePageWidget({Key key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePageWidget> {
int _selectedIndex = 0;
2019-08-21 11:35:21 +00:00
static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static List<Widget> _widgetOptions = <Widget>[
2019-08-05 08:33:39 +00:00
ReceiptPage2(),
StatsPage(),
MapPage(),
MorePage()
];
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: _widgetOptions.elementAt(_selectedIndex),
),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.receipt),
title: Text('Submit Receipt'),
),
BottomNavigationBarItem(
icon: Icon(Icons.show_chart),
title: Text('Statistics'),
),
2019-08-21 11:35:21 +00:00
BottomNavigationBarItem(
icon: Icon(Icons.map),
title: Text('Locations'),
),
BottomNavigationBarItem(
icon: Icon(Icons.more_horiz),
title: Text('More'),
),
],
currentIndex: _selectedIndex,
2019-08-21 11:35:21 +00:00
unselectedItemColor: Colors.grey[400],
selectedItemColor: Colors.blue[400],
onTap: _onItemTapped,
),
);
}
}