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
f1e4defb
Unverified
Commit
f1e4defb
authored
May 31, 2018
by
Hans Muller
Committed by
GitHub
May 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass locale along to RenderParagraph (#17879)
parent
49bcda52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+12
-1
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+4
-1
No files found.
packages/flutter/lib/src/rendering/paragraph.dart
View file @
f1e4defb
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:ui'
as
ui
show
Gradient
,
Shader
,
TextBox
;
import
'dart:ui'
as
ui
show
Gradient
,
Shader
,
TextBox
,
Locale
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
...
...
@@ -44,6 +44,7 @@ class RenderParagraph extends RenderBox {
TextOverflow
overflow:
TextOverflow
.
clip
,
double
textScaleFactor:
1.0
,
int
maxLines
,
ui
.
Locale
locale
,
})
:
assert
(
text
!=
null
),
assert
(
text
.
debugAssertIsValid
()),
assert
(
textAlign
!=
null
),
...
...
@@ -61,6 +62,7 @@ class RenderParagraph extends RenderBox {
textScaleFactor:
textScaleFactor
,
maxLines:
maxLines
,
ellipsis:
overflow
==
TextOverflow
.
ellipsis
?
_kEllipsis
:
null
,
locale:
locale
,
);
final
TextPainter
_textPainter
;
...
...
@@ -174,6 +176,15 @@ class RenderParagraph extends RenderBox {
markNeedsLayout
();
}
ui
.
Locale
get
locale
=>
_textPainter
.
locale
;
set
locale
(
ui
.
Locale
value
)
{
if
(
_textPainter
.
locale
==
value
)
return
;
_textPainter
.
locale
=
locale
;
_overflowShader
=
null
;
markNeedsLayout
();
}
void
_layoutText
({
double
minWidth:
0.0
,
double
maxWidth:
double
.
infinity
})
{
final
bool
widthMatters
=
softWrap
||
overflow
==
TextOverflow
.
ellipsis
;
_textPainter
.
layout
(
minWidth:
minWidth
,
maxWidth:
widthMatters
?
maxWidth
:
double
.
infinity
);
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
f1e4defb
...
...
@@ -10,6 +10,7 @@ import 'package:flutter/services.dart';
import
'debug.dart'
;
import
'framework.dart'
;
import
'localizations.dart'
;
export
'package:flutter/animation.dart'
;
export
'package:flutter/foundation.dart'
show
...
...
@@ -4341,6 +4342,7 @@ class RichText extends LeafRenderObjectWidget {
overflow:
overflow
,
textScaleFactor:
textScaleFactor
,
maxLines:
maxLines
,
locale:
Localizations
.
localeOf
(
context
,
nullOk:
true
),
);
}
...
...
@@ -4354,7 +4356,8 @@ class RichText extends LeafRenderObjectWidget {
..
softWrap
=
softWrap
..
overflow
=
overflow
..
textScaleFactor
=
textScaleFactor
..
maxLines
=
maxLines
;
..
maxLines
=
maxLines
..
locale
=
Localizations
.
localeOf
(
context
,
nullOk:
true
);
}
@override
...
...
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