🚧 remove new keyword to get inline with dart 2 code standard.

This commit is contained in:
Nishant Srivastava
2019-07-23 03:42:56 +02:00
parent e8b433c00d
commit 6d56bfc5d4
45 changed files with 438 additions and 438 deletions

View File

@ -1,18 +1,18 @@
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(home: new ContactPage(), debugShowCheckedModeBanner: false,));
runApp(MaterialApp(home: ContactPage(), debugShowCheckedModeBanner: false,));
}
class ContactPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Using SnackBar"),
return Scaffold(
appBar: AppBar(
title: Text("Using SnackBar"),
),
body: new Center(
child: new MyButton(),
body: Center(
child: MyButton(),
),
);
}
@ -21,23 +21,23 @@ class ContactPage extends StatelessWidget {
class MyButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new RaisedButton(
child: new Text('Show SnackBar'),
return RaisedButton(
child: Text('Show SnackBar'),
// On pressing the raised button
onPressed: () {
// show snackbar
Scaffold.of(context).showSnackBar(new SnackBar(
Scaffold.of(context).showSnackBar(SnackBar(
// set content of snackbar
content: new Text("Hello! I am SnackBar :)"),
content: Text("Hello! I am SnackBar :)"),
// set duration
duration: new Duration(seconds: 3),
duration: Duration(seconds: 3),
// set the action
action: new SnackBarAction(
action: SnackBarAction(
label: "Hit Me (Action)",
onPressed: () {
// When action button is pressed, show another snackbar
Scaffold.of(context).showSnackBar(new SnackBar(
content: new Text(
Scaffold.of(context).showSnackBar(SnackBar(
content: Text(
"Hello! I am shown becoz you pressed Action :)"),
));
}),