Skip to content

Commit 176cd7e

Browse files
committed
Example improved
1 parent 13b8396 commit 176cd7e

File tree

1 file changed

+46
-33
lines changed

1 file changed

+46
-33
lines changed

example/lib/main.dart

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ class _MyAppState extends State<MyApp> {
8181
child: Column(
8282
mainAxisAlignment: MainAxisAlignment.start,
8383
children: [
84+
const SizedBox(height: 20),
8485
notificationListener(),
85-
permissions(),
8686
autoReply(),
87+
permissions(),
8788
],
8889
),
8990
),
@@ -101,24 +102,30 @@ class _MyAppState extends State<MyApp> {
101102
bool isPermissionGranted = await Reflex.isPermissionGranted;
102103
debugPrint("Notification Permission: $isPermissionGranted");
103104
},
105+
style: ElevatedButton.styleFrom(
106+
fixedSize: const Size(170, 8),
107+
),
104108
),
105109
ElevatedButton(
106110
child: const Text("Request Permission"),
107111
onPressed: () async {
108112
await Reflex.requestPermission();
109113
},
114+
style: ElevatedButton.styleFrom(
115+
fixedSize: const Size(170, 8),
116+
),
110117
),
111118
],
112119
);
113120
}
114121

115122
Widget notificationListener() {
116123
return SizedBox(
117-
height: 400,
124+
height: 265,
118125
child: Column(
119126
children: [
120127
SizedBox(
121-
height: 300,
128+
height: 200,
122129
child: ListView.builder(
123130
reverse: true,
124131
itemCount: _notificationLogs.length,
@@ -151,22 +158,25 @@ class _MyAppState extends State<MyApp> {
151158
},
152159
),
153160
if (_notificationLogs.isNotEmpty)
154-
ElevatedButton.icon(
155-
style: ElevatedButton.styleFrom(
156-
primary: Colors.red,
157-
),
158-
icon: const Icon(Icons.clear),
159-
label: const Text(
160-
"Clear List",
161-
style: TextStyle(
162-
color: Colors.white,
161+
Padding(
162+
padding: const EdgeInsets.only(top: 8.0),
163+
child: ElevatedButton.icon(
164+
style: ElevatedButton.styleFrom(
165+
primary: Colors.red,
166+
),
167+
icon: const Icon(Icons.clear),
168+
label: const Text(
169+
"Clear List",
170+
style: TextStyle(
171+
color: Colors.white,
172+
),
163173
),
174+
onPressed: () {
175+
setState(() {
176+
_notificationLogs.clear();
177+
});
178+
},
164179
),
165-
onPressed: () {
166-
setState(() {
167-
_notificationLogs.clear();
168-
});
169-
},
170180
),
171181
],
172182
),
@@ -177,11 +187,11 @@ class _MyAppState extends State<MyApp> {
177187

178188
Widget autoReply() {
179189
return SizedBox(
180-
height: 400,
190+
height: 265,
181191
child: Column(
182192
children: [
183193
SizedBox(
184-
height: 300,
194+
height: 200,
185195
child: ListView.builder(
186196
itemCount: _autoReplyLogs.length,
187197
itemBuilder: (BuildContext context, int index) {
@@ -197,22 +207,25 @@ class _MyAppState extends State<MyApp> {
197207
),
198208
),
199209
if (_autoReplyLogs.isNotEmpty)
200-
ElevatedButton.icon(
201-
style: ElevatedButton.styleFrom(
202-
primary: Colors.red,
203-
),
204-
icon: const Icon(Icons.clear),
205-
label: const Text(
206-
"Clear List",
207-
style: TextStyle(
208-
color: Colors.white,
210+
Padding(
211+
padding: const EdgeInsets.only(top: 8.0),
212+
child: ElevatedButton.icon(
213+
style: ElevatedButton.styleFrom(
214+
primary: Colors.red,
215+
),
216+
icon: const Icon(Icons.clear),
217+
label: const Text(
218+
"Clear List",
219+
style: TextStyle(
220+
color: Colors.white,
221+
),
209222
),
223+
onPressed: () {
224+
setState(() {
225+
_autoReplyLogs.clear();
226+
});
227+
},
210228
),
211-
onPressed: () {
212-
setState(() {
213-
_autoReplyLogs.clear();
214-
});
215-
},
216229
),
217230
],
218231
),

0 commit comments

Comments
 (0)