1
0
mirror of https://github.com/nisrulz/flutter-examples.git synced 2025-11-09 21:19:55 +00:00

🚧 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

@@ -16,22 +16,22 @@ class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text("Sign In")),
body: new Container(
return Scaffold(
appBar: AppBar(title: Text("Sign In")),
body: Container(
padding: const EdgeInsets.all(20.0),
child: new Center(
child: new Column(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
showLoading
? new CircularProgressIndicator()
: new RaisedButton(
? CircularProgressIndicator()
: RaisedButton(
onPressed: this.onSignin,
child: new Text("Sign In"),
child: Text("Sign In"),
color: Colors.lightBlueAccent,
),
//new RaisedButton(onPressed: this.onLogout, child: new Text("Logout"), color: Colors.amberAccent),
//RaisedButton(onPressed: this.onLogout, child: Text("Logout"), color: Colors.amberAccent),
],
),
)),

View File

@@ -8,11 +8,11 @@ import 'home.dart';
import 'user.dart';
void main() {
runApp(new App());
runApp(App());
}
class App extends StatefulWidget {
AppState createState() => new AppState();
AppState createState() => AppState();
}
class AppState extends State<App> {
@@ -24,7 +24,7 @@ class AppState extends State<App> {
@override
void initState() {
super.initState();
userPage = new Home(
userPage = Home(
onSignin: () {
_signin();
print("Sign");
@@ -36,11 +36,11 @@ class AppState extends State<App> {
Future<FirebaseUser> _signin() async {
setState(() {
userPage = new Home(onSignin: null, onLogout: _logout, showLoading: true);
userPage = Home(onSignin: null, onLogout: _logout, showLoading: true);
});
FirebaseAuth _auth = FirebaseAuth.instance;
try {
googleSignIn = new GoogleSignIn();
googleSignIn = GoogleSignIn();
GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn();
GoogleSignInAuthentication gauth =
await googleSignInAccount.authentication;
@@ -51,7 +51,7 @@ class AppState extends State<App> {
setState(() {
_username = user.displayName;
userPage = new User(
userPage = User(
onLogout: _logout,
user: user,
);
@@ -67,7 +67,7 @@ class AppState extends State<App> {
void _logout() async {
await googleSignIn.signOut();
setState(() {
userPage = new Home(
userPage = Home(
onSignin: () {
_signin();
print("Sign");
@@ -82,7 +82,7 @@ class AppState extends State<App> {
@override
Widget build(BuildContext context) {
return new MaterialApp(
return MaterialApp(
home: userPage,
);
}

View File

@@ -13,22 +13,22 @@ class User extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text("Welcome"),
return Scaffold(
appBar: AppBar(
title: Text("Welcome"),
actions: <Widget>[
new IconButton(
icon: new Icon(Icons.exit_to_app), onPressed: this.onLogout)
IconButton(
icon: Icon(Icons.exit_to_app), onPressed: this.onLogout)
],
),
body: new Container(
body: Container(
padding: const EdgeInsets.all(20.0),
child: new Center(
child: new Column(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Image.network(user.photoUrl),
new Text(
Image.network(user.photoUrl),
Text(
user.displayName,
textScaleFactor: 1.5,
),