Added a "Download finished" dialog.
This commit is contained in:
parent
09118b3c88
commit
038d4a0ace
|
@ -3,7 +3,6 @@ import 'dart:io';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:quickgui/src/model/operating_system.dart';
|
||||
import 'package:quickgui/src/model/version.dart';
|
||||
import 'package:quickgui/src/pages/operating_system_page.dart';
|
||||
import 'package:quickgui/src/pages/operating_system_selection.dart';
|
||||
import 'package:quickgui/src/pages/version_selection.dart';
|
||||
import 'package:quickgui/src/widgets/home_page_button.dart';
|
||||
|
@ -95,9 +94,8 @@ class _MainPageState extends State<MainPage> {
|
|||
: () async {
|
||||
showLoadingIndicator(text: 'Downloading');
|
||||
await Process.run('quickget', [_selectedOperatingSystem!.code!, _selectedVersion!.code!]);
|
||||
print('Finished !');
|
||||
hideOpenDialog();
|
||||
Navigator.of(context).pop();
|
||||
hideLoadingIndicator();
|
||||
showDoneDialog(operatingSystem: _selectedOperatingSystem!.code!, version: _selectedVersion!.code!);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
@ -148,7 +146,49 @@ class _MainPageState extends State<MainPage> {
|
|||
);
|
||||
}
|
||||
|
||||
void hideOpenDialog() {
|
||||
void hideLoadingIndicator() {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
void showDoneDialog({required String operatingSystem, required String version}) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: AlertDialog(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
||||
),
|
||||
backgroundColor: Colors.black87,
|
||||
content: SizedBox(
|
||||
height: 200,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 32),
|
||||
child: Text('Done !', style: Theme.of(context).textTheme.bodyText1?.copyWith(color: Colors.white)),
|
||||
),
|
||||
Text('Now run "quickemu --vm $operatingSystem-$version" to start the VM',
|
||||
style: Theme.of(context).textTheme.bodyText1?.copyWith(color: Colors.white)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 32),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(
|
||||
'Dismiss',
|
||||
style: Theme.of(context).textTheme.bodyText1?.copyWith(color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue