Skip to content

Commit

Permalink
fix: don't show thin white pixel artifact around status dialog, and c…
Browse files Browse the repository at this point in the history
…lamp size
  • Loading branch information
Restioson committed Jun 13, 2024
1 parent f632f0e commit 8257584
Showing 1 changed file with 61 additions and 52 deletions.
113 changes: 61 additions & 52 deletions mobile/lib/common/task_status_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:get_10101/common/color.dart';
Expand Down Expand Up @@ -89,72 +90,80 @@ class _TaskStatusDialog extends State<TaskStatusDialog> {
});
}

Widget closeButton = SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
child: ElevatedButton(
onPressed: () {
var goRouter = GoRouter.of(context);
if (goRouter.canPop()) {
goRouter.pop();
}

if (widget.onClose != null) {
widget.onClose!();
}
},
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
padding: EdgeInsets.zero,
backgroundColor: tenTenOnePurple),
child: const Text("Close")),
);
double width = min((MediaQuery.of(context).size.width), 350);

Widget closeButton = ElevatedButton(
onPressed: () {
var goRouter = GoRouter.of(context);
if (goRouter.canPop()) {
goRouter.pop();
}

if (widget.onClose != null) {
widget.onClose!();
}
},
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
padding: EdgeInsets.zero,
backgroundColor: tenTenOnePurple),
child: const Text("Close"));

AlertDialog dialog = AlertDialog(
contentPadding: EdgeInsets.zero,
clipBehavior: Clip.antiAlias,
backgroundColor: Colors.transparent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
),
content: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(18.0),
),
clipBehavior: Clip.antiAlias,
width: MediaQuery.of(context).size.shortestSide,
content: SizedBox(
width: width,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
SizedBox(
width: double.infinity,
height: 110,
clipBehavior: Clip.antiAlias,
decoration: const BoxDecoration(
color: Colors.white,
),
child: coverImage,
),
const SizedBox(height: 15),
if (widget.showSuccessTitle) buildTitle(widget.task.status),
Padding(
padding: EdgeInsets.only(
top: 10.0, left: 15.0, right: 15.0, bottom: isPending ? 25.0 : 0.0),
child: widget.content),
if (widget.task.status == TaskStatus.failed && widget.task.error != null)
Padding(
padding: const EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
child: ErrorDetails(details: widget.task.error!),
Container(
decoration: const BoxDecoration(color: Colors.white),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 15),
if (widget.showSuccessTitle) buildTitle(widget.task.status),
Padding(
padding: EdgeInsets.only(
top: 10.0, left: 15.0, right: 15.0, bottom: isPending ? 25.0 : 0.0),
child: widget.content),
if (widget.task.status == TaskStatus.failed && widget.task.error != null)
Padding(
padding: const EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0),
child: ErrorDetails(details: widget.task.error!),
),
if (!isPending || timeout)
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: width * 0.65,
),
child: Padding(
padding:
const EdgeInsets.only(top: 20.0, left: 15.0, right: 15.0, bottom: 15.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: closeButton),
],
),
),
)
],
),
if (!isPending || timeout)
Padding(
padding: const EdgeInsets.only(top: 20.0, left: 15.0, right: 15.0, bottom: 15.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.center,
children: [
closeButton,
],
),
)
)
],
),
),
Expand Down

0 comments on commit 8257584

Please sign in to comment.