Commit f4e7b4e1 by Anuj Committed by GitHub

Fixed center problem of buttons. (#459)

* Fixed center problem of buttons of the issue #458

* Fixed center problem of buttons of the issue #458 for toast_context page
parent c91a2268
...@@ -26,6 +26,6 @@ subprojects { ...@@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }
...@@ -25,29 +25,31 @@ class _MyAppState extends State<MyApp> { ...@@ -25,29 +25,31 @@ class _MyAppState extends State<MyApp> {
appBar: AppBar( appBar: AppBar(
title: Text("Toast"), title: Text("Toast"),
), ),
body: Column( body: Center(
mainAxisAlignment: MainAxisAlignment.center, child: Column(
children: [ mainAxisAlignment: MainAxisAlignment.center,
ElevatedButton( children: [
onPressed: () { ElevatedButton(
Navigator.of(context).push(MaterialPageRoute( onPressed: () {
builder: (context) => ToastNoContext(), Navigator.of(context).push(MaterialPageRoute(
)); builder: (context) => ToastNoContext(),
}, ));
child: Text("Flutter Toast No Context"), },
), child: Text("Flutter Toast No Context"),
SizedBox( ),
height: 24.0, SizedBox(
), height: 24.0,
ElevatedButton( ),
onPressed: () { ElevatedButton(
Navigator.of(context).push(MaterialPageRoute( onPressed: () {
builder: (context) => ToastContext(), Navigator.of(context).push(MaterialPageRoute(
)); builder: (context) => ToastContext(),
}, ));
child: Text("Flutter Toast Context"), },
), child: Text("Flutter Toast Context"),
], ),
],
),
), ),
); );
} }
......
...@@ -139,60 +139,62 @@ class _ToastContextState extends State<ToastContext> { ...@@ -139,60 +139,62 @@ class _ToastContextState extends State<ToastContext> {
appBar: AppBar( appBar: AppBar(
title: Text("Custom Toasts"), title: Text("Custom Toasts"),
), ),
body: Column( body: Center(
children: [ child: Column(
SizedBox( children: [
height: 24.0, SizedBox(
), height: 24.0,
ElevatedButton( ),
child: Text("Show Custom Toast"), ElevatedButton(
onPressed: () { child: Text("Show Custom Toast"),
_showToast(); onPressed: () {
}, _showToast();
), },
ElevatedButton( ),
child: Text("Show Custom Toast via PositionedToastBuilder"), ElevatedButton(
onPressed: () { child: Text("Show Custom Toast via PositionedToastBuilder"),
_showBuilderToast(); onPressed: () {
}, _showBuilderToast();
), },
SizedBox( ),
height: 24.0, SizedBox(
), height: 24.0,
ElevatedButton( ),
child: Text("Custom Toast With Close Button"), ElevatedButton(
onPressed: () { child: Text("Custom Toast With Close Button"),
_showToastCancel(); onPressed: () {
}, _showToastCancel();
), },
SizedBox( ),
height: 24.0, SizedBox(
), height: 24.0,
ElevatedButton( ),
child: Text("Queue Toasts"), ElevatedButton(
onPressed: () { child: Text("Queue Toasts"),
_queueToasts(); onPressed: () {
}, _queueToasts();
), },
SizedBox( ),
height: 24.0, SizedBox(
), height: 24.0,
ElevatedButton( ),
child: Text("Cancel Toast"), ElevatedButton(
onPressed: () { child: Text("Cancel Toast"),
_removeToast(); onPressed: () {
}, _removeToast();
), },
SizedBox( ),
height: 24.0, SizedBox(
), height: 24.0,
ElevatedButton( ),
child: Text("Remove Queued Toasts"), ElevatedButton(
onPressed: () { child: Text("Remove Queued Toasts"),
_removeAllQueuedToasts(); onPressed: () {
}, _removeAllQueuedToasts();
), },
], ),
],
),
), ),
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment