diff --git a/README.md b/README.md index a866f235..9767eb9b 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ +

Mobile app to track the schedules of the [Chaban Delmas bridge](https://fr.wikipedia.org/wiki/Pont_Jacques-Chaban-Delmas) located in Bordeaux, France. diff --git a/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/1_en-GB.png b/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/1_en-GB.png index 11cdfedf..5b425b21 100644 Binary files a/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/1_en-GB.png and b/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/1_en-GB.png differ diff --git a/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/2_en-GB.png b/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/2_en-GB.png index fc2cd8e8..c615aa4b 100644 Binary files a/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/2_en-GB.png and b/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/2_en-GB.png differ diff --git a/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/3_en-GB.png b/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/3_en-GB.png index a3a57b5d..4fb82428 100644 Binary files a/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/3_en-GB.png and b/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/3_en-GB.png differ diff --git a/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/4_en-GB.png b/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/4_en-GB.png index 07f9233d..d1f60778 100644 Binary files a/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/4_en-GB.png and b/android/fastlane/metadata/android/en-GB/images/sevenInchScreenshots/4_en-GB.png differ diff --git a/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/1_en-GB.png b/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/1_en-GB.png index 11cdfedf..6b116eb5 100644 Binary files a/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/1_en-GB.png and b/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/1_en-GB.png differ diff --git a/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/2_en-GB.png b/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/2_en-GB.png index fc2cd8e8..3aeb8e06 100644 Binary files a/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/2_en-GB.png and b/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/2_en-GB.png differ diff --git a/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/3_en-GB.png b/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/3_en-GB.png index a3a57b5d..af76e0f0 100644 Binary files a/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/3_en-GB.png and b/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/3_en-GB.png differ diff --git a/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/4_en-GB.png b/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/4_en-GB.png index 07f9233d..766354aa 100644 Binary files a/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/4_en-GB.png and b/android/fastlane/metadata/android/en-GB/images/tenInchScreenshots/4_en-GB.png differ diff --git a/android/fastlane/metadata/android/en-US/images/phoneScreenshots/1_en-GB.png b/android/fastlane/metadata/android/en-US/images/phoneScreenshots/1_en-US.png similarity index 100% rename from android/fastlane/metadata/android/en-US/images/phoneScreenshots/1_en-GB.png rename to android/fastlane/metadata/android/en-US/images/phoneScreenshots/1_en-US.png diff --git a/android/fastlane/metadata/android/en-US/images/phoneScreenshots/2_en-GB.png b/android/fastlane/metadata/android/en-US/images/phoneScreenshots/2_en-US.png similarity index 100% rename from android/fastlane/metadata/android/en-US/images/phoneScreenshots/2_en-GB.png rename to android/fastlane/metadata/android/en-US/images/phoneScreenshots/2_en-US.png diff --git a/android/fastlane/metadata/android/en-US/images/phoneScreenshots/3_en-GB.png b/android/fastlane/metadata/android/en-US/images/phoneScreenshots/3_en-US.png similarity index 100% rename from android/fastlane/metadata/android/en-US/images/phoneScreenshots/3_en-GB.png rename to android/fastlane/metadata/android/en-US/images/phoneScreenshots/3_en-US.png diff --git a/android/fastlane/metadata/android/en-US/images/phoneScreenshots/4_en-GB.png b/android/fastlane/metadata/android/en-US/images/phoneScreenshots/4_en-US.png similarity index 100% rename from android/fastlane/metadata/android/en-US/images/phoneScreenshots/4_en-GB.png rename to android/fastlane/metadata/android/en-US/images/phoneScreenshots/4_en-US.png diff --git a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1_en-GB.png b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1_en-GB.png deleted file mode 100644 index 11cdfedf..00000000 Binary files a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1_en-GB.png and /dev/null differ diff --git a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1_en-US.png b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1_en-US.png new file mode 100644 index 00000000..5b425b21 Binary files /dev/null and b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1_en-US.png differ diff --git a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2_en-GB.png b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2_en-GB.png deleted file mode 100644 index fc2cd8e8..00000000 Binary files a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2_en-GB.png and /dev/null differ diff --git a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2_en-US.png b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2_en-US.png new file mode 100644 index 00000000..c615aa4b Binary files /dev/null and b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2_en-US.png differ diff --git a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3_en-GB.png b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3_en-GB.png deleted file mode 100644 index a3a57b5d..00000000 Binary files a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3_en-GB.png and /dev/null differ diff --git a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3_en-US.png b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3_en-US.png new file mode 100644 index 00000000..4fb82428 Binary files /dev/null and b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3_en-US.png differ diff --git a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4_en-GB.png b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4_en-GB.png deleted file mode 100644 index 07f9233d..00000000 Binary files a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4_en-GB.png and /dev/null differ diff --git a/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4_en-US.png b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4_en-US.png new file mode 100644 index 00000000..d1f60778 Binary files /dev/null and b/android/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4_en-US.png differ diff --git a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/1_en-GB.png b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/1_en-GB.png deleted file mode 100644 index 11cdfedf..00000000 Binary files a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/1_en-GB.png and /dev/null differ diff --git a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/1_en-US.png b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/1_en-US.png new file mode 100644 index 00000000..6b116eb5 Binary files /dev/null and b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/1_en-US.png differ diff --git a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/2_en-GB.png b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/2_en-GB.png deleted file mode 100644 index fc2cd8e8..00000000 Binary files a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/2_en-GB.png and /dev/null differ diff --git a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/2_en-US.png b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/2_en-US.png new file mode 100644 index 00000000..3aeb8e06 Binary files /dev/null and b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/2_en-US.png differ diff --git a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/3_en-GB.png b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/3_en-GB.png deleted file mode 100644 index a3a57b5d..00000000 Binary files a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/3_en-GB.png and /dev/null differ diff --git a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/3_en-US.png b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/3_en-US.png new file mode 100644 index 00000000..af76e0f0 Binary files /dev/null and b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/3_en-US.png differ diff --git a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/4_en-GB.png b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/4_en-GB.png deleted file mode 100644 index 07f9233d..00000000 Binary files a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/4_en-GB.png and /dev/null differ diff --git a/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/4_en-US.png b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/4_en-US.png new file mode 100644 index 00000000..766354aa Binary files /dev/null and b/android/fastlane/metadata/android/en-US/images/tenInchScreenshots/4_en-US.png differ diff --git a/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/1_es-ES.png b/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/1_es-ES.png index 73c69f9c..46bfbbeb 100644 Binary files a/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/1_es-ES.png and b/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/1_es-ES.png differ diff --git a/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/2_es-ES.png b/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/2_es-ES.png index 9962276a..4b6727fc 100644 Binary files a/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/2_es-ES.png and b/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/2_es-ES.png differ diff --git a/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/3_es-ES.png b/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/3_es-ES.png index b84acaa6..dd761683 100644 Binary files a/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/3_es-ES.png and b/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/3_es-ES.png differ diff --git a/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/4_es-ES.png b/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/4_es-ES.png index 2e73e868..9696928e 100644 Binary files a/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/4_es-ES.png and b/android/fastlane/metadata/android/es-ES/images/sevenInchScreenshots/4_es-ES.png differ diff --git a/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/1_es-ES.png b/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/1_es-ES.png index 73c69f9c..0e5f13bf 100644 Binary files a/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/1_es-ES.png and b/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/1_es-ES.png differ diff --git a/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/2_es-ES.png b/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/2_es-ES.png index 9962276a..a8e78e85 100644 Binary files a/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/2_es-ES.png and b/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/2_es-ES.png differ diff --git a/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/3_es-ES.png b/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/3_es-ES.png index b84acaa6..a091097e 100644 Binary files a/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/3_es-ES.png and b/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/3_es-ES.png differ diff --git a/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/4_es-ES.png b/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/4_es-ES.png index 2e73e868..a2fd387f 100644 Binary files a/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/4_es-ES.png and b/android/fastlane/metadata/android/es-ES/images/tenInchScreenshots/4_es-ES.png differ diff --git a/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/1_fr-FR.png b/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/1_fr-FR.png index 00d7df4e..80965f0f 100644 Binary files a/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/1_fr-FR.png and b/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/1_fr-FR.png differ diff --git a/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/2_fr-FR.png b/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/2_fr-FR.png index 96ddf6ca..89c2486c 100644 Binary files a/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/2_fr-FR.png and b/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/2_fr-FR.png differ diff --git a/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/3_fr-FR.png b/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/3_fr-FR.png index 0f3e6e8e..c7957694 100644 Binary files a/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/3_fr-FR.png and b/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/3_fr-FR.png differ diff --git a/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/4_fr-FR.png b/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/4_fr-FR.png index 9556ab8a..de82613a 100644 Binary files a/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/4_fr-FR.png and b/android/fastlane/metadata/android/fr-FR/images/sevenInchScreenshots/4_fr-FR.png differ diff --git a/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/1_fr-FR.png b/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/1_fr-FR.png index 00d7df4e..cd389dbf 100644 Binary files a/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/1_fr-FR.png and b/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/1_fr-FR.png differ diff --git a/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/2_fr-FR.png b/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/2_fr-FR.png index 96ddf6ca..430dcefb 100644 Binary files a/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/2_fr-FR.png and b/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/2_fr-FR.png differ diff --git a/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/3_fr-FR.png b/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/3_fr-FR.png index 0f3e6e8e..74a409e6 100644 Binary files a/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/3_fr-FR.png and b/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/3_fr-FR.png differ diff --git a/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/4_fr-FR.png b/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/4_fr-FR.png index 9556ab8a..d8fd8256 100644 Binary files a/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/4_fr-FR.png and b/android/fastlane/metadata/android/fr-FR/images/tenInchScreenshots/4_fr-FR.png differ diff --git a/lib/chabo.dart b/lib/chabo.dart index 47be7d02..28951ee3 100644 --- a/lib/chabo.dart +++ b/lib/chabo.dart @@ -5,6 +5,7 @@ import 'package:chabo/bloc/scroll_status/scroll_status_bloc.dart'; import 'package:chabo/bloc/status/status_bloc.dart'; import 'package:chabo/bloc/theme/theme_bloc.dart'; import 'package:chabo/cubits/floating_actions_cubit.dart'; +import 'package:chabo/helpers/device_helper.dart'; import 'package:chabo/screens/forecast_screen.dart'; import 'package:chabo/service/notification_service.dart'; import 'package:chabo/service/storage_service.dart'; @@ -27,6 +28,8 @@ class Chabo extends StatelessWidget { @override Widget build(BuildContext context) { + DeviceHelper.computePreferredOrientation(context); + return MultiBlocProvider( providers: [ /// Bloc intended to manage the theme of the App diff --git a/lib/dialogs/chabo_about_dialog.dart b/lib/dialogs/chabo_about_dialog.dart deleted file mode 100644 index a3b4c502..00000000 --- a/lib/dialogs/chabo_about_dialog.dart +++ /dev/null @@ -1,283 +0,0 @@ -import 'package:chabo/const.dart'; -import 'package:chabo/custom_properties.dart'; -import 'package:chabo/screens/changelog_screen.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:package_info_plus/package_info_plus.dart'; - -class ChaboAboutDialog extends StatelessWidget { - final Widget _iconWidget = Padding( - padding: const EdgeInsets.all(5), - child: SizedBox( - height: 60, - width: 60, - child: Image.asset(Const.appLogoPath), - ), - ); - - ChaboAboutDialog({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - final colorScheme = Theme.of(context).colorScheme; - final textTheme = Theme.of(context).textTheme; - - return FutureBuilder( - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const Center(child: CircularProgressIndicator()); - } - if (snapshot.connectionState == ConnectionState.none && - snapshot.data == null) { - return Text(AppLocalizations.of(context)!.unableAppInfo); - } - - return AlertDialog( - insetPadding: const EdgeInsets.symmetric(horizontal: 20), - titlePadding: const EdgeInsets.all(20), - contentPadding: const EdgeInsets.symmetric(horizontal: 20), - actionsPadding: const EdgeInsets.fromLTRB(0, 10, 20, 20), - title: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - IconTheme( - data: Theme.of(context).iconTheme, - child: Container( - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular( - CustomProperties.borderRadius, - ), - ), - ), - child: _iconWidget, - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - snapshot.data!.appName, - style: Theme.of(context) - .textTheme - .headlineSmall! - .copyWith( - fontWeight: FontWeight.bold, - fontSize: 30, - ), - ), - Text( - ' | v${snapshot.data!.version} (${snapshot.data!.buildNumber})', - style: textTheme.bodyMedium, - ), - ], - ), - Text( - Const.legalLease, - style: textTheme.bodySmall!.copyWith(), - ), - ], - ), - ), - ), - ], - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - CustomProperties.borderRadius, - ), - ), - content: ListBody( - children: [ - Text( - AppLocalizations.of(context)!.appDescription, - style: textTheme.bodyLarge, - ), - const SizedBox( - height: 15, - ), - Text( - AppLocalizations.of(context)!.disclaimer, - style: Theme.of(context) - .textTheme - .bodyMedium - ?.copyWith(fontStyle: FontStyle.italic), - ), - const SizedBox( - height: 15, - ), - Wrap( - alignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - children: Const.usefulLinks - .map( - (link) => ElevatedButton( - onPressed: () => link.launchURL(), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Icon( - link.iconData, - size: 20, - ), - const SizedBox( - width: 10, - ), - Padding( - padding: - const EdgeInsets.symmetric(vertical: 8.0), - child: Text( - AppLocalizations.of(context)!.selectAboutDialog( - link.translationKey, - ), - ), - ), - const SizedBox( - width: 10, - ), - ], - ), - ), - ) - .toList(), - ), - const SizedBox( - height: 10, - ), - Wrap( - spacing: 10, - runSpacing: 5, - alignment: WrapAlignment.center, - children: [ - ElevatedButton( - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( - colorScheme.secondaryContainer, - ), - foregroundColor: MaterialStateProperty.all( - colorScheme.onSecondaryContainer, - ), - ), - onPressed: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const ChangeLogScreen(), - ), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - const Icon( - FontAwesomeIcons.codeMerge, - size: 20, - ), - const SizedBox( - width: 10, - ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), - child: Text( - AppLocalizations.of(context)!.selectAboutDialog( - 'changelog', - ), - ), - ), - ], - ), - ), - ElevatedButton( - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( - colorScheme.secondaryContainer, - ), - foregroundColor: MaterialStateProperty.all( - colorScheme.onSecondaryContainer, - ), - ), - onPressed: () { - showLicensePage( - context: context, - applicationName: snapshot.data!.appName, - applicationVersion: - 'v${snapshot.data!.version}+${snapshot.data!.buildNumber}', - applicationIcon: Padding( - padding: const EdgeInsets.all(8.0), - child: IconTheme( - data: Theme.of(context).iconTheme, - child: Container( - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular( - CustomProperties.borderRadius, - ), - ), - ), - child: _iconWidget, - ), - ), - ), - applicationLegalese: Const.legalLease, - ); - }, - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - const Icon( - FontAwesomeIcons.fileLines, - size: 20, - ), - const SizedBox( - width: 10, - ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), - child: Text( - AppLocalizations.of(context)! - .selectAboutDialog('licenses'), - ), - ), - ], - ), - ), - ], - ), - ], - ), - actions: [ - ElevatedButton.icon( - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.white), - foregroundColor: MaterialStateProperty.all( - Theme.of(context).primaryColor, - ), - shape: MaterialStateProperty.all( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - CustomProperties.borderRadius, - ), - ), - ), - ), - onPressed: () => {Navigator.pop(context)}, - icon: const Icon(Icons.close), - label: Text( - MaterialLocalizations.of(context).closeButtonLabel, - ), - ), - ], - scrollable: true, - ); - }, - future: PackageInfo.fromPlatform(), - ); - } -} diff --git a/lib/dialogs/chabo_about_dialog/chabo_about_dialog.dart b/lib/dialogs/chabo_about_dialog/chabo_about_dialog.dart new file mode 100644 index 00000000..a90e79cc --- /dev/null +++ b/lib/dialogs/chabo_about_dialog/chabo_about_dialog.dart @@ -0,0 +1,197 @@ +import 'package:chabo/const.dart'; +import 'package:chabo/custom_properties.dart'; +import 'package:chabo/helpers/device_helper.dart'; +import 'package:chabo/screens/changelog_screen.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:package_info_plus/package_info_plus.dart'; + +part 'close_button.dart'; + +part 'page_links_widget.dart'; + +part 'web_links_widget.dart'; + +class ChaboAboutDialog extends StatelessWidget { + final Widget _iconWidget = Padding( + padding: const EdgeInsets.all(5), + child: SizedBox( + height: 60, + width: 60, + child: Image.asset(Const.appLogoPath), + ), + ); + + ChaboAboutDialog({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final textTheme = Theme.of(context).textTheme; + + return FutureBuilder( + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } + if (snapshot.connectionState == ConnectionState.none && + snapshot.data == null) { + return Text(AppLocalizations.of(context)!.unableAppInfo); + } + + return AlertDialog( + insetPadding: const EdgeInsets.symmetric(horizontal: 20), + titlePadding: const EdgeInsets.all(20), + contentPadding: const EdgeInsets.symmetric( + horizontal: 20, + ), + actionsPadding: const EdgeInsets.fromLTRB(0, 10, 20, 20), + title: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + IconTheme( + data: Theme.of(context).iconTheme, + child: Container( + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular( + CustomProperties.borderRadius, + ), + ), + ), + child: _iconWidget, + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + snapshot.data!.appName, + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith( + fontWeight: FontWeight.bold, + fontSize: 30, + ), + ), + Text( + ' | v${snapshot.data!.version} (${snapshot.data!.buildNumber})', + style: textTheme.bodyMedium, + ), + ], + ), + Text( + Const.legalLease, + style: textTheme.bodySmall!.copyWith(), + ), + ], + ), + ), + ), + !DeviceHelper.isPortrait(context) + ? const _CloseButton() + : const SizedBox.shrink(), + ], + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + CustomProperties.borderRadius, + ), + ), + content: Container( + constraints: DeviceHelper.isMobile(context) + ? DeviceHelper.isPortrait(context) + ? null + : BoxConstraints( + maxWidth: MediaQuery.of(context).size.width / 1.2, + ) + : BoxConstraints( + maxWidth: MediaQuery.of(context).size.width / 1.9, + ), + child: DeviceHelper.isPortrait(context) + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AppLocalizations.of(context)!.appDescription, + style: textTheme.bodyLarge, + ), + const SizedBox( + height: 15, + ), + Text( + AppLocalizations.of(context)!.disclaimer, + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith(fontStyle: FontStyle.italic), + ), + const SizedBox( + height: 15, + ), + _PageLinksWidget( + packageInfo: snapshot.data!, + iconWidget: _iconWidget, + ), + const SizedBox( + height: 15, + ), + const _WebLinksWidget(), + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AppLocalizations.of(context)!.appDescription, + style: textTheme.bodyLarge, + ), + const SizedBox( + height: 15, + ), + Text( + AppLocalizations.of(context)!.disclaimer, + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith(fontStyle: FontStyle.italic), + ), + const SizedBox( + height: 15, + ), + _PageLinksWidget( + packageInfo: snapshot.data!, + iconWidget: _iconWidget, + ), + const SizedBox( + height: 15, + ), + ], + ), + ), + const Flexible( + child: _WebLinksWidget(), + ), + ], + ), + ), + scrollable: true, + actions: + DeviceHelper.isPortrait(context) ? [const _CloseButton()] : [], + ); + }, + future: PackageInfo.fromPlatform(), + ); + } +} diff --git a/lib/dialogs/chabo_about_dialog/close_button.dart b/lib/dialogs/chabo_about_dialog/close_button.dart new file mode 100644 index 00000000..c5ad6805 --- /dev/null +++ b/lib/dialogs/chabo_about_dialog/close_button.dart @@ -0,0 +1,29 @@ +part of 'chabo_about_dialog.dart'; + +class _CloseButton extends StatelessWidget { + const _CloseButton({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return ElevatedButton.icon( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all(Colors.white), + foregroundColor: MaterialStateProperty.all( + Theme.of(context).primaryColor, + ), + shape: MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + CustomProperties.borderRadius, + ), + ), + ), + ), + onPressed: () => {Navigator.pop(context)}, + icon: const Icon(Icons.close), + label: Text( + MaterialLocalizations.of(context).closeButtonLabel, + ), + ); + } +} diff --git a/lib/dialogs/chabo_about_dialog/page_links_widget.dart b/lib/dialogs/chabo_about_dialog/page_links_widget.dart new file mode 100644 index 00000000..78cafdb6 --- /dev/null +++ b/lib/dialogs/chabo_about_dialog/page_links_widget.dart @@ -0,0 +1,115 @@ +part of 'chabo_about_dialog.dart'; + +class _PageLinksWidget extends StatelessWidget { + final PackageInfo packageInfo; + final Widget iconWidget; + + const _PageLinksWidget({ + Key? key, + required this.packageInfo, + required this.iconWidget, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final colorScheme = Theme.of(context).colorScheme; + + return Wrap( + spacing: 10, + runSpacing: 5, + alignment: WrapAlignment.center, + children: [ + ElevatedButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + colorScheme.secondaryContainer, + ), + foregroundColor: MaterialStateProperty.all( + colorScheme.onSecondaryContainer, + ), + ), + onPressed: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const ChangeLogScreen(), + ), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon( + FontAwesomeIcons.codeMerge, + size: 20, + ), + const SizedBox( + width: 10, + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Text( + AppLocalizations.of(context)!.selectAboutDialog( + 'changelog', + ), + ), + ), + ], + ), + ), + ElevatedButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + colorScheme.secondaryContainer, + ), + foregroundColor: MaterialStateProperty.all( + colorScheme.onSecondaryContainer, + ), + ), + onPressed: () { + showLicensePage( + context: context, + applicationName: packageInfo.appName, + applicationVersion: + 'v${packageInfo.version}+${packageInfo.buildNumber}', + applicationIcon: Padding( + padding: const EdgeInsets.all(8.0), + child: IconTheme( + data: Theme.of(context).iconTheme, + child: Container( + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular( + CustomProperties.borderRadius, + ), + ), + ), + child: iconWidget, + ), + ), + ), + applicationLegalese: Const.legalLease, + ); + }, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon( + FontAwesomeIcons.fileLines, + size: 20, + ), + const SizedBox( + width: 10, + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Text( + AppLocalizations.of(context)!.selectAboutDialog('licenses'), + ), + ), + ], + ), + ), + ], + ); + } +} diff --git a/lib/dialogs/chabo_about_dialog/web_links_widget.dart b/lib/dialogs/chabo_about_dialog/web_links_widget.dart new file mode 100644 index 00000000..f9003c2f --- /dev/null +++ b/lib/dialogs/chabo_about_dialog/web_links_widget.dart @@ -0,0 +1,48 @@ +part of 'chabo_about_dialog.dart'; + +class _WebLinksWidget extends StatelessWidget { + const _WebLinksWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Wrap( + alignment: WrapAlignment.center, + spacing: 10, + runSpacing: 10, + children: Const.usefulLinks + .map( + (link) => ElevatedButton( + onPressed: () => link.launchURL(), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + link.iconData, + size: 20, + ), + const SizedBox( + width: 10, + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Text( + AppLocalizations.of(context)!.selectAboutDialog( + link.translationKey, + ), + ), + ), + const SizedBox( + width: 10, + ), + ], + ), + ), + ) + .toList(), + ), + ], + ); + } +} diff --git a/lib/dialogs/forecast_information_dialog.dart b/lib/dialogs/forecast_information_dialog.dart index f0856532..bb750130 100644 --- a/lib/dialogs/forecast_information_dialog.dart +++ b/lib/dialogs/forecast_information_dialog.dart @@ -1,5 +1,6 @@ import 'package:chabo/custom_properties.dart'; import 'package:chabo/helpers/custom_page_routes.dart'; +import 'package:chabo/helpers/device_helper.dart'; import 'package:chabo/models/abstract_forecast.dart'; import 'package:chabo/screens/notification_screen/notification_screen.dart'; import 'package:flutter/material.dart'; @@ -66,70 +67,79 @@ class ForecastInformationDialog extends StatelessWidget { CustomProperties.borderRadius, ), ), - content: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: const EdgeInsets.all(20), - child: forecast.getInformationWidget(context), - ), - if (forecast.interferingTimeSlots.isNotEmpty) - Container( - padding: const EdgeInsets.all(5), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.primary, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular( - 15.0, - ), - bottomRight: Radius.circular( - 15.0, + content: Container( + constraints: DeviceHelper.isMobile(context) + ? DeviceHelper.isPortrait(context) + ? null + : BoxConstraints( + maxWidth: MediaQuery.of(context).size.width * 0.5, + ) + : BoxConstraints(maxWidth: MediaQuery.of(context).size.width * 0.5), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.all(20), + child: forecast.getInformationWidget(context), + ), + if (forecast.interferingTimeSlots.isNotEmpty) + Container( + padding: const EdgeInsets.all(5), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.primary, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular( + 15.0, + ), + bottomRight: Radius.circular( + 15.0, + ), ), ), - ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Flexible( - child: Text( - AppLocalizations.of(context)! - .favoriteSlotsInterferenceWarning, - overflow: TextOverflow.clip, - style: TextStyle( - color: Theme.of(context).cardColor, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Flexible( + child: Text( + AppLocalizations.of(context)! + .favoriteSlotsInterferenceWarning, + overflow: TextOverflow.clip, + style: TextStyle( + color: Theme.of(context).cardColor, + ), ), ), - ), - ElevatedButton( - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( - colorScheme.secondaryContainer, - ), - foregroundColor: MaterialStateProperty.all( - colorScheme.onSecondaryContainer, + ElevatedButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + colorScheme.secondaryContainer, + ), + foregroundColor: MaterialStateProperty.all( + colorScheme.onSecondaryContainer, + ), ), - ), - onPressed: () => { - Navigator.of(context).pop(), - Navigator.of(context).push( - BottomToTopPageRoute( - builder: (context) => const NotificationScreen( - highlightTimeSlots: true, + onPressed: () => { + Navigator.of(context).pop(), + Navigator.of(context).push( + BottomToTopPageRoute( + builder: (context) => const NotificationScreen( + highlightTimeSlots: true, + ), ), ), + }, + child: const Icon( + Icons.notifications_active, ), - }, - child: const Icon( - Icons.notifications_active, ), - ), - ], + ], + ), ), ), - ), - ], + ], + ), ), ); } diff --git a/lib/helpers/device_helper.dart b/lib/helpers/device_helper.dart new file mode 100644 index 00000000..352cea29 --- /dev/null +++ b/lib/helpers/device_helper.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class DeviceHelper { + static computePreferredOrientation(BuildContext context) { + if (isMobile(context)) { + SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + DeviceOrientation.landscapeLeft, + DeviceOrientation.landscapeRight, + ]); + } else { + SystemChrome.setPreferredOrientations([ + DeviceOrientation.landscapeLeft, + DeviceOrientation.landscapeRight, + ]); + } + } + + static isPortrait(BuildContext context) { + return MediaQuery.of(context).orientation == Orientation.portrait; + } + + static isMobile(BuildContext context) { + var shortestSide = MediaQuery.of(context).size.shortestSide; + + return shortestSide < 620; + } +} diff --git a/lib/screens/forecast_screen.dart b/lib/screens/forecast_screen.dart index 5aa65064..e7090a42 100644 --- a/lib/screens/forecast_screen.dart +++ b/lib/screens/forecast_screen.dart @@ -5,6 +5,7 @@ import 'package:chabo/bloc/status/status_bloc.dart'; import 'package:chabo/cubits/floating_actions_cubit.dart'; import 'package:chabo/custom_properties.dart'; import 'package:chabo/custom_widget_state.dart'; +import 'package:chabo/helpers/device_helper.dart'; import 'package:chabo/misc/no_scaling_animation.dart'; import 'package:chabo/screens/error_screen.dart'; import 'package:chabo/widgets/ad_banner_widget.dart'; @@ -39,13 +40,17 @@ class _ForecastScreenState extends CustomWidgetState { const Expanded( child: FloatingActionsWidget(), ), - Padding( - padding: EdgeInsets.only( - left: state.isRightHanded ? 32 : 0, - right: state.isRightHanded ? 0 : 32, - top: 5, - ), - child: const AdBannerWidget(), + Row( + children: [ + Padding( + padding: EdgeInsets.only( + left: state.isRightHanded ? 32 : 0, + right: state.isRightHanded ? 0 : 32, + top: 5, + ), + child: const AdBannerWidget(), + ), + ], ), ], ), @@ -132,36 +137,85 @@ class _ForecastScreenState extends CustomWidgetState { }, child: BlocBuilder( builder: (context, state) { - return CustomScrollView( - physics: const BouncingScrollPhysics(), - slivers: [ - SliverAppBar( - pinned: true, - snap: false, - stretch: true, - collapsedHeight: 250, - expandedHeight: 250, - shadowColor: Colors.black, - backgroundColor: Theme.of(context) - .colorScheme - .surfaceVariant, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical( - bottom: Radius.circular( - CustomProperties.borderRadius * 2, + return DeviceHelper.isPortrait(context) + ? CustomScrollView( + physics: const BouncingScrollPhysics(), + slivers: [ + SliverAppBar( + pinned: true, + snap: false, + stretch: true, + collapsedHeight: 250, + expandedHeight: 250, + shadowColor: Colors.black, + backgroundColor: Theme.of(context) + .colorScheme + .surfaceVariant, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical( + bottom: Radius.circular( + CustomProperties.borderRadius * 2, + ), + ), + ), + flexibleSpace: const FlexibleSpaceBar( + titlePadding: EdgeInsets.zero, + centerTitle: true, + expandedTitleScale: 1, + title: StatusWidget(), + ), ), - ), - ), - flexibleSpace: const FlexibleSpaceBar( - titlePadding: EdgeInsets.zero, - centerTitle: true, - expandedTitleScale: 1, - title: StatusWidget(), - ), - ), - const ForecastListWidget(), - ], - ); + const ForecastListWidget(), + ], + ) + : Row( + children: [ + Flexible( + flex: !DeviceHelper.isMobile(context) + ? 2 + : 1, + child: Column( + children: [ + Container( + decoration: BoxDecoration( + color: Theme.of(context) + .colorScheme + .surfaceVariant, + borderRadius: + const BorderRadius.vertical( + bottom: Radius.circular( + CustomProperties + .borderRadius * + 2, + ), + ), + ), + constraints: BoxConstraints( + minHeight: + DeviceHelper.isMobile( + context, + ) + ? 270 + : 380, + ), + child: const StatusWidget(), + ), + const SizedBox( + height: 50, + ), + ], + ), + ), + const Flexible( + child: CustomScrollView( + physics: BouncingScrollPhysics(), + slivers: [ + ForecastListWidget(), + ], + ), + ), + ], + ); }, ), ), diff --git a/lib/widgets/ad_banner_widget.dart b/lib/widgets/ad_banner_widget.dart index 3822e6da..0a9a7a43 100644 --- a/lib/widgets/ad_banner_widget.dart +++ b/lib/widgets/ad_banner_widget.dart @@ -1,6 +1,7 @@ import 'dart:developer' as developer; import 'package:chabo/helpers/ad_helper.dart'; +import 'package:chabo/helpers/device_helper.dart'; import 'package:flutter/material.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; @@ -56,11 +57,21 @@ class _AdBannerWidgetState extends State { @override Widget build(BuildContext context) { + final screenWidth = MediaQuery.of(context).size.width; + return _ad != null ? Card( child: Container( key: const ValueKey('adContent'), - height: 55, + constraints: BoxConstraints( + maxHeight: 55, + maxWidth: DeviceHelper.isPortrait(context) + ? screenWidth / 1.11 + //ignore: avoid-nested-conditional-expressions + : !DeviceHelper.isMobile(context) + ? screenWidth / 1.55 + : screenWidth / 2.13, + ), alignment: Alignment.center, child: AnimatedSize( curve: Curves.ease, diff --git a/lib/widgets/floating_actions/floating_actions_widget.dart b/lib/widgets/floating_actions/floating_actions_widget.dart index f2b92a97..cbdf7501 100644 --- a/lib/widgets/floating_actions/floating_actions_widget.dart +++ b/lib/widgets/floating_actions/floating_actions_widget.dart @@ -2,8 +2,9 @@ import 'dart:ui'; import 'package:chabo/cubits/floating_actions_cubit.dart'; import 'package:chabo/custom_properties.dart'; -import 'package:chabo/dialogs/chabo_about_dialog.dart'; +import 'package:chabo/dialogs/chabo_about_dialog/chabo_about_dialog.dart'; import 'package:chabo/helpers/custom_page_routes.dart'; +import 'package:chabo/helpers/device_helper.dart'; import 'package:chabo/screens/notification_screen/notification_screen.dart'; import 'package:chabo/widgets/floating_actions/floating_actions_item.dart'; import 'package:chabo/widgets/theme_switcher_widget.dart'; @@ -62,7 +63,10 @@ class _FloatingActionsWidgetState extends State sigmaY: CustomProperties.blurSigmaY, ), child: Wrap( - direction: Axis.vertical, + direction: DeviceHelper.isMobile(context) && + !DeviceHelper.isPortrait(context) + ? Axis.horizontal + : Axis.vertical, crossAxisAlignment: state.isRightHanded ? WrapCrossAlignment.end : WrapCrossAlignment.start, @@ -91,8 +95,10 @@ class _FloatingActionsWidgetState extends State onPressed: () { showModalBottomSheet( useSafeArea: true, - constraints: const BoxConstraints( - minWidth: double.infinity, + constraints: BoxConstraints( + minWidth: DeviceHelper.isPortrait(context) + ? double.infinity + : MediaQuery.of(context).size.width / 3, ), enableDrag: false, context: context, diff --git a/lib/widgets/forecast/forecast_list_widget.dart b/lib/widgets/forecast/forecast_list_widget.dart index eb5fea70..3d0ef8a6 100644 --- a/lib/widgets/forecast/forecast_list_widget.dart +++ b/lib/widgets/forecast/forecast_list_widget.dart @@ -2,7 +2,7 @@ import 'package:chabo/bloc/forecast/forecast_bloc.dart'; import 'package:chabo/bloc/notification/notification_bloc.dart'; import 'package:chabo/bloc/scroll_status/scroll_status_bloc.dart'; import 'package:chabo/models/abstract_forecast.dart'; -import 'package:chabo/widgets/forecast/forecast_list_item_widget/forecast_list_item_widget.dart'; +import 'package:chabo/widgets/forecast/forecast_widget/forecast_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:intl/intl.dart'; @@ -42,7 +42,7 @@ class _ForecastListWidgetState extends State { .computeSlotInterference(timeSlotState.timeSlotsValue); return !forecast.hasPassed() - ? ForecastListItemWidget( + ? ForecastWidget( key: GlobalObjectKey(forecast.hashCode), isCurrent: forecast == forecastState.currentForecast, hasPassed: forecast.hasPassed(), diff --git a/lib/widgets/forecast/forecast_list_item_widget/closing_info_widget.dart b/lib/widgets/forecast/forecast_widget/closing_info_widget.dart similarity index 95% rename from lib/widgets/forecast/forecast_list_item_widget/closing_info_widget.dart rename to lib/widgets/forecast/forecast_widget/closing_info_widget.dart index 4c99e900..3acfa86e 100644 --- a/lib/widgets/forecast/forecast_list_item_widget/closing_info_widget.dart +++ b/lib/widgets/forecast/forecast_widget/closing_info_widget.dart @@ -1,4 +1,4 @@ -part of 'forecast_list_item_widget.dart'; +part of 'forecast_widget.dart'; class _ClosingInfoWidget extends StatelessWidget { final AbstractForecast forecast; diff --git a/lib/widgets/forecast/forecast_list_item_widget/duration_widget.dart b/lib/widgets/forecast/forecast_widget/duration_widget.dart similarity index 94% rename from lib/widgets/forecast/forecast_list_item_widget/duration_widget.dart rename to lib/widgets/forecast/forecast_widget/duration_widget.dart index c6e1a027..3e8f920a 100644 --- a/lib/widgets/forecast/forecast_list_item_widget/duration_widget.dart +++ b/lib/widgets/forecast/forecast_widget/duration_widget.dart @@ -1,4 +1,4 @@ -part of 'forecast_list_item_widget.dart'; +part of 'forecast_widget.dart'; class _DurationWidget extends StatelessWidget { final AbstractForecast forecast; diff --git a/lib/widgets/forecast/forecast_list_item_widget/forecast_list_item_widget.dart b/lib/widgets/forecast/forecast_widget/forecast_widget.dart similarity index 98% rename from lib/widgets/forecast/forecast_list_item_widget/forecast_list_item_widget.dart rename to lib/widgets/forecast/forecast_widget/forecast_widget.dart index 027c3239..bf4b410d 100644 --- a/lib/widgets/forecast/forecast_list_item_widget/forecast_list_item_widget.dart +++ b/lib/widgets/forecast/forecast_widget/forecast_widget.dart @@ -20,7 +20,7 @@ part 'opening_info_widget.dart'; part 'time_slot_warning_widget.dart'; -class ForecastListItemWidget extends StatelessWidget { +class ForecastWidget extends StatelessWidget { final AbstractForecast forecast; final Function()? onTap; final bool hasPassed; @@ -29,7 +29,7 @@ class ForecastListItemWidget extends StatelessWidget { final int index; final Color? backgroundColor; - const ForecastListItemWidget({ + const ForecastWidget({ Key? key, required this.forecast, required this.index, diff --git a/lib/widgets/forecast/forecast_list_item_widget/leading_icon_widget.dart b/lib/widgets/forecast/forecast_widget/leading_icon_widget.dart similarity index 95% rename from lib/widgets/forecast/forecast_list_item_widget/leading_icon_widget.dart rename to lib/widgets/forecast/forecast_widget/leading_icon_widget.dart index dbb0d5bb..5823f0df 100644 --- a/lib/widgets/forecast/forecast_list_item_widget/leading_icon_widget.dart +++ b/lib/widgets/forecast/forecast_widget/leading_icon_widget.dart @@ -1,4 +1,4 @@ -part of 'forecast_list_item_widget.dart'; +part of 'forecast_widget.dart'; class _LeadingIconWidget extends StatelessWidget { final AbstractForecast forecast; diff --git a/lib/widgets/forecast/forecast_list_item_widget/opening_info_widget.dart b/lib/widgets/forecast/forecast_widget/opening_info_widget.dart similarity index 95% rename from lib/widgets/forecast/forecast_list_item_widget/opening_info_widget.dart rename to lib/widgets/forecast/forecast_widget/opening_info_widget.dart index 6bbab2ad..032c53db 100644 --- a/lib/widgets/forecast/forecast_list_item_widget/opening_info_widget.dart +++ b/lib/widgets/forecast/forecast_widget/opening_info_widget.dart @@ -1,4 +1,4 @@ -part of 'forecast_list_item_widget.dart'; +part of 'forecast_widget.dart'; class _OpeningInfoWidget extends StatelessWidget { final AbstractForecast forecast; diff --git a/lib/widgets/forecast/forecast_list_item_widget/time_slot_warning_widget.dart b/lib/widgets/forecast/forecast_widget/time_slot_warning_widget.dart similarity index 94% rename from lib/widgets/forecast/forecast_list_item_widget/time_slot_warning_widget.dart rename to lib/widgets/forecast/forecast_widget/time_slot_warning_widget.dart index 8aad2713..bf3853c5 100644 --- a/lib/widgets/forecast/forecast_list_item_widget/time_slot_warning_widget.dart +++ b/lib/widgets/forecast/forecast_widget/time_slot_warning_widget.dart @@ -1,4 +1,4 @@ -part of 'forecast_list_item_widget.dart'; +part of 'forecast_widget.dart'; class _TimeSlotWarningWidget extends StatelessWidget { const _TimeSlotWarningWidget({Key? key}) : super(key: key); diff --git a/lib/widgets/forecast/status_widget/current_status_widget.dart b/lib/widgets/forecast/status_widget/current_status_widget.dart index a09d64f2..64c41377 100644 --- a/lib/widgets/forecast/status_widget/current_status_widget.dart +++ b/lib/widgets/forecast/status_widget/current_status_widget.dart @@ -33,7 +33,7 @@ class _CurrentStatusWidget extends StatelessWidget { padding: const EdgeInsets.symmetric( horizontal: 10, ), - child: ForecastListItemWidget( + child: ForecastWidget( onTap: () => { BlocProvider.of( context, diff --git a/lib/widgets/forecast/status_widget/status_widget.dart b/lib/widgets/forecast/status_widget/status_widget.dart index e01945a1..f3587644 100644 --- a/lib/widgets/forecast/status_widget/status_widget.dart +++ b/lib/widgets/forecast/status_widget/status_widget.dart @@ -5,7 +5,8 @@ import 'package:chabo/bloc/status/status_bloc.dart'; import 'package:chabo/custom_properties.dart'; import 'package:chabo/custom_widget_state.dart'; import 'package:chabo/extensions/duration_extension.dart'; -import 'package:chabo/widgets/forecast/forecast_list_item_widget/forecast_list_item_widget.dart'; +import 'package:chabo/helpers/device_helper.dart'; +import 'package:chabo/widgets/forecast/forecast_widget/forecast_widget.dart'; import 'package:chabo/widgets/progress_indicator/custom_circular_progress_indicator.dart'; import 'package:chabo/widgets/progress_indicator/custom_progress_bar_indicator.dart'; import 'package:flutter/material.dart'; diff --git a/lib/widgets/forecast/status_widget/text_widget.dart b/lib/widgets/forecast/status_widget/text_widget.dart index 96f38cce..2c1e1d22 100644 --- a/lib/widgets/forecast/status_widget/text_widget.dart +++ b/lib/widgets/forecast/status_widget/text_widget.dart @@ -53,7 +53,11 @@ class _TextWidget extends StatelessWidget { style: Theme.of(context).textTheme.headlineLarge?.copyWith( color: statusState.foregroundColor, fontWeight: FontWeight.bold, - fontSize: 30, + fontSize: DeviceHelper.isMobile(context) + ? 30 + : DeviceHelper.isPortrait(context) + ? 30 + : 55, ), ), ),