Files
cabo-counter/lib/main.dart
Felix Kirchner 8565382fab Beta-Version 0.4.4 (#105)
* Update README.md

* Tried new design for im- and export-button

* Moved views to presentation folder

* Moved widgets to presentation folder

* Implemented CustomRowForm Widget

* Used new custom form row

* Removed double information

* Refactored methods to private

* Changed label

* Modified paddings and text color

* Changed string

* Updated CustomFormRow padding and pressed handler

* Implemented various new forms of CustomFormRow into SettingsView

* Implemented VersionService

* Updated strings, added wiki button

* Corrected replaced string

* Added import dialog feedback (got lost in refactoring)

* Corrected function duplication

* changed suffixWidget assignment and moved stepperKeys

* Changed icons

* Added rate_my_app package

* Renamed folder

* Implement native rating dialog

* Implemented logic for pre rating and refactored rating dialog

* updated launch mode

* Small changes

* Updated launch mode

* Updated linting rules

* Renamed folders

* Changed l10n files location

* Implemented new link constants

* Changed privacy policy link

* Corrected wiki link

* Removed import

* Updated links

* Updated links to subdomains

* Updated file paths

* Updated strings

* Updated identifiers

* Added break in switch case

* Updated strings

* Implemented new popup

* Corrected links

* Changed color

* Ensured rating dialog wont show in Beta

* Refactoring

* Adding const

* Renamed variables

* Corrected links

* updated Dialog function

* Added version number in about view

* Changed order and corrected return

* Changed translation

* Changed popups because of unmounted context errors

* corrected string typo

* Replaced int constants with enums

* Renamed Stepper to CustomStepper

* Changed argument order

* Reordered properties

* Implemented empty builder for GraphView

* Added jitterStip to prevent the graphs overlaying each other

* Removed german comments

* Added comment to jitter calculation

* Overhauled comments in CustomTheme

* Updated version

* Added Delete all games button to Settings

* Updated version

* Updated en string

* Updated RoundView buttons when game is finished

* Changed lock emoji to CuperinoIcons.lock and placed it in trailing of app bar

* Simplified comparison

* Updated version

* Corrected scaling

* Updates constant names and lint rule

* HOTFIX: Graph showed wrong data

* Graph starts at round 0 now where all players have 0 points

* Adjusted jitterStep

* Removed dead code

* Updated Y-Axis and removed values under y = 0

* Changed overflow mode

* Replaced string & if statement with visibility widget

* updated accessability of graph view

* Changed string for GraphView title

* Updated comment

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Updated generated files

* Updated version in README

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-13 12:48:24 +02:00

83 lines
2.5 KiB
Dart

import 'package:cabo_counter/core/custom_theme.dart';
import 'package:cabo_counter/l10n/generated/app_localizations.dart';
import 'package:cabo_counter/presentation/views/tab_view.dart';
import 'package:cabo_counter/services/config_service.dart';
import 'package:cabo_counter/services/local_storage_service.dart';
import 'package:cabo_counter/services/version_service.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
await ConfigService.initConfig();
ConfigService.pointLimit = await ConfigService.getPointLimit();
ConfigService.caboPenalty = await ConfigService.getCaboPenalty();
await VersionService.init();
runApp(const App());
}
class App extends StatefulWidget {
const App({super.key});
@override
State<StatefulWidget> createState() => _AppState();
}
class _AppState extends State<App> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
LocalStorageService.loadGameSessions();
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.paused ||
state == AppLifecycleState.detached) {
LocalStorageService.saveGameSessions();
}
}
@override
Widget build(BuildContext context) {
LocalStorageService.loadGameSessions();
return CupertinoApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: const [
Locale('en'), // English
Locale('de'), // German
],
localeResolutionCallback: (locale, supportedLocales) {
for (final supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale?.languageCode) {
return supportedLocale;
}
}
return supportedLocales.first;
},
theme: CupertinoThemeData(
applyThemeToAll: true,
brightness: Brightness.dark,
primaryColor: CustomTheme.primaryColor,
scaffoldBackgroundColor: CustomTheme.backgroundColor,
textTheme: CupertinoTextThemeData(
primaryColor: CustomTheme.primaryColor,
),
),
debugShowCheckedModeBanner: false,
title: 'Cabo Counter',
home: const TabView(),
);
}
}