Skip to content

Commit

Permalink
增加一些注释
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyxd committed Oct 17, 2019
1 parent 8a21b55 commit 1858569
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions lib/Picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,21 @@ class PickerLocalizations {
class Picker {
static const double DefaultTextSize = 20.0;

/// Index of currently selected items
List<int> selecteds;
/// Picker adapter, Used to provide data and generate widgets
final PickerAdapter adapter;
/// insert separator before picker columns
final List<PickerDelimiter> delimiter;

final VoidCallback onCancel;
final PickerSelectedCallback onSelect;
final PickerConfirmCallback onConfirm;

/// When the previous level selection changes, scroll the child to the first item.
final changeToFirst;

/// Specify flex for each column
final List<int> columnFlex;

final Widget title;
Expand All @@ -94,14 +99,26 @@ class Picker {
final String cancelText;
final String confirmText;

final double height, itemExtent;
final double height;

/// Height of list item
final double itemExtent;

final TextStyle textStyle, cancelTextStyle, confirmTextStyle, selectedTextStyle;
final TextAlign textAlign;

/// Text scaling factor
final double textScaleFactor;

final EdgeInsetsGeometry columnPadding;
final Color backgroundColor, headercolor, containerColor;

/// Hide head
final bool hideHeader;

/// List item loop
final bool looping;

final Widget footer;

final Decoration headerDecoration;
Expand Down Expand Up @@ -146,6 +163,7 @@ class Picker {
int _maxLevel = 1;

/// 生成picker控件
/// Build picker control
Widget makePicker([ThemeData themeData, bool isModal = false]) {
_maxLevel = adapter.maxLevel;
adapter.picker = this;
Expand All @@ -154,14 +172,14 @@ class Picker {
return _widget;
}

/// 显示 picker
/// show picker
void show(ScaffoldState state, [ThemeData themeData]) {
state.showBottomSheet((BuildContext context) {
return makePicker(themeData);
});
}

/// 显示模态 picker
/// Display modal picker
Future<T> showModal<T>(BuildContext context, [ThemeData themeData]) async {
return await showModalBottomSheet<T>(
context: context, //state.context,
Expand Down Expand Up @@ -214,6 +232,7 @@ class Picker {
}

/// 获取当前选择的值
/// Get the value of the current selection
List getSelectedValues() {
return adapter.getSelectedValues();
}
Expand Down Expand Up @@ -557,7 +576,10 @@ abstract class PickerAdapter<T> {
}

int get maxLevel => getMaxLevel();

/// Content length of current column
int get length => getLength();

String get text => getText();

// 是否联动,即后面的列受前面列数据影响
Expand Down

0 comments on commit 1858569

Please sign in to comment.