Skip to content

Commit

Permalink
Set min length for columns in a row (#980)
Browse files Browse the repository at this point in the history
* Scan example onboarding page: Switch svgs of ecoscore and nutriscore

* Set min length for columns in a row

* Format

Co-authored-by: Jasmeet Singh <jasmeetsingh@google.com>
  • Loading branch information
jasmeet0817 and Jasmeet Singh authored Jan 18, 2022
1 parent c5b982c commit 8cb5529
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import 'package:smooth_ui_library/util/ui_helpers.dart';
// text larger than this limit will be wrapped in multiple rows.
const int kMaxCellLengthInARow = 40;

// Minimum length of a cell, without this a column may look unnaturally small
// when put next to larger columns.
const int kMinCellLengthInARow = 20;

/// ColumnGroup is a group of columns collapsed into a single column. Purpose of
/// this is to show a dropdown menu which the users can use to select which column
/// to display. A group can also have a single column, in which case there will
Expand Down Expand Up @@ -228,8 +232,8 @@ class _KnowledgePanelTableCardState extends State<KnowledgePanelTableCard> {
_columnsMaxLength.add(cell.text.length);
} else {
if (cell.text.length > _columnsMaxLength[index]) {
_columnsMaxLength[index] =
min(kMaxCellLengthInARow, cell.text.length);
_columnsMaxLength[index] = max(kMinCellLengthInARow,
min(kMaxCellLengthInARow, cell.text.length));
}
}
index++;
Expand Down

0 comments on commit 8cb5529

Please sign in to comment.