diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_card.dart index cfa864cd08b..bfa9260fe59 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_card.dart @@ -28,6 +28,7 @@ class KnowledgePanelCard extends StatelessWidget { panel: panel, allPanels: allPanels, product: product, + isInitiallyExpanded: false, ); } diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_element_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_element_card.dart index 291fc705a80..a1572529b42 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_element_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_element_card.dart @@ -19,11 +19,13 @@ class KnowledgePanelElementCard extends StatelessWidget { required this.knowledgePanelElement, required this.allPanels, required this.product, + required this.isInitiallyExpanded, }); final KnowledgePanelElement knowledgePanelElement; final KnowledgePanels allPanels; final Product product; + final bool isInitiallyExpanded; @override Widget build(BuildContext context) { @@ -54,6 +56,7 @@ class KnowledgePanelElementCard extends StatelessWidget { case KnowledgePanelElementType.TABLE: return KnowledgePanelTableCard( tableElement: knowledgePanelElement.tableElement!, + isInitiallyExpanded: isInitiallyExpanded, ); case KnowledgePanelElementType.MAP: return KnowledgePanelWorldMapCard(knowledgePanelElement.mapElement!); diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart index 02cf616f273..14df766ea35 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart @@ -12,11 +12,13 @@ class KnowledgePanelExpandedCard extends StatelessWidget { required this.panel, required this.allPanels, required this.product, + required this.isInitiallyExpanded, }); final KnowledgePanel panel; final KnowledgePanels allPanels; final Product product; + final bool isInitiallyExpanded; @override Widget build(BuildContext context) { @@ -31,6 +33,7 @@ class KnowledgePanelExpandedCard extends StatelessWidget { knowledgePanelElement: element, allPanels: allPanels, product: product, + isInitiallyExpanded: isInitiallyExpanded, ), ), ); diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_page.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_page.dart index 520f46fdae5..a591d6d5f88 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_page.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_page.dart @@ -60,6 +60,7 @@ class _KnowledgePanelPageState extends State panel: widget.panel, allPanels: widget.allPanels, product: widget.product, + isInitiallyExpanded: true, ), ), ), diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart index 298e876d419..54fb7a79934 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart @@ -59,9 +59,11 @@ class TableCell { class KnowledgePanelTableCard extends StatefulWidget { const KnowledgePanelTableCard({ required this.tableElement, + required this.isInitiallyExpanded, }); final KnowledgePanelTableElement tableElement; + final bool isInitiallyExpanded; @override State createState() => @@ -169,10 +171,12 @@ class _KnowledgePanelTableCardState extends State { availableWidth / totalMaxColumnWidth * _columnsMaxLength[index++]; rowWidgets.add( TableCellWidget( - cell: cell, - cellWidth: cellWidth, - tableElement: widget.tableElement, - rebuildTable: setState), + cell: cell, + cellWidth: cellWidth, + tableElement: widget.tableElement, + rebuildTable: setState, + isInitiallyExpanded: widget.isInitiallyExpanded, + ), ); } rowsWidgets.add(rowWidgets); @@ -250,19 +254,27 @@ class TableCellWidget extends StatefulWidget { required this.cellWidth, required this.tableElement, required this.rebuildTable, + required this.isInitiallyExpanded, }); final TableCell cell; final double cellWidth; final KnowledgePanelTableElement tableElement; final void Function(VoidCallback fn) rebuildTable; + final bool isInitiallyExpanded; @override State createState() => _TableCellWidgetState(); } class _TableCellWidgetState extends State { - bool _isExpanded = false; + late bool _isExpanded; + + @override + void initState() { + super.initState(); + _isExpanded = widget.isInitiallyExpanded; + } @override Widget build(BuildContext context) { diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels_builder.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels_builder.dart index 432dc44bc00..52dea92291c 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels_builder.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels_builder.dart @@ -48,6 +48,7 @@ class KnowledgePanelWidget extends StatelessWidget { knowledgePanelElement: knowledgePanelElement, allPanels: knowledgePanels, product: product, + isInitiallyExpanded: false, ), ); }