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> {
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
textDirection
=
Directionality
.
of
(
context
)
!
;
textDirection
=
Directionality
.
of
(
context
);
localizations
=
CupertinoLocalizations
.
of
(
context
);
_measureLabelMetrics
();
...
...
packages/flutter/lib/src/cupertino/nav_bar.dart
View file @
f2a25c5b
...
...
@@ -1374,7 +1374,7 @@ class _BackChevron extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
TextStyle
textStyle
=
DefaultTextStyle
.
of
(
context
).
style
;
// Replicate the Icon logic here to get a tightly sized icon and add
...
...
@@ -1588,7 +1588,7 @@ class _NavigationBarTransition extends StatelessWidget {
animation:
animation
,
bottomNavBar:
bottomNavBar
,
topNavBar:
topNavBar
,
directionality:
Directionality
.
of
(
context
)
!
,
directionality:
Directionality
.
of
(
context
),
);
final
List
<
Widget
>
children
=
<
Widget
>[
...
...
packages/flutter/lib/src/cupertino/picker.dart
View file @
f2a25c5b
...
...
@@ -413,14 +413,14 @@ class _CupertinoPickerSemantics extends SingleChildRenderObjectWidget {
@override
RenderObject
createRenderObject
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
return
_RenderCupertinoPickerSemantics
(
scrollController
,
Directionality
.
of
(
context
)
!
);
return
_RenderCupertinoPickerSemantics
(
scrollController
,
Directionality
.
of
(
context
));
}
@override
void
updateRenderObject
(
BuildContext
context
,
covariant
_RenderCupertinoPickerSemantics
renderObject
)
{
assert
(
debugCheckHasDirectionality
(
context
));
renderObject
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
controller
=
scrollController
;
}
}
...
...
packages/flutter/lib/src/cupertino/route.dart
View file @
f2a25c5b
...
...
@@ -514,7 +514,7 @@ class CupertinoPageTransition extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
final
TextDirection
?
textDirection
=
Directionality
.
of
(
context
);
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
return
SlideTransition
(
position:
_secondaryPositionAnimation
,
textDirection:
textDirection
,
...
...
@@ -578,7 +578,7 @@ class CupertinoFullscreenDialogTransition extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
final
TextDirection
?
textDirection
=
Directionality
.
of
(
context
);
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
return
SlideTransition
(
position:
_secondaryPositionAnimation
,
textDirection:
textDirection
,
...
...
@@ -677,7 +677,7 @@ class _CupertinoBackGestureDetectorState<T> extends State<_CupertinoBackGestureD
}
double
_convertToLogical
(
double
value
)
{
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
return
-
value
;
case
TextDirection
.
ltr
:
...
...
packages/flutter/lib/src/cupertino/scrollbar.dart
View file @
f2a25c5b
...
...
@@ -283,7 +283,7 @@ class _CupertinoScrollbarState extends State<CupertinoScrollbar> with TickerProv
_painter
=
_buildCupertinoScrollbarPainter
(
context
);
}
else
{
_painter
!
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
color
=
CupertinoDynamicColor
.
resolve
(
_kScrollbarColor
,
context
)!
..
padding
=
MediaQuery
.
of
(
context
).
padding
;
}
...
...
@@ -309,7 +309,7 @@ class _CupertinoScrollbarState extends State<CupertinoScrollbar> with TickerProv
ScrollbarPainter
_buildCupertinoScrollbarPainter
(
BuildContext
context
)
{
return
ScrollbarPainter
(
color:
CupertinoDynamicColor
.
resolve
(
_kScrollbarColor
,
context
)!,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
thickness:
_thickness
,
fadeoutOpacityAnimation:
_fadeoutOpacityAnimation
,
mainAxisMargin:
_kScrollbarMainAxisMargin
,
...
...
packages/flutter/lib/src/cupertino/segmented_control.dart
View file @
f2a25c5b
...
...
@@ -448,7 +448,7 @@ class _SegmentedControlRenderWidget<T> extends MultiChildRenderObjectWidget {
@override
RenderObject
createRenderObject
(
BuildContext
context
)
{
return
_RenderSegmentedControl
<
T
>(
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
selectedIndex:
selectedIndex
,
pressedIndex:
pressedIndex
,
backgroundColors:
backgroundColors
,
...
...
@@ -459,7 +459,7 @@ class _SegmentedControlRenderWidget<T> extends MultiChildRenderObjectWidget {
@override
void
updateRenderObject
(
BuildContext
context
,
_RenderSegmentedControl
<
T
>
renderObject
)
{
renderObject
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
selectedIndex
=
selectedIndex
..
pressedIndex
=
pressedIndex
..
backgroundColors
=
backgroundColors
...
...
packages/flutter/lib/src/cupertino/slider.dart
View file @
f2a25c5b
...
...
@@ -288,7 +288,7 @@ class _CupertinoSliderRenderObjectWidget extends LeafRenderObjectWidget {
onChangeStart:
onChangeStart
,
onChangeEnd:
onChangeEnd
,
vsync:
vsync
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
);
}
...
...
@@ -304,7 +304,7 @@ class _CupertinoSliderRenderObjectWidget extends LeafRenderObjectWidget {
..
onChanged
=
onChanged
..
onChangeStart
=
onChangeStart
..
onChangeEnd
=
onChangeEnd
..
textDirection
=
Directionality
.
of
(
context
)
!
;
..
textDirection
=
Directionality
.
of
(
context
);
// Ticker provider cannot change since there's a 1:1 relationship between
// 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
Widget
build
(
BuildContext
context
)
{
debugCheckHasDirectionality
(
context
);
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
ltr
:
keys
=
widget
.
children
.
keys
.
toList
(
growable:
false
);
break
;
...
...
packages/flutter/lib/src/cupertino/switch.dart
View file @
f2a25c5b
...
...
@@ -254,7 +254,7 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt
..
curve
=
Curves
.
linear
..
reverseCurve
=
Curves
.
linear
;
final
double
delta
=
details
.
primaryDelta
!
/
_kTrackInnerLength
;
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
_positionController
.
value
-=
delta
;
break
;
...
...
@@ -302,7 +302,7 @@ class _CupertinoSwitchState extends State<CupertinoSwitch> with TickerProviderSt
)!,
trackColor:
CupertinoDynamicColor
.
resolve
(
widget
.
trackColor
??
CupertinoColors
.
secondarySystemFill
,
context
)!,
onChanged:
widget
.
onChanged
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
state:
this
,
),
);
...
...
packages/flutter/lib/src/material/animated_icons/animated_icons.dart
View file @
f2a25c5b
...
...
@@ -109,7 +109,7 @@ class AnimatedIcon extends StatelessWidget {
final
IconThemeData
iconTheme
=
IconTheme
.
of
(
context
);
assert
(
iconTheme
.
isConcrete
);
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
!;
Color
iconColor
=
color
??
iconTheme
.
color
!;
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
child:
CustomPaint
(
painter:
_RadialPainter
(
circles:
_circles
.
toList
(),
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
),
child:
Material
(
// Splashes.
type:
MaterialType
.
transparency
,
...
...
packages/flutter/lib/src/material/chip.dart
View file @
f2a25c5b
...
...
@@ -2129,7 +2129,7 @@ class _ChipRenderWidget extends RenderObjectWidget {
RenderObject
createRenderObject
(
BuildContext
context
)
{
return
_RenderChip
(
theme:
theme
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
value:
value
,
isEnabled:
isEnabled
,
checkmarkAnimation:
checkmarkAnimation
,
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
f2a25c5b
...
...
@@ -407,7 +407,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
delta
=
-
delta
;
break
;
}
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
_controller
.
value
-=
delta
;
break
;
...
...
@@ -434,7 +434,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
visualVelocity
=
-
visualVelocity
;
break
;
}
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
_controller
.
fling
(
velocity:
-
visualVelocity
);
if
(
widget
.
drawerCallback
!=
null
)
...
...
@@ -499,7 +499,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
Widget
_buildDrawer
(
BuildContext
context
)
{
final
bool
drawerIsStart
=
widget
.
alignment
==
DrawerAlignment
.
start
;
final
EdgeInsets
padding
=
MediaQuery
.
of
(
context
).
padding
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
double
?
dragAreaWidth
=
widget
.
edgeDragWidth
;
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> {
Alignment
_getTitleAlignment
(
bool
effectiveCenterTitle
)
{
if
(
effectiveCenterTitle
)
return
Alignment
.
bottomCenter
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
assert
(
textDirection
!=
null
);
switch
(
textDirection
)
{
case
TextDirection
.
rtl
:
...
...
packages/flutter/lib/src/material/ink_well.dart
View file @
f2a25c5b
...
...
@@ -842,7 +842,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
customBorder:
widget
.
customBorder
,
rectCallback:
widget
.
getRectCallback
!(
referenceBox
),
onRemoved:
handleInkRemoval
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
fadeDuration:
getFadeDurationForType
(
type
),
);
updateKeepAlive
();
...
...
@@ -900,7 +900,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
borderRadius:
borderRadius
,
customBorder:
customBorder
,
onRemoved:
onRemoved
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
);
return
splash
;
...
...
packages/flutter/lib/src/material/input_decorator.dart
View file @
f2a25c5b
...
...
@@ -237,7 +237,7 @@ class _BorderContainerState extends State<_BorderContainer> with TickerProviderS
border:
_border
,
gapAnimation:
widget
.
gapAnimation
,
gap:
widget
.
gap
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
fillColor:
widget
.
fillColor
,
hoverColorTween:
_hoverColorTween
,
hoverAnimation:
_hoverAnimation
,
...
...
@@ -2311,7 +2311,7 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
// The _Decoration widget and _RenderDecoration assume that contentPadding
// 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
contentPadding
;
...
...
packages/flutter/lib/src/material/list_tile.dart
View file @
f2a25c5b
...
...
@@ -1067,7 +1067,7 @@ class ListTile extends StatelessWidget {
}
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
)
??
tileTheme
.
contentPadding
?.
resolve
(
textDirection
)
??
_defaultContentPadding
;
...
...
packages/flutter/lib/src/material/pickers/calendar_date_picker.dart
View file @
f2a25c5b
...
...
@@ -180,7 +180,7 @@ class _CalendarDatePickerState extends State<CalendarDatePicker> {
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
_localizations
=
MaterialLocalizations
.
of
(
context
);
_textDirection
=
Directionality
.
of
(
context
)
!
;
_textDirection
=
Directionality
.
of
(
context
);
if
(!
_announcedInitialDate
)
{
_announcedInitialDate
=
true
;
SemanticsService
.
announce
(
...
...
@@ -525,7 +525,7 @@ class _MonthPickerState extends State<_MonthPicker> {
void
didChangeDependencies
()
{
super
.
didChangeDependencies
();
_localizations
=
MaterialLocalizations
.
of
(
context
);
_textDirection
=
Directionality
.
of
(
context
)
!
;
_textDirection
=
Directionality
.
of
(
context
);
}
@override
...
...
@@ -709,7 +709,7 @@ class _MonthPickerState extends State<_MonthPicker> {
}
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
));
while
(!
nextDate
.
isBefore
(
widget
.
firstDate
)
&&
!
nextDate
.
isAfter
(
widget
.
lastDate
))
{
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>
}
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
));
if
(!
nextDate
.
isBefore
(
widget
.
firstDate
)
&&
!
nextDate
.
isAfter
(
widget
.
lastDate
))
{
return
nextDate
;
...
...
@@ -707,7 +707,7 @@ class _MonthItemState extends State<_MonthItem> {
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
final
TextTheme
textTheme
=
theme
.
textTheme
;
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
Color
highlightColor
=
_highlightColor
(
context
);
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> {
position
,
itemSizes
,
selectedItemIndex
,
Directionality
.
of
(
context
)
!
,
Directionality
.
of
(
context
),
),
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
@override
Widget
build
(
BuildContext
context
)
{
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
if
(
widget
.
value
!=
null
)
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 {
onChangeStart:
onChangeStart
,
onChangeEnd:
onChangeEnd
,
state:
state
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
semanticFormatterCallback:
semanticFormatterCallback
,
platform:
Theme
.
of
(
context
)!.
platform
,
);
...
...
@@ -741,7 +741,7 @@ class _RangeSliderRenderObjectWidget extends LeafRenderObjectWidget {
..
onChanged
=
onChanged
..
onChangeStart
=
onChangeStart
..
onChangeEnd
=
onChangeEnd
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
semanticFormatterCallback
=
semanticFormatterCallback
..
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 {
assert
(
debugCheckHasDirectionality
(
context
));
final
MediaQueryData
mediaQuery
=
MediaQuery
.
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
_accessibleNavigation
=
mediaQuery
.
accessibleNavigation
;
...
...
packages/flutter/lib/src/material/scrollbar.dart
View file @
f2a25c5b
...
...
@@ -122,7 +122,7 @@ class _ScrollbarState extends State<Scrollbar> with SingleTickerProviderStateMix
case
TargetPlatform
.
linux
:
case
TargetPlatform
.
windows
:
_themeColor
=
theme
.
highlightColor
.
withOpacity
(
1.0
);
_textDirection
=
Directionality
.
of
(
context
)
!
;
_textDirection
=
Directionality
.
of
(
context
);
_materialPainter
=
_buildMaterialScrollbarPainter
();
_useCupertinoScrollbar
=
false
;
_triggerScrollbar
();
...
...
packages/flutter/lib/src/material/slider.dart
View file @
f2a25c5b
...
...
@@ -550,7 +550,7 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
void
_actionHandler
(
_AdjustSliderIntent
intent
)
{
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
)
{
case
_SliderAdjustmentType
.
right
:
switch
(
textDirection
)
{
...
...
@@ -825,7 +825,7 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
onChangeStart:
onChangeStart
,
onChangeEnd:
onChangeEnd
,
state:
state
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
semanticFormatterCallback:
semanticFormatterCallback
,
platform:
Theme
.
of
(
context
)!.
platform
,
hasFocus:
hasFocus
,
...
...
@@ -847,7 +847,7 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
..
onChanged
=
onChanged
..
onChangeStart
=
onChangeStart
..
onChangeEnd
=
onChangeEnd
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
semanticFormatterCallback
=
semanticFormatterCallback
..
platform
=
Theme
.
of
(
context
)!.
platform
..
hasFocus
=
hasFocus
...
...
packages/flutter/lib/src/material/switch.dart
View file @
f2a25c5b
...
...
@@ -476,7 +476,7 @@ class _SwitchRenderObjectWidget extends LeafRenderObjectWidget {
inactiveTrackColor:
inactiveTrackColor
,
configuration:
configuration
,
onChanged:
onChanged
!=
null
?
_handleValueChanged
:
null
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
additionalConstraints:
additionalConstraints
,
hasFocus:
hasFocus
,
hovering:
hovering
,
...
...
@@ -501,7 +501,7 @@ class _SwitchRenderObjectWidget extends LeafRenderObjectWidget {
..
inactiveTrackColor
=
inactiveTrackColor
..
configuration
=
configuration
..
onChanged
=
onChanged
!=
null
?
_handleValueChanged
:
null
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
additionalConstraints
=
additionalConstraints
..
dragStartBehavior
=
dragStartBehavior
..
hasFocus
=
hasFocus
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
f2a25c5b
...
...
@@ -918,7 +918,7 @@ class _TabBarState extends State<TabBar> {
if
(!
widget
.
isScrollable
)
return
0.0
;
double
tabCenter
=
_indicatorPainter
!.
centerOf
(
index
);
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
tabCenter
=
_tabStripWidth
-
tabCenter
;
break
;
...
...
packages/flutter/lib/src/material/time_picker.dart
View file @
f2a25c5b
...
...
@@ -1266,7 +1266,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
accentColor:
accentColor
,
dotColor:
theme
.
colorScheme
.
surface
,
theta:
_theta
.
value
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
),
),
);
...
...
@@ -2210,5 +2210,5 @@ Future<TimeOfDay?> showTimePicker({
}
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 {
);
final
ThemeData
theme
=
Theme
.
of
(
context
)!;
final
ToggleButtonsThemeData
toggleButtonsTheme
=
ToggleButtonsTheme
.
of
(
context
);
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
return
IntrinsicHeight
(
child:
Row
(
...
...
@@ -901,7 +901,7 @@ class _SelectToggleButton extends SingleChildRenderObjectWidget {
borderRadius
,
isFirstButton
,
isLastButton
,
Directionality
.
of
(
context
)
!
,
Directionality
.
of
(
context
),
);
@override
...
...
@@ -913,7 +913,7 @@ class _SelectToggleButton extends SingleChildRenderObjectWidget {
..
borderRadius
=
borderRadius
..
isFirstButton
=
isFirstButton
..
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 {
// updated values from happening to leak into the overlay when the overlay
// rebuilds.
final
Widget
overlay
=
Directionality
(
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
child:
_TooltipOverlay
(
message:
widget
.
message
,
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
Widget
accountDetails
=
CustomMultiChildLayout
(
delegate:
_AccountDetailsLayout
(
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
),
children:
<
Widget
>[
if
(
widget
.
accountName
!=
null
)
...
...
packages/flutter/lib/src/widgets/banner.dart
View file @
f2a25c5b
...
...
@@ -304,9 +304,9 @@ class Banner extends StatelessWidget {
return
CustomPaint
(
foregroundPainter:
BannerPainter
(
message:
message
,
textDirection:
textDirection
??
Directionality
.
of
(
context
)
!
,
textDirection:
textDirection
??
Directionality
.
of
(
context
),
location:
location
,
layoutDirection:
layoutDirection
??
Directionality
.
of
(
context
)
!
,
layoutDirection:
layoutDirection
??
Directionality
.
of
(
context
),
color:
color
,
textStyle:
textStyle
,
),
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
f2a25c5b
...
...
@@ -100,17 +100,23 @@ class Directionality extends InheritedWidget {
/// the given context.
///
/// 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:
///
/// ```dart
/// TextDirection textDirection = Directionality.of(context);
/// ```
// TODO(goderbauer): Make this non-null when customers have upgraded to Directionality.maybeOf.
static
TextDirection
?
of
(
BuildContext
context
)
{
final
Directionality
?
widget
=
context
.
dependOnInheritedWidgetOfExactType
<
Directionality
>();
return
widget
?.
textDirection
;
///
/// See also:
///
/// * [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
...
...
@@ -124,6 +130,11 @@ class Directionality extends InheritedWidget {
/// ```dart
/// 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
)
{
final
Directionality
?
widget
=
context
.
dependOnInheritedWidgetOfExactType
<
Directionality
>();
return
widget
?.
textDirection
;
...
...
@@ -3135,7 +3146,7 @@ AxisDirection getAxisDirectionFromAxisReverseAndDirectionality(
switch
(
axis
)
{
case
Axis
.
horizontal
:
assert
(
debugCheckHasDirectionality
(
context
));
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
AxisDirection
axisDirection
=
textDirectionToAxisDirection
(
textDirection
);
return
reverse
?
flipAxisDirection
(
axisDirection
)
:
axisDirection
;
case
Axis
.
vertical
:
...
...
@@ -3866,7 +3877,7 @@ class PositionedDirectional extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
Positioned
.
directional
(
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
start:
start
,
top:
top
,
end:
end
,
...
...
@@ -5376,7 +5387,7 @@ class RichText extends MultiChildRenderObjectWidget {
assert
(
textDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
return
RenderParagraph
(
text
,
textAlign:
textAlign
,
textDirection:
textDirection
??
Directionality
.
of
(
context
)
!
,
textDirection:
textDirection
??
Directionality
.
of
(
context
),
softWrap:
softWrap
,
overflow:
overflow
,
textScaleFactor:
textScaleFactor
,
...
...
@@ -5394,7 +5405,7 @@ class RichText extends MultiChildRenderObjectWidget {
renderObject
..
text
=
text
..
textAlign
=
textAlign
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
!
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
..
softWrap
=
softWrap
..
overflow
=
overflow
..
textScaleFactor
=
textScaleFactor
...
...
packages/flutter/lib/src/widgets/dismissible.dart
View file @
f2a25c5b
...
...
@@ -274,7 +274,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
if
(
extent
==
0.0
)
return
null
;
if
(
_directionIsXAxis
)
{
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
return
extent
<
0
?
DismissDirection
.
startToEnd
:
DismissDirection
.
endToStart
;
case
TextDirection
.
ltr
:
...
...
@@ -332,7 +332,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
break
;
case
DismissDirection
.
endToStart
:
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
if
(
_dragExtent
+
delta
>
0
)
_dragExtent
+=
delta
;
...
...
@@ -345,7 +345,7 @@ class _DismissibleState extends State<Dismissible> with TickerProviderStateMixin
break
;
case
DismissDirection
.
startToEnd
:
switch
(
Directionality
.
of
(
context
)
!
)
{
switch
(
Directionality
.
of
(
context
))
{
case
TextDirection
.
rtl
:
if
(
_dragExtent
+
delta
<
0
)
_dragExtent
+=
delta
;
...
...
packages/flutter/lib/src/widgets/editable_text.dart
View file @
f2a25c5b
...
...
@@ -2429,9 +2429,9 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
}
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.'
);
return
result
!
;
return
result
;
}
/// 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 {
@override
Widget
build
(
BuildContext
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
);
...
...
packages/flutter/lib/src/widgets/implicit_animations.dart
View file @
f2a25c5b
...
...
@@ -1307,7 +1307,7 @@ class _AnimatedPositionedDirectionalState extends AnimatedWidgetBaseState<Animat
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
return
Positioned
.
directional
(
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
child:
widget
.
child
,
start:
_start
?.
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 {
@override
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasDirectionality
(
context
));
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
return
CustomMultiChildLayout
(
delegate:
_ToolbarLayout
(
centerMiddle:
centerMiddle
,
...
...
packages/flutter/lib/src/widgets/overflow_bar.dart
View file @
f2a25c5b
...
...
@@ -225,7 +225,7 @@ class OverflowBar extends MultiChildRenderObjectWidget {
overflowSpacing:
overflowSpacing
,
overflowAlignment:
overflowAlignment
,
overflowDirection:
overflowDirection
,
textDirection:
textDirection
??
Directionality
.
of
(
context
)
!
,
textDirection:
textDirection
??
Directionality
.
of
(
context
),
clipBehavior:
clipBehavior
,
);
}
...
...
@@ -237,7 +237,7 @@ class OverflowBar extends MultiChildRenderObjectWidget {
..
overflowSpacing
=
overflowSpacing
..
overflowAlignment
=
overflowAlignment
..
overflowDirection
=
overflowDirection
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
!
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
..
clipBehavior
=
clipBehavior
;
}
...
...
packages/flutter/lib/src/widgets/overlay.dart
View file @
f2a25c5b
...
...
@@ -547,7 +547,7 @@ class _Theatre extends MultiChildRenderObjectWidget {
_RenderTheatre
createRenderObject
(
BuildContext
context
)
{
return
_RenderTheatre
(
skipCount:
skipCount
,
textDirection:
Directionality
.
of
(
context
)
!
,
textDirection:
Directionality
.
of
(
context
),
clipBehavior:
clipBehavior
,
);
}
...
...
@@ -556,7 +556,7 @@ class _Theatre extends MultiChildRenderObjectWidget {
void
updateRenderObject
(
BuildContext
context
,
_RenderTheatre
renderObject
)
{
renderObject
..
skipCount
=
skipCount
..
textDirection
=
Directionality
.
of
(
context
)
!
..
textDirection
=
Directionality
.
of
(
context
)
..
clipBehavior
=
clipBehavior
;
}
...
...
packages/flutter/lib/src/widgets/page_view.dart
View file @
f2a25c5b
...
...
@@ -846,7 +846,7 @@ class _PageViewState extends State<PageView> {
switch
(
widget
.
scrollDirection
)
{
case
Axis
.
horizontal
:
assert
(
debugCheckHasDirectionality
(
context
));
final
TextDirection
textDirection
=
Directionality
.
of
(
context
)
!
;
final
TextDirection
textDirection
=
Directionality
.
of
(
context
);
final
AxisDirection
axisDirection
=
textDirectionToAxisDirection
(
textDirection
);
return
widget
.
reverse
?
flipAxisDirection
(
axisDirection
)
:
axisDirection
;
case
Axis
.
vertical
:
...
...
packages/flutter/lib/src/widgets/platform_view.dart
View file @
f2a25c5b
...
...
@@ -491,7 +491,7 @@ class _AndroidViewState extends State<AndroidView> {
TextDirection
_findLayoutDirection
()
{
assert
(
widget
.
layoutDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
return
widget
.
layoutDirection
??
Directionality
.
of
(
context
)
!
;
return
widget
.
layoutDirection
??
Directionality
.
of
(
context
);
}
@override
...
...
@@ -616,7 +616,7 @@ class _UiKitViewState extends State<UiKitView> {
TextDirection
_findLayoutDirection
()
{
assert
(
widget
.
layoutDirection
!=
null
||
debugCheckHasDirectionality
(
context
));
return
widget
.
layoutDirection
??
Directionality
.
of
(
context
)
!
;
return
widget
.
layoutDirection
??
Directionality
.
of
(
context
);
}
@override
...
...
packages/flutter/lib/src/widgets/table.dart
View file @
f2a25c5b
...
...
@@ -249,7 +249,7 @@ class Table extends RenderObjectWidget {
rows:
children
.
length
,
columnWidths:
columnWidths
,
defaultColumnWidth:
defaultColumnWidth
,
textDirection:
textDirection
??
Directionality
.
of
(
context
)
!
,
textDirection:
textDirection
??
Directionality
.
of
(
context
),
border:
border
,
rowDecorations:
_rowDecorations
,
configuration:
createLocalImageConfiguration
(
context
),
...
...
@@ -266,7 +266,7 @@ class Table extends RenderObjectWidget {
renderObject
..
columnWidths
=
columnWidths
..
defaultColumnWidth
=
defaultColumnWidth
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
!
..
textDirection
=
textDirection
??
Directionality
.
of
(
context
)
..
border
=
border
..
rowDecorations
=
_rowDecorations
..
configuration
=
createLocalImageConfiguration
(
context
)
...
...
packages/flutter/lib/src/widgets/viewport.dart
View file @
f2a25c5b
...
...
@@ -147,7 +147,7 @@ class Viewport extends MultiChildRenderObjectWidget {
why:
'to determine the cross-axis direction when the viewport has an
\'
up
\'
axisDirection'
,
alternative:
'Alternatively, consider specifying the
\'
crossAxisDirection
\'
argument on the Viewport.'
,
));
return
textDirectionToAxisDirection
(
Directionality
.
of
(
context
)
!
);
return
textDirectionToAxisDirection
(
Directionality
.
of
(
context
));
case
AxisDirection
.
right
:
return
AxisDirection
.
down
;
case
AxisDirection
.
down
:
...
...
@@ -156,7 +156,7 @@ class Viewport extends MultiChildRenderObjectWidget {
why:
'to determine the cross-axis direction when the viewport has a
\'
down
\'
axisDirection'
,
alternative:
'Alternatively, consider specifying the
\'
crossAxisDirection
\'
argument on the Viewport.'
,
));
return
textDirectionToAxisDirection
(
Directionality
.
of
(
context
)
!
);
return
textDirectionToAxisDirection
(
Directionality
.
of
(
context
));
case
AxisDirection
.
left
:
return
AxisDirection
.
down
;
}
...
...
packages/flutter/test/widgets/directionality_test.dart
View file @
f2a25c5b
...
...
@@ -10,7 +10,7 @@ void main() {
final
List
<
TextDirection
>
log
=
<
TextDirection
>[];
final
Widget
inner
=
Builder
(
builder:
(
BuildContext
context
)
{
log
.
add
(
Directionality
.
of
(
context
)
!
);
log
.
add
(
Directionality
.
of
(
context
));
return
const
Placeholder
();
}
);
...
...
@@ -80,4 +80,26 @@ void main() {
expect
(
Directionality
.
maybeOf
(
noDirectionality
.
currentContext
!),
isNull
);
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