frosty/lib/widgets/channel_list.dart
tommyxchow e3f774d8e5 Redesign & refactor home screen
- Removed hamburger/drawer menu
- Moved search to bottom navigation bar
- Moved settings and profile to app bar
- Moved channel list from screen to widget folder
- Created search screen for viewing results
- Switched from Cupertino to Material routes due to rebuild issues
2021-11-10 21:29:15 -05:00

34 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:frosty/stores/channel_list_store.dart';
import 'package:frosty/widgets/channel_card.dart';
class ChannelList extends StatelessWidget {
final ChannelCategory category;
final ChannelListStore channelListStore;
const ChannelList({Key? key, required this.category, required this.channelListStore}) : super(key: key);
@override
Widget build(BuildContext context) {
debugPrint('Build channel list!');
return RefreshIndicator(
child: Observer(
builder: (_) {
return ListView.builder(
itemCount: channelListStore.channels(category: category).length,
padding: const EdgeInsets.all(5.0),
itemBuilder: (context, index) {
if (index > channelListStore.channels(category: category).length / 2 && channelListStore.hasMore(category: category)) {
channelListStore.getChannels(category: category);
}
return ChannelCard(channelInfo: channelListStore.channels(category: category).elementAt(index));
},
);
},
),
onRefresh: () => channelListStore.refresh(category: category),
);
}
}