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
- Improve topbar buttons
......
......@@ -12,36 +12,49 @@ class PageParameters extends StatelessWidget {
final ApplicationConfigDefinition appConfig;
final bool canBeResumed;
final double separatorHeight = 8.0;
final double separatorHeight = 4.0;
@override
Widget build(BuildContext context) {
final List<Widget> lines = [];
// Activity settings (top)
final List<Widget> blockTop = [];
for (ApplicationSettingsParameter parameter in appConfig.activitySettings) {
if (parameter.displayedOnTop) {
for (var itemsLine in buildParametersLines(
for (List<Widget> itemsLine in buildParametersLines(
parameter: parameter,
isEnabled: !canBeResumed,
)) {
lines.add(Row(
blockTop.add(Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: itemsLine,
));
}
lines.add(SizedBox(height: separatorHeight));
blockTop.add(SizedBox(height: separatorHeight));
}
}
lines.add(Expanded(
child: SizedBox(height: separatorHeight),
));
// Activity settings (bottom)
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) {
// Resume activity
lines.add(AspectRatio(
blockActions.add(AspectRatio(
aspectRatio: 3,
child: ActivityButtonResumeSaved(
onPressed: () {
......@@ -50,7 +63,7 @@ class PageParameters extends StatelessWidget {
),
));
// Delete saved activity
lines.add(SizedBox.square(
blockActions.add(SizedBox.square(
dimension: MediaQuery.of(context).size.width / 5,
child: ActivityButtonDeleteSaved(
onPressed: () {
......@@ -60,7 +73,7 @@ class PageParameters extends StatelessWidget {
));
} else {
// Start new activity
lines.add(
blockActions.add(
AspectRatio(
aspectRatio: 3,
child: ActivityButtonStartNew(
......@@ -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)
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,
));
}
blocks.addAll(blockActions);
lines.add(SizedBox(height: separatorHeight));
}
if (blockBottom.isNotEmpty) {
blocks.addAll(blockBottom);
}
return Column(
children: lines,
);
return Column(children: blocks);
}
List<List<Widget>> buildParametersLines({
......
......@@ -3,7 +3,7 @@ description: "Flutter custom toolbox for org.benoitharrault.* projects."
publish_to: "none"
version: 0.8.3
version: 0.8.4
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