From f7b3d4d1b32c7903263b4c37d4260ebbf1d9dbc8 Mon Sep 17 00:00:00 2001 From: AyushBherwani1998 Date: Sat, 11 Apr 2020 19:49:44 +0530 Subject: [PATCH] adds code documentation and license --- lib/src/flutter/drop_down_button.dart | 46 +++++++++++++++++++++++++ test/flutter/drop_down_button_test.dart | 13 +++++++ 2 files changed, 59 insertions(+) diff --git a/lib/src/flutter/drop_down_button.dart b/lib/src/flutter/drop_down_button.dart index 29a5b78..ce63c82 100644 --- a/lib/src/flutter/drop_down_button.dart +++ b/lib/src/flutter/drop_down_button.dart @@ -21,22 +21,68 @@ class VxDropDownButton extends VxWidgetBuilder { @required this.valueHolder, }) : assert(valueHolder != null); + /// The List used to create [DropdownMenuItem]. + /// + /// _items can't be null. final List _items; + + /// The value used to define currently selected value of [VxDropDownButton]. String valueHolder; + + /// Defines the [TextStyle] for [DropdownMenuItem]. + /// + /// By default the value of `_textStyle` is [TextTheme.subhead] + /// value of the current [ThemeData.textTheme]. TextStyle _textStyle; + + /// Defines the widget used to draw underline for [VxDropDownButton] Widget _underLine; + + /// Defines the elevation for menu when drop down is open. + /// + /// By default, the value of `_elevation` is 8. int _elevation; + + /// Defines the size of [VxDropDownButton] icon. + /// + /// By default, the value of `_iconSize` is 24. double _iconSize; + + /// The [Icon] used for [VxDropDownButton]. + /// + /// By default, the icon is [Icons.arrow_drop_down] Icon _dropDownIcon; + + /// Defines the drop down button icon color when button is disabled. + /// + /// By default, the color is `Colors.grey.shade400`. Color _disabledIconColor; + + /// Defines the drop down button icon color when button is enabled. + /// + /// By default, the color is `Colors.grey.shade700` when the theme's [ThemeData.brightness] + /// is [Brightness.light] and to [Colors.white70] when it is [Brightness.dark]. Color _enabledIconColor; + + /// The color for the button's Material when it has the input focus. Color _focusColor; + + /// If the `_autoFocus` is true, [VxDropDownButton] will be selected as the initial focus when no other node + /// in its scope is currently focused. bool _autoFocus = false; + + /// Set the dropdown's inner contents to horizontally fill its parent. bool _isExpanded = false; + + /// Reduce the button's height. + /// + /// By default this button's height is the same as its menu items' heights. bool _isDense = false; + /// Called when user selects a value from drop down menu. ValueChanged _onValueChange; + VxDropDownButton textStyle(TextStyle style) => this.._textStyle = style; VxDropDownButton underLine(Widget widget) => this.._underLine = widget; diff --git a/test/flutter/drop_down_button_test.dart b/test/flutter/drop_down_button_test.dart index 185d0d1..578c0e9 100644 --- a/test/flutter/drop_down_button_test.dart +++ b/test/flutter/drop_down_button_test.dart @@ -1,3 +1,16 @@ +/* + * Copyright 2020 Pawan Kumar. All rights reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:velocity_x/velocity_x.dart';