-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: new resource loading screen (#823)
* Pass loading progress and path to front end * Add new resource loading screen * Clean up and refactor start screen
- Loading branch information
Showing
11 changed files
with
174 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:provider/provider.dart'; | ||
|
||
import 'package:mlperfbench/app_constants.dart'; | ||
import 'package:mlperfbench/benchmark/state.dart'; | ||
import 'package:mlperfbench/localizations/app_localizations.dart'; | ||
|
||
class ResourceLoadingScreen extends StatefulWidget { | ||
const ResourceLoadingScreen({super.key}); | ||
|
||
@override | ||
State<ResourceLoadingScreen> createState() => _ResourceLoadingScreenState(); | ||
} | ||
|
||
class _ResourceLoadingScreenState extends State<ResourceLoadingScreen> { | ||
static const double progressCircleEdgeSize = 150; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final state = context.watch<BenchmarkState>(); | ||
final l10n = AppLocalizations.of(context); | ||
final loadingProgressText = '${(state.loadingProgress * 100).round()}%'; | ||
|
||
final progressCircle = Stack( | ||
alignment: AlignmentDirectional.center, | ||
children: <Widget>[ | ||
Center( | ||
child: Container( | ||
width: progressCircleEdgeSize, | ||
height: progressCircleEdgeSize, | ||
decoration: BoxDecoration( | ||
shape: BoxShape.circle, | ||
gradient: LinearGradient( | ||
colors: AppColors.progressCircleGradient, | ||
begin: Alignment.topCenter, | ||
end: Alignment.bottomCenter, | ||
), | ||
boxShadow: const [ | ||
BoxShadow( | ||
color: Colors.black12, | ||
offset: Offset(15, 15), | ||
blurRadius: 10, | ||
) | ||
], | ||
), | ||
child: Center( | ||
child: Text( | ||
loadingProgressText, | ||
style: const TextStyle( | ||
fontWeight: FontWeight.bold, | ||
color: AppColors.lightText, | ||
), | ||
textScaleFactor: 2, | ||
), | ||
), | ||
), | ||
), | ||
Center( | ||
child: Container( | ||
width: MediaQuery.of(context).size.width * 0.35, | ||
alignment: Alignment.center, | ||
decoration: const BoxDecoration( | ||
shape: BoxShape.circle, | ||
color: AppColors.progressCircle, | ||
boxShadow: [ | ||
BoxShadow( | ||
color: Colors.black12, | ||
offset: Offset(15, 15), | ||
blurRadius: 10, | ||
) | ||
], | ||
), | ||
), | ||
), | ||
], | ||
); | ||
|
||
final statusText = Padding( | ||
padding: const EdgeInsets.fromLTRB(20, 40, 20, 20), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [ | ||
Text( | ||
l10n.mainScreenLoading, | ||
style: const TextStyle( | ||
color: AppColors.lightText, | ||
fontSize: 16, | ||
), | ||
), | ||
const SizedBox(height: 20), | ||
Text( | ||
state.loadingPath, | ||
style: const TextStyle( | ||
fontWeight: FontWeight.w300, | ||
color: AppColors.lightText, | ||
fontSize: 12, | ||
), | ||
), | ||
], | ||
), | ||
); | ||
|
||
final backgroundGradient = BoxDecoration( | ||
gradient: LinearGradient( | ||
colors: AppColors.progressScreenGradient, | ||
begin: Alignment.topCenter, | ||
end: Alignment.bottomCenter, | ||
), | ||
); | ||
|
||
return Scaffold( | ||
body: Container( | ||
decoration: backgroundGradient, | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
progressCircle, | ||
statusText, | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters