mucke/lib/presentation/pages/library_page.dart

76 lines
1.7 KiB
Dart
Raw Normal View History

2020-03-28 09:39:59 +01:00
import 'package:flutter/material.dart';
import '../state/music_store.dart';
2020-03-28 11:08:43 +01:00
import 'albums_page.dart';
import 'songs_page.dart';
2020-03-28 09:39:59 +01:00
class LibraryPage extends StatefulWidget {
2020-03-28 09:39:59 +01:00
const LibraryPage({Key key, @required this.store}) : super(key: key);
final MusicStore store;
@override
_LibraryPageState createState() => _LibraryPageState();
}
class _LibraryPageState extends State<LibraryPage>
with SingleTickerProviderStateMixin {
TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 3, vsync: this);
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
print('LibraryPage.build');
return SafeArea(
child: Column(
children: <Widget>[
TabBar(
controller: _tabController,
tabs: <Tab>[
Tab(
text: 'Artists',
),
Tab(
text: 'Albums',
),
Tab(
text: 'Songs',
2020-03-28 11:08:43 +01:00
),
],
),
Expanded(
child: TabBarView(
controller: _tabController,
children: <Widget>[
Center(
key: PageStorageKey('ArtistsPage'),
child: Text('Artists'),
),
AlbumsPage(
key: const PageStorageKey('AlbumsPage'),
store: widget.store,
),
SongsPage(
key: const PageStorageKey('SongsPage'),
store: widget.store,
),
],
),
)
],
),
);
}
2020-03-28 09:39:59 +01:00
}