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

Scroll too long parameters page, improve layout

parent 63d38ebc
No related branches found
No related tags found
1 merge request!15Resolve "Scroll too long parameters page"
Pipeline #7406 passed
## 0.8.4
- Allow scroll too long parameters page, improve layout
## 0.8.3 ## 0.8.3
- Improve topbar buttons - Improve topbar buttons
......
...@@ -12,36 +12,49 @@ class PageParameters extends StatelessWidget { ...@@ -12,36 +12,49 @@ class PageParameters extends StatelessWidget {
final ApplicationConfigDefinition appConfig; final ApplicationConfigDefinition appConfig;
final bool canBeResumed; final bool canBeResumed;
final double separatorHeight = 8.0; final double separatorHeight = 4.0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<Widget> lines = [];
// Activity settings (top) // Activity settings (top)
final List<Widget> blockTop = [];
for (ApplicationSettingsParameter parameter in appConfig.activitySettings) { for (ApplicationSettingsParameter parameter in appConfig.activitySettings) {
if (parameter.displayedOnTop) { if (parameter.displayedOnTop) {
for (var itemsLine in buildParametersLines( for (List<Widget> itemsLine in buildParametersLines(
parameter: parameter, parameter: parameter,
isEnabled: !canBeResumed, isEnabled: !canBeResumed,
)) { )) {
lines.add(Row( blockTop.add(Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: itemsLine, children: itemsLine,
)); ));
} }
blockTop.add(SizedBox(height: separatorHeight));
lines.add(SizedBox(height: separatorHeight));
} }
} }
lines.add(Expanded( // Activity settings (bottom)
child: SizedBox(height: separatorHeight), final List<Widget> blockBottom = [];
for (ApplicationSettingsParameter parameter in appConfig.activitySettings) {
if (!parameter.displayedOnTop) {
for (List<Widget> itemsLine in buildParametersLines(
parameter: parameter,
isEnabled: !canBeResumed,
)) {
blockBottom.add(Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: itemsLine,
)); ));
}
blockBottom.add(SizedBox(height: separatorHeight));
}
}
// Actions buttons (middle block)
final List<Widget> blockActions = [];
if (canBeResumed) { if (canBeResumed) {
// Resume activity // Resume activity
lines.add(AspectRatio( blockActions.add(AspectRatio(
aspectRatio: 3, aspectRatio: 3,
child: ActivityButtonResumeSaved( child: ActivityButtonResumeSaved(
onPressed: () { onPressed: () {
...@@ -50,7 +63,7 @@ class PageParameters extends StatelessWidget { ...@@ -50,7 +63,7 @@ class PageParameters extends StatelessWidget {
), ),
)); ));
// Delete saved activity // Delete saved activity
lines.add(SizedBox.square( blockActions.add(SizedBox.square(
dimension: MediaQuery.of(context).size.width / 5, dimension: MediaQuery.of(context).size.width / 5,
child: ActivityButtonDeleteSaved( child: ActivityButtonDeleteSaved(
onPressed: () { onPressed: () {
...@@ -60,7 +73,7 @@ class PageParameters extends StatelessWidget { ...@@ -60,7 +73,7 @@ class PageParameters extends StatelessWidget {
)); ));
} else { } else {
// Start new activity // Start new activity
lines.add( blockActions.add(
AspectRatio( AspectRatio(
aspectRatio: 3, aspectRatio: 3,
child: ActivityButtonStartNew( child: ActivityButtonStartNew(
...@@ -71,29 +84,25 @@ class PageParameters extends StatelessWidget { ...@@ -71,29 +84,25 @@ class PageParameters extends StatelessWidget {
), ),
); );
} }
blockActions.add(SizedBox(height: separatorHeight));
lines.add(SizedBox(height: separatorHeight)); // Global blocks list
final List<Widget> blocks = [
Expanded(
child: ListView(
children: blockTop,
),
),
SizedBox(height: separatorHeight),
];
// Activity settings (bottom) blocks.addAll(blockActions);
for (ApplicationSettingsParameter parameter in appConfig.activitySettings) {
if (!parameter.displayedOnTop) {
for (var itemsLine in buildParametersLines(
parameter: parameter,
isEnabled: !canBeResumed,
)) {
lines.add(Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: itemsLine,
));
}
lines.add(SizedBox(height: separatorHeight)); if (blockBottom.isNotEmpty) {
} blocks.addAll(blockBottom);
} }
return Column( return Column(children: blocks);
children: lines,
);
} }
List<List<Widget>> buildParametersLines({ List<List<Widget>> buildParametersLines({
......
...@@ -3,7 +3,7 @@ description: "Flutter custom toolbox for org.benoitharrault.* projects." ...@@ -3,7 +3,7 @@ description: "Flutter custom toolbox for org.benoitharrault.* projects."
publish_to: "none" publish_to: "none"
version: 0.8.3 version: 0.8.4
homepage: https://git.harrault.fr/android/flutter-toolbox homepage: https://git.harrault.fr/android/flutter-toolbox
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment