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
@@ -8,15 +8,15 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
void main() {
|
||||
runApp(new PlatformView());
|
||||
runApp(PlatformView());
|
||||
}
|
||||
|
||||
class PlatformView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new MaterialApp(
|
||||
return MaterialApp(
|
||||
title: 'Platform View',
|
||||
theme: new ThemeData(
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.grey,
|
||||
),
|
||||
home: const MyHomePage(title: 'Platform View'),
|
||||
@@ -30,7 +30,7 @@ class MyHomePage extends StatefulWidget {
|
||||
final String title;
|
||||
|
||||
@override
|
||||
_MyHomePageState createState() => new _MyHomePageState();
|
||||
_MyHomePageState createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
@@ -54,25 +54,25 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => new Scaffold(
|
||||
appBar: new AppBar(
|
||||
title: new Text(widget.title),
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: new Column(
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Expanded(
|
||||
child: new Center(
|
||||
child: new Column(
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
Text(
|
||||
'Button tapped $_counter time${ _counter == 1 ? '' : 's' }.',
|
||||
style: const TextStyle(fontSize: 17.0),
|
||||
),
|
||||
new Padding(
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(18.0),
|
||||
child: new RaisedButton(
|
||||
child: RaisedButton(
|
||||
child: Platform.isIOS
|
||||
? const Text('Continue in iOS view')
|
||||
: const Text('Continue in Android view'),
|
||||
@@ -82,11 +82,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
new Container(
|
||||
Container(
|
||||
padding: const EdgeInsets.only(bottom: 15.0, left: 5.0),
|
||||
child: new Row(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Image.asset('assets/flutter-mark-square-64.png',
|
||||
Image.asset('assets/flutter-mark-square-64.png',
|
||||
scale: 1.5),
|
||||
const Text(
|
||||
'Flutter',
|
||||
@@ -97,7 +97,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
floatingActionButton: new FloatingActionButton(
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.add),
|
||||
|
||||
Reference in New Issue
Block a user