1
0
mirror of https://github.com/stonega/tsacdop synced 2025-03-10 16:20:10 +01:00

Change back button style.

This commit is contained in:
stonegate 2020-10-09 23:59:29 +08:00
parent 80e22ab24d
commit 061fadbccc
22 changed files with 118 additions and 25 deletions

View File

@ -115,6 +115,7 @@ class _EpisodeDetailState extends State<EpisodeDetail> {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
) )
: Center(), : Center(),
leading: CustomBackButton(),
elevation: _showTitle ? 1 : 0, elevation: _showTitle ? 1 : 0,
//actions: [ //actions: [
// PopupMenuButton( // PopupMenuButton(

View File

@ -126,6 +126,7 @@ class _AboutAppState extends State<AboutApp> {
backgroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).primaryColor,
appBar: AppBar( appBar: AppBar(
title: Text(s.homeToprightMenuAbout), title: Text(s.homeToprightMenuAbout),
leading: CustomBackButton(),
elevation: _scroll ? 1 : 0, elevation: _scroll ? 1 : 0,
), ),
body: SafeArea( body: SafeArea(

View File

@ -161,9 +161,8 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
padding: padding:
const EdgeInsets.all(0), const EdgeInsets.all(0),
child: Text(s.understood, child: Text(s.understood,
style: Theme.of(context) style: context
.textTheme .textTheme.button
.button
.copyWith( .copyWith(
color: color:
Colors.white)), Colors.white)),
@ -191,6 +190,7 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
), ),
child: IconButton( child: IconButton(
tooltip: s.add, tooltip: s.add,
splashRadius: 25,
icon: const Icon( icon: const Icon(
Icons.add_circle_outline), Icons.add_circle_outline),
onPressed: () async { onPressed: () async {

View File

@ -86,6 +86,7 @@ class MyHomePageDelegate extends SearchDelegate<int> {
}, },
child: IconButton( child: IconButton(
tooltip: context.s.back, tooltip: context.s.back,
splashRadius: 25,
icon: AnimatedIcon( icon: AnimatedIcon(
icon: AnimatedIcons.menu_arrow, icon: AnimatedIcons.menu_arrow,
progress: transitionAnimation, progress: transitionAnimation,
@ -114,6 +115,7 @@ class MyHomePageDelegate extends SearchDelegate<int> {
if (query.isNotEmpty) if (query.isNotEmpty)
IconButton( IconButton(
tooltip: context.s.clear, tooltip: context.s.clear,
splashRadius: 25,
icon: const Icon(Icons.clear), icon: const Icon(Icons.clear),
onPressed: () { onPressed: () {
query = ''; query = '';

View File

@ -55,6 +55,7 @@ const String gpodderRemoteAddKey = 'gpodderRemoteAddKey';
const String gpodderRemoteRemoveKey = 'gpodderRemoteRemoveKey'; const String gpodderRemoteRemoveKey = 'gpodderRemoteRemoveKey';
const String hidePodcastDiscoveryKey = 'hidePodcastDiscoveryKey'; const String hidePodcastDiscoveryKey = 'hidePodcastDiscoveryKey';
const String searchEngineKey = 'searchEngineKey'; const String searchEngineKey = 'searchEngineKey';
const String markListenedAfterSkipKey = 'markListenedAfterSkipKey';
class KeyValueStorage { class KeyValueStorage {
final String key; final String key;

View File

@ -348,7 +348,7 @@ class _PodcastDetailState extends State<PodcastDetail> {
final s = context.s; final s = context.s;
return _customPopupMenu( return _customPopupMenu(
tooltip: s.menu, tooltip: s.menu,
clip: false, // clip: false,
onSelected: (value) { onSelected: (value) {
switch (value) { switch (value) {
case 0: case 0:
@ -388,7 +388,7 @@ class _PodcastDetailState extends State<PodcastDetail> {
), ),
PopupMenuItem( PopupMenuItem(
value: 1, value: 1,
child: Container( child: Padding(
padding: EdgeInsets.only(left: 10), padding: EdgeInsets.only(left: 10),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@ -406,7 +406,7 @@ class _PodcastDetailState extends State<PodcastDetail> {
), ),
PopupMenuItem( PopupMenuItem(
value: 2, value: 2,
child: Container( child: Padding(
padding: const EdgeInsets.only(left: 10), padding: const EdgeInsets.only(left: 10),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -779,6 +779,7 @@ class _PodcastDetailState extends State<PodcastDetail> {
backgroundColor: color, backgroundColor: color,
floating: true, floating: true,
pinned: true, pinned: true,
leading: CustomBackButton(),
flexibleSpace: LayoutBuilder( flexibleSpace: LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
_topHeight = constraints.biggest.height; _topHeight = constraints.biggest.height;
@ -828,7 +829,7 @@ class _PodcastDetailState extends State<PodcastDetail> {
"${widget.podcastLocal.imagePath}")), "${widget.podcastLocal.imagePath}")),
), ),
), ),
Container( Align(
alignment: Alignment.center, alignment: Alignment.center,
child: _podcastInfo(context), child: _podcastInfo(context),
), ),

View File

@ -9,6 +9,7 @@ import 'package:line_icons/line_icons.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../state/podcast_group.dart'; import '../state/podcast_group.dart';
import '../util/custom_widget.dart';
import '../util/extension_helper.dart'; import '../util/extension_helper.dart';
import '../util/general_dialog.dart'; import '../util/general_dialog.dart';
import '../util/pageroute.dart'; import '../util/pageroute.dart';
@ -203,6 +204,7 @@ class _PodcastManageState extends State<PodcastManage>
appBar: AppBar( appBar: AppBar(
centerTitle: true, centerTitle: true,
title: Text(context.s.groups(2)), title: Text(context.s.groups(2)),
leading: CustomBackButton(),
actions: <Widget>[ actions: <Widget>[
DescribedFeatureOverlay( DescribedFeatureOverlay(
featureId: addGroupFeature, featureId: addGroupFeature,

View File

@ -11,6 +11,7 @@ import 'package:provider/provider.dart';
import '../local_storage/sqflite_localpodcast.dart'; import '../local_storage/sqflite_localpodcast.dart';
import '../state/podcast_group.dart'; import '../state/podcast_group.dart';
import '../type/podcastlocal.dart'; import '../type/podcastlocal.dart';
import '../util/custom_widget.dart';
import '../util/extension_helper.dart'; import '../util/extension_helper.dart';
import '../util/general_dialog.dart'; import '../util/general_dialog.dart';
import '../util/pageroute.dart'; import '../util/pageroute.dart';
@ -77,7 +78,9 @@ class _AboutPodcastState extends State<AboutPodcast> {
children: <Widget>[ children: <Widget>[
!_load !_load
? Center() ? Center()
: _description != null ? Html(data: _description) : Center(), : _description != null
? Html(data: _description)
: Center(),
if (widget.podcastLocal.author != null) if (widget.podcastLocal.author != null)
Text(widget.podcastLocal.author, Text(widget.podcastLocal.author,
style: TextStyle(color: Colors.blue)) style: TextStyle(color: Colors.blue))
@ -113,6 +116,7 @@ class _PodcastListState extends State<PodcastList> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(context.s.podcast(2)), title: Text(context.s.podcast(2)),
leading: CustomBackButton(),
centerTitle: true, centerTitle: true,
), ),
body: SafeArea( body: SafeArea(

View File

@ -1055,6 +1055,7 @@ class __GpodderInfoState extends State<_GpodderInfo> {
iconTheme: IconThemeData( iconTheme: IconThemeData(
color: Colors.white, color: Colors.white,
), ),
leading: CustomBackButton(),
elevation: 0, elevation: 0,
backgroundColor: context.accentColor, backgroundColor: context.accentColor,
expandedHeight: 200, expandedHeight: 200,

View File

@ -11,6 +11,7 @@ import 'package:provider/provider.dart';
import '../local_storage/sqflite_localpodcast.dart'; import '../local_storage/sqflite_localpodcast.dart';
import '../state/download_state.dart'; import '../state/download_state.dart';
import '../type/episodebrief.dart'; import '../type/episodebrief.dart';
import '../util/custom_widget.dart';
import '../util/extension_helper.dart'; import '../util/extension_helper.dart';
class DownloadsManage extends StatefulWidget { class DownloadsManage extends StatefulWidget {
@ -124,6 +125,7 @@ class _DownloadsManageState extends State<DownloadsManage> {
), ),
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
leading: CustomBackButton(),
elevation: 0, elevation: 0,
backgroundColor: context.primaryColor, backgroundColor: context.primaryColor,
), ),

View File

@ -15,6 +15,7 @@ import '../state/podcast_group.dart';
import '../type/play_histroy.dart'; import '../type/play_histroy.dart';
import '../type/search_api/searchpodcast.dart'; import '../type/search_api/searchpodcast.dart';
import '../type/sub_history.dart'; import '../type/sub_history.dart';
import '../util/custom_widget.dart';
import '../util/extension_helper.dart'; import '../util/extension_helper.dart';
class PlayedHistory extends StatefulWidget { class PlayedHistory extends StatefulWidget {
@ -135,6 +136,7 @@ class _PlayedHistoryState extends State<PlayedHistory>
return <Widget>[ return <Widget>[
SliverAppBar( SliverAppBar(
backgroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).primaryColor,
leading: CustomBackButton(),
elevation: 0, elevation: 0,
expandedHeight: 260, expandedHeight: 260,
floating: false, floating: false,

View File

@ -196,6 +196,7 @@ class _LayoutSettingState extends State<LayoutSetting> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(s.settingsLayout), title: Text(s.settingsLayout),
leading: CustomBackButton(),
elevation: 0, elevation: 0,
backgroundColor: context.primaryColor, backgroundColor: context.primaryColor,
), ),

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../util/custom_widget.dart';
import '../util/extension_helper.dart'; import '../util/extension_helper.dart';
import 'licenses.dart'; import 'licenses.dart';
@ -25,6 +27,7 @@ class Libries extends StatelessWidget {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(context.s.settingsLibraries), title: Text(context.s.settingsLibraries),
leading: CustomBackButton(),
elevation: 0, elevation: 0,
backgroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).primaryColor,
), ),

View File

@ -12,6 +12,7 @@ import '../state/audio_state.dart';
import '../state/setting_state.dart'; import '../state/setting_state.dart';
import '../util/custom_dropdown.dart'; import '../util/custom_dropdown.dart';
import '../util/custom_time_picker.dart'; import '../util/custom_time_picker.dart';
import '../util/custom_widget.dart';
import '../util/extension_helper.dart'; import '../util/extension_helper.dart';
const List kSecondsToSelect = [5, 10, 15, 20, 25, 30, 45, 60]; const List kSecondsToSelect = [5, 10, 15, 20, 25, 30, 45, 60];
@ -33,7 +34,12 @@ const List<double> kSpeedToSelect = [
5.0 5.0
]; ];
class PlaySetting extends StatelessWidget { class PlaySetting extends StatefulWidget {
@override
_PlaySettingState createState() => _PlaySettingState();
}
class _PlaySettingState extends State<PlaySetting> {
String _volumeEffect(BuildContext context, int i) { String _volumeEffect(BuildContext context, int i) {
final s = context.s; final s = context.s;
if (i == 2000) { if (i == 2000) {
@ -44,6 +50,17 @@ class PlaySetting extends StatelessWidget {
return s.playerHeightTall; return s.playerHeightTall;
} }
Future<bool> _getMarkListenedSkip() async {
final storage = KeyValueStorage(markListenedAfterSkipKey);
return storage.getBool(defaultValue: false);
}
Future<void> _saveMarkListenedSkip(bool boo) async {
final storage = KeyValueStorage(markListenedAfterSkipKey);
await storage.saveBool(boo);
if (mounted) setState(() {});
}
Widget _modeWidget(BuildContext context) { Widget _modeWidget(BuildContext context) {
var settings = Provider.of<SettingState>(context, listen: false); var settings = Provider.of<SettingState>(context, listen: false);
return Selector<SettingState, Tuple2<int, int>>( return Selector<SettingState, Tuple2<int, int>>(
@ -218,6 +235,7 @@ class PlaySetting extends StatelessWidget {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(s.play), title: Text(s.play),
leading: CustomBackButton(),
elevation: 0, elevation: 0,
backgroundColor: context.primaryColor, backgroundColor: context.primaryColor,
), ),
@ -268,6 +286,22 @@ class PlaySetting extends StatelessWidget {
), ),
), ),
), ),
FutureBuilder<bool>(
initialData: false,
future: _getMarkListenedSkip(),
builder: (context, snapshot) => ListTile(
onTap: () => _saveMarkListenedSkip(!snapshot.data),
contentPadding:
EdgeInsets.only(left: 70.0, right: 20, bottom: 10),
title: Text('Mark listened when episode skipped'),
subtitle: Text('Mark as listened'),
trailing: Transform.scale(
scale: 0.9,
child: Switch(
value: snapshot.data, onChanged: _saveMarkListenedSkip),
),
),
),
Divider(height: 1), Divider(height: 1),
Padding( Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
@ -277,10 +311,8 @@ class PlaySetting extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 70), padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text(s.playback, child: Text(s.playback,
style: Theme.of(context) style: context.textTheme.bodyText1
.textTheme .copyWith(color: context.accentColor)),
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
), ),
ListTile( ListTile(
contentPadding: contentPadding:

View File

@ -99,6 +99,7 @@ class _PopupMenuSettingState extends State<PopupMenuSetting> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
leading: CustomBackButton(),
backgroundColor: context.primaryColor, backgroundColor: context.primaryColor,
), ),
body: Column( body: Column(

View File

@ -7,6 +7,7 @@ import 'package:line_icons/line_icons.dart';
import '../home/home.dart'; import '../home/home.dart';
import '../intro_slider/app_intro.dart'; import '../intro_slider/app_intro.dart';
import '../podcasts/podcast_manage.dart'; import '../podcasts/podcast_manage.dart';
import '../util/custom_widget.dart';
import '../util/extension_helper.dart'; import '../util/extension_helper.dart';
import '../util/general_dialog.dart'; import '../util/general_dialog.dart';
import 'data_backup.dart'; import 'data_backup.dart';
@ -53,6 +54,7 @@ class _SettingsState extends State<Settings> {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(s.settings), title: Text(s.settings),
leading: CustomBackButton(),
elevation: 0, elevation: 0,
backgroundColor: context.primaryColor, backgroundColor: context.primaryColor,
), ),

View File

@ -7,6 +7,7 @@ import '../local_storage/key_value_storage.dart';
import '../settings/downloads_manage.dart'; import '../settings/downloads_manage.dart';
import '../state/setting_state.dart'; import '../state/setting_state.dart';
import '../util/custom_dropdown.dart'; import '../util/custom_dropdown.dart';
import '../util/custom_widget.dart';
import '../util/extension_helper.dart'; import '../util/extension_helper.dart';
class StorageSetting extends StatefulWidget { class StorageSetting extends StatefulWidget {
@ -95,6 +96,7 @@ class _StorageSettingState extends State<StorageSetting>
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(s.settingStorage), title: Text(s.settingStorage),
leading: CustomBackButton(),
elevation: 0, elevation: 0,
backgroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).primaryColor,
), ),

View File

@ -5,6 +5,7 @@ import 'package:tuple/tuple.dart';
import '../state/setting_state.dart'; import '../state/setting_state.dart';
import '../util/custom_dropdown.dart'; import '../util/custom_dropdown.dart';
import '../util/custom_widget.dart';
import '../util/extension_helper.dart'; import '../util/extension_helper.dart';
class SyncingSetting extends StatelessWidget { class SyncingSetting extends StatelessWidget {
@ -22,6 +23,7 @@ class SyncingSetting extends StatelessWidget {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(s.settingsSyncing), title: Text(s.settingsSyncing),
leading: CustomBackButton(),
elevation: 0, elevation: 0,
backgroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).primaryColor,
), ),

View File

@ -22,6 +22,7 @@ class ThemeSetting extends StatelessWidget {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(s.settingsAppearance), title: Text(s.settingsAppearance),
leading: CustomBackButton(),
elevation: 0, elevation: 0,
backgroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).primaryColor,
), ),
@ -376,15 +377,20 @@ class __ColorPickerState extends State<_ColorPicker>
: color == : color ==
Colors Colors
.cyan .cyan
? _accentList(
Colors
.cyanAccent)
: color == Colors.lightBlue
? _accentList(Colors ? _accentList(Colors
.lightBlueAccent) .cyanAccent)
: color ==
Colors.lightBlue
? _accentList(Colors.lightBlueAccent)
: color == Colors.blue : color == Colors.blue
? _accentList(Colors.blueAccent) ? _accentList(Colors.blueAccent)
: color == Colors.indigo ? _accentList(Colors.indigoAccent) : color == Colors.purple ? _accentList(Colors.purpleAccent) : color == Colors.deepPurple ? _accentList(Colors.deepPurpleAccent) : [] : color == Colors.indigo
? _accentList(Colors.indigoAccent)
: color == Colors.purple
? _accentList(Colors.purpleAccent)
: color == Colors.deepPurple
? _accentList(Colors.deepPurpleAccent)
: []
], ],
), ),
)) ))

View File

@ -75,6 +75,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
var skipSilenceStorage = KeyValueStorage(skipSilenceKey); var skipSilenceStorage = KeyValueStorage(skipSilenceKey);
var boostVolumeStorage = KeyValueStorage(boostVolumeKey); var boostVolumeStorage = KeyValueStorage(boostVolumeKey);
var volumeGainStorage = KeyValueStorage(volumeGainKey); var volumeGainStorage = KeyValueStorage(volumeGainKey);
var markListenedAfterSkipStorage = KeyValueStorage(markListenedAfterSkipKey);
/// Current playing episdoe. /// Current playing episdoe.
EpisodeBrief _episode; EpisodeBrief _episode;
@ -166,6 +167,8 @@ class AudioPlayerNotifier extends ChangeNotifier {
// ignore: prefer_final_fields // ignore: prefer_final_fields
bool _playerRunning = false; bool _playerRunning = false;
bool _markListened;
AudioProcessingState get audioState => _audioState; AudioProcessingState get audioState => _audioState;
int get backgroundAudioDuration => _backgroundAudioDuration; int get backgroundAudioDuration => _backgroundAudioDuration;
int get backgroundAudioPosition => _backgroundAudioPosition; int get backgroundAudioPosition => _backgroundAudioPosition;
@ -332,6 +335,9 @@ class AudioPlayerNotifier extends ChangeNotifier {
await fastForwardSecondsStorage.getInt(defaultValue: 30); await fastForwardSecondsStorage.getInt(defaultValue: 30);
_rewindSeconds = await rewindSecondsStorage.getInt(defaultValue: 10); _rewindSeconds = await rewindSecondsStorage.getInt(defaultValue: 10);
/// Get if auto mark listened after skip
_markListened = await skipSilenceStorage.getBool(defaultValue: false);
/// Start audio service. /// Start audio service.
await AudioService.start( await AudioService.start(
backgroundTaskEntrypoint: _audioPlayerTaskEntrypoint, backgroundTaskEntrypoint: _audioPlayerTaskEntrypoint,
@ -444,8 +450,13 @@ class AudioPlayerNotifier extends ChangeNotifier {
_lastPostion = 0; _lastPostion = 0;
notifyListeners(); notifyListeners();
await positionStorage.saveInt(_lastPostion); await positionStorage.saveInt(_lastPostion);
final history = PlayHistory(_episode.title, _episode.enclosureUrl, var history;
if (_markListened) {
history = PlayHistory(_episode.title, _episode.enclosureUrl, 0, 1);
} else {
history = PlayHistory(_episode.title, _episode.enclosureUrl,
_backgroundAudioPosition ~/ 1000, _seekSliderValue); _backgroundAudioPosition ~/ 1000, _seekSliderValue);
}
await dbHelper.saveHistory(history); await dbHelper.saveHistory(history);
} }
if (event is Map && event['playerRunning'] == false && _playerRunning) { if (event is Map && event['playerRunning'] == false && _playerRunning) {
@ -667,7 +678,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
} }
//Set sleep timer //Set sleep timer
sleepTimer(int mins) { void sleepTimer(int mins) {
if (_sleepTimerMode == SleepTimerMode.timer) { if (_sleepTimerMode == SleepTimerMode.timer) {
_startSleepTimer = true; _startSleepTimer = true;
_switchValue = 1; _switchValue = 1;
@ -703,7 +714,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
} }
//Cancel sleep timer //Cancel sleep timer
cancelTimer() { void cancelTimer() {
if (_sleepTimerMode == SleepTimerMode.timer) { if (_sleepTimerMode == SleepTimerMode.timer) {
_stopTimer.cancel(); _stopTimer.cancel();
_timeLeft = 0; _timeLeft = 0;

View File

@ -1204,3 +1204,19 @@ class TabIndicator extends CustomPainter {
return oldDelegate.fraction != fraction || oldDelegate.index != index; return oldDelegate.fraction != fraction || oldDelegate.index != index;
} }
} }
/// Custom back button
class CustomBackButton extends StatelessWidget {
const CustomBackButton({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return IconButton(
splashRadius: 25,
icon: const BackButtonIcon(),
tooltip: context.s.back,
onPressed: () {
Navigator.maybePop(context);
},
);
}
}

View File

@ -21,7 +21,7 @@ dependencies:
connectivity: ^0.4.9 connectivity: ^0.4.9
convert: ^2.1.1 convert: ^2.1.1
crypto: ^2.1.5 crypto: ^2.1.5
device_info: ^0.4.2+8 device_info: ^0.4.2+7
dio: ^3.0.10 dio: ^3.0.10
dio_cookie_manager: ^1.0.0 dio_cookie_manager: ^1.0.0
extended_nested_scroll_view: ^1.0.1 extended_nested_scroll_view: ^1.0.1