Files
feeddeck/app/lib/main.dart
dependabot[bot] 648ed898d9 Bump the pub group across 1 directory with 25 updates (#279)
* Bump the pub group across 1 directory with 25 updates

Bumps the pub group with 23 updates in the /app directory:

| Package | From | To |
| --- | --- | --- |
| [carousel_slider](https://github.com/serenader2014/flutter_carousel_slider) | `5.0.0` | `5.1.1` |
| [file_picker](https://github.com/miguelpruivo/flutter_file_picker) | `10.1.2` | `10.2.0` |
| [flutter_launcher_icons](https://github.com/fluttercommunity/flutter_launcher_icons) | `0.14.3` | `0.14.4` |
| [flutter_lints](https://github.com/flutter/packages/tree/main/packages) | `5.0.0` | `6.0.0` |
| [flutter_markdown](https://github.com/flutter/packages/tree/main/packages) | `0.7.6` | `0.7.7+1` |
| [flutter_native_splash](https://github.com/jonbhanson/flutter_native_splash) | `2.4.5` | `2.4.6` |
| [html](https://github.com/dart-lang/tools/tree/main/pkgs) | `0.15.5` | `0.15.6` |
| [http](https://github.com/dart-lang/http/tree/master/pkgs) | `1.3.0` | `1.4.0` |
| [intl](https://github.com/dart-lang/i18n/tree/main/pkgs) | `0.19.0` | `0.20.2` |
| [just_audio](https://github.com/ryanheise/just_audio) | `0.9.46` | `0.10.4` |
| [just_audio_background](https://github.com/ryanheise/just_audio) | `0.0.1-beta.15` | `0.0.1-beta.17` |
| [just_audio_media_kit](https://github.com/Pato05/just_audio_media_kit) | `2.0.6` | `2.1.0` |
| [media_kit_libs_video](https://github.com/media-kit/media-kit) | `1.0.5` | `1.0.6` |
| [media_kit_video](https://github.com/media-kit/media-kit) | `1.2.5` | `1.3.0` |
| [msix](https://github.com/YehudaKremer/msix) | `3.16.8` | `3.16.9` |
| [provider](https://github.com/rrousselGit/provider) | `6.1.2` | `6.1.5` |
| [purchases_flutter](https://github.com/RevenueCat/purchases-flutter) | `8.6.1` | `9.1.0` |
| [shared_preferences](https://github.com/flutter/packages/tree/main/packages/shared_preferences) | `2.5.2` | `2.5.3` |
| [sign_in_with_apple](https://github.com/aboutyou/dart_packages) | `6.1.4` | `7.0.1` |
| [supabase_flutter](https://github.com/supabase/supabase-flutter/tree/main/packages) | `2.8.4` | `2.9.1` |
| [url_launcher](https://github.com/flutter/packages/tree/main/packages/url_launcher) | `6.3.1` | `6.3.2` |
| [window_manager](https://github.com/leanflutter/window_manager) | `0.4.3` | `0.5.1` |
| [youtube_explode_dart](https://github.com/Hexer10/youtube_explode_dart) | `2.3.10` | `2.5.1` |



Updates `carousel_slider` from 5.0.0 to 5.1.1
- [Release notes](https://github.com/serenader2014/flutter_carousel_slider/releases)
- [Changelog](https://github.com/serenader2014/flutter_carousel_slider/blob/master/CHANGELOG.md)
- [Commits](https://github.com/serenader2014/flutter_carousel_slider/commits)

Updates `file_picker` from 10.1.2 to 10.2.0
- [Release notes](https://github.com/miguelpruivo/flutter_file_picker/releases)
- [Changelog](https://github.com/miguelpruivo/flutter_file_picker/blob/master/CHANGELOG.md)
- [Commits](https://github.com/miguelpruivo/flutter_file_picker/commits)

Updates `flutter_launcher_icons` from 0.14.3 to 0.14.4
- [Release notes](https://github.com/fluttercommunity/flutter_launcher_icons/releases)
- [Changelog](https://github.com/fluttercommunity/flutter_launcher_icons/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fluttercommunity/flutter_launcher_icons/commits/v0.14.4)

Updates `flutter_lints` from 5.0.0 to 6.0.0
- [Release notes](https://github.com/flutter/packages/releases)
- [Commits](https://github.com/flutter/packages/commits/flutter_lints-v6.0.0/packages)

Updates `flutter_markdown` from 0.7.6 to 0.7.7+1
- [Release notes](https://github.com/flutter/packages/releases)
- [Commits](https://github.com/flutter/packages/commits/flutter_markdown-v0.7.7/packages)

Updates `flutter_native_splash` from 2.4.5 to 2.4.6
- [Release notes](https://github.com/jonbhanson/flutter_native_splash/releases)
- [Changelog](https://github.com/jonbhanson/flutter_native_splash/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jonbhanson/flutter_native_splash/compare/v2.4.5...v2.4.6)

Updates `html` from 0.15.5 to 0.15.6
- [Release notes](https://github.com/dart-lang/tools/releases)
- [Commits](https://github.com/dart-lang/tools/commits/html-v0.15.6/pkgs)

Updates `http` from 1.3.0 to 1.4.0
- [Release notes](https://github.com/dart-lang/http/releases)
- [Commits](https://github.com/dart-lang/http/commits/HEAD/pkgs)

Updates `intl` from 0.19.0 to 0.20.2
- [Release notes](https://github.com/dart-lang/i18n/releases)
- [Commits](https://github.com/dart-lang/i18n/commits/intl-v0.20.2/pkgs)

Updates `just_audio` from 0.9.46 to 0.10.4
- [Release notes](https://github.com/ryanheise/just_audio/releases)
- [Commits](https://github.com/ryanheise/just_audio/compare/just_audio-v0.9.46...just_audio-v0.10.4)

Updates `just_audio_background` from 0.0.1-beta.15 to 0.0.1-beta.17
- [Release notes](https://github.com/ryanheise/just_audio/releases)
- [Commits](https://github.com/ryanheise/just_audio/compare/just_audio_background-v0.0.1-beta.15...just_audio_background-v0.0.1-beta.17)

Updates `just_audio_media_kit` from 2.0.6 to 2.1.0
- [Changelog](https://github.com/Pato05/just_audio_media_kit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Pato05/just_audio_media_kit/compare/v2.0.6...v2.1.0)

Updates `media_kit` from 1.1.11 to 1.2.0
- [Release notes](https://github.com/media-kit/media-kit/releases)
- [Changelog](https://github.com/media-kit/media-kit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/media-kit/media-kit/commits/media_kit_video-v1.2.0)

Updates `media_kit_libs_video` from 1.0.5 to 1.0.6
- [Release notes](https://github.com/media-kit/media-kit/releases)
- [Changelog](https://github.com/media-kit/media-kit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/media-kit/media-kit/compare/media_kit_libs_ios_audio-v1.0.5...media_kit_libs_macos_audio-v1.0.6)

Updates `media_kit_video` from 1.2.5 to 1.3.0
- [Release notes](https://github.com/media-kit/media-kit/releases)
- [Changelog](https://github.com/media-kit/media-kit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/media-kit/media-kit/commits/media_kit_libs_android_audio-v1.3.0)

Updates `msix` from 3.16.8 to 3.16.9
- [Release notes](https://github.com/YehudaKremer/msix/releases)
- [Changelog](https://github.com/YehudaKremer/msix/blob/main/CHANGELOG.md)
- [Commits](https://github.com/YehudaKremer/msix/compare/v3.16.8...v3.16.9)

Updates `provider` from 6.1.2 to 6.1.5
- [Commits](https://github.com/rrousselGit/provider/compare/provider-v6.1.2...provider-v6.1.5)

Updates `purchases_flutter` from 8.6.1 to 9.1.0
- [Release notes](https://github.com/RevenueCat/purchases-flutter/releases)
- [Changelog](https://github.com/RevenueCat/purchases-flutter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/RevenueCat/purchases-flutter/compare/8.6.1...9.1.0)

Updates `shared_preferences` from 2.5.2 to 2.5.3
- [Release notes](https://github.com/flutter/packages/releases)
- [Commits](https://github.com/flutter/packages/commits/shared_preferences-v2.5.3/packages/shared_preferences)

Updates `sign_in_with_apple` from 6.1.4 to 7.0.1
- [Release notes](https://github.com/aboutyou/dart_packages/releases)
- [Commits](https://github.com/aboutyou/dart_packages/commits)

Updates `supabase_flutter` from 2.8.4 to 2.9.1
- [Changelog](https://github.com/supabase/supabase-flutter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/supabase/supabase-flutter/commits/HEAD/packages)

Updates `timeago` from 3.7.0 to 3.7.1
- [Commits](https://github.com/andresaraujo/timeago.dart/commits)

Updates `url_launcher` from 6.3.1 to 6.3.2
- [Release notes](https://github.com/flutter/packages/releases)
- [Commits](https://github.com/flutter/packages/commits/url_launcher-v6.3.2/packages/url_launcher)

Updates `window_manager` from 0.4.3 to 0.5.1
- [Release notes](https://github.com/leanflutter/window_manager/releases)
- [Commits](https://github.com/leanflutter/window_manager/commits)

Updates `youtube_explode_dart` from 2.3.10 to 2.5.1
- [Release notes](https://github.com/Hexer10/youtube_explode_dart/releases)
- [Changelog](https://github.com/Hexer10/youtube_explode_dart/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Hexer10/youtube_explode_dart/compare/v2.3.10...v2.5.1)

---
updated-dependencies:
- dependency-name: carousel_slider
  dependency-version: 5.1.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
- dependency-name: file_picker
  dependency-version: 10.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
- dependency-name: flutter_launcher_icons
  dependency-version: 0.14.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: flutter_lints
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: pub
- dependency-name: flutter_markdown
  dependency-version: 0.7.7+1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: flutter_native_splash
  dependency-version: 2.4.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: html
  dependency-version: 0.15.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: http
  dependency-version: 1.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
- dependency-name: intl
  dependency-version: 0.20.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
- dependency-name: just_audio
  dependency-version: 0.10.4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
- dependency-name: just_audio_background
  dependency-version: 0.0.1-beta.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: just_audio_media_kit
  dependency-version: 2.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
- dependency-name: media_kit
  dependency-version: 1.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
- dependency-name: media_kit_libs_video
  dependency-version: 1.0.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: media_kit_video
  dependency-version: 1.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
- dependency-name: msix
  dependency-version: 3.16.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: provider
  dependency-version: 6.1.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: purchases_flutter
  dependency-version: 9.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: pub
- dependency-name: shared_preferences
  dependency-version: 2.5.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: sign_in_with_apple
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: pub
- dependency-name: supabase_flutter
  dependency-version: 2.9.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
- dependency-name: timeago
  dependency-version: 3.7.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: url_launcher
  dependency-version: 6.3.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: pub
- dependency-name: window_manager
  dependency-version: 0.5.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
- dependency-name: youtube_explode_dart
  dependency-version: 2.5.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: pub
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update Flutter Version to 3.32.7

- Update Flutter version to 3.32.7
- Enable Swift Package Manager for iOS and macOS

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ricoberger <mail@ricoberger.de>
2025-07-27 15:23:10 +02:00

211 lines
8.3 KiB
Dart

import 'dart:io' show Platform;
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:just_audio_background/just_audio_background.dart';
import 'package:media_kit/media_kit.dart';
import 'package:provider/provider.dart';
import 'package:window_manager/window_manager.dart';
import 'package:feeddeck/repositories/app_repository.dart';
import 'package:feeddeck/repositories/layout_repository.dart';
import 'package:feeddeck/repositories/profile_repository.dart';
import 'package:feeddeck/repositories/settings_repository.dart';
import 'package:feeddeck/utils/constants.dart';
import 'package:feeddeck/widgets/confirmation/confirmation.dart';
import 'package:feeddeck/widgets/home/home.dart';
import 'package:feeddeck/widgets/item/details/utils/item_audio_palyer/item_audio_player_init/item_audio_player_init.dart';
import 'package:feeddeck/widgets/reset_password/reset_password.dart';
/// Before we are calling [runApp] we have to ensure that the widget bindings
/// are initialized, so that we can preserve the splash screen until we are done
/// with the initalization of the app.
void main() async {
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
/// We have to initialize the [windowManager] before we are calling [runApp]
/// on all desktop platforms, so we can set the window size, title and so on.
if (!kIsWeb && (Platform.isLinux || Platform.isMacOS || Platform.isWindows)) {
await windowManager.ensureInitialized();
WindowOptions windowOptions = const WindowOptions(
size: Size(1024, 768),
center: true,
backgroundColor: Colors.transparent,
skipTaskbar: false,
titleBarStyle: TitleBarStyle.normal,
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.setTitle('FeedDeck');
await windowManager.show();
await windowManager.focus();
});
}
/// Initialize the [media_kit] packages, so that we can play audio and video
/// files.
MediaKit.ensureInitialized();
if (!kIsWeb && (Platform.isLinux || Platform.isWindows)) {
ItemAudioPlayerInit().init();
}
/// Initialize the [just_audio_background] package, so that we can play audio
/// files in the background.
///
/// We can not initialize the [just_audio_background] package on Windows and
/// Linux, because then the returned duration in the `_player.durationStream`
/// isn't working correctly in the [ItemAudioPlayer] widget.
if (kIsWeb || Platform.isAndroid || Platform.isIOS || Platform.isMacOS) {
await JustAudioBackground.init(
androidNotificationChannelId: 'com.ryanheise.bg_demo.channel.audio',
androidNotificationChannelName: 'Audio playback',
androidNotificationOngoing: true,
);
}
/// For the ewb we have to use the path url strategy, so that the redirect
/// within Supabase is working in all cases. On all other platforms this is a
/// noop.
usePathUrlStrategy();
/// We also have to initialize the [SettingsRepository], which contains all
/// the settings, to use the app with Supabase. This way a user can also use
/// his own Supabase backend.
await SettingsRepository().init();
runApp(const FeedDeckApp());
}
/// [FeedDeckScrollBehavior] changes the scrolling behavior of the app. This is
/// required to enable scrolling on desktop via drag, which is the only way that
/// a user can scroll vertically with a mouse via drag.
///
/// E.g. this is required for the [ColumnLayoutSources] widget, where we rely on
/// the drag gesture to scroll the list of sources.
class FeedDeckScrollBehavior extends MaterialScrollBehavior {
@override
Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
PointerDeviceKind.trackpad,
PointerDeviceKind.stylus,
PointerDeviceKind.unknown,
};
}
/// [onGenerateRoute] is used in `onGenerateRoute` and `onGenerateInitialRoutes`
/// of the [MaterialApp] to add handling for some special routes were do not
/// want to render the [Home] widget (e.g. set a new password).
///
/// For that we have to check the current path and when the user call one of
/// this "special" routes we render the corresponding widget and pass all the
/// required values from the query paramters to this widget.
Route onGenerateRoute(RouteSettings settings) {
if (settings.name != null) {
var uriData = Uri.parse(settings.name!);
switch (uriData.path) {
case '/confirmation':
return MaterialPageRoute(
builder: (_) => Confirmation(
template: uriData.queryParameters['template'] ?? '',
confirmationUrl: uriData.queryParameters['confirmation_url'] ?? '',
),
);
case '/reset-password':
return MaterialPageRoute(builder: (_) => const ResetPassword());
}
}
return MaterialPageRoute(builder: (_) => const Home());
}
/// The [FeedDeckApp] is the root widget of the app. The widget is used to
/// initialize some of our providers via the [MultiProvider] widget and to set
/// the theme for the app.
class FeedDeckApp extends StatelessWidget {
const FeedDeckApp({super.key});
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => LayoutRepository()),
ChangeNotifierProvider(create: (_) => AppRepository()),
ChangeNotifierProvider(create: (_) => ProfileRepository()),
],
child: TooltipVisibility(
visible: false,
child: MaterialApp(
title: 'FeedDeck',
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
colorScheme: const ColorScheme(
brightness: Constants.brightness,
primary: Constants.primary,
onPrimary: Constants.onPrimary,
secondary: Constants.secondary,
onSecondary: Constants.onSecondary,
error: Constants.error,
onError: Constants.onError,
surface: Constants.surface,
onSurface: Constants.onSurface,
),
canvasColor: Constants.canvasColor,
appBarTheme: const AppBarTheme(
centerTitle: true,
backgroundColor: Constants.appBarBackgroundColor,
scrolledUnderElevation: Constants.scrolledUnderElevation,
elevation: Constants.appBarElevation,
),
snackBarTheme: const SnackBarThemeData(
backgroundColor: Constants.secondary,
contentTextStyle: TextStyle(color: Constants.onSurface),
),
dialogTheme: const DialogThemeData(
backgroundColor: Constants.surface,
surfaceTintColor: Constants.surface,
contentTextStyle: TextStyle(color: Constants.onSurface),
),
popupMenuTheme: const PopupMenuThemeData(
color: Constants.surface,
surfaceTintColor: Constants.surface,
textStyle: TextStyle(color: Constants.onSurface),
),
drawerTheme: const DrawerThemeData(
backgroundColor: Constants.surface,
surfaceTintColor: Constants.surface,
),
bottomSheetTheme: const BottomSheetThemeData(
backgroundColor: Constants.surface,
surfaceTintColor: Constants.surface,
),
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
TargetPlatform.android: CupertinoPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
TargetPlatform.linux: CupertinoPageTransitionsBuilder(),
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
TargetPlatform.windows: CupertinoPageTransitionsBuilder(),
},
),
),
scrollBehavior: FeedDeckScrollBehavior(),
onGenerateInitialRoutes: (initialRoute) => [
onGenerateRoute(RouteSettings(name: initialRoute)),
],
onGenerateRoute: (RouteSettings settings) =>
onGenerateRoute(settings),
),
),
);
}
}