Commit 6fe9446f authored by Adam Barth's avatar Adam Barth

Merge pull request #1679 from abarth/fix_analyzer

Fix analyzer warnings in examples
parents f9e43f12 8382ca2c
...@@ -18,7 +18,8 @@ RenderBox buildFlexExample() { ...@@ -18,7 +18,8 @@ RenderBox buildFlexExample() {
void addFlexChildSolidColor(RenderFlex parent, ui.Color backgroundColor, { int flex: 0 }) { void addFlexChildSolidColor(RenderFlex parent, ui.Color backgroundColor, { int flex: 0 }) {
RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
parent.add(child); parent.add(child);
child.parentData.flex = flex; final FlexParentData childParentData = child.parentData;
childParentData.flex = flex;
} }
// Yellow bar at top // Yellow bar at top
......
...@@ -49,7 +49,8 @@ void main() { ...@@ -49,7 +49,8 @@ void main() {
void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex: 0 }) { void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex: 0 }) {
RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
parent.add(child); parent.add(child);
child.parentData.flex = flex; final FlexParentData childParentData = child.parentData;
childParentData.flex = flex;
} }
var row = new RenderFlex(direction: FlexDirection.horizontal); var row = new RenderFlex(direction: FlexDirection.horizontal);
...@@ -90,7 +91,8 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin."""; ...@@ -90,7 +91,8 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
addFlexChildSolidColor(column, const Color(0xFF0081C6), flex: 2); addFlexChildSolidColor(column, const Color(0xFF0081C6), flex: 2);
row.add(column); row.add(column);
column.parentData.flex = 8; final FlexParentData childParentData = column.parentData;
childParentData.flex = 8;
RenderDecoratedBox root = new RenderDecoratedBox( RenderDecoratedBox root = new RenderDecoratedBox(
decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)), decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)),
......
...@@ -16,7 +16,8 @@ void main() { ...@@ -16,7 +16,8 @@ void main() {
RenderObject child = new RenderSolidColorBox(const Color(0xFFFFFF00)); RenderObject child = new RenderSolidColorBox(const Color(0xFFFFFF00));
flexRoot.add(child); flexRoot.add(child);
child.parentData.flex = 2; FlexParentData childParentData = child.parentData;
childParentData.flex = 2;
// The internet is a beautiful place. https://baconipsum.com/ // The internet is a beautiful place. https://baconipsum.com/
String meatyString = """Bacon ipsum dolor amet ham fatback tri-tip, prosciutto String meatyString = """Bacon ipsum dolor amet ham fatback tri-tip, prosciutto
...@@ -33,7 +34,8 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin."""; ...@@ -33,7 +34,8 @@ Pancetta meatball tongue tenderloin rump tail jowl boudin.""";
child: new RenderParagraph(text) child: new RenderParagraph(text)
); );
flexRoot.add(child); flexRoot.add(child);
child.parentData.flex = 1; childParentData = child.parentData;
childParentData.flex = 1;
new FlutterBinding(root: root); new FlutterBinding(root: root);
} }
...@@ -18,7 +18,8 @@ void main() { ...@@ -18,7 +18,8 @@ void main() {
void addFlexChildSolidColor(RenderFlex parent, ui.Color backgroundColor, { int flex: 0 }) { void addFlexChildSolidColor(RenderFlex parent, ui.Color backgroundColor, { int flex: 0 }) {
RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
parent.add(child); parent.add(child);
child.parentData.flex = flex; final FlexParentData childParentData = child.parentData;
childParentData.flex = flex;
} }
addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFF00FF), flex: 1); addFlexChildSolidColor(flexRoot, const ui.Color(0xFFFF00FF), flex: 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment