Skip to content
Snippets Groups Projects
Commit 24f8a397 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Fix display big vertical board

parent 060a001d
No related branches found
No related tags found
1 merge request!2Resolve "Fix display big vertical board"
Pipeline #7769 passed
Fix display big vertical grids.
Correction sur l'affichage des grandes grilles verticales.
import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
...@@ -124,18 +123,7 @@ class CellWidget extends StatelessWidget { ...@@ -124,18 +123,7 @@ class CellWidget extends StatelessWidget {
const Color cellBorderSelectedColor = Colors.red; const Color cellBorderSelectedColor = Colors.red;
Color cellBorderColor = cellBorderSelectedColor; Color cellBorderColor = cellBorderSelectedColor;
double cellBorderWidth = 4; final double cellBorderWidth = 4;
final int boardSizeReference =
max(activity.boardSizeHorizontal, activity.boardSizeVertical);
// Reduce cell border width on big boards
if (boardSizeReference > 8) {
cellBorderWidth = 2;
if (boardSizeReference > 10) {
cellBorderWidth = 1;
}
}
if (!activity.isRunning) { if (!activity.isRunning) {
cellBorderColor = Colors.green.shade700; cellBorderColor = Colors.green.shade700;
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
...@@ -17,7 +18,11 @@ class GameBoardWidget extends StatelessWidget { ...@@ -17,7 +18,11 @@ class GameBoardWidget extends StatelessWidget {
final Color borderColor = Theme.of(context).colorScheme.onSurface; final Color borderColor = Theme.of(context).colorScheme.onSurface;
return Container( final Size size = MediaQuery.of(context).size;
final double width = size.width;
final double height = size.height;
final Container board = Container(
margin: const EdgeInsets.all(2), margin: const EdgeInsets.all(2),
padding: const EdgeInsets.all(2), padding: const EdgeInsets.all(2),
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -81,6 +86,16 @@ class GameBoardWidget extends StatelessWidget { ...@@ -81,6 +86,16 @@ class GameBoardWidget extends StatelessWidget {
], ],
), ),
); );
return ConstrainedBox(
constraints: BoxConstraints.tightFor(
width: width,
height: height * .6,
),
child: FittedBox(
child: board,
), //Text
);
}, },
); );
} }
......
...@@ -3,7 +3,7 @@ description: A suguru game application. ...@@ -3,7 +3,7 @@ description: A suguru game application.
publish_to: "none" publish_to: "none"
version: 0.0.1+1 version: 0.0.2+2
environment: environment:
sdk: "^3.0.0" sdk: "^3.0.0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment