52 lines
1.5 KiB
Dart
52 lines
1.5 KiB
Dart
import 'package:ltx_flutter/pages/account_page.dart';
|
|
import 'package:ltx_flutter/pages/categories_page.dart';
|
|
import 'package:ltx_flutter/pages/today_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
import '../app_properties_bloc.dart';
|
|
|
|
class TabsPage extends StatefulWidget {
|
|
const TabsPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_TabsPageState createState() => _TabsPageState();
|
|
}
|
|
|
|
class _TabsPageState extends State<TabsPage> {
|
|
int _selectedIndex = 0;
|
|
|
|
static const _widgets = [TodayPage(), CategoriesPage(), AccountPage()];
|
|
|
|
void _onItemTapped(int index) {
|
|
setState(() {
|
|
_selectedIndex = index;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: StreamBuilder<Object>(
|
|
stream: appBloc.titleStream,
|
|
initialData: "Flutter",
|
|
builder: (context, snapshot) {
|
|
return Text(snapshot.data.toString());
|
|
}),
|
|
),
|
|
body: _widgets.elementAt(_selectedIndex),
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
items: const [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.today_outlined), label: "Today"),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.category_outlined), label: "Categories"),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.account_circle_outlined), label: "Account")
|
|
],
|
|
currentIndex: _selectedIndex,
|
|
onTap: _onItemTapped,
|
|
),
|
|
);
|
|
}
|
|
}
|