Skip to content

Commit 2bc29c1

Browse files
committed
Fix Advanced Mode toggle sometimes overlapping scrollbar
1 parent 04cd9da commit 2bc29c1

2 files changed

Lines changed: 34 additions & 27 deletions

File tree

lib/project_view/configs/views/base.dart

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,26 @@ class BaseConfigView<T extends BaseConfigModel> extends StatelessWidget {
2828

2929
@override
3030
Widget build(BuildContext context) {
31-
return Center(
32-
child: config.modelOrProblem.match(
33-
(FileConfigFileLoadProblem e) {
34-
return const _OpenErrorDisplay(
35-
"Simple View currently not available for this config, due to errors.\n"
36-
"You can use Advanced Mode to fix them.",
37-
);
38-
},
39-
(T model) {
40-
return ConstrainedBox(
41-
constraints: const BoxConstraints(maxWidth: 1500),
42-
child: switch (model) {
43-
CoreConfigModel() => const CoreConfigView(),
44-
StartupConfigModel() => const StartupConfigView(),
45-
WebappConfigModel() => const WebappConfigView(),
46-
WebserverConfigModel() => const WebserverConfigView(),
47-
MapConfigModel() => const MapConfigView(),
48-
_ => const _OpenErrorDisplay(
49-
"Simple View currently not available for this config.\n"
50-
"Please use Advanced Mode for this config.",
51-
),
52-
},
53-
);
54-
},
55-
),
31+
return config.modelOrProblem.match(
32+
(FileConfigFileLoadProblem e) {
33+
return const _OpenErrorDisplay(
34+
"Simple View currently not available for this config, due to errors.\n"
35+
"You can use Advanced Mode to fix them.",
36+
);
37+
},
38+
(T model) {
39+
return switch (model) {
40+
CoreConfigModel() => const CoreConfigView(),
41+
StartupConfigModel() => const StartupConfigView(),
42+
WebappConfigModel() => const WebappConfigView(),
43+
WebserverConfigModel() => const WebserverConfigView(),
44+
MapConfigModel() => const MapConfigView(),
45+
_ => const _OpenErrorDisplay(
46+
"Simple View currently not available for this config.\n"
47+
"Please use Advanced Mode for this config.",
48+
),
49+
};
50+
},
5651
);
5752
}
5853
}

lib/project_view/project_view.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,21 @@ class ProjectView extends ConsumerWidget {
2727
: Stack(
2828
children: [
2929
advancedMode.when(
30-
data: (value) => value
30+
data: (enabled) => enabled
3131
? AdvancedEditor(openConfig)
32-
: BaseConfigView(openConfig),
32+
: LayoutBuilder(
33+
builder: (context, constraints) {
34+
final configView = BaseConfigView(openConfig);
35+
return Center(
36+
child: constraints.maxWidth < 1900
37+
? configView
38+
: ConstrainedBox(
39+
constraints: const .new(maxWidth: 1500),
40+
child: configView,
41+
),
42+
);
43+
},
44+
),
3345
loading: () => const Center(child: CircularProgressIndicator()),
3446
),
3547
const AdvancedModeToggle(),

0 commit comments

Comments
 (0)