@@ -74,6 +74,7 @@ GoRouter _createRouter() {
74
74
final sampleParam = state.uri.queryParameters['sample' ];
75
75
final themeParam = state.uri.queryParameters['theme' ] ?? 'dark' ;
76
76
final channelParam = state.uri.queryParameters['channel' ];
77
+ final embedMode = state.uri.queryParameters['embed' ] == 'true' ;
77
78
78
79
final bool darkMode = themeParam == 'dark' ;
79
80
final colorScheme = ColorScheme .fromSwatch (
@@ -94,6 +95,7 @@ GoRouter _createRouter() {
94
95
child: DartPadMainPage (
95
96
title: appName,
96
97
initialChannel: channelParam,
98
+ embedMode: embedMode,
97
99
sampleId: sampleParam,
98
100
gistId: idParam,
99
101
),
@@ -109,10 +111,12 @@ class DartPadMainPage extends StatefulWidget {
109
111
final String ? initialChannel;
110
112
final String ? sampleId;
111
113
final String ? gistId;
114
+ final bool embedMode;
112
115
113
116
DartPadMainPage ({
114
117
required this .title,
115
118
required this .initialChannel,
119
+ required this .embedMode,
116
120
this .sampleId,
117
121
this .gistId,
118
122
}) : super (key: ValueKey ('sample:$sampleId gist:$gistId ' ));
@@ -122,8 +126,7 @@ class DartPadMainPage extends StatefulWidget {
122
126
}
123
127
124
128
class _DartPadMainPageState extends State <DartPadMainPage > {
125
- final SplitViewController mainSplitter =
126
- SplitViewController (weights: [0.50 , 0.50 ]);
129
+ late final SplitViewController mainSplitter;
127
130
128
131
late AppModel appModel;
129
132
late AppServices appServices;
@@ -132,6 +135,10 @@ class _DartPadMainPageState extends State<DartPadMainPage> {
132
135
void initState () {
133
136
super .initState ();
134
137
138
+ final leftPanelSize = widget.embedMode ? 0.62 : 0.50 ;
139
+ mainSplitter =
140
+ SplitViewController (weights: [leftPanelSize, 1.0 - leftPanelSize]);
141
+
135
142
final channel = widget.initialChannel != null
136
143
? Channel .channelForName (widget.initialChannel! )
137
144
: null ;
@@ -164,52 +171,54 @@ class _DartPadMainPageState extends State<DartPadMainPage> {
164
171
final theme = Theme .of (context);
165
172
166
173
final scaffold = Scaffold (
167
- appBar: AppBar (
168
- title: SizedBox (
169
- height: toolbarItemHeight,
170
- child: Row (
171
- children: [
172
- dartLogo (width: 32 ),
173
- const SizedBox (width: denseSpacing),
174
- const Text (appName),
175
- const SizedBox (width: defaultSpacing * 4 ),
176
- NewSnippetWidget (appServices: appServices),
177
- const SizedBox (width: denseSpacing),
178
- const ListSamplesWidget (),
179
- const SizedBox (width: defaultSpacing),
180
- // title widget
181
- Expanded (
182
- child: Center (
183
- child: ValueBuilder (
184
- appModel.title,
185
- (String value) => Text (value),
186
- ),
174
+ appBar: widget.embedMode
175
+ ? null
176
+ : AppBar (
177
+ title: SizedBox (
178
+ height: toolbarItemHeight,
179
+ child: Row (
180
+ children: [
181
+ dartLogo (width: 32 ),
182
+ const SizedBox (width: denseSpacing),
183
+ const Text (appName),
184
+ const SizedBox (width: defaultSpacing * 4 ),
185
+ NewSnippetWidget (appServices: appServices),
186
+ const SizedBox (width: denseSpacing),
187
+ const ListSamplesWidget (),
188
+ const SizedBox (width: defaultSpacing),
189
+ // title widget
190
+ Expanded (
191
+ child: Center (
192
+ child: ValueBuilder (
193
+ appModel.title,
194
+ (String value) => Text (value),
195
+ ),
196
+ ),
197
+ ),
198
+ const SizedBox (width: defaultSpacing),
199
+ ],
187
200
),
188
201
),
189
- const SizedBox (width: defaultSpacing),
190
- ],
191
- ),
192
- ),
193
- actions: [
194
- // install sdk
195
- TextButton (
196
- onPressed: () {
197
- url_launcher.launchUrl (
198
- Uri .parse ('https://docs.flutter.dev/get-started/install' ),
199
- );
200
- },
201
- child: const Row (
202
- children: [
203
- Text ('Install SDK' ),
204
- SizedBox (width: denseSpacing),
205
- Icon (Icons .launch, size: smallIconSize),
202
+ actions: [
203
+ // install sdk
204
+ TextButton (
205
+ onPressed: () {
206
+ url_launcher.launchUrl (
207
+ Uri .parse ('https://docs.flutter.dev/get-started/install' ),
208
+ );
209
+ },
210
+ child: const Row (
211
+ children: [
212
+ Text ('Install SDK' ),
213
+ SizedBox (width: denseSpacing),
214
+ Icon (Icons .launch, size: smallIconSize),
215
+ ],
216
+ ),
217
+ ),
218
+ const SizedBox (width: denseSpacing),
219
+ const OverflowMenu (),
206
220
],
207
221
),
208
- ),
209
- const SizedBox (width: denseSpacing),
210
- const OverflowMenu (),
211
- ],
212
- ),
213
222
body: Column (
214
223
children: [
215
224
Expanded (
@@ -350,7 +359,7 @@ class _DartPadMainPageState extends State<DartPadMainPage> {
350
359
),
351
360
),
352
361
),
353
- const StatusLineWidget (),
362
+ if ( ! widget.embedMode) const StatusLineWidget (),
354
363
],
355
364
),
356
365
);
0 commit comments