Merge pull request #1703 from HansMuller/button_demo
Gallery Demos: button, dialog, snack bar Added button, dialog, and snack bar gallery demos. Split gallery main.dart into files in the lib/gallery subdirectory. Enable TabBarSelectionState to deal with the PageStorage saved selected value no longer equalling any value. Changed the color of Dialog text to match the theme's caption color. Also: uppercased tab labels per #1617
This commit is contained in:
@@ -134,7 +134,8 @@ abstract class MaterialButtonState<T extends MaterialButton> extends State<T> {
|
||||
return new Container(
|
||||
height: 36.0,
|
||||
constraints: new BoxConstraints(minWidth: 88.0),
|
||||
margin: new EdgeDims.all(8.0),
|
||||
padding: const EdgeDims.symmetric(horizontal: 8.0),
|
||||
margin: const EdgeDims.all(8.0),
|
||||
child: contents
|
||||
);
|
||||
}
|
||||
|
||||
@@ -436,6 +436,12 @@ class TabBarSelectionState<T> extends State<TabBarSelection<T>> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_value = config.value ?? PageStorage.of(context)?.readState(context) ?? values.first;
|
||||
|
||||
// If the selection's values have changed since the selected value was saved with
|
||||
// PageStorage.writeState() then use the default.
|
||||
if (!values.contains(_value))
|
||||
_value = values.first;
|
||||
|
||||
_previousValue = _value;
|
||||
_initValueToIndex();
|
||||
}
|
||||
@@ -870,6 +876,7 @@ class _TabBarViewState extends PageableListState<TabBarView> implements TabBarSe
|
||||
void _updateItemsAndScrollBehavior() {
|
||||
assert(_selection != null);
|
||||
final int selectedIndex = _selection.index;
|
||||
assert(selectedIndex != null);
|
||||
_updateItemsForSelectedIndex(selectedIndex);
|
||||
_updateScrollBehaviorForSelectedIndex(selectedIndex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user