@@ -3,9 +3,9 @@ import 'dart:async';
3
3
import 'package:catalyst_voices/pages/proposal_builder/proposal_builder_body.dart' ;
4
4
import 'package:catalyst_voices/pages/proposal_builder/proposal_builder_navigation_panel.dart' ;
5
5
import 'package:catalyst_voices/pages/proposal_builder/proposal_builder_setup_panel.dart' ;
6
- import 'package:catalyst_voices/widgets/containers/space_scaffold.dart' ;
7
- import 'package:catalyst_voices/widgets/navigation/sections_controller.dart' ;
6
+ import 'package:catalyst_voices/widgets/widgets.dart' ;
8
7
import 'package:catalyst_voices_blocs/catalyst_voices_blocs.dart' ;
8
+ import 'package:catalyst_voices_models/catalyst_voices_models.dart' ;
9
9
import 'package:catalyst_voices_view_models/catalyst_voices_view_models.dart' ;
10
10
import 'package:flutter/foundation.dart' ;
11
11
import 'package:flutter/material.dart' ;
@@ -25,29 +25,29 @@ class ProposalBuilderPage extends StatefulWidget {
25
25
}
26
26
27
27
class _ProposalBuilderPageState extends State <ProposalBuilderPage > {
28
- late final SectionsController _sectionsController ;
28
+ late final SegmentsController _segmentsController ;
29
29
late final ItemScrollController _bodyItemScrollController;
30
30
31
- SectionStepId ? _activeStepId ;
32
- StreamSubscription <List <Section >>? _sectionsSub ;
31
+ NodeId ? _activeSegmentId ;
32
+ StreamSubscription <List <Segment >>? _segmentsSub ;
33
33
34
34
@override
35
35
void initState () {
36
36
super .initState ();
37
37
38
38
final bloc = context.read <ProposalBuilderBloc >();
39
39
40
- _sectionsController = SectionsController ();
40
+ _segmentsController = SegmentsController ();
41
41
_bodyItemScrollController = ItemScrollController ();
42
42
43
- _sectionsController
43
+ _segmentsController
44
44
..addListener (_handleSectionsControllerChange)
45
45
..attachItemsScrollController (_bodyItemScrollController);
46
46
47
- _sectionsSub = bloc.stream
48
- .map ((event) => event.sections )
47
+ _segmentsSub = bloc.stream
48
+ .map ((event) => event.segments )
49
49
.distinct (listEquals)
50
- .listen (_updateSections );
50
+ .listen (_updateSegments );
51
51
52
52
bloc.add (LoadProposalEvent (id: widget.proposalId));
53
53
}
@@ -64,17 +64,17 @@ class _ProposalBuilderPageState extends State<ProposalBuilderPage> {
64
64
65
65
@override
66
66
void dispose () {
67
- unawaited (_sectionsSub ? .cancel ());
68
- _sectionsSub = null ;
67
+ unawaited (_segmentsSub ? .cancel ());
68
+ _segmentsSub = null ;
69
69
70
- _sectionsController .dispose ();
70
+ _segmentsController .dispose ();
71
71
super .dispose ();
72
72
}
73
73
74
74
@override
75
75
Widget build (BuildContext context) {
76
- return SectionsControllerScope (
77
- controller: _sectionsController ,
76
+ return SegmentsControllerScope (
77
+ controller: _segmentsController ,
78
78
child: SpaceScaffold (
79
79
left: const ProposalBuilderNavigationPanel (),
80
80
body: ProposalBuilderBody (
@@ -85,23 +85,23 @@ class _ProposalBuilderPageState extends State<ProposalBuilderPage> {
85
85
);
86
86
}
87
87
88
- void _updateSections (List <Section > data) {
89
- final state = _sectionsController .value;
88
+ void _updateSegments (List <Segment > data) {
89
+ final state = _segmentsController .value;
90
90
91
- final newState = state.sections .isEmpty
92
- ? SectionsControllerState .initial (sections : data)
93
- : state.copyWith (sections : data);
91
+ final newState = state.segments .isEmpty
92
+ ? SegmentsControllerState .initial (segments : data)
93
+ : state.copyWith (segments : data);
94
94
95
- _sectionsController .value = newState;
95
+ _segmentsController .value = newState;
96
96
}
97
97
98
98
void _handleSectionsControllerChange () {
99
- final activeStepId = _sectionsController .value.activeStepId ;
99
+ final activeSectionId = _segmentsController .value.activeSectionId ;
100
100
101
- if (_activeStepId != activeStepId ) {
102
- _activeStepId = activeStepId ;
101
+ if (_activeSegmentId != activeSectionId ) {
102
+ _activeSegmentId = activeSectionId ;
103
103
104
- final event = ActiveStepChangedEvent (activeStepId );
104
+ final event = ActiveStepChangedEvent (activeSectionId );
105
105
context.read <ProposalBuilderBloc >().add (event);
106
106
}
107
107
}
0 commit comments