Line data Source code
1 : import 'package:flutter/material.dart';
2 :
3 : import 'package:flutter_redux/flutter_redux.dart';
4 : import 'package:redfire/widgets.dart';
5 :
6 : import '../../../app_state.dart';
7 : import '../../../sections/actions/tap_sections_action.dart';
8 : import '../../models/sections_v_m.dart';
9 : import 'new_section_item.dart';
10 : import 'sections_list_view.dart';
11 :
12 : class SectionsView extends StatelessWidget {
13 2 : const SectionsView({Key? key}) : super(key: key);
14 1 : @override
15 : Widget build(BuildContext context) {
16 1 : return StoreConnector<AppState, SectionsVM?>(
17 2 : onInit: (store) => store.dispatch(const TapSectionsAction()),
18 : distinct: true,
19 3 : converter: (store) => store.state.sections,
20 1 : builder: (context, vm) {
21 1 : if (vm == null || vm.creatingNewSection) {
22 : return const WaitingIndicator('Creating...');
23 : }
24 1 : return Column(
25 1 : children: [
26 2 : SectionsListView(vm.list),
27 : const NewSectionItem(),
28 : ],
29 : );
30 : },
31 : );
32 : }
33 : }
|