mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
[flutter]: fix bugs
This commit is contained in:
parent
2114dd7761
commit
0e94092df1
@ -88,7 +88,7 @@ class _MenuAppState extends State<MenuApp> {
|
||||
return MultiProvider(
|
||||
providers: [ChangeNotifierProvider.value(value: notifier)],
|
||||
child: Consumer(builder: (context, AppDataNotifier notifier, child) {
|
||||
return const ViewSection().padding(vertical: 8);
|
||||
return const ViewSection();
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
@ -37,18 +37,24 @@ class ViewSection extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _renderSectionItems(BuildContext context, List<View> views) {
|
||||
var viewWidgets = views.map(
|
||||
(view) => ViewSectionItem(
|
||||
view: view,
|
||||
isSelected: _isViewSelected(context, view.id),
|
||||
onSelected: (view) {
|
||||
context.read<ViewSectionNotifier>().selectedView = view;
|
||||
Provider.of<MenuSharedState>(context, listen: false).selectedView = view;
|
||||
},
|
||||
).padding(vertical: 4),
|
||||
);
|
||||
List<Widget> viewWidgets = [];
|
||||
|
||||
return Column(children: viewWidgets.toList(growable: false));
|
||||
if (views.isNotEmpty) {
|
||||
viewWidgets = views
|
||||
.map(
|
||||
(view) => ViewSectionItem(
|
||||
view: view,
|
||||
isSelected: _isViewSelected(context, view.id),
|
||||
onSelected: (view) {
|
||||
context.read<ViewSectionNotifier>().selectedView = view;
|
||||
Provider.of<MenuSharedState>(context, listen: false).selectedView = view;
|
||||
},
|
||||
).padding(vertical: 4),
|
||||
)
|
||||
.toList(growable: false);
|
||||
}
|
||||
|
||||
return Column(children: viewWidgets);
|
||||
}
|
||||
|
||||
bool _isViewSelected(BuildContext context, String viewId) {
|
||||
|
Loading…
Reference in New Issue
Block a user