Skip to content

Commit

Permalink
Fixed center problem of buttons. (#459)
Browse files Browse the repository at this point in the history
* Fixed center problem of buttons of the issue #458

* Fixed center problem of buttons of the issue #458 for toast_context page
  • Loading branch information
AnujPandey007 committed Aug 31, 2023
1 parent c91a226 commit f4e7b4e
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 78 deletions.
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
48 changes: 25 additions & 23 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,31 @@ class _MyAppState extends State<MyApp> {
appBar: AppBar(
title: Text("Toast"),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ToastNoContext(),
));
},
child: Text("Flutter Toast No Context"),
),
SizedBox(
height: 24.0,
),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ToastContext(),
));
},
child: Text("Flutter Toast Context"),
),
],
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ToastNoContext(),
));
},
child: Text("Flutter Toast No Context"),
),
SizedBox(
height: 24.0,
),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ToastContext(),
));
},
child: Text("Flutter Toast Context"),
),
],
),
),
);
}
Expand Down
110 changes: 56 additions & 54 deletions example/lib/toast_context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,60 +139,62 @@ class _ToastContextState extends State<ToastContext> {
appBar: AppBar(
title: Text("Custom Toasts"),
),
body: Column(
children: [
SizedBox(
height: 24.0,
),
ElevatedButton(
child: Text("Show Custom Toast"),
onPressed: () {
_showToast();
},
),
ElevatedButton(
child: Text("Show Custom Toast via PositionedToastBuilder"),
onPressed: () {
_showBuilderToast();
},
),
SizedBox(
height: 24.0,
),
ElevatedButton(
child: Text("Custom Toast With Close Button"),
onPressed: () {
_showToastCancel();
},
),
SizedBox(
height: 24.0,
),
ElevatedButton(
child: Text("Queue Toasts"),
onPressed: () {
_queueToasts();
},
),
SizedBox(
height: 24.0,
),
ElevatedButton(
child: Text("Cancel Toast"),
onPressed: () {
_removeToast();
},
),
SizedBox(
height: 24.0,
),
ElevatedButton(
child: Text("Remove Queued Toasts"),
onPressed: () {
_removeAllQueuedToasts();
},
),
],
body: Center(
child: Column(
children: [
SizedBox(
height: 24.0,
),
ElevatedButton(
child: Text("Show Custom Toast"),
onPressed: () {
_showToast();
},
),
ElevatedButton(
child: Text("Show Custom Toast via PositionedToastBuilder"),
onPressed: () {
_showBuilderToast();
},
),
SizedBox(
height: 24.0,
),
ElevatedButton(
child: Text("Custom Toast With Close Button"),
onPressed: () {
_showToastCancel();
},
),
SizedBox(
height: 24.0,
),
ElevatedButton(
child: Text("Queue Toasts"),
onPressed: () {
_queueToasts();
},
),
SizedBox(
height: 24.0,
),
ElevatedButton(
child: Text("Cancel Toast"),
onPressed: () {
_removeToast();
},
),
SizedBox(
height: 24.0,
),
ElevatedButton(
child: Text("Remove Queued Toasts"),
onPressed: () {
_removeAllQueuedToasts();
},
),
],
),
),
);
}
Expand Down

0 comments on commit f4e7b4e

Please sign in to comment.