Skip to content

Commit 8257584

Browse files
committed
fix: don't show thin white pixel artifact around status dialog, and clamp size
1 parent f632f0e commit 8257584

File tree

1 file changed

+61
-52
lines changed

1 file changed

+61
-52
lines changed

mobile/lib/common/task_status_dialog.dart

+61-52
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:async';
2+
import 'dart:math';
23

34
import 'package:flutter/material.dart';
45
import 'package:get_10101/common/color.dart';
@@ -89,72 +90,80 @@ class _TaskStatusDialog extends State<TaskStatusDialog> {
8990
});
9091
}
9192

92-
Widget closeButton = SizedBox(
93-
width: MediaQuery.of(context).size.width * 0.65,
94-
child: ElevatedButton(
95-
onPressed: () {
96-
var goRouter = GoRouter.of(context);
97-
if (goRouter.canPop()) {
98-
goRouter.pop();
99-
}
100-
101-
if (widget.onClose != null) {
102-
widget.onClose!();
103-
}
104-
},
105-
style: ElevatedButton.styleFrom(
106-
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
107-
padding: EdgeInsets.zero,
108-
backgroundColor: tenTenOnePurple),
109-
child: const Text("Close")),
110-
);
93+
double width = min((MediaQuery.of(context).size.width), 350);
94+
95+
Widget closeButton = ElevatedButton(
96+
onPressed: () {
97+
var goRouter = GoRouter.of(context);
98+
if (goRouter.canPop()) {
99+
goRouter.pop();
100+
}
101+
102+
if (widget.onClose != null) {
103+
widget.onClose!();
104+
}
105+
},
106+
style: ElevatedButton.styleFrom(
107+
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
108+
padding: EdgeInsets.zero,
109+
backgroundColor: tenTenOnePurple),
110+
child: const Text("Close"));
111111

112112
AlertDialog dialog = AlertDialog(
113113
contentPadding: EdgeInsets.zero,
114+
clipBehavior: Clip.antiAlias,
115+
backgroundColor: Colors.transparent,
114116
shape: RoundedRectangleBorder(
115117
borderRadius: BorderRadius.circular(18.0),
116118
),
117-
content: Container(
118-
decoration: BoxDecoration(
119-
color: Colors.white,
120-
borderRadius: BorderRadius.circular(18.0),
121-
),
122-
clipBehavior: Clip.antiAlias,
123-
width: MediaQuery.of(context).size.shortestSide,
119+
content: SizedBox(
120+
width: width,
124121
child: Column(
125122
mainAxisSize: MainAxisSize.min,
123+
mainAxisAlignment: MainAxisAlignment.start,
126124
children: [
127-
Container(
125+
SizedBox(
128126
width: double.infinity,
129127
height: 110,
130-
clipBehavior: Clip.antiAlias,
131-
decoration: const BoxDecoration(
132-
color: Colors.white,
133-
),
134128
child: coverImage,
135129
),
136-
const SizedBox(height: 15),
137-
if (widget.showSuccessTitle) buildTitle(widget.task.status),
138-
Padding(
139-
padding: EdgeInsets.only(
140-
top: 10.0, left: 15.0, right: 15.0, bottom: isPending ? 25.0 : 0.0),
141-
child: widget.content),
142-
if (widget.task.status == TaskStatus.failed && widget.task.error != null)
143-
Padding(
144-
padding: const EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
145-
child: ErrorDetails(details: widget.task.error!),
130+
Container(
131+
decoration: const BoxDecoration(color: Colors.white),
132+
child: Column(
133+
mainAxisSize: MainAxisSize.min,
134+
crossAxisAlignment: CrossAxisAlignment.stretch,
135+
children: [
136+
const SizedBox(height: 15),
137+
if (widget.showSuccessTitle) buildTitle(widget.task.status),
138+
Padding(
139+
padding: EdgeInsets.only(
140+
top: 10.0, left: 15.0, right: 15.0, bottom: isPending ? 25.0 : 0.0),
141+
child: widget.content),
142+
if (widget.task.status == TaskStatus.failed && widget.task.error != null)
143+
Padding(
144+
padding: const EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
145+
child: ErrorDetails(details: widget.task.error!),
146+
),
147+
if (!isPending || timeout)
148+
ConstrainedBox(
149+
constraints: BoxConstraints(
150+
maxWidth: width * 0.65,
151+
),
152+
child: Padding(
153+
padding:
154+
const EdgeInsets.only(top: 20.0, left: 15.0, right: 15.0, bottom: 15.0),
155+
child: Row(
156+
crossAxisAlignment: CrossAxisAlignment.end,
157+
mainAxisAlignment: MainAxisAlignment.center,
158+
children: [
159+
Expanded(child: closeButton),
160+
],
161+
),
162+
),
163+
)
164+
],
146165
),
147-
if (!isPending || timeout)
148-
Padding(
149-
padding: const EdgeInsets.only(top: 20.0, left: 15.0, right: 15.0, bottom: 15.0),
150-
child: Row(
151-
crossAxisAlignment: CrossAxisAlignment.end,
152-
mainAxisAlignment: MainAxisAlignment.center,
153-
children: [
154-
closeButton,
155-
],
156-
),
157-
)
166+
)
158167
],
159168
),
160169
),

0 commit comments

Comments
 (0)