diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs
index a8686ad..1886311 100644
--- a/android/.settings/org.eclipse.buildship.core.prefs
+++ b/android/.settings/org.eclipse.buildship.core.prefs
@@ -1,11 +1,11 @@
arguments=
auto.sync=false
build.scans.enabled=false
-connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.1.1))
+connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
-java.home=/usr/lib/jvm/java-17-openjdk-17.0.2.0.8-7.fc36.x86_64
+java.home=/usr/lib/jvm/java-17-openjdk-17.0.3.0.7-1.fc36.x86_64
jvm.arguments=
offline.mode=false
override.workspace.settings=true
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 4fa572b..f33bd52 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -32,9 +32,9 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
}
android {
- compileSdkVersion 29
+ compileSdkVersion 31
- ndkVersion "21.4.7075529"
+ ndkVersion "22.1.7171670"
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 7d99abc..90de22b 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -7,7 +7,7 @@
-
+
diff --git a/android/app/src/main/java/io/flutter/plugins/IsolatePluginRegistrant.java b/android/app/src/main/java/io/flutter/plugins/IsolatePluginRegistrant.java
index 25a9b42..99c729a 100644
--- a/android/app/src/main/java/io/flutter/plugins/IsolatePluginRegistrant.java
+++ b/android/app/src/main/java/io/flutter/plugins/IsolatePluginRegistrant.java
@@ -2,6 +2,7 @@ package io.flutter.plugins;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
+import io.flutter.Log;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;
@@ -11,29 +12,34 @@ import com.tekartik.sqflite.SqflitePlugin;
import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin;
import vn.hunghd.flutterdownloader.FlutterDownloaderPlugin;
-/**
- * Generated file. Do not edit. This file is generated by the Flutter tool based
- * on the plugins that support the Android platform.
- */
-
@Keep
public final class IsolatePluginRegistrant {
- public static void registerWith(PluginRegistry registry) {
- if (alreadyRegisteredWith(registry)) {
- return;
+ private static final String TAG = "CustomPluginRegistrant";
+ public static void registerWith(@NonNull FlutterEngine flutterEngine) {
+ try {
+ flutterEngine.getPlugins().add(new vn.hunghd.flutterdownloader.FlutterDownloaderPlugin());
+ } catch(Exception e) {
+ Log.e(TAG, "Error registering plugin flutter_downloader, vn.hunghd.flutterdownloader.FlutterDownloaderPlugin", e);
}
- PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin"));
- SqflitePlugin.registerWith(registry.registrarFor("com.tekartik.sqflite.SqflitePlugin"));
- SharedPreferencesPlugin.registerWith(registry.registrarFor("io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin"));
- FlutterDownloaderPlugin.registerWith(registry.registrarFor("vn.hunghd.flutterdownloader.FlutterDownloaderPlugin"));
- }
-
- private static boolean alreadyRegisteredWith(PluginRegistry registry) {
- final String key = IsolatePluginRegistrant.class.getCanonicalName();
- if (registry.hasPlugin(key)) {
- return true;
+ try {
+ flutterEngine.getPlugins().add(new com.rmawatson.flutterisolate.FlutterIsolatePlugin());
+ } catch(Exception e) {
+ Log.e(TAG, "Error registering plugin flutter_isolate, com.rmawatson.flutterisolate.FlutterIsolatePlugin", e);
+ }
+ try {
+ flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
+ } catch(Exception e) {
+ Log.e(TAG, "Error registering plugin path_provider_android, io.flutter.plugins.pathprovider.PathProviderPlugin", e);
+ }
+ try {
+ flutterEngine.getPlugins().add(new io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin());
+ } catch(Exception e) {
+ Log.e(TAG, "Error registering plugin shared_preferences, io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin", e);
+ }
+ try {
+ flutterEngine.getPlugins().add(new com.tekartik.sqflite.SqflitePlugin());
+ } catch(Exception e) {
+ Log.e(TAG, "Error registering plugin sqflite, com.tekartik.sqflite.SqflitePlugin", e);
}
- registry.registrarFor(key);
- return false;
}
}
\ No newline at end of file
diff --git a/android/app/src/main/kotlin/com/stonegate/tsacdop/MainActivity.kt b/android/app/src/main/kotlin/com/stonegate/tsacdop/MainActivity.kt
index 1f4cac6..678a0b2 100644
--- a/android/app/src/main/kotlin/com/stonegate/tsacdop/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/stonegate/tsacdop/MainActivity.kt
@@ -17,7 +17,6 @@ import com.rmawatson.flutterisolate.FlutterIsolatePlugin
class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
- FlutterIsolatePlugin.setCustomIsolateRegistrant(IsolatePluginRegistrant::class.java);
MethodChannel(flutterEngine.dartExecutor, "android_app_retain").apply {
setMethodCallHandler { method, result ->
if (method.method == "sendToBackground") {
diff --git a/android/app/src/main/kotlin/com/stonegate/tsacdop/MainApplication.kt b/android/app/src/main/kotlin/com/stonegate/tsacdop/MainApplication.kt
new file mode 100644
index 0000000..05e8eb8
--- /dev/null
+++ b/android/app/src/main/kotlin/com/stonegate/tsacdop/MainApplication.kt
@@ -0,0 +1,10 @@
+package com.stonegate.tsacdop
+import com.rmawatson.flutterisolate.FlutterIsolatePlugin
+import io.flutter.app.FlutterApplication
+import io.flutter.plugins.IsolatePluginRegistrant
+
+public class MainApplication: FlutterApplication() {
+ public fun MainApplication() {
+ FlutterIsolatePlugin.setCustomIsolateRegistrant(IsolatePluginRegistrant::class.java);
+ }
+}
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index 94e89a3..f72f1f7 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,5 +1,5 @@
buildscript {
- ext.kotlin_version = '1.3.70'
+ ext.kotlin_version = '1.6.21'
repositories {
google()
jcenter()
diff --git a/lib/episodes/episode_detail.dart b/lib/episodes/episode_detail.dart
index e96e7d2..35c6710 100644
--- a/lib/episodes/episode_detail.dart
+++ b/lib/episodes/episode_detail.dart
@@ -44,7 +44,7 @@ class _EpisodeDetailState extends State {
String? path;
Future _getPosition(EpisodeBrief episode) async {
- var dbHelper = DBHelper();
+ final dbHelper = DBHelper();
return await dbHelper.getPosition(episode);
}
@@ -86,204 +86,205 @@ class _EpisodeDetailState extends State {
@override
Widget build(BuildContext context) {
+ SystemChrome.setSystemUIOverlayStyle(
+ SystemUiOverlayStyle(
+ statusBarColor: Colors.transparent,
+ systemNavigationBarColor: Colors.transparent,
+ systemNavigationBarContrastEnforced: false,
+ systemNavigationBarIconBrightness: context.iconBrightness,
+ statusBarBrightness: context.brightness,
+ statusBarIconBrightness: context.iconBrightness),
+ );
final s = context.s!;
final audio = context.watch();
- return AnnotatedRegion(
- value: SystemUiOverlayStyle(
- statusBarIconBrightness: Theme.of(context).accentColorBrightness,
- systemNavigationBarColor: Theme.of(context).primaryColor,
- systemNavigationBarIconBrightness:
- Theme.of(context).accentColorBrightness,
- ),
- child: WillPopScope(
- onWillPop: () async {
- if (_playerKey.currentState != null &&
- _playerKey.currentState!.initSize! > 100) {
- _playerKey.currentState!.backToMini();
- return false;
- } else {
- return true;
- }
- },
- child: Scaffold(
- backgroundColor: Theme.of(context).primaryColor,
- body: Stack(
+ return WillPopScope(
+ onWillPop: () async {
+ if (_playerKey.currentState != null &&
+ _playerKey.currentState!.initSize! > 100) {
+ _playerKey.currentState!.backToMini();
+ return false;
+ } else {
+ return true;
+ }
+ },
+ child: Scaffold(
+ backgroundColor: Theme.of(context).primaryColor,
+ body: SafeArea(
+ child: Stack(
children: [
- SafeArea(
- child: ScrollConfiguration(
- behavior: NoGrowBehavior(),
- child: NestedScrollView(
- scrollDirection: Axis.vertical,
- controller: _controller,
- headerSliverBuilder: (context, innerBoxScrolled) {
- return [
- SliverAppBar(
- floating: true,
- pinned: true,
- title: _showTitle
- ? Text(
- widget.episodeItem!.title!,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- )
- : Text(
- widget.episodeItem!.feedTitle!,
- maxLines: 1,
- style: TextStyle(
- fontSize: 15,
- color:
- context.textColor!.withOpacity(0.7)),
- ),
- leading: CustomBackButton(),
- elevation: _showTitle ? 1 : 0,
- ),
- ];
- },
- body: SingleChildScrollView(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding: EdgeInsets.symmetric(horizontal: 20.0),
- child: Align(
- alignment: Alignment.centerLeft,
- child: Text(
+ ScrollConfiguration(
+ behavior: NoGrowBehavior(),
+ child: NestedScrollView(
+ scrollDirection: Axis.vertical,
+ controller: _controller,
+ headerSliverBuilder: (context, innerBoxScrolled) {
+ return [
+ SliverAppBar(
+ floating: true,
+ pinned: true,
+ title: _showTitle
+ ? Text(
widget.episodeItem!.title!,
- textAlign: TextAlign.left,
- style: Theme.of(context).textTheme.headline5,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ )
+ : Text(
+ widget.episodeItem!.feedTitle!,
+ maxLines: 1,
+ style: TextStyle(
+ fontSize: 15,
+ color:
+ context.textColor!.withOpacity(0.7)),
),
+ leading: CustomBackButton(),
+ elevation: _showTitle ? 1 : 0,
+ ),
+ ];
+ },
+ body: SingleChildScrollView(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: EdgeInsets.symmetric(horizontal: 20.0),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Text(
+ widget.episodeItem!.title!,
+ textAlign: TextAlign.left,
+ style: Theme.of(context).textTheme.headline5,
),
),
- Padding(
- padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
- child: Row(
- children: [
- Text(
- s.published(DateFormat.yMMMd().format(
- DateTime.fromMillisecondsSinceEpoch(
- widget.episodeItem!.pubDate!))),
- style:
- TextStyle(color: context.accentColor)),
- SizedBox(width: 10),
- if (widget.episodeItem!.explicit == 1)
- Text('E',
- style: TextStyle(
- fontWeight: FontWeight.bold,
- color: Colors.red)),
- Spacer(),
- ],
- ),
+ ),
+ Padding(
+ padding: EdgeInsets.fromLTRB(20, 10, 20, 10),
+ child: Row(
+ children: [
+ Text(
+ s.published(DateFormat.yMMMd().format(
+ DateTime.fromMillisecondsSinceEpoch(
+ widget.episodeItem!.pubDate!))),
+ style:
+ TextStyle(color: context.accentColor)),
+ SizedBox(width: 10),
+ if (widget.episodeItem!.explicit == 1)
+ Text('E',
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ color: Colors.red)),
+ Spacer(),
+ ],
),
- Padding(
- padding: EdgeInsets.symmetric(
- horizontal: 20, vertical: 5),
- child: Row(
- children: [
- if (widget.episodeItem!.duration != 0)
- Container(
- decoration: BoxDecoration(
- color: Colors.cyan[300],
- borderRadius: BorderRadius.all(
- Radius.circular(16.0))),
- height: 28.0,
- margin: EdgeInsets.only(right: 10.0),
- padding: EdgeInsets.symmetric(
- horizontal: 10.0),
- alignment: Alignment.center,
- child: Text(
- s.minsCount(
- widget.episodeItem!.duration! ~/ 60,
- ),
- style: TextStyle(color: Colors.black),
- )),
- if (widget.episodeItem!.enclosureLength !=
- null &&
- widget.episodeItem!.enclosureLength != 0)
- Container(
+ ),
+ Padding(
+ padding: EdgeInsets.symmetric(
+ horizontal: 20, vertical: 5),
+ child: Row(
+ children: [
+ if (widget.episodeItem!.duration != 0)
+ Container(
decoration: BoxDecoration(
- color: Colors.lightBlue[300],
+ color: Colors.cyan[300],
borderRadius: BorderRadius.all(
Radius.circular(16.0))),
height: 28.0,
margin: EdgeInsets.only(right: 10.0),
- padding:
- EdgeInsets.symmetric(horizontal: 10.0),
+ padding: EdgeInsets.symmetric(
+ horizontal: 10.0),
alignment: Alignment.center,
child: Text(
- '${widget.episodeItem!.enclosureLength! ~/ 1000000}MB',
+ s.minsCount(
+ widget.episodeItem!.duration! ~/ 60,
+ ),
style: TextStyle(color: Colors.black),
- ),
+ )),
+ if (widget.episodeItem!.enclosureLength !=
+ null &&
+ widget.episodeItem!.enclosureLength != 0)
+ Container(
+ decoration: BoxDecoration(
+ color: Colors.lightBlue[300],
+ borderRadius: BorderRadius.all(
+ Radius.circular(16.0))),
+ height: 28.0,
+ margin: EdgeInsets.only(right: 10.0),
+ padding:
+ EdgeInsets.symmetric(horizontal: 10.0),
+ alignment: Alignment.center,
+ child: Text(
+ '${widget.episodeItem!.enclosureLength! ~/ 1000000}MB',
+ style: TextStyle(color: Colors.black),
),
- FutureBuilder(
- future: _getPosition(widget.episodeItem!),
- builder: (context, snapshot) {
- if (snapshot.hasError) {
- developer.log(snapshot.error as String);
- }
- if (snapshot.hasData &&
- snapshot.data!.seekValue! < 0.9 &&
- snapshot.data!.seconds! > 10) {
- return ButtonTheme(
- height: 28,
- padding: EdgeInsets.symmetric(
- horizontal: 0),
- child: OutlineButton(
- shape: RoundedRectangleBorder(
- borderRadius:
- BorderRadius.circular(
- 100.0),
- side: BorderSide(
- color:
- context.accentColor)),
- highlightedBorderColor:
- Colors.green[700],
- onPressed: () => audio.episodeLoad(
- widget.episodeItem,
- startPosition:
- (snapshot.data!.seconds! *
- 1000)
- .toInt()),
- child: Row(
- children: [
- SizedBox(
- width: 20,
- height: 20,
- child: CustomPaint(
- painter: ListenedPainter(
- context.textColor,
- stroke: 2.0),
- ),
+ ),
+ FutureBuilder(
+ future: _getPosition(widget.episodeItem!),
+ builder: (context, snapshot) {
+ if (snapshot.hasError) {
+ developer.log(snapshot.error as String);
+ }
+ if (snapshot.hasData &&
+ snapshot.data!.seekValue! < 0.9 &&
+ snapshot.data!.seconds! > 10) {
+ return ButtonTheme(
+ height: 28,
+ padding: EdgeInsets.symmetric(
+ horizontal: 0),
+ child: OutlineButton(
+ shape: RoundedRectangleBorder(
+ borderRadius:
+ BorderRadius.circular(
+ 100.0),
+ side: BorderSide(
+ color:
+ context.accentColor)),
+ highlightedBorderColor:
+ Colors.green[700],
+ onPressed: () => audio.episodeLoad(
+ widget.episodeItem,
+ startPosition:
+ (snapshot.data!.seconds! *
+ 1000)
+ .toInt()),
+ child: Row(
+ children: [
+ SizedBox(
+ width: 20,
+ height: 20,
+ child: CustomPaint(
+ painter: ListenedPainter(
+ context.textColor,
+ stroke: 2.0),
),
- SizedBox(width: 5),
- Text(
- snapshot
- .data!.seconds!.toTime,
- ),
- ],
- ),
+ ),
+ SizedBox(width: 5),
+ Text(
+ snapshot
+ .data!.seconds!.toTime,
+ ),
+ ],
),
- );
- } else {
- return Center();
- }
- }),
- ],
- ),
+ ),
+ );
+ } else {
+ return Center();
+ }
+ }),
+ ],
),
- ShowNote(episode: widget.episodeItem),
- Selector>(
- selector: (_, audio) => Tuple2(
- audio.playerRunning, audio.playerHeight),
- builder: (_, data, __) {
- var height =
- kMinPlayerHeight[data.item2!.index];
- return SizedBox(
- height: data.item1 ? height : 0,
- );
- }),
- ],
- ),
+ ),
+ ShowNote(episode: widget.episodeItem),
+ Selector>(
+ selector: (_, audio) => Tuple2(
+ audio.playerRunning, audio.playerHeight),
+ builder: (_, data, __) {
+ var height =
+ kMinPlayerHeight[data.item2!.index];
+ return SizedBox(
+ height: data.item1 ? height : 0,
+ );
+ }),
+ ],
),
),
),
@@ -451,7 +452,7 @@ class __MenuBarState extends State<_MenuBar> {
_overlayEntry = _createOverlayEntry();
Overlay.of(context)!.insert(_overlayEntry);
await Future.delayed(Duration(seconds: 2));
- _overlayEntry?.remove();
+ _overlayEntry.remove();
})
: _buttonOnMenu(
child: Icon(
diff --git a/lib/episodes/episode_download.dart b/lib/episodes/episode_download.dart
index 88af8a0..624a8c2 100644
--- a/lib/episodes/episode_download.dart
+++ b/lib/episodes/episode_download.dart
@@ -163,7 +163,6 @@ class _DownloadButtonState extends State {
),
),
() => _requestDownload(task.episode));
- break;
case 2:
return Material(
color: Colors.transparent,
@@ -193,7 +192,6 @@ class _DownloadButtonState extends State {
),
),
);
- break;
case 6:
return Material(
color: Colors.transparent,
diff --git a/lib/home/about.dart b/lib/home/about.dart
index 76f6b7b..ef7daf5 100644
--- a/lib/home/about.dart
+++ b/lib/home/about.dart
@@ -299,7 +299,7 @@ class _AboutAppState extends State {
_overlayEntry = _createOverlayEntry(detail);
Overlay.of(context)!.insert(_overlayEntry);
await Future.delayed(Duration(seconds: 2));
- _overlayEntry?.remove();
+ _overlayEntry.remove();
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
diff --git a/lib/home/audioplayer.dart b/lib/home/audioplayer.dart
index f2f1c75..7c97295 100644
--- a/lib/home/audioplayer.dart
+++ b/lib/home/audioplayer.dart
@@ -120,8 +120,7 @@ class PlayerWidget extends StatelessWidget {
TextStyle(color: context.accentColor),
)
: Text(
- s!.timeLeft(
- (data.item2).toInt().toTime ?? ''),
+ s!.timeLeft((data.item2).toInt().toTime),
maxLines: 2,
),
);
@@ -227,7 +226,7 @@ class PlayerWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Selector>(
- selector: (_, audio) => Tuple2(audio.playerRunning, audio?.playerHeight),
+ selector: (_, audio) => Tuple2(audio.playerRunning, audio.playerHeight),
builder: (_, data, __) {
if (!data.item1) {
return Center();
@@ -358,7 +357,8 @@ class LastPosition extends StatelessWidget {
color: context.accentColor)),
highlightedBorderColor: Colors.green[700],
onPressed: () => audio.seekTo(
- (snapshot.data!.seconds! * 1000).toInt()),
+ (snapshot.data!.seconds! * 1000)
+ .toInt()),
child: Row(
children: [
SizedBox(
@@ -1311,8 +1311,7 @@ class _ControlPanelState extends State
child: Row(
children: [
Text(
- (data.backgroundAudioPosition! ~/ 1000).toTime ??
- '',
+ (data.backgroundAudioPosition! ~/ 1000).toTime,
style: TextStyle(fontSize: 10),
),
Expanded(
@@ -1336,8 +1335,7 @@ class _ControlPanelState extends State
),
),
Text(
- (data.backgroundAudioDuration ~/ 1000).toTime ??
- '',
+ (data.backgroundAudioDuration ~/ 1000).toTime,
style: TextStyle(fontSize: 10),
),
],
diff --git a/lib/home/home.dart b/lib/home/home.dart
index 211bb1a..f3eb7c5 100644
--- a/lib/home/home.dart
+++ b/lib/home/home.dart
@@ -241,7 +241,7 @@ class _HomeState extends State with SingleTickerProviderStateMixin {
),
Selector(
selector: (_, audio) =>
- audio?.playerRunning ?? false,
+ audio.playerRunning,
builder: (_, data, __) {
return Padding(
padding:
@@ -540,7 +540,7 @@ class _RecentUpdateState extends State<_RecentUpdate>
var storage = KeyValueStorage(recentLayoutKey);
var hideListenedStorage = KeyValueStorage(hideListenedKey);
var index = await storage.getInt(defaultValue: 1);
- if (_layout == null) _layout = Layout.values[index!];
+ if (_layout == null) _layout = Layout.values[index];
if (_hideListened == null) {
_hideListened = await hideListenedStorage.getBool(defaultValue: false);
}
@@ -909,7 +909,7 @@ class _MyFavoriteState extends State<_MyFavorite>
var storage = KeyValueStorage(favLayoutKey);
var index = await storage.getInt(defaultValue: 1);
var hideListenedStorage = KeyValueStorage(hideListenedKey);
- if (_layout == null) _layout = Layout.values[index!];
+ if (_layout == null) _layout = Layout.values[index];
if (_hideListened == null) {
_hideListened = await hideListenedStorage.getBool(defaultValue: false);
}
@@ -1189,7 +1189,7 @@ class _MyDownloadState extends State<_MyDownload>
var storage = KeyValueStorage(downloadLayoutKey);
var index = await storage.getInt(defaultValue: 1);
var hideListenedStorage = KeyValueStorage(hideListenedKey);
- if (_layout == null) _layout = Layout.values[index!];
+ if (_layout == null) _layout = Layout.values[index];
if (_hideListened == null) {
_hideListened = await hideListenedStorage.getBool(defaultValue: false);
}
diff --git a/lib/home/home_groups.dart b/lib/home/home_groups.dart
index e87c550..aa878c5 100644
--- a/lib/home/home_groups.dart
+++ b/lib/home/home_groups.dart
@@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:math' as math;
import 'package:connectivity/connectivity.dart';
-import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:focused_menu/focused_menu.dart';
@@ -712,7 +711,7 @@ class ShowEpisode extends StatelessWidget {
return Selector, bool>>(
selector: (_, audio) => tuple.Tuple3(
- audio?.episode,
+ audio.episode,
audio.queue.episodes
.map((e) => e!.enclosureUrl)
.toList(),
diff --git a/lib/home/home_menu.dart b/lib/home/home_menu.dart
index aec3370..a5f20c9 100644
--- a/lib/home/home_menu.dart
+++ b/lib/home/home_menu.dart
@@ -34,7 +34,7 @@ class _PopupMenuState extends State {
} else {
refreshDate = i;
}
- return refreshDate!.toDate(context);
+ return refreshDate.toDate(context);
}
void _saveOmpl(String path) async {
diff --git a/lib/home/search_podcast.dart b/lib/home/search_podcast.dart
index 87ef04a..ea0f942 100644
--- a/lib/home/search_podcast.dart
+++ b/lib/home/search_podcast.dart
@@ -206,10 +206,10 @@ class _RssResultState extends State {
_loadItems = 10;
_onlinePodcast = OnlinePodcast(
rss: widget.url,
- title: p?.title ?? widget.url,
- publisher: p?.author ?? "",
- description: p?.description ?? "No description for this podcast",
- image: p?.itunes?.image?.href ?? p?.image?.url ?? "",
+ title: p.title ?? widget.url,
+ publisher: p.author ?? "",
+ description: p.description ?? "No description for this podcast",
+ image: p.itunes?.image?.href ?? p.image?.url ?? "",
count: p.items!.length);
super.initState();
}
@@ -325,7 +325,7 @@ class _RssResultState extends State {
],
),
ListView.builder(
- itemCount: math.min(_loadItems! + 1, items.length),
+ itemCount: math.min(_loadItems + 1, items.length),
itemBuilder: (context, index) {
if (index == _loadItems) {
return Container(
@@ -379,7 +379,7 @@ class __SearchPopupMenuState extends State<_SearchPopupMenu> {
Future _getSearchEngine() async {
final storage = KeyValueStorage(searchEngineKey);
final index = await storage.getInt();
- setState(() => _searchEngine = SearchEngine.values[index!]);
+ setState(() => _searchEngine = SearchEngine.values[index]);
widget.onSelected!(_searchEngine);
}
diff --git a/lib/local_storage/key_value_storage.dart b/lib/local_storage/key_value_storage.dart
index cbce010..073ca01 100644
--- a/lib/local_storage/key_value_storage.dart
+++ b/lib/local_storage/key_value_storage.dart
@@ -66,28 +66,26 @@ class KeyValueStorage {
final String key;
KeyValueStorage(this.key);
Future?> getGroups() async {
- var prefs = await SharedPreferences.getInstance();
+ final prefs = await SharedPreferences.getInstance();
if (prefs.getString(key) == null) {
- var home = PodcastGroup('Home');
+ final home = PodcastGroup('Home');
await prefs.setString(
key,
json.encode({
'groups': [home.toEntity().toJson()]
}));
}
- return json
- .decode(prefs.getString(key)!)['groups']
- .cast