@@ -113,91 +113,104 @@ class ChallengeView extends StatelessWidget {
113
113
),
114
114
);
115
115
116
- return Scaffold (
117
- appBar: ! model.hideAppBar
118
- ? AppBar (
119
- automaticallyImplyLeading: false ,
120
- title: challenge.files.length == 1
121
- ? const Text ('Editor' )
122
- : null ,
123
- actions: [
124
- if (model.showPreview)
125
- Expanded (
126
- child: Container (
127
- decoration: model.showPreview ? decoration : null ,
116
+ return WillPopScope (
117
+ onWillPop: () async {
118
+ model.updateProgressOnPop (context);
119
+
120
+ return Future .value (true );
121
+ },
122
+ child: Scaffold (
123
+ appBar: ! model.hideAppBar
124
+ ? AppBar (
125
+ leading: IconButton (
126
+ icon: const Icon (Icons .arrow_back_ios),
127
+ onPressed: () async {
128
+ model.updateProgressOnPop (context);
129
+ },
130
+ ),
131
+ title: challenge.files.length == 1
132
+ ? const Text ('Editor' )
133
+ : null ,
134
+ actions: [
135
+ if (model.showPreview)
136
+ Expanded (
128
137
child: Container (
129
138
decoration:
130
- model.showConsole ? decoration : null ,
131
- child: ElevatedButton (
132
- onPressed: () {},
133
- child: const Text ('Preview' ),
139
+ model.showPreview ? decoration : null ,
140
+ child: Container (
141
+ decoration:
142
+ model.showConsole ? decoration : null ,
143
+ child: ElevatedButton (
144
+ onPressed: () {},
145
+ child: const Text ('Preview' ),
146
+ ),
134
147
),
135
148
),
136
149
),
137
- ),
138
- if (model.showPreview)
139
- Expanded (
140
- child: ElevatedButton (
141
- child : const Text ( 'Console' ),
142
- onPressed : () {
143
- model. consoleSnackbar ();
144
- } ,
150
+ if (model.showPreview)
151
+ Expanded (
152
+ child : ElevatedButton (
153
+ child: const Text ( 'Console' ),
154
+ onPressed : () {
155
+ model. consoleSnackbar ();
156
+ },
157
+ ) ,
145
158
),
146
- ),
147
- if ( ! model.showPreview && challenge.files.length > 1 )
148
- for ( ChallengeFile file in challenge.files)
149
- customTabBar (
150
- model ,
151
- challenge ,
152
- file ,
153
- editor,
154
- )
155
- ],
156
- )
157
- : null ,
158
- bottomNavigationBar : Padding (
159
- padding : EdgeInsets . only (
160
- bottom : MediaQuery . of (context).viewInsets.bottom ,
161
- ),
162
- child : customBottomBar (
163
- model ,
164
- challenge ,
165
- editor ,
166
- context ,
159
+ if ( ! model.showPreview && challenge.files.length > 1 )
160
+ for ( ChallengeFile file in challenge.files)
161
+ customTabBar (
162
+ model,
163
+ challenge ,
164
+ file ,
165
+ editor ,
166
+ )
167
+ ],
168
+ )
169
+ : null ,
170
+ bottomNavigationBar : Padding (
171
+ padding : EdgeInsets . only (
172
+ bottom : MediaQuery . of (context).viewInsets.bottom,
173
+ ) ,
174
+ child : customBottomBar (
175
+ model,
176
+ challenge ,
177
+ editor ,
178
+ context ,
179
+ ) ,
167
180
),
168
- ),
169
- body: ! model.showPreview
170
- ? Column (
171
- children: [
172
- if (model.showPanel && ! keyboard)
173
- DynamicPanel (
174
- challenge: challenge,
175
- model: model,
176
- panel: model.panelType,
177
- maxChallenges: maxChallenges,
178
- challengesCompleted: challengesCompleted,
179
- editor: editor,
180
- ),
181
- Expanded (child: editor)
182
- ],
183
- )
184
- : Column (
185
- children: [
186
- if (model.showPanel && ! keyboard)
187
- DynamicPanel (
181
+ body: ! model.showPreview
182
+ ? Column (
183
+ children: [
184
+ if (model.showPanel && ! keyboard)
185
+ DynamicPanel (
186
+ challenge: challenge,
187
+ model: model,
188
+ panel: model.panelType,
189
+ maxChallenges: maxChallenges,
190
+ challengesCompleted: challengesCompleted,
191
+ editor: editor,
192
+ ),
193
+ Expanded (child: editor)
194
+ ],
195
+ )
196
+ : Column (
197
+ children: [
198
+ if (model.showPanel && ! keyboard)
199
+ DynamicPanel (
200
+ challenge: challenge,
201
+ model: model,
202
+ panel: model.panelType,
203
+ maxChallenges: maxChallenges,
204
+ challengesCompleted: challengesCompleted,
205
+ editor: editor,
206
+ ),
207
+ ProjectPreview (
188
208
challenge: challenge,
189
209
model: model,
190
- panel: model.panelType,
191
- maxChallenges: maxChallenges,
192
- challengesCompleted: challengesCompleted,
193
- editor: editor,
194
210
),
195
- ProjectPreview (
196
- challenge: challenge,
197
- model: model,
198
- ),
199
- ],
200
- ),
211
+ ],
212
+ ),
213
+ ),
201
214
);
202
215
}
203
216
0 commit comments