Fixed buttons leaving this world without SafeArea

This commit is contained in:
Andrew 2023-03-04 04:11:21 +07:00
parent 9eb1c8e59a
commit 740dcba160

View file

@ -835,95 +835,99 @@ class _GamePageState extends State<GamePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final size = MediaQuery.of(context).size; final size = MediaQuery.of(context).size;
return Scaffold( return SafeArea(
body: SizedBox( child: Scaffold(
width: size.width, body: SizedBox(
height: size.height, width: size.width,
child: Stack( height: size.height,
children: [ child: Stack(
InteractiveViewer( children: [
constrained: false, InteractiveViewer(
boundaryMargin: const EdgeInsets.all(800), constrained: false,
maxScale: 0.8, boundaryMargin: const EdgeInsets.all(800),
minScale: 0.4, maxScale: 0.8,
child: isGuesser ? _generateGameField() : _generateStaticField(), minScale: 0.4,
), child:
Positioned( isGuesser ? _generateGameField() : _generateStaticField(),
bottom: 0,
right: 0,
child: InkResponse(
onTap: _openChat,
child: Container(
width: 50,
height: 50,
decoration: const BoxDecoration(
color: Colors.amberAccent,
borderRadius:
BorderRadius.only(topLeft: Radius.circular(25)),
),
child: const Icon(
Icons.message,
color: Colors.black,
),
),
), ),
),
Positioned(
top: 0,
right: 0,
child: InkResponse(
onTap: _leaveGame,
child: Container(
width: 50,
height: 50,
decoration: const BoxDecoration(
color: Colors.redAccent,
borderRadius:
BorderRadius.only(bottomLeft: Radius.circular(25)),
),
child: const Icon(
Icons.close,
color: Colors.black,
),
),
),
),
if (!isGuesser)
Positioned( Positioned(
bottom: 0, bottom: 0,
left: 0, right: 0,
child: InkResponse( child: InkResponse(
onTap: _openColorsCard, onTap: _openChat,
child: Container( child: Container(
width: 50, width: 50,
height: 50, height: 50,
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Colors.greenAccent, color: Colors.amberAccent,
borderRadius: borderRadius:
BorderRadius.only(topRight: Radius.circular(25)), BorderRadius.only(topLeft: Radius.circular(25)),
), ),
child: const Icon( child: const Icon(
Icons.content_copy_rounded, Icons.message,
color: Colors.black, color: Colors.black,
), ),
), ),
), ),
), ),
Positioned( Positioned(
top: 0, top: 0,
left: 0, right: 0,
child: Container( child: InkResponse(
height: 50, onTap: _leaveGame,
width: 50, child: Container(
decoration: const BoxDecoration( width: 50,
color: Colors.black, height: 50,
borderRadius: decoration: const BoxDecoration(
BorderRadius.only(bottomRight: Radius.circular(25)), color: Colors.redAccent,
borderRadius:
BorderRadius.only(bottomLeft: Radius.circular(25)),
),
child: const Icon(
Icons.close,
color: Colors.black,
),
),
), ),
child: Obx(() => Text("${10 - guessedColors.length}/10")),
), ),
), if (!isGuesser)
], Positioned(
bottom: 0,
left: 0,
child: InkResponse(
onTap: _openColorsCard,
child: Container(
width: 50,
height: 50,
decoration: const BoxDecoration(
color: Colors.greenAccent,
borderRadius:
BorderRadius.only(topRight: Radius.circular(25)),
),
child: const Icon(
Icons.content_copy_rounded,
color: Colors.black,
),
),
),
),
Positioned(
top: 0,
left: 0,
child: Container(
height: 50,
width: 50,
alignment: Alignment.center,
decoration: const BoxDecoration(
color: Colors.black,
borderRadius:
BorderRadius.only(bottomRight: Radius.circular(25)),
),
child: Obx(() => Text("${10 - guessedColors.length}/10")),
),
),
],
),
), ),
), ),
); );