Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f2a25c5b
Unverified
Commit
f2a25c5b
authored
Oct 30, 2020
by
Michael Goderbauer
Committed by
GitHub
Oct 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Directionality.of non-null (#69060)
parent
156be1d8
Changes
45
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
117 additions
and
84 deletions
+117
-84
date_picker.dart
packages/flutter/lib/src/cupertino/date_picker.dart
+1
-1
nav_bar.dart
packages/flutter/lib/src/cupertino/nav_bar.dart
+2
-2
picker.dart
packages/flutter/lib/src/cupertino/picker.dart
+2
-2
route.dart
packages/flutter/lib/src/cupertino/route.dart
+3
-3
scrollbar.dart
packages/flutter/lib/src/cupertino/scrollbar.dart
+2
-2
segmented_control.dart
packages/flutter/lib/src/cupertino/segmented_control.dart
+2
-2
slider.dart
packages/flutter/lib/src/cupertino/slider.dart
+2
-2
sliding_segmented_control.dart
.../flutter/lib/src/cupertino/sliding_segmented_control.dart
+1
-1
switch.dart
packages/flutter/lib/src/cupertino/switch.dart
+2
-2
animated_icons.dart
...utter/lib/src/material/animated_icons/animated_icons.dart
+1
-1
bottom_navigation_bar.dart
packages/flutter/lib/src/material/bottom_navigation_bar.dart
+1
-1
chip.dart
packages/flutter/lib/src/material/chip.dart
+1
-1
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+3
-3
flexible_space_bar.dart
packages/flutter/lib/src/material/flexible_space_bar.dart
+1
-1
ink_well.dart
packages/flutter/lib/src/material/ink_well.dart
+2
-2
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+2
-2
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+1
-1
calendar_date_picker.dart
...lutter/lib/src/material/pickers/calendar_date_picker.dart
+3
-3
calendar_date_range_picker.dart
.../lib/src/material/pickers/calendar_date_range_picker.dart
+2
-2
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+1
-1
progress_indicator.dart
packages/flutter/lib/src/material/progress_indicator.dart
+1
-1
range_slider.dart
packages/flutter/lib/src/material/range_slider.dart
+2
-2
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+1
-1
scrollbar.dart
packages/flutter/lib/src/material/scrollbar.dart
+1
-1
slider.dart
packages/flutter/lib/src/material/slider.dart
+3
-3
switch.dart
packages/flutter/lib/src/material/switch.dart
+2
-2
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+1
-1
time_picker.dart
packages/flutter/lib/src/material/time_picker.dart
+2
-2
toggle_buttons.dart
packages/flutter/lib/src/material/toggle_buttons.dart
+3
-3
tooltip.dart
packages/flutter/lib/src/material/tooltip.dart
+1
-1
user_accounts_drawer_header.dart
...flutter/lib/src/material/user_accounts_drawer_header.dart
+1
-1
banner.dart
packages/flutter/lib/src/widgets/banner.dart
+2
-2
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+20
-9
dismissible.dart
packages/flutter/lib/src/widgets/dismissible.dart
+3
-3
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+2
-2
icon.dart
packages/flutter/lib/src/widgets/icon.dart
+1
-1
implicit_animations.dart
packages/flutter/lib/src/widgets/implicit_animations.dart
+1
-1
navigation_toolbar.dart
packages/flutter/lib/src/widgets/navigation_toolbar.dart
+1
-1
overflow_bar.dart
packages/flutter/lib/src/widgets/overflow_bar.dart
+2
-2
overlay.dart
packages/flutter/lib/src/widgets/overlay.dart
+2
-2
page_view.dart
packages/flutter/lib/src/widgets/page_view.dart
+1
-1
platform_view.dart
packages/flutter/lib/src/widgets/platform_view.dart
+2
-2
table.dart
packages/flutter/lib/src/widgets/table.dart
+2
-2
viewport.dart
packages/flutter/lib/src/widgets/viewport.dart
+2
-2
directionality_test.dart
packages/flutter/test/widgets/directionality_test.dart
+23
-1
No files found.
packages/flutter/lib/src/cupertino/date_picker.dart
View file @
f2a25c5b
...
@@ -1620,7 +1620,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
...
@@ -1620,7 +1620,7 @@ class _CupertinoTimerPickerState extends State<CupertinoTimerPicker> {
void
didChangeDependencies
()
{
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
textDirection
=
Directionality
.
of
(
context
)
!
;
textDirection
=
Directionality
.
of
(
context
);
localizations
=
CupertinoLocalizations
.
of
(
context
);
localizations
=
CupertinoLocalizations
.
of
(
context
);
_measureLabelMetrics
();
_measureLabelMetrics
();
...
...
packages/flutter/lib/src/cupertino/nav_bar.dart
View file @
f2a25c5b
...
@@ -1374,7 +1374,7 @@ class _BackChevron extends StatelessWidget {
...
@@ -1374,7 +1374,7 @@ class _BackChevron extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
TextStyle
textStyle
=
DefaultTextStyle
.
of
(
context
).
style
;
final
TextStyle
textStyle
=
DefaultTextStyle
.
of
(
context
).
style
;
// Replicate the Icon logic here to get a tightly sized icon and add
// Replicate the Icon logic here to get a tightly sized icon and add
...
@@ -1588,7 +1588,7 @@ class _NavigationBarTransition extends StatelessWidget {
...
@@ -1588,7 +1588,7 @@ class _NavigationBarTransition extends StatelessWidget {
animation:
animation
,
animation:
animation
,
bottomNavBar:
bottomNavBar
,
bottomNavBar:
bottomNavBar
,
topNavBar:
topNavBar
,
topNavBar:
topNavBar
,
directionality:
Directionality
.
of
(
context
)
!
,
directionality:
Directionality
.
of
(
context
),
);
);
final
List
<
Widget
>
children
=
<
Widget
>[
final
List
<
Widget
>
children
=
<
Widget
>[
...
...
packages/flutter/lib/src/cupertino/picker.dart
View file @
f2a25c5b
...
@@ -413,14 +413,14 @@ class _CupertinoPickerSemantics extends SingleChildRenderObjectWidget {
...
@@ -413,14 +413,14 @@ class _CupertinoPickerSemantics extends SingleChildRenderObjectWidget {
@override
@override
RenderObject
createRenderObject
(
BuildContext
context
)
{
RenderObject
createRenderObject
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
return
_RenderCupertinoPickerSemantics
(
scrollController
,
Directionality
.
of
(
context
)
!
);
return
_RenderCupertinoPickerSemantics
(
scrollController
,
Directionality
.
of
(
context
));
}
}
@override
@override
void
updateRenderObject
(
BuildContext
context
,
covariant
_RenderCupertinoPickerSemantics
renderObject
)
{
void
updateRenderObject
(
BuildContext
context
,
covariant
_RenderCupertinoPickerSemantics
renderObject
)
{
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
renderObject
renderObject
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
controller
=
scrollController
;
..
controller
=
scrollController
;
}
}
}
}
...
...
packages/flutter/lib/src/cupertino/route.dart
View file @
f2a25c5b
...
@@ -514,7 +514,7 @@ class CupertinoPageTransition extends StatelessWidget {
...
@@ -514,7 +514,7 @@ class CupertinoPageTransition extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
final
TextDirection
?
textDirection
=
Directionality
.
of
(
context
);
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
return
SlideTransition
(
return
SlideTransition
(
position:
_secondaryPositionAnimation
,
position:
_secondaryPositionAnimation
,
textDirection:
textDirection
,
textDirection:
textDirection
,
...
@@ -578,7 +578,7 @@ class CupertinoFullscreenDialogTransition extends StatelessWidget {
...
@@ -578,7 +578,7 @@ class CupertinoFullscreenDialogTransition extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
final
TextDirection
?
textDirection
=
Directionality
.
of
(
context
);
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
return
SlideTransition
(
return
SlideTransition
(
position:
_secondaryPositionAnimation
,
position:
_secondaryPositionAnimation
,
textDirection:
textDirection
,
textDirection:
textDirection
,
...
@@ -677,7 +677,7 @@ class _CupertinoBackGestureDetectorState<T> extends State<_CupertinoBackGestureD
...
@@ -677,7 +677,7 @@ class _CupertinoBackGestureDetectorState<T> extends State<_CupertinoBackGestureD
}
}
double
_convertToLogical
(
double
value
)
{
double
_convertToLogical
(
double
value
)
{
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
case
TextDirection
.
rtl
:
return
-
value
;
return
-
value
;
case
TextDirection
.
ltr
:
case
TextDirection
.
ltr
:
...
...
packages/flutter/lib/src/cupertino/scrollbar.dart
View file @
f2a25c5b
...
@@ -283,7 +283,7 @@ class _CupertinoScrollbarState extends State<CupertinoScrollbar> with TickerProv
...
@@ -283,7 +283,7 @@ class _CupertinoScrollbarState extends State<CupertinoScrollbar> with TickerProv
_painter
=
_buildCupertinoScrollbarPainter
(
context
);
_painter
=
_buildCupertinoScrollbarPainter
(
context
);
}
else
{
}
else
{
_painter
!
_painter
!
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
color
=
CupertinoDynamicColor
.
resolve
(
_kScrollbarColor
,
context
)!
..
color
=
CupertinoDynamicColor
.
resolve
(
_kScrollbarColor
,
context
)!
..
padding
=
MediaQuery
.
of
(
context
).
padding
;
..
padding
=
MediaQuery
.
of
(
context
).
padding
;
}
}
...
@@ -309,7 +309,7 @@ class _CupertinoScrollbarState extends State<CupertinoScrollbar> with TickerProv
...
@@ -309,7 +309,7 @@ class _CupertinoScrollbarState extends State<CupertinoScrollbar> with TickerProv
ScrollbarPainter
_buildCupertinoScrollbarPainter
(
BuildContext
context
)
{
ScrollbarPainter
_buildCupertinoScrollbarPainter
(
BuildContext
context
)
{
return
ScrollbarPainter
(
return
ScrollbarPainter
(
color:
CupertinoDynamicColor
.
resolve
(
_kScrollbarColor
,
context
)!,
color:
CupertinoDynamicColor
.
resolve
(
_kScrollbarColor
,
context
)!,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
thickness:
_thickness
,
thickness:
_thickness
,
fadeoutOpacityAnimation:
_fadeoutOpacityAnimation
,
fadeoutOpacityAnimation:
_fadeoutOpacityAnimation
,
mainAxisMargin:
_kScrollbarMainAxisMargin
,
mainAxisMargin:
_kScrollbarMainAxisMargin
,
...
...
packages/flutter/lib/src/cupertino/segmented_control.dart
View file @
f2a25c5b
...
@@ -448,7 +448,7 @@ class _SegmentedControlRenderWidget<T> extends MultiChildRenderObjectWidget {
...
@@ -448,7 +448,7 @@ class _SegmentedControlRenderWidget<T> extends MultiChildRenderObjectWidget {
@override
@override
RenderObject
createRenderObject
(
BuildContext
context
)
{
RenderObject
createRenderObject
(
BuildContext
context
)
{
return
_RenderSegmentedControl
<
T
>(
return
_RenderSegmentedControl
<
T
>(
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
selectedIndex:
selectedIndex
,
selectedIndex:
selectedIndex
,
pressedIndex:
pressedIndex
,
pressedIndex:
pressedIndex
,
backgroundColors:
backgroundColors
,
backgroundColors:
backgroundColors
,
...
@@ -459,7 +459,7 @@ class _SegmentedControlRenderWidget<T> extends MultiChildRenderObjectWidget {
...
@@ -459,7 +459,7 @@ class _SegmentedControlRenderWidget<T> extends MultiChildRenderObjectWidget {
@override
@override
void
updateRenderObject
(
BuildContext
context
,
_RenderSegmentedControl
<
T
>
renderObject
)
{
void
updateRenderObject
(
BuildContext
context
,
_RenderSegmentedControl
<
T
>
renderObject
)
{
renderObject
renderObject
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
selectedIndex
=
selectedIndex
..
selectedIndex
=
selectedIndex
..
pressedIndex
=
pressedIndex
..
pressedIndex
=
pressedIndex
..
backgroundColors
=
backgroundColors
..
backgroundColors
=
backgroundColors
...
...
packages/flutter/lib/src/cupertino/slider.dart
View file @
f2a25c5b
...
@@ -288,7 +288,7 @@ class _CupertinoSliderRenderObjectWidget extends LeafRenderObjectWidget {
...
@@ -288,7 +288,7 @@ class _CupertinoSliderRenderObjectWidget extends LeafRenderObjectWidget {
onChangeStart:
onChangeStart
,
onChangeStart:
onChangeStart
,
onChangeEnd:
onChangeEnd
,
onChangeEnd:
onChangeEnd
,
vsync:
vsync
,
vsync:
vsync
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
);
);
}
}
...
@@ -304,7 +304,7 @@ class _CupertinoSliderRenderObjectWidget extends LeafRenderObjectWidget {
...
@@ -304,7 +304,7 @@ class _CupertinoSliderRenderObjectWidget extends LeafRenderObjectWidget {
..
onChanged
=
onChanged
..
onChanged
=
onChanged
..
onChangeStart
=
onChangeStart
..
onChangeStart
=
onChangeStart
..
onChangeEnd
=
onChangeEnd
..
onChangeEnd
=
onChangeEnd
..
textDirection
=
Directionality
.
of
(
context
)
!
;
..
textDirection
=
Directionality
.
of
(
context
);
// Ticker provider cannot change since there's a 1:1 relationship between
// Ticker provider cannot change since there's a 1:1 relationship between
// the _SliderRenderObjectWidget object and the _SliderState object.
// the _SliderRenderObjectWidget object and the _SliderState object.
}
}
...
...
packages/flutter/lib/src/cupertino/sliding_segmented_control.dart
View file @
f2a25c5b
...
@@ -399,7 +399,7 @@ class _SegmentedControlState<T> extends State<CupertinoSlidingSegmentedControl<T
...
@@ -399,7 +399,7 @@ class _SegmentedControlState<T> extends State<CupertinoSlidingSegmentedControl<T
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
debugCheckHasDirectionality
(
context
);
debugCheckHasDirectionality
(
context
);
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
ltr
:
case
TextDirection
.
ltr
:
keys
=
widget
.
children
.
keys
.
toList
(
growable:
false
);
keys
=
widget
.
children
.
keys
.
toList
(
growable:
false
);
break
;
break
;
...
...
packages/flutter/lib/src/cupertino/switch.dart
View file @
f2a25c5b
...
@@ -254,7 +254,7 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt
...
@@ -254,7 +254,7 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt
..
curve
=
Curves
.
linear
..
curve
=
Curves
.
linear
..
reverseCurve
=
Curves
.
linear
;
..
reverseCurve
=
Curves
.
linear
;
final
double
delta
=
details
.
primaryDelta
!
/
_kTrackInnerLength
;
final
double
delta
=
details
.
primaryDelta
!
/
_kTrackInnerLength
;
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
case
TextDirection
.
rtl
:
_positionController
.
value
-=
delta
;
_positionController
.
value
-=
delta
;
break
;
break
;
...
@@ -302,7 +302,7 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt
...
@@ -302,7 +302,7 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt
)!,
)!,
trackColor:
CupertinoDynamicColor
.
resolve
(
widget
.
trackColor
??
CupertinoColors
.
secondarySystemFill
,
context
)!,
trackColor:
CupertinoDynamicColor
.
resolve
(
widget
.
trackColor
??
CupertinoColors
.
secondarySystemFill
,
context
)!,
onChanged:
widget
.
onChanged
,
onChanged:
widget
.
onChanged
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
state:
this
,
state:
this
,
),
),
);
);
...
...
packages/flutter/lib/src/material/animated_icons/animated_icons.dart
View file @
f2a25c5b
...
@@ -109,7 +109,7 @@ class AnimatedIcon extends StatelessWidget {
...
@@ -109,7 +109,7 @@ class AnimatedIcon extends StatelessWidget {
final
IconThemeData
iconTheme
=
IconTheme
.
of
(
context
);
final
IconThemeData
iconTheme
=
IconTheme
.
of
(
context
);
assert
(
iconTheme
.
isConcrete
);
assert
(
iconTheme
.
isConcrete
);
final
double
iconSize
=
size
??
iconTheme
.
size
!;
final
double
iconSize
=
size
??
iconTheme
.
size
!;
final
TextDirection
textDirection
=
this
.
textDirection
??
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
this
.
textDirection
??
Directionality
.
of
(
context
);
final
double
iconOpacity
=
iconTheme
.
opacity
!;
final
double
iconOpacity
=
iconTheme
.
opacity
!;
Color
iconColor
=
color
??
iconTheme
.
color
!;
Color
iconColor
=
color
??
iconTheme
.
color
!;
if
(
iconOpacity
!=
1.0
)
if
(
iconOpacity
!=
1.0
)
...
...
packages/flutter/lib/src/material/bottom_navigation_bar.dart
View file @
f2a25c5b
...
@@ -940,7 +940,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
...
@@ -940,7 +940,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
child:
CustomPaint
(
child:
CustomPaint
(
painter:
_RadialPainter
(
painter:
_RadialPainter
(
circles:
_circles
.
toList
(),
circles:
_circles
.
toList
(),
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
),
),
child:
Material
(
// Splashes.
child:
Material
(
// Splashes.
type:
MaterialType
.
transparency
,
type:
MaterialType
.
transparency
,
...
...
packages/flutter/lib/src/material/chip.dart
View file @
f2a25c5b
...
@@ -2129,7 +2129,7 @@ class _ChipRenderWidget extends RenderObjectWidget {
...
@@ -2129,7 +2129,7 @@ class _ChipRenderWidget extends RenderObjectWidget {
RenderObject
createRenderObject
(
BuildContext
context
)
{
RenderObject
createRenderObject
(
BuildContext
context
)
{
return
_RenderChip
(
return
_RenderChip
(
theme:
theme
,
theme:
theme
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
value:
value
,
value:
value
,
isEnabled:
isEnabled
,
isEnabled:
isEnabled
,
checkmarkAnimation:
checkmarkAnimation
,
checkmarkAnimation:
checkmarkAnimation
,
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
f2a25c5b
...
@@ -407,7 +407,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
...
@@ -407,7 +407,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
delta
=
-
delta
;
delta
=
-
delta
;
break
;
break
;
}
}
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
case
TextDirection
.
rtl
:
_controller
.
value
-=
delta
;
_controller
.
value
-=
delta
;
break
;
break
;
...
@@ -434,7 +434,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
...
@@ -434,7 +434,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
visualVelocity
=
-
visualVelocity
;
visualVelocity
=
-
visualVelocity
;
break
;
break
;
}
}
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
case
TextDirection
.
rtl
:
_controller
.
fling
(
velocity:
-
visualVelocity
);
_controller
.
fling
(
velocity:
-
visualVelocity
);
if
(
widget
.
drawerCallback
!=
null
)
if
(
widget
.
drawerCallback
!=
null
)
...
@@ -499,7 +499,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
...
@@ -499,7 +499,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
Widget
_buildDrawer
(
BuildContext
context
)
{
Widget
_buildDrawer
(
BuildContext
context
)
{
final
bool
drawerIsStart
=
widget
.
alignment
==
DrawerAlignment
.
start
;
final
bool
drawerIsStart
=
widget
.
alignment
==
DrawerAlignment
.
start
;
final
EdgeInsets
padding
=
MediaQuery
.
of
(
context
).
padding
;
final
EdgeInsets
padding
=
MediaQuery
.
of
(
context
).
padding
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
double
?
dragAreaWidth
=
widget
.
edgeDragWidth
;
double
?
dragAreaWidth
=
widget
.
edgeDragWidth
;
if
(
widget
.
edgeDragWidth
==
null
)
{
if
(
widget
.
edgeDragWidth
==
null
)
{
...
...
packages/flutter/lib/src/material/flexible_space_bar.dart
View file @
f2a25c5b
...
@@ -252,7 +252,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
...
@@ -252,7 +252,7 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
Alignment
_getTitleAlignment
(
bool
effectiveCenterTitle
)
{
Alignment
_getTitleAlignment
(
bool
effectiveCenterTitle
)
{
if
(
effectiveCenterTitle
)
if
(
effectiveCenterTitle
)
return
Alignment
.
bottomCenter
;
return
Alignment
.
bottomCenter
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
assert
(
textDirection
!=
null
);
assert
(
textDirection
!=
null
);
switch
(
textDirection
)
{
switch
(
textDirection
)
{
case
TextDirection
.
rtl
:
case
TextDirection
.
rtl
:
...
...
packages/flutter/lib/src/material/ink_well.dart
View file @
f2a25c5b
...
@@ -842,7 +842,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
...
@@ -842,7 +842,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
customBorder:
widget
.
customBorder
,
customBorder:
widget
.
customBorder
,
rectCallback:
widget
.
getRectCallback
!(
referenceBox
),
rectCallback:
widget
.
getRectCallback
!(
referenceBox
),
onRemoved:
handleInkRemoval
,
onRemoved:
handleInkRemoval
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
fadeDuration:
getFadeDurationForType
(
type
),
fadeDuration:
getFadeDurationForType
(
type
),
);
);
updateKeepAlive
();
updateKeepAlive
();
...
@@ -900,7 +900,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
...
@@ -900,7 +900,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
borderRadius:
borderRadius
,
borderRadius:
borderRadius
,
customBorder:
customBorder
,
customBorder:
customBorder
,
onRemoved:
onRemoved
,
onRemoved:
onRemoved
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
);
);
return
splash
;
return
splash
;
...
...
packages/flutter/lib/src/material/input_decorator.dart
View file @
f2a25c5b
...
@@ -237,7 +237,7 @@ class _BorderContainerState extends State<_BorderContainer> with TickerProviderS
...
@@ -237,7 +237,7 @@ class _BorderContainerState extends State<_BorderContainer> with TickerProviderS
border:
_border
,
border:
_border
,
gapAnimation:
widget
.
gapAnimation
,
gapAnimation:
widget
.
gapAnimation
,
gap:
widget
.
gap
,
gap:
widget
.
gap
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
fillColor:
widget
.
fillColor
,
fillColor:
widget
.
fillColor
,
hoverColorTween:
_hoverColorTween
,
hoverColorTween:
_hoverColorTween
,
hoverAnimation:
_hoverAnimation
,
hoverAnimation:
_hoverAnimation
,
...
@@ -2311,7 +2311,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
...
@@ -2311,7 +2311,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
// The _Decoration widget and _RenderDecoration assume that contentPadding
// The _Decoration widget and _RenderDecoration assume that contentPadding
// has been resolved to EdgeInsets.
// has been resolved to EdgeInsets.
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
EdgeInsets
?
decorationContentPadding
=
decoration
!.
contentPadding
?.
resolve
(
textDirection
);
final
EdgeInsets
?
decorationContentPadding
=
decoration
!.
contentPadding
?.
resolve
(
textDirection
);
final
EdgeInsets
contentPadding
;
final
EdgeInsets
contentPadding
;
...
...
packages/flutter/lib/src/material/list_tile.dart
View file @
f2a25c5b
...
@@ -1067,7 +1067,7 @@ class ListTile extends StatelessWidget {
...
@@ -1067,7 +1067,7 @@ class ListTile extends StatelessWidget {
}
}
const
EdgeInsets
_defaultContentPadding
=
EdgeInsets
.
symmetric
(
horizontal:
16.0
);
const
EdgeInsets
_defaultContentPadding
=
EdgeInsets
.
symmetric
(
horizontal:
16.0
);
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
EdgeInsets
resolvedContentPadding
=
contentPadding
?.
resolve
(
textDirection
)
final
EdgeInsets
resolvedContentPadding
=
contentPadding
?.
resolve
(
textDirection
)
??
tileTheme
.
contentPadding
?.
resolve
(
textDirection
)
??
tileTheme
.
contentPadding
?.
resolve
(
textDirection
)
??
_defaultContentPadding
;
??
_defaultContentPadding
;
...
...
packages/flutter/lib/src/material/pickers/calendar_date_picker.dart
View file @
f2a25c5b
...
@@ -180,7 +180,7 @@ class _CalendarDatePickerState extends State<CalendarDatePicker> {
...
@@ -180,7 +180,7 @@ class _CalendarDatePickerState extends State<CalendarDatePicker> {
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
_localizations
=
MaterialLocalizations
.
of
(
context
);
_localizations
=
MaterialLocalizations
.
of
(
context
);
_textDirection
=
Directionality
.
of
(
context
)
!
;
_textDirection
=
Directionality
.
of
(
context
);
if
(!
_announcedInitialDate
)
{
if
(!
_announcedInitialDate
)
{
_announcedInitialDate
=
true
;
_announcedInitialDate
=
true
;
SemanticsService
.
announce
(
SemanticsService
.
announce
(
...
@@ -525,7 +525,7 @@ class _MonthPickerState extends State<_MonthPicker> {
...
@@ -525,7 +525,7 @@ class _MonthPickerState extends State<_MonthPicker> {
void
didChangeDependencies
()
{
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
super
.
didChangeDependencies
();
_localizations
=
MaterialLocalizations
.
of
(
context
);
_localizations
=
MaterialLocalizations
.
of
(
context
);
_textDirection
=
Directionality
.
of
(
context
)
!
;
_textDirection
=
Directionality
.
of
(
context
);
}
}
@override
@override
...
@@ -709,7 +709,7 @@ class _MonthPickerState extends State<_MonthPicker> {
...
@@ -709,7 +709,7 @@ class _MonthPickerState extends State<_MonthPicker> {
}
}
DateTime
?
_nextDateInDirection
(
DateTime
date
,
TraversalDirection
direction
)
{
DateTime
?
_nextDateInDirection
(
DateTime
date
,
TraversalDirection
direction
)
{
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
DateTime
nextDate
=
utils
.
addDaysToDate
(
date
,
_dayDirectionOffset
(
direction
,
textDirection
));
DateTime
nextDate
=
utils
.
addDaysToDate
(
date
,
_dayDirectionOffset
(
direction
,
textDirection
));
while
(!
nextDate
.
isBefore
(
widget
.
firstDate
)
&&
!
nextDate
.
isAfter
(
widget
.
lastDate
))
{
while
(!
nextDate
.
isBefore
(
widget
.
firstDate
)
&&
!
nextDate
.
isAfter
(
widget
.
lastDate
))
{
if
(
_isSelectable
(
nextDate
))
{
if
(
_isSelectable
(
nextDate
))
{
...
...
packages/flutter/lib/src/material/pickers/calendar_date_range_picker.dart
View file @
f2a25c5b
...
@@ -340,7 +340,7 @@ class _CalendarKeyboardNavigatorState extends State<_CalendarKeyboardNavigator>
...
@@ -340,7 +340,7 @@ class _CalendarKeyboardNavigatorState extends State<_CalendarKeyboardNavigator>
}
}
DateTime
?
_nextDateInDirection
(
DateTime
date
,
TraversalDirection
direction
)
{
DateTime
?
_nextDateInDirection
(
DateTime
date
,
TraversalDirection
direction
)
{
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
DateTime
nextDate
=
utils
.
addDaysToDate
(
date
,
_dayDirectionOffset
(
direction
,
textDirection
));
final
DateTime
nextDate
=
utils
.
addDaysToDate
(
date
,
_dayDirectionOffset
(
direction
,
textDirection
));
if
(!
nextDate
.
isBefore
(
widget
.
firstDate
)
&&
!
nextDate
.
isAfter
(
widget
.
lastDate
))
{
if
(!
nextDate
.
isBefore
(
widget
.
firstDate
)
&&
!
nextDate
.
isAfter
(
widget
.
lastDate
))
{
return
nextDate
;
return
nextDate
;
...
@@ -707,7 +707,7 @@ class _MonthItemState extends State<_MonthItem> {
...
@@ -707,7 +707,7 @@ class _MonthItemState extends State<_MonthItem> {
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
Color
highlightColor
=
_highlightColor
(
context
);
final
Color
highlightColor
=
_highlightColor
(
context
);
final
int
day
=
dayToBuild
.
day
;
final
int
day
=
dayToBuild
.
day
;
...
...
packages/flutter/lib/src/material/popup_menu.dart
View file @
f2a25c5b
...
@@ -749,7 +749,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
...
@@ -749,7 +749,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
position
,
position
,
itemSizes
,
itemSizes
,
selectedItemIndex
,
selectedItemIndex
,
Directionality
.
of
(
context
)
!
,
Directionality
.
of
(
context
),
),
),
child:
capturedThemes
.
wrap
(
menu
),
child:
capturedThemes
.
wrap
(
menu
),
);
);
...
...
packages/flutter/lib/src/material/progress_indicator.dart
View file @
f2a25c5b
...
@@ -332,7 +332,7 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
...
@@ -332,7 +332,7 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
if
(
widget
.
value
!=
null
)
if
(
widget
.
value
!=
null
)
return
_buildIndicator
(
context
,
_controller
.
value
,
textDirection
);
return
_buildIndicator
(
context
,
_controller
.
value
,
textDirection
);
...
...
packages/flutter/lib/src/material/range_slider.dart
View file @
f2a25c5b
...
@@ -720,7 +720,7 @@ class _RangeSliderRenderObjectWidget extends LeafRenderObjectWidget {
...
@@ -720,7 +720,7 @@ class _RangeSliderRenderObjectWidget extends LeafRenderObjectWidget {
onChangeStart:
onChangeStart
,
onChangeStart:
onChangeStart
,
onChangeEnd:
onChangeEnd
,
onChangeEnd:
onChangeEnd
,
state:
state
,
state:
state
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
semanticFormatterCallback:
semanticFormatterCallback
,
semanticFormatterCallback:
semanticFormatterCallback
,
platform:
Theme
.
of
(
context
)!.
platform
,
platform:
Theme
.
of
(
context
)!.
platform
,
);
);
...
@@ -741,7 +741,7 @@ class _RangeSliderRenderObjectWidget extends LeafRenderObjectWidget {
...
@@ -741,7 +741,7 @@ class _RangeSliderRenderObjectWidget extends LeafRenderObjectWidget {
..
onChanged
=
onChanged
..
onChanged
=
onChanged
..
onChangeStart
=
onChangeStart
..
onChangeStart
=
onChangeStart
..
onChangeEnd
=
onChangeEnd
..
onChangeEnd
=
onChangeEnd
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
semanticFormatterCallback
=
semanticFormatterCallback
..
semanticFormatterCallback
=
semanticFormatterCallback
..
platform
=
Theme
.
of
(
context
)!.
platform
;
..
platform
=
Theme
.
of
(
context
)!.
platform
;
}
}
...
...
packages/flutter/lib/src/material/scaffold.dart
View file @
f2a25c5b
...
@@ -2908,7 +2908,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
...
@@ -2908,7 +2908,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
final
MediaQueryData
mediaQuery
=
MediaQuery
.
of
(
context
);
final
MediaQueryData
mediaQuery
=
MediaQuery
.
of
(
context
);
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
ThemeData
themeData
=
Theme
.
of
(
context
)!;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
// TODO(Piinks): Remove old SnackBar API after migrating ScaffoldMessenger
// TODO(Piinks): Remove old SnackBar API after migrating ScaffoldMessenger
_accessibleNavigation
=
mediaQuery
.
accessibleNavigation
;
_accessibleNavigation
=
mediaQuery
.
accessibleNavigation
;
...
...
packages/flutter/lib/src/material/scrollbar.dart
View file @
f2a25c5b
...
@@ -122,7 +122,7 @@ class _ScrollbarState extends State<Scrollbar> with SingleTickerProviderStateMix
...
@@ -122,7 +122,7 @@ class _ScrollbarState extends State<Scrollbar> with SingleTickerProviderStateMix
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
case
TargetPlatform
.
windows
:
_themeColor
=
theme
.
highlightColor
.
withOpacity
(
1.0
);
_themeColor
=
theme
.
highlightColor
.
withOpacity
(
1.0
);
_textDirection
=
Directionality
.
of
(
context
)
!
;
_textDirection
=
Directionality
.
of
(
context
);
_materialPainter
=
_buildMaterialScrollbarPainter
();
_materialPainter
=
_buildMaterialScrollbarPainter
();
_useCupertinoScrollbar
=
false
;
_useCupertinoScrollbar
=
false
;
_triggerScrollbar
();
_triggerScrollbar
();
...
...
packages/flutter/lib/src/material/slider.dart
View file @
f2a25c5b
...
@@ -550,7 +550,7 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
...
@@ -550,7 +550,7 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
void
_actionHandler
(
_AdjustSliderIntent
intent
)
{
void
_actionHandler
(
_AdjustSliderIntent
intent
)
{
final
_RenderSlider
renderSlider
=
_renderObjectKey
.
currentContext
!.
findRenderObject
()!
as
_RenderSlider
;
final
_RenderSlider
renderSlider
=
_renderObjectKey
.
currentContext
!.
findRenderObject
()!
as
_RenderSlider
;
final
TextDirection
textDirection
=
Directionality
.
of
(
_renderObjectKey
.
currentContext
!)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
_renderObjectKey
.
currentContext
!);
switch
(
intent
.
type
)
{
switch
(
intent
.
type
)
{
case
_SliderAdjustmentType
.
right
:
case
_SliderAdjustmentType
.
right
:
switch
(
textDirection
)
{
switch
(
textDirection
)
{
...
@@ -825,7 +825,7 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
...
@@ -825,7 +825,7 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
onChangeStart:
onChangeStart
,
onChangeStart:
onChangeStart
,
onChangeEnd:
onChangeEnd
,
onChangeEnd:
onChangeEnd
,
state:
state
,
state:
state
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
semanticFormatterCallback:
semanticFormatterCallback
,
semanticFormatterCallback:
semanticFormatterCallback
,
platform:
Theme
.
of
(
context
)!.
platform
,
platform:
Theme
.
of
(
context
)!.
platform
,
hasFocus:
hasFocus
,
hasFocus:
hasFocus
,
...
@@ -847,7 +847,7 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
...
@@ -847,7 +847,7 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
..
onChanged
=
onChanged
..
onChanged
=
onChanged
..
onChangeStart
=
onChangeStart
..
onChangeStart
=
onChangeStart
..
onChangeEnd
=
onChangeEnd
..
onChangeEnd
=
onChangeEnd
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
semanticFormatterCallback
=
semanticFormatterCallback
..
semanticFormatterCallback
=
semanticFormatterCallback
..
platform
=
Theme
.
of
(
context
)!.
platform
..
platform
=
Theme
.
of
(
context
)!.
platform
..
hasFocus
=
hasFocus
..
hasFocus
=
hasFocus
...
...
packages/flutter/lib/src/material/switch.dart
View file @
f2a25c5b
...
@@ -476,7 +476,7 @@ class _SwitchRenderObjectWidget extends LeafRenderObjectWidget {
...
@@ -476,7 +476,7 @@ class _SwitchRenderObjectWidget extends LeafRenderObjectWidget {
inactiveTrackColor:
inactiveTrackColor
,
inactiveTrackColor:
inactiveTrackColor
,
configuration:
configuration
,
configuration:
configuration
,
onChanged:
onChanged
!=
null
?
_handleValueChanged
:
null
,
onChanged:
onChanged
!=
null
?
_handleValueChanged
:
null
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
additionalConstraints:
additionalConstraints
,
additionalConstraints:
additionalConstraints
,
hasFocus:
hasFocus
,
hasFocus:
hasFocus
,
hovering:
hovering
,
hovering:
hovering
,
...
@@ -501,7 +501,7 @@ class _SwitchRenderObjectWidget extends LeafRenderObjectWidget {
...
@@ -501,7 +501,7 @@ class _SwitchRenderObjectWidget extends LeafRenderObjectWidget {
..
inactiveTrackColor
=
inactiveTrackColor
..
inactiveTrackColor
=
inactiveTrackColor
..
configuration
=
configuration
..
configuration
=
configuration
..
onChanged
=
onChanged
!=
null
?
_handleValueChanged
:
null
..
onChanged
=
onChanged
!=
null
?
_handleValueChanged
:
null
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
additionalConstraints
=
additionalConstraints
..
additionalConstraints
=
additionalConstraints
..
dragStartBehavior
=
dragStartBehavior
..
dragStartBehavior
=
dragStartBehavior
..
hasFocus
=
hasFocus
..
hasFocus
=
hasFocus
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
f2a25c5b
...
@@ -918,7 +918,7 @@ class _TabBarState extends State<TabBar> {
...
@@ -918,7 +918,7 @@ class _TabBarState extends State<TabBar> {
if
(!
widget
.
isScrollable
)
if
(!
widget
.
isScrollable
)
return
0.0
;
return
0.0
;
double
tabCenter
=
_indicatorPainter
!.
centerOf
(
index
);
double
tabCenter
=
_indicatorPainter
!.
centerOf
(
index
);
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
case
TextDirection
.
rtl
:
tabCenter
=
_tabStripWidth
-
tabCenter
;
tabCenter
=
_tabStripWidth
-
tabCenter
;
break
;
break
;
...
...
packages/flutter/lib/src/material/time_picker.dart
View file @
f2a25c5b
...
@@ -1266,7 +1266,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
...
@@ -1266,7 +1266,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
accentColor:
accentColor
,
accentColor:
accentColor
,
dotColor:
theme
.
colorScheme
.
surface
,
dotColor:
theme
.
colorScheme
.
surface
,
theta:
_theta
.
value
,
theta:
_theta
.
value
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
),
),
),
),
);
);
...
@@ -2210,5 +2210,5 @@ Future<TimeOfDay?> showTimePicker({
...
@@ -2210,5 +2210,5 @@ Future<TimeOfDay?> showTimePicker({
}
}
void
_announceToAccessibility
(
BuildContext
context
,
String
message
)
{
void
_announceToAccessibility
(
BuildContext
context
,
String
message
)
{
SemanticsService
.
announce
(
message
,
Directionality
.
of
(
context
)
!
);
SemanticsService
.
announce
(
message
,
Directionality
.
of
(
context
));
}
}
packages/flutter/lib/src/material/toggle_buttons.dart
View file @
f2a25c5b
...
@@ -577,7 +577,7 @@ class ToggleButtons extends StatelessWidget {
...
@@ -577,7 +577,7 @@ class ToggleButtons extends StatelessWidget {
);
);
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ToggleButtonsThemeData
toggleButtonsTheme
=
ToggleButtonsTheme
.
of
(
context
);
final
ToggleButtonsThemeData
toggleButtonsTheme
=
ToggleButtonsTheme
.
of
(
context
);
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
return
IntrinsicHeight
(
return
IntrinsicHeight
(
child:
Row
(
child:
Row
(
...
@@ -901,7 +901,7 @@ class _SelectToggleButton extends SingleChildRenderObjectWidget {
...
@@ -901,7 +901,7 @@ class _SelectToggleButton extends SingleChildRenderObjectWidget {
borderRadius
,
borderRadius
,
isFirstButton
,
isFirstButton
,
isLastButton
,
isLastButton
,
Directionality
.
of
(
context
)
!
,
Directionality
.
of
(
context
),
);
);
@override
@override
...
@@ -913,7 +913,7 @@ class _SelectToggleButton extends SingleChildRenderObjectWidget {
...
@@ -913,7 +913,7 @@ class _SelectToggleButton extends SingleChildRenderObjectWidget {
..
borderRadius
=
borderRadius
..
borderRadius
=
borderRadius
..
isFirstButton
=
isFirstButton
..
isFirstButton
=
isFirstButton
..
isLastButton
=
isLastButton
..
isLastButton
=
isLastButton
..
textDirection
=
Directionality
.
of
(
context
)
!
;
..
textDirection
=
Directionality
.
of
(
context
);
}
}
}
}
...
...
packages/flutter/lib/src/material/tooltip.dart
View file @
f2a25c5b
...
@@ -332,7 +332,7 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
...
@@ -332,7 +332,7 @@ class _TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
// updated values from happening to leak into the overlay when the overlay
// updated values from happening to leak into the overlay when the overlay
// rebuilds.
// rebuilds.
final
Widget
overlay
=
Directionality
(
final
Widget
overlay
=
Directionality
(
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
child:
_TooltipOverlay
(
child:
_TooltipOverlay
(
message:
widget
.
message
,
message:
widget
.
message
,
height:
height
,
height:
height
,
...
...
packages/flutter/lib/src/material/user_accounts_drawer_header.dart
View file @
f2a25c5b
...
@@ -138,7 +138,7 @@ class _AccountDetailsState extends State<_AccountDetails> with SingleTickerProvi
...
@@ -138,7 +138,7 @@ class _AccountDetailsState extends State<_AccountDetails> with SingleTickerProvi
Widget
accountDetails
=
CustomMultiChildLayout
(
Widget
accountDetails
=
CustomMultiChildLayout
(
delegate:
_AccountDetailsLayout
(
delegate:
_AccountDetailsLayout
(
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
),
),
children:
<
Widget
>[
children:
<
Widget
>[
if
(
widget
.
accountName
!=
null
)
if
(
widget
.
accountName
!=
null
)
...
...
packages/flutter/lib/src/widgets/banner.dart
View file @
f2a25c5b
...
@@ -304,9 +304,9 @@ class Banner extends StatelessWidget {
...
@@ -304,9 +304,9 @@ class Banner extends StatelessWidget {
return
CustomPaint
(
return
CustomPaint
(
foregroundPainter:
BannerPainter
(
foregroundPainter:
BannerPainter
(
message:
message
,
message:
message
,
textDirection:
textDirection
??
Directionality
.
of
(
context
)
!
,
textDirection:
textDirection
??
Directionality
.
of
(
context
),
location:
location
,
location:
location
,
layoutDirection:
layoutDirection
??
Directionality
.
of
(
context
)
!
,
layoutDirection:
layoutDirection
??
Directionality
.
of
(
context
),
color:
color
,
color:
color
,
textStyle:
textStyle
,
textStyle:
textStyle
,
),
),
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
f2a25c5b
...
@@ -100,17 +100,23 @@ class Directionality extends InheritedWidget {
...
@@ -100,17 +100,23 @@ class Directionality extends InheritedWidget {
/// the given context.
/// the given context.
///
///
/// If there is no [Directionality] ancestor widget in the tree at the given
/// If there is no [Directionality] ancestor widget in the tree at the given
/// context, then this will return null.
/// context, then this will throw a descriptive [FlutterError] in debug mode
/// and an exception in release mode.
///
///
/// Typical usage is as follows:
/// Typical usage is as follows:
///
///
/// ```dart
/// ```dart
/// TextDirection textDirection = Directionality.of(context);
/// TextDirection textDirection = Directionality.of(context);
/// ```
/// ```
// TODO(goderbauer): Make this non-null when customers have upgraded to Directionality.maybeOf.
///
static
TextDirection
?
of
(
BuildContext
context
)
{
/// See also:
final
Directionality
?
widget
=
context
.
dependOnInheritedWidgetOfExactType
<
Directionality
>();
///
return
widget
?.
textDirection
;
/// * [maybeOf], which will return null if no [Directionality] ancestor
/// widget is in the tree.
static
TextDirection
of
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
final
Directionality
widget
=
context
.
dependOnInheritedWidgetOfExactType
<
Directionality
>()!;
return
widget
.
textDirection
;
}
}
/// The text direction from the closest instance of this class that encloses
/// The text direction from the closest instance of this class that encloses
...
@@ -124,6 +130,11 @@ class Directionality extends InheritedWidget {
...
@@ -124,6 +130,11 @@ class Directionality extends InheritedWidget {
/// ```dart
/// ```dart
/// TextDirection? textDirection = Directionality.maybeOf(context);
/// TextDirection? textDirection = Directionality.maybeOf(context);
/// ```
/// ```
///
/// See also:
///
/// * [of], which will throw if no [Directionality] ancestor widget is in the
/// tree.
static
TextDirection
?
maybeOf
(
BuildContext
context
)
{
static
TextDirection
?
maybeOf
(
BuildContext
context
)
{
final
Directionality
?
widget
=
context
.
dependOnInheritedWidgetOfExactType
<
Directionality
>();
final
Directionality
?
widget
=
context
.
dependOnInheritedWidgetOfExactType
<
Directionality
>();
return
widget
?.
textDirection
;
return
widget
?.
textDirection
;
...
@@ -3135,7 +3146,7 @@ AxisDirection getAxisDirectionFromAxisReverseAndDirectionality(
...
@@ -3135,7 +3146,7 @@ AxisDirection getAxisDirectionFromAxisReverseAndDirectionality(
switch
(
axis
)
{
switch
(
axis
)
{
case
Axis
.
horizontal
:
case
Axis
.
horizontal
:
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
AxisDirection
axisDirection
=
textDirectionToAxisDirection
(
textDirection
);
final
AxisDirection
axisDirection
=
textDirectionToAxisDirection
(
textDirection
);
return
reverse
?
flipAxisDirection
(
axisDirection
)
:
axisDirection
;
return
reverse
?
flipAxisDirection
(
axisDirection
)
:
axisDirection
;
case
Axis
.
vertical
:
case
Axis
.
vertical
:
...
@@ -3866,7 +3877,7 @@ class PositionedDirectional extends StatelessWidget {
...
@@ -3866,7 +3877,7 @@ class PositionedDirectional extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Positioned
.
directional
(
return
Positioned
.
directional
(
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
start:
start
,
start:
start
,
top:
top
,
top:
top
,
end:
end
,
end:
end
,
...
@@ -5376,7 +5387,7 @@ class RichText extends MultiChildRenderObjectWidget {
...
@@ -5376,7 +5387,7 @@ class RichText extends MultiChildRenderObjectWidget {
assert
(
textDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
assert
(
textDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
return
RenderParagraph
(
text
,
return
RenderParagraph
(
text
,
textAlign:
textAlign
,
textAlign:
textAlign
,
textDirection:
textDirection
??
Directionality
.
of
(
context
)
!
,
textDirection:
textDirection
??
Directionality
.
of
(
context
),
softWrap:
softWrap
,
softWrap:
softWrap
,
overflow:
overflow
,
overflow:
overflow
,
textScaleFactor:
textScaleFactor
,
textScaleFactor:
textScaleFactor
,
...
@@ -5394,7 +5405,7 @@ class RichText extends MultiChildRenderObjectWidget {
...
@@ -5394,7 +5405,7 @@ class RichText extends MultiChildRenderObjectWidget {
renderObject
renderObject
..
text
=
text
..
text
=
text
..
textAlign
=
textAlign
..
textAlign
=
textAlign
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
!
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
..
softWrap
=
softWrap
..
softWrap
=
softWrap
..
overflow
=
overflow
..
overflow
=
overflow
..
textScaleFactor
=
textScaleFactor
..
textScaleFactor
=
textScaleFactor
...
...
packages/flutter/lib/src/widgets/dismissible.dart
View file @
f2a25c5b
...
@@ -274,7 +274,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
...
@@ -274,7 +274,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
if
(
extent
==
0.0
)
if
(
extent
==
0.0
)
return
null
;
return
null
;
if
(
_directionIsXAxis
)
{
if
(
_directionIsXAxis
)
{
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
case
TextDirection
.
rtl
:
return
extent
<
0
?
DismissDirection
.
startToEnd
:
DismissDirection
.
endToStart
;
return
extent
<
0
?
DismissDirection
.
startToEnd
:
DismissDirection
.
endToStart
;
case
TextDirection
.
ltr
:
case
TextDirection
.
ltr
:
...
@@ -332,7 +332,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
...
@@ -332,7 +332,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
break
;
break
;
case
DismissDirection
.
endToStart
:
case
DismissDirection
.
endToStart
:
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
case
TextDirection
.
rtl
:
if
(
_dragExtent
+
delta
>
0
)
if
(
_dragExtent
+
delta
>
0
)
_dragExtent
+=
delta
;
_dragExtent
+=
delta
;
...
@@ -345,7 +345,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
...
@@ -345,7 +345,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
break
;
break
;
case
DismissDirection
.
startToEnd
:
case
DismissDirection
.
startToEnd
:
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
case
TextDirection
.
rtl
:
if
(
_dragExtent
+
delta
<
0
)
if
(
_dragExtent
+
delta
<
0
)
_dragExtent
+=
delta
;
_dragExtent
+=
delta
;
...
...
packages/flutter/lib/src/widgets/editable_text.dart
View file @
f2a25c5b
...
@@ -2429,9 +2429,9 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
...
@@ -2429,9 +2429,9 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
}
}
TextDirection
get
_textDirection
{
TextDirection
get
_textDirection
{
final
TextDirection
?
result
=
widget
.
textDirection
??
Directionality
.
of
(
context
);
final
TextDirection
result
=
widget
.
textDirection
??
Directionality
.
of
(
context
);
assert
(
result
!=
null
,
'
$runtimeType
created without a textDirection and with no ambient Directionality.'
);
assert
(
result
!=
null
,
'
$runtimeType
created without a textDirection and with no ambient Directionality.'
);
return
result
!
;
return
result
;
}
}
/// The renderer for this widget's descendant.
/// The renderer for this widget's descendant.
...
...
packages/flutter/lib/src/widgets/icon.dart
View file @
f2a25c5b
...
@@ -152,7 +152,7 @@ class Icon extends StatelessWidget {
...
@@ -152,7 +152,7 @@ class Icon extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
this
.
textDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
assert
(
this
.
textDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
final
TextDirection
textDirection
=
this
.
textDirection
??
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
this
.
textDirection
??
Directionality
.
of
(
context
);
final
IconThemeData
iconTheme
=
IconTheme
.
of
(
context
);
final
IconThemeData
iconTheme
=
IconTheme
.
of
(
context
);
...
...
packages/flutter/lib/src/widgets/implicit_animations.dart
View file @
f2a25c5b
...
@@ -1307,7 +1307,7 @@ class _AnimatedPositionedDirectionalState extends AnimatedWidgetBaseState<Animat
...
@@ -1307,7 +1307,7 @@ class _AnimatedPositionedDirectionalState extends AnimatedWidgetBaseState<Animat
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
return
Positioned
.
directional
(
return
Positioned
.
directional
(
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
child:
widget
.
child
,
child:
widget
.
child
,
start:
_start
?.
evaluate
(
animation
!),
start:
_start
?.
evaluate
(
animation
!),
top:
_top
?.
evaluate
(
animation
!),
top:
_top
?.
evaluate
(
animation
!),
...
...
packages/flutter/lib/src/widgets/navigation_toolbar.dart
View file @
f2a25c5b
...
@@ -61,7 +61,7 @@ class NavigationToolbar extends StatelessWidget {
...
@@ -61,7 +61,7 @@ class NavigationToolbar extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
return
CustomMultiChildLayout
(
return
CustomMultiChildLayout
(
delegate:
_ToolbarLayout
(
delegate:
_ToolbarLayout
(
centerMiddle:
centerMiddle
,
centerMiddle:
centerMiddle
,
...
...
packages/flutter/lib/src/widgets/overflow_bar.dart
View file @
f2a25c5b
...
@@ -225,7 +225,7 @@ class OverflowBar extends MultiChildRenderObjectWidget {
...
@@ -225,7 +225,7 @@ class OverflowBar extends MultiChildRenderObjectWidget {
overflowSpacing:
overflowSpacing
,
overflowSpacing:
overflowSpacing
,
overflowAlignment:
overflowAlignment
,
overflowAlignment:
overflowAlignment
,
overflowDirection:
overflowDirection
,
overflowDirection:
overflowDirection
,
textDirection:
textDirection
??
Directionality
.
of
(
context
)
!
,
textDirection:
textDirection
??
Directionality
.
of
(
context
),
clipBehavior:
clipBehavior
,
clipBehavior:
clipBehavior
,
);
);
}
}
...
@@ -237,7 +237,7 @@ class OverflowBar extends MultiChildRenderObjectWidget {
...
@@ -237,7 +237,7 @@ class OverflowBar extends MultiChildRenderObjectWidget {
..
overflowSpacing
=
overflowSpacing
..
overflowSpacing
=
overflowSpacing
..
overflowAlignment
=
overflowAlignment
..
overflowAlignment
=
overflowAlignment
..
overflowDirection
=
overflowDirection
..
overflowDirection
=
overflowDirection
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
!
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
..
clipBehavior
=
clipBehavior
;
..
clipBehavior
=
clipBehavior
;
}
}
...
...
packages/flutter/lib/src/widgets/overlay.dart
View file @
f2a25c5b
...
@@ -547,7 +547,7 @@ class _Theatre extends MultiChildRenderObjectWidget {
...
@@ -547,7 +547,7 @@ class _Theatre extends MultiChildRenderObjectWidget {
_RenderTheatre
createRenderObject
(
BuildContext
context
)
{
_RenderTheatre
createRenderObject
(
BuildContext
context
)
{
return
_RenderTheatre
(
return
_RenderTheatre
(
skipCount:
skipCount
,
skipCount:
skipCount
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
clipBehavior:
clipBehavior
,
clipBehavior:
clipBehavior
,
);
);
}
}
...
@@ -556,7 +556,7 @@ class _Theatre extends MultiChildRenderObjectWidget {
...
@@ -556,7 +556,7 @@ class _Theatre extends MultiChildRenderObjectWidget {
void
updateRenderObject
(
BuildContext
context
,
_RenderTheatre
renderObject
)
{
void
updateRenderObject
(
BuildContext
context
,
_RenderTheatre
renderObject
)
{
renderObject
renderObject
..
skipCount
=
skipCount
..
skipCount
=
skipCount
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
clipBehavior
=
clipBehavior
;
..
clipBehavior
=
clipBehavior
;
}
}
...
...
packages/flutter/lib/src/widgets/page_view.dart
View file @
f2a25c5b
...
@@ -846,7 +846,7 @@ class _PageViewState extends State<PageView> {
...
@@ -846,7 +846,7 @@ class _PageViewState extends State<PageView> {
switch
(
widget
.
scrollDirection
)
{
switch
(
widget
.
scrollDirection
)
{
case
Axis
.
horizontal
:
case
Axis
.
horizontal
:
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
AxisDirection
axisDirection
=
textDirectionToAxisDirection
(
textDirection
);
final
AxisDirection
axisDirection
=
textDirectionToAxisDirection
(
textDirection
);
return
widget
.
reverse
?
flipAxisDirection
(
axisDirection
)
:
axisDirection
;
return
widget
.
reverse
?
flipAxisDirection
(
axisDirection
)
:
axisDirection
;
case
Axis
.
vertical
:
case
Axis
.
vertical
:
...
...
packages/flutter/lib/src/widgets/platform_view.dart
View file @
f2a25c5b
...
@@ -491,7 +491,7 @@ class _AndroidViewState extends State<AndroidView> {
...
@@ -491,7 +491,7 @@ class _AndroidViewState extends State<AndroidView> {
TextDirection
_findLayoutDirection
()
{
TextDirection
_findLayoutDirection
()
{
assert
(
widget
.
layoutDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
assert
(
widget
.
layoutDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
return
widget
.
layoutDirection
??
Directionality
.
of
(
context
)
!
;
return
widget
.
layoutDirection
??
Directionality
.
of
(
context
);
}
}
@override
@override
...
@@ -616,7 +616,7 @@ class _UiKitViewState extends State<UiKitView> {
...
@@ -616,7 +616,7 @@ class _UiKitViewState extends State<UiKitView> {
TextDirection
_findLayoutDirection
()
{
TextDirection
_findLayoutDirection
()
{
assert
(
widget
.
layoutDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
assert
(
widget
.
layoutDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
return
widget
.
layoutDirection
??
Directionality
.
of
(
context
)
!
;
return
widget
.
layoutDirection
??
Directionality
.
of
(
context
);
}
}
@override
@override
...
...
packages/flutter/lib/src/widgets/table.dart
View file @
f2a25c5b
...
@@ -249,7 +249,7 @@ class Table extends RenderObjectWidget {
...
@@ -249,7 +249,7 @@ class Table extends RenderObjectWidget {
rows:
children
.
length
,
rows:
children
.
length
,
columnWidths:
columnWidths
,
columnWidths:
columnWidths
,
defaultColumnWidth:
defaultColumnWidth
,
defaultColumnWidth:
defaultColumnWidth
,
textDirection:
textDirection
??
Directionality
.
of
(
context
)
!
,
textDirection:
textDirection
??
Directionality
.
of
(
context
),
border:
border
,
border:
border
,
rowDecorations:
_rowDecorations
,
rowDecorations:
_rowDecorations
,
configuration:
createLocalImageConfiguration
(
context
),
configuration:
createLocalImageConfiguration
(
context
),
...
@@ -266,7 +266,7 @@ class Table extends RenderObjectWidget {
...
@@ -266,7 +266,7 @@ class Table extends RenderObjectWidget {
renderObject
renderObject
..
columnWidths
=
columnWidths
..
columnWidths
=
columnWidths
..
defaultColumnWidth
=
defaultColumnWidth
..
defaultColumnWidth
=
defaultColumnWidth
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
!
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
..
border
=
border
..
border
=
border
..
rowDecorations
=
_rowDecorations
..
rowDecorations
=
_rowDecorations
..
configuration
=
createLocalImageConfiguration
(
context
)
..
configuration
=
createLocalImageConfiguration
(
context
)
...
...
packages/flutter/lib/src/widgets/viewport.dart
View file @
f2a25c5b
...
@@ -147,7 +147,7 @@ class Viewport extends MultiChildRenderObjectWidget {
...
@@ -147,7 +147,7 @@ class Viewport extends MultiChildRenderObjectWidget {
why:
'to determine the cross-axis direction when the viewport has an
\'
up
\'
axisDirection'
,
why:
'to determine the cross-axis direction when the viewport has an
\'
up
\'
axisDirection'
,
alternative:
'Alternatively, consider specifying the
\'
crossAxisDirection
\'
argument on the Viewport.'
,
alternative:
'Alternatively, consider specifying the
\'
crossAxisDirection
\'
argument on the Viewport.'
,
));
));
return
textDirectionToAxisDirection
(
Directionality
.
of
(
context
)
!
);
return
textDirectionToAxisDirection
(
Directionality
.
of
(
context
));
case
AxisDirection
.
right
:
case
AxisDirection
.
right
:
return
AxisDirection
.
down
;
return
AxisDirection
.
down
;
case
AxisDirection
.
down
:
case
AxisDirection
.
down
:
...
@@ -156,7 +156,7 @@ class Viewport extends MultiChildRenderObjectWidget {
...
@@ -156,7 +156,7 @@ class Viewport extends MultiChildRenderObjectWidget {
why:
'to determine the cross-axis direction when the viewport has a
\'
down
\'
axisDirection'
,
why:
'to determine the cross-axis direction when the viewport has a
\'
down
\'
axisDirection'
,
alternative:
'Alternatively, consider specifying the
\'
crossAxisDirection
\'
argument on the Viewport.'
,
alternative:
'Alternatively, consider specifying the
\'
crossAxisDirection
\'
argument on the Viewport.'
,
));
));
return
textDirectionToAxisDirection
(
Directionality
.
of
(
context
)
!
);
return
textDirectionToAxisDirection
(
Directionality
.
of
(
context
));
case
AxisDirection
.
left
:
case
AxisDirection
.
left
:
return
AxisDirection
.
down
;
return
AxisDirection
.
down
;
}
}
...
...
packages/flutter/test/widgets/directionality_test.dart
View file @
f2a25c5b
...
@@ -10,7 +10,7 @@ void main() {
...
@@ -10,7 +10,7 @@ void main() {
final
List
<
TextDirection
>
log
=
<
TextDirection
>[];
final
List
<
TextDirection
>
log
=
<
TextDirection
>[];
final
Widget
inner
=
Builder
(
final
Widget
inner
=
Builder
(
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
log
.
add
(
Directionality
.
of
(
context
)
!
);
log
.
add
(
Directionality
.
of
(
context
));
return
const
Placeholder
();
return
const
Placeholder
();
}
}
);
);
...
@@ -80,4 +80,26 @@ void main() {
...
@@ -80,4 +80,26 @@ void main() {
expect
(
Directionality
.
maybeOf
(
noDirectionality
.
currentContext
!),
isNull
);
expect
(
Directionality
.
maybeOf
(
noDirectionality
.
currentContext
!),
isNull
);
expect
(
Directionality
.
maybeOf
(
hasDirectionality
.
currentContext
!),
TextDirection
.
rtl
);
expect
(
Directionality
.
maybeOf
(
hasDirectionality
.
currentContext
!),
TextDirection
.
rtl
);
});
});
testWidgets
(
'Directionality.of'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
hasDirectionality
=
GlobalKey
();
final
GlobalKey
noDirectionality
=
GlobalKey
();
await
tester
.
pumpWidget
(
Container
(
key:
noDirectionality
,
child:
Directionality
(
textDirection:
TextDirection
.
rtl
,
child:
Container
(
key:
hasDirectionality
,
),
),
),
);
expect
(()
=>
Directionality
.
of
(
noDirectionality
.
currentContext
!),
throwsA
(
isAssertionError
.
having
(
(
AssertionError
e
)
=>
e
.
message
,
'message'
,
contains
(
'No Directionality widget found.'
),
)));
expect
(
Directionality
.
of
(
hasDirectionality
.
currentContext
!),
TextDirection
.
rtl
);
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment