Skip to content

Commit

Permalink
Use a transparent placeholder when switching chapter image
Browse files Browse the repository at this point in the history
closes #583
  • Loading branch information
erdemyerebasmaz committed May 16, 2024
1 parent 225b633 commit 249d354
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 20 deletions.
45 changes: 28 additions & 17 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ void main() async {
final repository = SembastRepository();
await Firebase.initializeApp();
_configureEasyLoading();
SharedPreferences.getInstance().then((preferences) async {
await runMigration(preferences);
AppBlocs blocs = AppBlocs(repository.backupDatabaseListener);
runApp(AppBlocsProvider(
appBlocs: blocs,
child: AnytimePodcastApp(
SharedPreferences.getInstance().then(
(preferences) async {
await runMigration(preferences);
AppBlocs blocs = AppBlocs(repository.backupDatabaseListener);
runApp(
AppBlocsProvider(
appBlocs: blocs,
child: AnytimePodcastApp(
mobileService,
repository,
Provider<PodcastPaymentsBloc>(
Expand All @@ -65,17 +67,26 @@ void main() async {
),
dispose: (_, value) => value.dispose(),
child: PlayerControlsBuilder(
builder: playerBuilder,
child: PlaceholderBuilder(
builder: placeholderBuilder,
errorBuilder: errorPlaceholderBuilder,
child: SharePodcastButtonBuilder(
builder: sharePodcastButtonBuilder,
child: ShareEpisodeButtonBuilder(
builder: shareEpisodeButtonBuilder,
child: UserApp(repository.reloadDatabaseSink))))),
))));
});
builder: playerBuilder,
child: PlaceholderBuilder(
builder: placeholderBuilder,
errorBuilder: errorPlaceholderBuilder,
podcastImageBuilder: podcastImagePlaceholderBuilder,
child: SharePodcastButtonBuilder(
builder: sharePodcastButtonBuilder,
child: ShareEpisodeButtonBuilder(
builder: shareEpisodeButtonBuilder,
child: UserApp(repository.reloadDatabaseSink),
),
),
),
),
),
),
),
);
},
);
}, (error, stackTrace) async {
BreezBridge breezBridge = ServiceInjector().breezBridge;
if (error is! FlutterErrorDetails) {
Expand Down
8 changes: 8 additions & 0 deletions lib/routes/podcast/podcast_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ WidgetBuilder placeholderBuilder() {
return builder;
}

WidgetBuilder podcastImagePlaceholderBuilder() {
builder(BuildContext context) => Container(
color: Colors.transparent,
constraints: const BoxConstraints.expand(),
);
return builder;
}

WidgetBuilder errorPlaceholderBuilder() {
builder(BuildContext context) => Placeholder(
color: Theme.of(context).colorScheme.error,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "7ae0038eb14e1ebaa1eb8a26ae144a795e0b787d"
resolved-ref: "7ae0038eb14e1ebaa1eb8a26ae144a795e0b787d"
ref: db9f878aa640954aa272e92bd7a5c364683179a9
resolved-ref: db9f878aa640954aa272e92bd7a5c364683179a9
url: "https://github.com/breez/anytime_podcast_player.git"
source: git
version: "1.2.1+74-breez"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ dependencies:
anytime:
git:
url: https://github.com/breez/anytime_podcast_player.git
ref: 7ae0038eb14e1ebaa1eb8a26ae144a795e0b787d
ref: db9f878aa640954aa272e92bd7a5c364683179a9
flutter_downloader:
git:
url: https://github.com/breez/flutter_downloader.git
Expand Down

0 comments on commit 249d354

Please sign in to comment.