From ec36605cbace460856f49a080da5c293c8d71cac Mon Sep 17 00:00:00 2001 From: Hemish Pancholi <46677360+hemish11@users.noreply.github.com> Date: Wed, 2 Dec 2020 22:17:58 +0530 Subject: [PATCH 1/2] Optimized the example code Added const so that there is less to render on runtime and also formatted to code in a better way. --- example/lib/main.dart | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index a0c20bc..e3b1bb1 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -25,7 +25,7 @@ class Test extends StatelessWidget { Scaffold.of(context).showSnackBar(SnackBar( content: Text('$btn Button Pressed!'), backgroundColor: Colors.black26, - duration: Duration(milliseconds: 400), + duration: const Duration(milliseconds: 400), )); } @@ -45,36 +45,28 @@ class Test extends StatelessWidget { borderRadius: BorderRadius.all(Radius.circular(20)), ), ), - SizedBox( - height: 10, - ), + const SizedBox(height: 10), SignInButton( Buttons.Facebook, onPressed: () { _showButtonPressDialog(context, 'Facebook'); }, ), - SizedBox( - height: 10, - ), + const SizedBox(height: 10), SignInButton( Buttons.Apple, onPressed: () { _showButtonPressDialog(context, 'Apple'); }, ), - SizedBox( - height: 10, - ), + const SizedBox(height: 10), SignInButton( Buttons.Microsoft, onPressed: () { _showButtonPressDialog(context, 'Microsoft'); }, ), - SizedBox( - height: 10, - ), + const SizedBox(height: 10), SignInButton( Buttons.GitHub, text: "Sign up with GitHub", @@ -82,9 +74,7 @@ class Test extends StatelessWidget { _showButtonPressDialog(context, 'Github'); }, ), - SizedBox( - height: 10, - ), + const SizedBox(height: 10), SignInButton( Buttons.Twitter, text: "Sign In with Twitter", @@ -92,9 +82,7 @@ class Test extends StatelessWidget { _showButtonPressDialog(context, 'Twitter'); }, ), - SizedBox( - height: 10, - ), + const SizedBox(height: 10), ], ), ), From 675b21fdf290659e0582e2c04e3cb031ed7dcee4 Mon Sep 17 00:00:00 2001 From: Hemish Pancholi <46677360+hemish11@users.noreply.github.com> Date: Wed, 2 Dec 2020 22:20:41 +0530 Subject: [PATCH 2/2] Optimized the example code Optimized the example app by adding const so that there is less load on runtime rendering. --- example/lib/main.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index e3b1bb1..974c5cb 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -42,7 +42,7 @@ class Test extends StatelessWidget { _showButtonPressDialog(context, 'Google'); }, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), + borderRadius: BorderRadius.circular(20), ), ), const SizedBox(height: 10),