Formatting

This commit is contained in:
Shawn 2023-01-01 12:20:42 -07:00
parent 01b1a16ec4
commit 099ae9893d
3 changed files with 13 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/// Consolidate shared imports that are common across the app.
/// Consolidate imports that are common across the app.
export 'dart:math';
@ -23,6 +23,7 @@ export 'package:wonders/logic/settings_logic.dart';
export 'package:wonders/main.dart';
export 'package:wonders/router.dart';
export 'package:wonders/styles/styles.dart';
export 'package:wonders/ui/app_scaffold.dart';
export 'package:wonders/ui/common/controls/app_image.dart';
export 'package:wonders/ui/common/controls/buttons.dart';
export 'package:wonders/ui/common/controls/circle_buttons.dart';

View File

@ -11,8 +11,7 @@ class AppLogic {
/// The router will use this to prevent redirects while bootstrapping.
bool isBootstrapComplete = false;
bool get isLandscapeEnabled =>
PlatformInfo.isDesktopOrWeb || deviceSize.shortestSide > 500;
bool get isLandscapeEnabled => PlatformInfo.isDesktopOrWeb || deviceSize.shortestSide > 500;
/// Support portrait and landscape on desktop, web and tablets. Stick to portrait for phones.
/// A return value of null indicated both orientations are supported.
@ -26,8 +25,7 @@ class AppLogic {
/// Initialize the app and all main actors.
/// Loads settings, sets up services etc.
Future<void> bootstrap() async {
debugPrint(
'bootstrap app, deviceSize: $deviceSize, isTablet: $isLandscapeEnabled');
debugPrint('bootstrap app, deviceSize: $deviceSize, isTablet: $isLandscapeEnabled');
// Set min-sizes for desktop apps
if (PlatformInfo.isDesktop) {
@ -89,8 +87,7 @@ class AppLogic {
SystemChrome.setPreferredOrientations(orientations);
}
Future<T?> showFullscreenDialogRoute<T>(BuildContext context, Widget child,
{bool transparent = false}) async {
Future<T?> showFullscreenDialogRoute<T>(BuildContext context, Widget child, {bool transparent = false}) async {
return await Navigator.of(context).push<T>(
PageRoutes.dialog<T>(child, duration: $styles.times.pageTransition),
);

View File

@ -25,18 +25,18 @@ void main() async {
FlutterNativeSplash.remove();
}
/// Creates an app using the [MaterialApp.router] constructor and the `appRouter`, an instance of [GoRouter].
/// Creates an app using the [MaterialApp.router] constructor and the global `appRouter`, an instance of [GoRouter].
class WondersApp extends StatelessWidget with GetItMixin {
WondersApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final locale = watchX((SettingsLogic s) => s.currentLocale);
return MaterialApp.router(
routeInformationProvider: appRouter.routeInformationProvider,
routeInformationParser: appRouter.routeInformationParser,
locale: locale == null ? null : Locale(locale),
debugShowCheckedModeBanner: false,
routerDelegate: appRouter.routerDelegate,
routeInformationProvider: appRouter.routeInformationProvider,
routeInformationParser: appRouter.routeInformationParser,
theme: ThemeData(fontFamily: $styles.text.body.fontFamily),
localizationsDelegates: const [
AppLocalizations.delegate,
@ -49,7 +49,7 @@ class WondersApp extends StatelessWidget with GetItMixin {
}
}
/// Create singletons (controllers and services) that can be shared across the app.
/// Create singletons (logic and services) that can be shared across the app.
void registerSingletons() {
// Top level app controller
GetIt.I.registerLazySingleton<AppLogic>(() => AppLogic());
@ -70,7 +70,7 @@ void registerSingletons() {
GetIt.I.registerLazySingleton<LocaleLogic>(() => LocaleLogic());
}
/// Add syntax sugar for quickly accessing the main logical controllers in the app
/// Add syntax sugar for quickly accessing the main "logic" controllers in the app
/// We deliberately do not create shortcuts for services, to discourage their use directly in the view/widget layer.
AppLogic get appLogic => GetIt.I.get<AppLogic>();
WondersLogic get wondersLogic => GetIt.I.get<WondersLogic>();
@ -81,4 +81,7 @@ MetAPILogic get metAPILogic => GetIt.I.get<MetAPILogic>();
CollectiblesLogic get collectiblesLogic => GetIt.I.get<CollectiblesLogic>();
WallPaperLogic get wallpaperLogic => GetIt.I.get<WallPaperLogic>();
LocaleLogic get localeLogic => GetIt.I.get<LocaleLogic>();
/// Global helpers for readability
AppLocalizations get $strings => localeLogic.strings;
AppStyle get $styles => WondersAppScaffold.style;