Unnecessary new (#20138)
* enable lint unnecessary_new * fix tests * fix tests * fix tests
This commit is contained in:
committed by
GitHub
parent
d7a0dcaa4a
commit
d927c93310
@@ -28,9 +28,9 @@ class RenderDots extends RenderConstrainedBox {
|
||||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
final Canvas canvas = context.canvas;
|
||||
canvas.drawRect(offset & size, new Paint()..color = const Color(0xFF0000FF));
|
||||
canvas.drawRect(offset & size, Paint()..color = const Color(0xFF0000FF));
|
||||
|
||||
final Paint paint = new Paint()..color = const Color(0xFF00FF00);
|
||||
final Paint paint = Paint()..color = const Color(0xFF00FF00);
|
||||
for (Offset point in _dots.values)
|
||||
canvas.drawCircle(point, 50.0, paint);
|
||||
|
||||
@@ -42,7 +42,7 @@ class Dots extends SingleChildRenderObjectWidget {
|
||||
const Dots({ Key key, Widget child }) : super(key: key, child: child);
|
||||
|
||||
@override
|
||||
RenderDots createRenderObject(BuildContext context) => new RenderDots();
|
||||
RenderDots createRenderObject(BuildContext context) => RenderDots();
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -29,12 +29,12 @@ class _GesturePainter extends CustomPainter {
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final Offset center = size.center(Offset.zero) * zoom + offset;
|
||||
final double radius = size.width / 2.0 * zoom;
|
||||
final Gradient gradient = new RadialGradient(
|
||||
final Gradient gradient = RadialGradient(
|
||||
colors: forward ? <Color>[swatch.shade50, swatch.shade900]
|
||||
: <Color>[swatch.shade900, swatch.shade50]
|
||||
);
|
||||
final Paint paint = new Paint()
|
||||
..shader = gradient.createShader(new Rect.fromCircle(
|
||||
final Paint paint = Paint()
|
||||
..shader = gradient.createShader(Rect.fromCircle(
|
||||
center: center,
|
||||
radius: radius,
|
||||
));
|
||||
@@ -56,7 +56,7 @@ class _GesturePainter extends CustomPainter {
|
||||
|
||||
class GestureDemo extends StatefulWidget {
|
||||
@override
|
||||
GestureDemoState createState() => new GestureDemoState();
|
||||
GestureDemoState createState() => GestureDemoState();
|
||||
}
|
||||
|
||||
class GestureDemoState extends State<GestureDemo> {
|
||||
@@ -141,17 +141,17 @@ class GestureDemoState extends State<GestureDemo> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Stack(
|
||||
return Stack(
|
||||
fit: StackFit.expand,
|
||||
children: <Widget>[
|
||||
new GestureDetector(
|
||||
GestureDetector(
|
||||
onScaleStart: _scaleEnabled ? _handleScaleStart : null,
|
||||
onScaleUpdate: _scaleEnabled ? _handleScaleUpdate : null,
|
||||
onTap: _tapEnabled ? _handleColorChange : null,
|
||||
onDoubleTap: _doubleTapEnabled ? _handleScaleReset : null,
|
||||
onLongPress: _longPressEnabled ? _handleDirectionChange : null,
|
||||
child: new CustomPaint(
|
||||
painter: new _GesturePainter(
|
||||
child: CustomPaint(
|
||||
painter: _GesturePainter(
|
||||
zoom: _zoom,
|
||||
offset: _offset,
|
||||
swatch: swatch,
|
||||
@@ -163,44 +163,44 @@ class GestureDemoState extends State<GestureDemo> {
|
||||
)
|
||||
)
|
||||
),
|
||||
new Positioned(
|
||||
Positioned(
|
||||
bottom: 0.0,
|
||||
left: 0.0,
|
||||
child: new Card(
|
||||
child: new Container(
|
||||
child: Card(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: new Column(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
new Row(
|
||||
Row(
|
||||
children: <Widget>[
|
||||
new Checkbox(
|
||||
Checkbox(
|
||||
value: _scaleEnabled,
|
||||
onChanged: (bool value) { setState(() { _scaleEnabled = value; }); }
|
||||
),
|
||||
const Text('Scale'),
|
||||
]
|
||||
),
|
||||
new Row(
|
||||
Row(
|
||||
children: <Widget>[
|
||||
new Checkbox(
|
||||
Checkbox(
|
||||
value: _tapEnabled,
|
||||
onChanged: (bool value) { setState(() { _tapEnabled = value; }); }
|
||||
),
|
||||
const Text('Tap'),
|
||||
]
|
||||
),
|
||||
new Row(
|
||||
Row(
|
||||
children: <Widget>[
|
||||
new Checkbox(
|
||||
Checkbox(
|
||||
value: _doubleTapEnabled,
|
||||
onChanged: (bool value) { setState(() { _doubleTapEnabled = value; }); }
|
||||
),
|
||||
const Text('Double Tap'),
|
||||
]
|
||||
),
|
||||
new Row(
|
||||
Row(
|
||||
children: <Widget>[
|
||||
new Checkbox(
|
||||
Checkbox(
|
||||
value: _longPressEnabled,
|
||||
onChanged: (bool value) { setState(() { _longPressEnabled = value; }); }
|
||||
),
|
||||
@@ -219,11 +219,11 @@ class GestureDemoState extends State<GestureDemo> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
theme: new ThemeData.dark(),
|
||||
home: new Scaffold(
|
||||
appBar: new AppBar(title: const Text('Gestures Demo')),
|
||||
body: new GestureDemo()
|
||||
runApp(MaterialApp(
|
||||
theme: ThemeData.dark(),
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('Gestures Demo')),
|
||||
body: GestureDemo()
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
@@ -11,15 +11,15 @@ class AdaptedListItem extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Row(
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
Container(
|
||||
width: 32.0,
|
||||
height: 32.0,
|
||||
margin: const EdgeInsets.all(8.0),
|
||||
color: Colors.lightBlueAccent.shade100,
|
||||
),
|
||||
new Text(name)
|
||||
Text(name)
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -32,20 +32,20 @@ class AdaptedGridItem extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Card(
|
||||
child: new Column(
|
||||
return Card(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
new Expanded(
|
||||
child: new Container(
|
||||
Expanded(
|
||||
child: Container(
|
||||
color: Colors.lightBlueAccent.shade100,
|
||||
)
|
||||
),
|
||||
new Container(
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 8.0),
|
||||
child: new Row(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Expanded(
|
||||
child: new Text(name)
|
||||
Expanded(
|
||||
child: Text(name)
|
||||
),
|
||||
const IconButton(
|
||||
icon: Icon(Icons.more_vert),
|
||||
@@ -72,14 +72,14 @@ class AdaptiveContainer extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (MediaQuery.of(context).size.width < _kGridViewBreakpoint) {
|
||||
return new ListView(
|
||||
return ListView(
|
||||
itemExtent: _kListItemExtent,
|
||||
children: names.map((String name) => new AdaptedListItem(name: name)).toList(),
|
||||
children: names.map((String name) => AdaptedListItem(name: name)).toList(),
|
||||
);
|
||||
} else {
|
||||
return new GridView.extent(
|
||||
return GridView.extent(
|
||||
maxCrossAxisExtent: _kMaxTileWidth,
|
||||
children: names.map((String name) => new AdaptedGridItem(name: name)).toList(),
|
||||
children: names.map((String name) => AdaptedGridItem(name: name)).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -95,13 +95,13 @@ List<String> _initNames() {
|
||||
final List<String> _kNames = _initNames();
|
||||
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
runApp(MaterialApp(
|
||||
title: 'Media Query Example',
|
||||
home: new Scaffold(
|
||||
appBar: new AppBar(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Media Query Example')
|
||||
),
|
||||
body: new Material(child: new AdaptiveContainer(names: _kNames))
|
||||
body: Material(child: AdaptiveContainer(names: _kNames))
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
@@ -10,21 +10,21 @@ import 'package:flutter/rendering.dart';
|
||||
import '../rendering/src/sector_layout.dart';
|
||||
|
||||
RenderBox initCircle() {
|
||||
return new RenderBoxToRenderSectorAdapter(
|
||||
return RenderBoxToRenderSectorAdapter(
|
||||
innerRadius: 25.0,
|
||||
child: new RenderSectorRing(padding: 0.0)
|
||||
child: RenderSectorRing(padding: 0.0)
|
||||
);
|
||||
}
|
||||
|
||||
class SectorApp extends StatefulWidget {
|
||||
@override
|
||||
SectorAppState createState() => new SectorAppState();
|
||||
SectorAppState createState() => SectorAppState();
|
||||
}
|
||||
|
||||
class SectorAppState extends State<SectorApp> {
|
||||
|
||||
final RenderBoxToRenderSectorAdapter sectors = initCircle();
|
||||
final math.Random rand = new math.Random(1);
|
||||
final math.Random rand = math.Random(1);
|
||||
|
||||
List<double> wantedSectorSizes = <double>[];
|
||||
List<double> actualSectorSizes = <double>[];
|
||||
@@ -60,19 +60,19 @@ class SectorAppState extends State<SectorApp> {
|
||||
actualSectorSizes.removeLast();
|
||||
}
|
||||
while (index < wantedSectorSizes.length) {
|
||||
final Color color = new Color(((0xFF << 24) + rand.nextInt(0xFFFFFF)) | 0x808080);
|
||||
ring.add(new RenderSolidColor(color, desiredDeltaTheta: wantedSectorSizes[index]));
|
||||
final Color color = Color(((0xFF << 24) + rand.nextInt(0xFFFFFF)) | 0x808080);
|
||||
ring.add(RenderSolidColor(color, desiredDeltaTheta: wantedSectorSizes[index]));
|
||||
actualSectorSizes.add(wantedSectorSizes[index]);
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
static RenderBox initSector(Color color) {
|
||||
final RenderSectorRing ring = new RenderSectorRing(padding: 1.0);
|
||||
ring.add(new RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
|
||||
ring.add(new RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
|
||||
ring.add(new RenderSolidColor(color, desiredDeltaTheta: kTwoPi * 0.2));
|
||||
return new RenderBoxToRenderSectorAdapter(
|
||||
final RenderSectorRing ring = RenderSectorRing(padding: 1.0);
|
||||
ring.add(RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
|
||||
ring.add(RenderSolidColor(const Color(0xFF909090), desiredDeltaTheta: kTwoPi * 0.15));
|
||||
ring.add(RenderSolidColor(color, desiredDeltaTheta: kTwoPi * 0.2));
|
||||
return RenderBoxToRenderSectorAdapter(
|
||||
innerRadius: 5.0,
|
||||
child: ring
|
||||
);
|
||||
@@ -90,36 +90,36 @@ class SectorAppState extends State<SectorApp> {
|
||||
}
|
||||
|
||||
Widget buildBody() {
|
||||
return new Column(
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 25.0),
|
||||
child: new Row(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
RaisedButton(
|
||||
onPressed: _enabledAdd ? addSector : null,
|
||||
child: new IntrinsicWidth(
|
||||
child: new Row(
|
||||
child: IntrinsicWidth(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
Container(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
margin: const EdgeInsets.only(right: 10.0),
|
||||
child: new WidgetToRenderBoxAdapter(renderBox: sectorAddIcon)
|
||||
child: WidgetToRenderBoxAdapter(renderBox: sectorAddIcon)
|
||||
),
|
||||
const Text('ADD SECTOR'),
|
||||
]
|
||||
)
|
||||
)
|
||||
),
|
||||
new RaisedButton(
|
||||
RaisedButton(
|
||||
onPressed: _enabledRemove ? removeSector : null,
|
||||
child: new IntrinsicWidth(
|
||||
child: new Row(
|
||||
child: IntrinsicWidth(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
Container(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
margin: const EdgeInsets.only(right: 10.0),
|
||||
child: new WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon)
|
||||
child: WidgetToRenderBoxAdapter(renderBox: sectorRemoveIcon)
|
||||
),
|
||||
const Text('REMOVE SECTOR'),
|
||||
]
|
||||
@@ -130,14 +130,14 @@ class SectorAppState extends State<SectorApp> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround
|
||||
)
|
||||
),
|
||||
new Expanded(
|
||||
child: new Container(
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(8.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border.all()
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all()
|
||||
),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: new WidgetToRenderBoxAdapter(
|
||||
child: WidgetToRenderBoxAdapter(
|
||||
renderBox: sectors,
|
||||
onBuild: doUpdates
|
||||
)
|
||||
@@ -150,11 +150,11 @@ class SectorAppState extends State<SectorApp> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new MaterialApp(
|
||||
theme: new ThemeData.light(),
|
||||
return MaterialApp(
|
||||
theme: ThemeData.light(),
|
||||
title: 'Sector Layout',
|
||||
home: new Scaffold(
|
||||
appBar: new AppBar(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Sector Layout in a Widget Tree')
|
||||
),
|
||||
body: buildBody()
|
||||
@@ -164,5 +164,5 @@ class SectorAppState extends State<SectorApp> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(new SectorApp());
|
||||
runApp(SectorApp());
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import '../rendering/src/solid_color_box.dart';
|
||||
|
||||
// Solid colour, RenderObject version
|
||||
void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int flex = 0 }) {
|
||||
final RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor);
|
||||
final RenderSolidColorBox child = RenderSolidColorBox(backgroundColor);
|
||||
parent.add(child);
|
||||
final FlexParentData childParentData = child.parentData;
|
||||
childParentData.flex = flex;
|
||||
@@ -23,8 +23,8 @@ class Rectangle extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Expanded(
|
||||
child: new Container(
|
||||
return Expanded(
|
||||
child: Container(
|
||||
color: color,
|
||||
)
|
||||
);
|
||||
@@ -33,27 +33,27 @@ class Rectangle extends StatelessWidget {
|
||||
|
||||
double value;
|
||||
RenderObjectToWidgetElement<RenderBox> element;
|
||||
BuildOwner owner = new BuildOwner();
|
||||
BuildOwner owner = BuildOwner();
|
||||
void attachWidgetTreeToRenderTree(RenderProxyBox container) {
|
||||
element = new RenderObjectToWidgetAdapter<RenderBox>(
|
||||
element = RenderObjectToWidgetAdapter<RenderBox>(
|
||||
container: container,
|
||||
child: new Directionality(
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: new Container(
|
||||
child: Container(
|
||||
height: 300.0,
|
||||
child: new Column(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
const Rectangle(Color(0xFF00FFFF)),
|
||||
new Material(
|
||||
child: new Container(
|
||||
Material(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
child: new Row(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new RaisedButton(
|
||||
child: new Row(
|
||||
RaisedButton(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Image.network('https://flutter.io/images/favicon.png'),
|
||||
Image.network('https://flutter.io/images/favicon.png'),
|
||||
const Text('PRESS ME'),
|
||||
],
|
||||
),
|
||||
@@ -62,7 +62,7 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
|
||||
attachWidgetTreeToRenderTree(container);
|
||||
},
|
||||
),
|
||||
new CircularProgressIndicator(value: value),
|
||||
CircularProgressIndicator(value: value),
|
||||
],
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
),
|
||||
@@ -92,16 +92,16 @@ void rotate(Duration timeStamp) {
|
||||
|
||||
void main() {
|
||||
final WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized();
|
||||
final RenderProxyBox proxy = new RenderProxyBox();
|
||||
final RenderProxyBox proxy = RenderProxyBox();
|
||||
attachWidgetTreeToRenderTree(proxy);
|
||||
|
||||
final RenderFlex flexRoot = new RenderFlex(direction: Axis.vertical);
|
||||
final RenderFlex flexRoot = RenderFlex(direction: Axis.vertical);
|
||||
addFlexChildSolidColor(flexRoot, const Color(0xFFFF00FF), flex: 1);
|
||||
flexRoot.add(proxy);
|
||||
addFlexChildSolidColor(flexRoot, const Color(0xFF0000FF), flex: 1);
|
||||
|
||||
transformBox = new RenderTransform(child: flexRoot, transform: new Matrix4.identity(), alignment: Alignment.center);
|
||||
final RenderPadding root = new RenderPadding(padding: const EdgeInsets.all(80.0), child: transformBox);
|
||||
transformBox = RenderTransform(child: flexRoot, transform: Matrix4.identity(), alignment: Alignment.center);
|
||||
final RenderPadding root = RenderPadding(padding: const EdgeInsets.all(80.0), child: transformBox);
|
||||
|
||||
binding.renderView.child = root;
|
||||
binding.addPersistentFrameCallback(rotate);
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter/widgets.dart';
|
||||
|
||||
class SpinningSquare extends StatefulWidget {
|
||||
@override
|
||||
_SpinningSquareState createState() => new _SpinningSquareState();
|
||||
_SpinningSquareState createState() => _SpinningSquareState();
|
||||
}
|
||||
|
||||
class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProviderStateMixin {
|
||||
@@ -18,7 +18,7 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid
|
||||
// We use 3600 milliseconds instead of 1800 milliseconds because 0.0 -> 1.0
|
||||
// represents an entire turn of the square whereas in the other examples
|
||||
// we used 0.0 -> math.pi, which is only half a turn.
|
||||
_animation = new AnimationController(
|
||||
_animation = AnimationController(
|
||||
duration: const Duration(milliseconds: 3600),
|
||||
vsync: this,
|
||||
)..repeat();
|
||||
@@ -32,9 +32,9 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new RotationTransition(
|
||||
return RotationTransition(
|
||||
turns: _animation,
|
||||
child: new Container(
|
||||
child: Container(
|
||||
width: 200.0,
|
||||
height: 200.0,
|
||||
color: const Color(0xFF00FF00),
|
||||
@@ -44,5 +44,5 @@ class _SpinningSquareState extends State<SpinningSquare> with SingleTickerProvid
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(new Center(child: new SpinningSquare()));
|
||||
runApp(Center(child: SpinningSquare()));
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ final List<List<String>> _kNameLines = _kDialogText
|
||||
.map((String line) => line.split(':'))
|
||||
.toList();
|
||||
|
||||
final TextStyle _kDaveStyle = new TextStyle(color: Colors.indigo.shade400, height: 1.8);
|
||||
final TextStyle _kHalStyle = new TextStyle(color: Colors.red.shade400, fontFamily: 'monospace');
|
||||
final TextStyle _kDaveStyle = TextStyle(color: Colors.indigo.shade400, height: 1.8);
|
||||
final TextStyle _kHalStyle = TextStyle(color: Colors.red.shade400, fontFamily: 'monospace');
|
||||
const TextStyle _kBold = TextStyle(fontWeight: FontWeight.bold);
|
||||
const TextStyle _kUnderline = TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
@@ -34,33 +34,33 @@ const TextStyle _kUnderline = TextStyle(
|
||||
|
||||
Widget toStyledText(String name, String text) {
|
||||
final TextStyle lineStyle = (name == 'Dave') ? _kDaveStyle : _kHalStyle;
|
||||
return new RichText(
|
||||
key: new Key(text),
|
||||
text: new TextSpan(
|
||||
return RichText(
|
||||
key: Key(text),
|
||||
text: TextSpan(
|
||||
style: lineStyle,
|
||||
children: <TextSpan>[
|
||||
new TextSpan(
|
||||
TextSpan(
|
||||
style: _kBold,
|
||||
children: <TextSpan>[
|
||||
new TextSpan(
|
||||
TextSpan(
|
||||
style: _kUnderline,
|
||||
text: name
|
||||
),
|
||||
const TextSpan(text: ':')
|
||||
]
|
||||
),
|
||||
new TextSpan(text: text)
|
||||
TextSpan(text: text)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Widget toPlainText(String name, String text) => new Text(name + ':' + text);
|
||||
Widget toPlainText(String name, String text) => Text(name + ':' + text);
|
||||
|
||||
class SpeakerSeparator extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
return Container(
|
||||
constraints: const BoxConstraints.expand(height: 0.0),
|
||||
margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 64.0),
|
||||
decoration: const BoxDecoration(
|
||||
@@ -74,7 +74,7 @@ class SpeakerSeparator extends StatelessWidget {
|
||||
|
||||
class StyledTextDemo extends StatefulWidget {
|
||||
@override
|
||||
_StyledTextDemoState createState() => new _StyledTextDemoState();
|
||||
_StyledTextDemoState createState() => _StyledTextDemoState();
|
||||
}
|
||||
|
||||
class _StyledTextDemoState extends State<StyledTextDemo> {
|
||||
@@ -102,14 +102,14 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
|
||||
for (Widget line in lines) {
|
||||
children.add(line);
|
||||
if (line != lines.last)
|
||||
children.add(new SpeakerSeparator());
|
||||
children.add(SpeakerSeparator());
|
||||
}
|
||||
|
||||
return new GestureDetector(
|
||||
return GestureDetector(
|
||||
onTap: _handleTap,
|
||||
child: new Container(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: new Column(
|
||||
child: Column(
|
||||
children: children,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start
|
||||
@@ -120,15 +120,15 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
theme: new ThemeData.light(),
|
||||
home: new Scaffold(
|
||||
appBar: new AppBar(
|
||||
runApp(MaterialApp(
|
||||
theme: ThemeData.light(),
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Hal and Dave')
|
||||
),
|
||||
body: new Material(
|
||||
body: Material(
|
||||
color: Colors.grey.shade50,
|
||||
child: new StyledTextDemo()
|
||||
child: StyledTextDemo()
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user