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
Felix 60873a07ef Lots!
New navigation system, new 'about/settings/logout' page, some more types of dialog boxes added, some more minor things
2019-07-15 12:09:10 +01:00

62 lines
No EOL
1.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:local_spend/pages/receipt_page.dart';
import 'package:local_spend/pages/settings.dart';
class HomePage extends StatelessWidget {
static String _title = 'Text here';
@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;
static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static List<Widget> _widgetOptions = <Widget>[
ReceiptPage(),
SettingsPage()
];
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.settings),
title: Text('Settings'),
),
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.blue[400],
onTap: _onItemTapped,
),
);
}
}