Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
e30663e
(WIP) Preliminary toggle button implementation
shihaohong May 3, 2019
e5b66ad
WIP - scaffold out ToggleButton
shihaohong May 8, 2019
6037c93
WIP - work on using IconButton for ToggleButton
shihaohong May 14, 2019
92d3ad3
Merge IconButton conflicts
shihaohong May 28, 2019
9c3c302
WIP - ToggleButton implementation with RawMaterialButton
shihaohong May 28, 2019
e08820c
Add focusColor and constructor documentation
shihaohong May 28, 2019
00ecc12
WIP - Basic ToggleButtons implementation
shihaohong Jun 3, 2019
220a482
const ToggleButtons constructor, made ToggleButton private class
shihaohong Jun 3, 2019
1bddd3c
WIP - Add skeleton of ToggleButtonBorder class
shihaohong Jun 4, 2019
be500d2
WIP - Basic borders with Paint API
shihaohong Jun 7, 2019
ef96857
Basic rounded corners
shihaohong Jun 10, 2019
70dc32b
WIP - Uniform border width, fix paint, still needs children horizonta…
shihaohong Jun 10, 2019
594542c
Reorder classes in toggle_button.dart
shihaohong Jun 10, 2019
77ce86a
Remove accidentally added IconButton properties
shihaohong Jun 10, 2019
b403ea7
WIP - Fix border radius anand child content clip misalignment
shihaohong Jun 14, 2019
a0746a2
Add ClipRRect logic to round off toggle button contents
shihaohong Jun 17, 2019
08e7a80
Proper layout of borders and children
shihaohong Jun 17, 2019
fc4c613
Fix gap between curved corners and straight horizontal border
shihaohong Jun 17, 2019
90d4e39
constraints logic cleanup in performLayout
shihaohong Jun 17, 2019
5cfa230
Paint logic refactor
shihaohong Jun 17, 2019
5e1aef7
Fix bottom right corner radii bug
shihaohong Jun 17, 2019
bfe4274
WIP - directionality
shihaohong Jun 17, 2019
74a19be
Fix RTL layout
shihaohong Jun 18, 2019
f6488dd
Merge branch 'master' of github.com:flutter/flutter into toggle-button
shihaohong Jun 24, 2019
246afad
Add scaleRadii to ToggleButton borders
shihaohong Jun 24, 2019
21c77fe
Remove intermediary side variables for paint API
shihaohong Jun 24, 2019
b7dfebe
Add first draft API documentation
shihaohong Jun 24, 2019
9b92b55
remove print statement
shihaohong Jun 24, 2019
3099f15
Add border-less option with borderWidth set to null
shihaohong Jun 24, 2019
aff007c
Wrap Row in IntrinsicHeight such that all child widgets match heights
shihaohong Jun 25, 2019
223fbb2
Refactor out borderSide and borderRadius logic in ToggleButtons class
shihaohong Jun 25, 2019
379e537
Add comments to all members
shihaohong Jun 25, 2019
8f4cb3d
Made RenderObject members non-final
shihaohong Jun 25, 2019
dbabfc3
Remove whitespace for ToggleButtons private methods
shihaohong Jun 25, 2019
a3cbeff
Remove unnecessary shape property
shihaohong Jun 25, 2019
8376dac
Add three samples for onPressed implementations
shihaohong Jun 25, 2019
79c160c
Complete first draft of ToggleButtons API Doc
shihaohong Jun 25, 2019
65df447
Add link to toggle button material design spec, constructor documenta…
shihaohong Jun 25, 2019
d673156
Add a check to ensure isSelected has no null values
shihaohong Jun 25, 2019
7a9705f
Wire through remaining color properties to RawMaterialButton
shihaohong Jun 25, 2019
ff0d1a9
Added documentation for color properties
shihaohong Jun 25, 2019
6192921
Add key property to constructor
shihaohong Jun 25, 2019
6c70b0d
Merge branch 'master' of github.com:flutter/flutter into toggle-button
shihaohong Jun 25, 2019
b567d30
update sweepAngle from final to const
shihaohong Jun 26, 2019
b6887d6
Create ToggleButtons theme
shihaohong Jun 26, 2019
24df035
Integrated ToggleButtonsTheme into ToggleButtons classes
shihaohong Jun 26, 2019
32542da
Remove TODO for properties
shihaohong Jun 26, 2019
b8b1d4d
Fix docs typo teach -> each
shihaohong Jun 26, 2019
64c0e4d
Fix ToggleButtonsTheme borderRadius and borderWidth, add renderBorder…
shihaohong Jun 26, 2019
12f69ca
use BorderRadius.zero instead of .circular(0.0)
shihaohong Jun 26, 2019
5dda49c
Improve docs per rami-a code review #1
shihaohong Jun 27, 2019
b98b1e7
Update param naming convention from [foo] to selected[Foo] active[Foo…
shihaohong Jun 27, 2019
061ed97
Add debugFillProperties
shihaohong Jul 1, 2019
e76ef3d
Stubbed out toggle button tests
shihaohong Jul 1, 2019
2d4e47e
assert children and isSelected properties be the same length
shihaohong Jul 1, 2019
fe053ec
Add initial state test
shihaohong Jul 1, 2019
aa3dedc
Added assertion tests, state tests
shihaohong Jul 1, 2019
2172252
Added more test stubs
shihaohong Jul 1, 2019
0eeeaf6
Add default text/icon ToggleButton tests
shihaohong Jul 2, 2019
764a150
Remove all Builders, reformat code
shihaohong Jul 2, 2019
c2d3bf0
Reorder children in args, add default fillColor test
shihaohong Jul 2, 2019
ec3efb4
WIP - add highlightColor, splashColor and hoverColor tests
shihaohong Jul 2, 2019
45eba30
WIP - Started FocusNode test, need to implement actual focusNode func…
shihaohong Jul 2, 2019
cc3918e
Fix relative import statements in toggle_button.dart
shihaohong Jul 2, 2019
1a08cb3
Merge branch 'toggle-button' of github.com:shihaohong/flutter into to…
shihaohong Jul 2, 2019
b1c8ebf
Add custom icon/text color tests
shihaohong Jul 2, 2019
83a420c
Add tests for custom fillColor, fix other tests to use ToggleButtonsT…
shihaohong Jul 2, 2019
c516315
Add focusNodes functionality and default focusNode test
shihaohong Jul 2, 2019
be729ec
Add custom and theme inkwell tests
shihaohong Jul 2, 2019
0aa6f19
Rename toggle_button* to toggle_buttons*
shihaohong Jul 2, 2019
8f36d4d
Fix - add import for toggle_buttons instead of toggle_button to mater…
shihaohong Jul 2, 2019
345d94e
Add documentation on focusNodes
shihaohong Jul 2, 2019
96cfe73
Fix theme focusColor, highlightColor, hoverColor and splashColor not …
shihaohong Jul 2, 2019
6d02083
Account for single button border drawing case
shihaohong Jul 2, 2019
2e62dde
complete default border color and width test
shihaohong Jul 2, 2019
069838a
Implement custom border properties, fix implementation
shihaohong Jul 2, 2019
575e1d9
Add themeable border properties tests
shihaohong Jul 2, 2019
6dccf30
Add test for tallest widget
shihaohong Jul 2, 2019
be22fb7
Add Directionality tests
shihaohong Jul 2, 2019
cc99f9b
Remove comment
shihaohong Jul 2, 2019
bc7bce6
Add state test, remove unnecessary comments
shihaohong Jul 2, 2019
9ac26a7
Refactored ToggleButtonsTheme to follow best practices
shihaohong Jul 10, 2019
c12e3b3
Added theme documentation
shihaohong Jul 10, 2019
cf9fb96
Added license header to toggle_buttons_theme.dart
shihaohong Jul 10, 2019
0263695
Fix wiring and documentation of toggleButtonsTheme in ThemeData
shihaohong Jul 10, 2019
b714f90
Fix merge conflict
shihaohong Jul 10, 2019
10f697b
Remove default values from ToggleButtonsThemeData.copyWith
shihaohong Jul 10, 2019
6969642
Separate ToggleButtonsTheme tests into its own file
shihaohong Jul 15, 2019
a80befd
Add ToggleButtonsThemeData default and debugFillProperties tests, upd…
shihaohong Jul 16, 2019
932217e
Add ToggleButtonsThemeData implements debugFillProperties test
shihaohong Jul 16, 2019
5a5a09e
WIP - Refactor ToggleButton renderObject to do the right thing
shihaohong Jul 19, 2019
f18ec67
Implement computeIntrinsicMinHeight and computeIntrinsicMaxHeight to …
shihaohong Jul 22, 2019
ac34889
Add layout/sizing test for rebuild cases
shihaohong Jul 22, 2019
00e0770
Doc updates per feedback, remove default borderRadius and borderWidth…
shihaohong Jul 22, 2019
3a60259
Remove redundant IconTheme instantiation
shihaohong Jul 22, 2019
2daa778
Add remainder of getters/setters that mark needing another layout
shihaohong Jul 22, 2019
cb58a9a
Add computeMaxIntrinsicWidth and computeMinIntrinsicWidth methods to …
shihaohong Jul 22, 2019
37bd4ff
WIP - Add proper default values in documenting toggle button API
shihaohong Jul 22, 2019
6cd4241
More documentation feedback - clarity on defaults and theme usage
shihaohong Jul 23, 2019
9095400
Fix incorrect doc about borderWidth = null instead of renderBorder = …
shihaohong Jul 23, 2019
6cc76bb
Refactor _isFirstIndex into its own getter for readability
shihaohong Jul 23, 2019
b3dd3d6
Assert message improvements, similar improvements to API docs
shihaohong Jul 23, 2019
5bf16b3
Add test for default null instantiation of Theme and ThemeData
shihaohong Jul 23, 2019
5cc4c51
Improve matching focus nodes and children length assert message
shihaohong Jul 23, 2019
ce47ce5
Add computeDistanceToActualBaseline override
shihaohong Jul 23, 2019
349a5c9
Add test for TextBaseline alignment
shihaohong Jul 23, 2019
8905edf
Fix baseline test comment to be accurate
shihaohong Jul 23, 2019
fa4893e
Documentation updates per code review feedback
shihaohong Jul 24, 2019
92c95d8
Refactor to use _isLastIndex function
shihaohong Jul 24, 2019
6e8f445
Update to use colorScheme.onSurface.withOpacity(0.32) for disabledColor
shihaohong Jul 24, 2019
6729ded
Update content/ink of disabledColor to Material spec
shihaohong Jul 24, 2019
5d553aa
Update fillColor and text/icon colors to adhere to Material spec foll…
shihaohong Jul 24, 2019
ea16745
Remove highlightColor, update splashColor defaults
shihaohong Jul 24, 2019
683bc27
Add ToggleButtonsTheme fallback for splashColor
shihaohong Jul 24, 2019
43aa195
Update ToggleButtons hoverColor to Material Spec
shihaohong Jul 24, 2019
f576aec
Update focusColor defaults to material spec
shihaohong Jul 24, 2019
a4ed5e5
Update border colors to match Material spec
shihaohong Jul 24, 2019
550fdfc
Update fillColor and borderColor per android team feedback
shihaohong Jul 25, 2019
6a4c0b9
Merge branch 'master' of github.com:flutter/flutter into toggle-button
shihaohong Jul 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/flutter/lib/material.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export 'src/material/theme.dart';
export 'src/material/theme_data.dart';
export 'src/material/time.dart';
export 'src/material/time_picker.dart';
export 'src/material/toggle_buttons.dart';
export 'src/material/toggle_buttons_theme.dart';
export 'src/material/toggleable.dart';
export 'src/material/tooltip.dart';
export 'src/material/tooltip_theme.dart';
Expand Down
15 changes: 15 additions & 0 deletions packages/flutter/lib/src/material/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import 'slider_theme.dart';
import 'snack_bar_theme.dart';
import 'tab_bar_theme.dart';
import 'text_theme.dart';
import 'toggle_buttons_theme.dart';
import 'tooltip_theme.dart';
import 'typography.dart';

Expand Down Expand Up @@ -136,6 +137,7 @@ class ThemeData extends Diagnosticable {
Color disabledColor,
Color buttonColor,
ButtonThemeData buttonTheme,
ToggleButtonsThemeData toggleButtonsTheme,
Color secondaryHeaderColor,
Color textSelectionColor,
Color cursorColor,
Expand Down Expand Up @@ -253,6 +255,7 @@ class ThemeData extends Diagnosticable {
splashColor: splashColor,
materialTapTargetSize: materialTapTargetSize,
);
toggleButtonsTheme ??= const ToggleButtonsThemeData();
disabledColor ??= isDark ? Colors.white38 : Colors.black38;
highlightColor ??= isDark ? _kDarkThemeHighlightColor : _kLightThemeHighlightColor;
splashColor ??= isDark ? _kDarkThemeSplashColor : _kLightThemeSplashColor;
Expand Down Expand Up @@ -297,6 +300,7 @@ class ThemeData extends Diagnosticable {
disabledColor: disabledColor,
buttonTheme: buttonTheme,
buttonColor: buttonColor,
toggleButtonsTheme: toggleButtonsTheme,
toggleableActiveColor: toggleableActiveColor,
secondaryHeaderColor: secondaryHeaderColor,
textSelectionColor: textSelectionColor,
Expand Down Expand Up @@ -368,6 +372,7 @@ class ThemeData extends Diagnosticable {
@required this.disabledColor,
@required this.buttonTheme,
@required this.buttonColor,
@required this.toggleButtonsTheme,
@required this.secondaryHeaderColor,
@required this.textSelectionColor,
@required this.cursorColor,
Expand Down Expand Up @@ -425,6 +430,7 @@ class ThemeData extends Diagnosticable {
assert(disabledColor != null),
assert(toggleableActiveColor != null),
assert(buttonTheme != null),
assert(toggleButtonsTheme != null),
assert(secondaryHeaderColor != null),
assert(textSelectionColor != null),
assert(cursorColor != null),
Expand Down Expand Up @@ -593,6 +599,9 @@ class ThemeData extends Diagnosticable {
/// and [FlatButton].
final ButtonThemeData buttonTheme;

/// Defines the default configuration of [ToggleButtons] widgets.
final ToggleButtonsThemeData toggleButtonsTheme;

/// The default fill color of the [Material] used in [RaisedButton]s.
final Color buttonColor;

Expand Down Expand Up @@ -802,6 +811,7 @@ class ThemeData extends Diagnosticable {
Color unselectedWidgetColor,
Color disabledColor,
ButtonThemeData buttonTheme,
ToggleButtonsTheme toggleButtonsTheme,
Color buttonColor,
Color secondaryHeaderColor,
Color textSelectionColor,
Expand Down Expand Up @@ -863,6 +873,7 @@ class ThemeData extends Diagnosticable {
disabledColor: disabledColor ?? this.disabledColor,
buttonColor: buttonColor ?? this.buttonColor,
buttonTheme: buttonTheme ?? this.buttonTheme,
toggleButtonsTheme: toggleButtonsTheme ?? this.toggleButtonsTheme,
secondaryHeaderColor: secondaryHeaderColor ?? this.secondaryHeaderColor,
textSelectionColor: textSelectionColor ?? this.textSelectionColor,
cursorColor: cursorColor ?? this.cursorColor,
Expand Down Expand Up @@ -1000,6 +1011,7 @@ class ThemeData extends Diagnosticable {
unselectedWidgetColor: Color.lerp(a.unselectedWidgetColor, b.unselectedWidgetColor, t),
disabledColor: Color.lerp(a.disabledColor, b.disabledColor, t),
buttonTheme: t < 0.5 ? a.buttonTheme : b.buttonTheme,
toggleButtonsTheme: ToggleButtonsThemeData.lerp(a.toggleButtonsTheme, b.toggleButtonsTheme, t),
buttonColor: Color.lerp(a.buttonColor, b.buttonColor, t),
secondaryHeaderColor: Color.lerp(a.secondaryHeaderColor, b.secondaryHeaderColor, t),
textSelectionColor: Color.lerp(a.textSelectionColor, b.textSelectionColor, t),
Expand Down Expand Up @@ -1067,6 +1079,7 @@ class ThemeData extends Diagnosticable {
(otherData.disabledColor == disabledColor) &&
(otherData.buttonTheme == buttonTheme) &&
(otherData.buttonColor == buttonColor) &&
(otherData.toggleButtonsTheme == toggleButtonsTheme) &&
(otherData.secondaryHeaderColor == secondaryHeaderColor) &&
(otherData.textSelectionColor == textSelectionColor) &&
(otherData.cursorColor == cursorColor) &&
Expand Down Expand Up @@ -1132,6 +1145,7 @@ class ThemeData extends Diagnosticable {
disabledColor,
buttonTheme,
buttonColor,
toggleButtonsTheme,
toggleableActiveColor,
secondaryHeaderColor,
textSelectionColor,
Expand Down Expand Up @@ -1205,6 +1219,7 @@ class ThemeData extends Diagnosticable {
properties.add(ColorProperty('errorColor', errorColor, defaultValue: defaultData.errorColor));
properties.add(ColorProperty('toggleableActiveColor', toggleableActiveColor, defaultValue: defaultData.toggleableActiveColor));
properties.add(DiagnosticsProperty<ButtonThemeData>('buttonTheme', buttonTheme));
properties.add(DiagnosticsProperty<ToggleButtonsThemeData>('toggleButtonsTheme', toggleButtonsTheme));
properties.add(DiagnosticsProperty<TextTheme>('textTheme', textTheme));
properties.add(DiagnosticsProperty<TextTheme>('primaryTextTheme', primaryTextTheme));
properties.add(DiagnosticsProperty<TextTheme>('accentTextTheme', accentTextTheme));
Expand Down
Loading