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,
)
: Center(),
leading: CustomBackButton(),
elevation: _showTitle ? 1 : 0,
//actions: [
// PopupMenuButton(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,6 +12,7 @@ import '../state/audio_state.dart';
import '../state/setting_state.dart';
import '../util/custom_dropdown.dart';
import '../util/custom_time_picker.dart';
import '../util/custom_widget.dart';
import '../util/extension_helper.dart';
const List kSecondsToSelect = [5, 10, 15, 20, 25, 30, 45, 60];
@ -33,7 +34,12 @@ const List<double> kSpeedToSelect = [
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) {
final s = context.s;
if (i == 2000) {
@ -44,6 +50,17 @@ class PlaySetting extends StatelessWidget {
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) {
var settings = Provider.of<SettingState>(context, listen: false);
return Selector<SettingState, Tuple2<int, int>>(
@ -218,6 +235,7 @@ class PlaySetting extends StatelessWidget {
child: Scaffold(
appBar: AppBar(
title: Text(s.play),
leading: CustomBackButton(),
elevation: 0,
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),
Padding(
padding: const EdgeInsets.all(10.0),
@ -277,10 +311,8 @@ class PlaySetting extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 70),
alignment: Alignment.centerLeft,
child: Text(s.playback,
style: Theme.of(context)
.textTheme
.bodyText1
.copyWith(color: Theme.of(context).accentColor)),
style: context.textTheme.bodyText1
.copyWith(color: context.accentColor)),
),
ListTile(
contentPadding:

View File

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

View File

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

View File

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

View File

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

View File

@ -22,6 +22,7 @@ class ThemeSetting extends StatelessWidget {
child: Scaffold(
appBar: AppBar(
title: Text(s.settingsAppearance),
leading: CustomBackButton(),
elevation: 0,
backgroundColor: Theme.of(context).primaryColor,
),
@ -376,15 +377,20 @@ class __ColorPickerState extends State<_ColorPicker>
: color ==
Colors
.cyan
? _accentList(
Colors
.cyanAccent)
: color == Colors.lightBlue
? _accentList(Colors
.lightBlueAccent)
? _accentList(Colors
.cyanAccent)
: color ==
Colors.lightBlue
? _accentList(Colors.lightBlueAccent)
: color == Colors.blue
? _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 boostVolumeStorage = KeyValueStorage(boostVolumeKey);
var volumeGainStorage = KeyValueStorage(volumeGainKey);
var markListenedAfterSkipStorage = KeyValueStorage(markListenedAfterSkipKey);
/// Current playing episdoe.
EpisodeBrief _episode;
@ -166,6 +167,8 @@ class AudioPlayerNotifier extends ChangeNotifier {
// ignore: prefer_final_fields
bool _playerRunning = false;
bool _markListened;
AudioProcessingState get audioState => _audioState;
int get backgroundAudioDuration => _backgroundAudioDuration;
int get backgroundAudioPosition => _backgroundAudioPosition;
@ -332,6 +335,9 @@ class AudioPlayerNotifier extends ChangeNotifier {
await fastForwardSecondsStorage.getInt(defaultValue: 30);
_rewindSeconds = await rewindSecondsStorage.getInt(defaultValue: 10);
/// Get if auto mark listened after skip
_markListened = await skipSilenceStorage.getBool(defaultValue: false);
/// Start audio service.
await AudioService.start(
backgroundTaskEntrypoint: _audioPlayerTaskEntrypoint,
@ -444,8 +450,13 @@ class AudioPlayerNotifier extends ChangeNotifier {
_lastPostion = 0;
notifyListeners();
await positionStorage.saveInt(_lastPostion);
final history = PlayHistory(_episode.title, _episode.enclosureUrl,
_backgroundAudioPosition ~/ 1000, _seekSliderValue);
var history;
if (_markListened) {
history = PlayHistory(_episode.title, _episode.enclosureUrl, 0, 1);
} else {
history = PlayHistory(_episode.title, _episode.enclosureUrl,
_backgroundAudioPosition ~/ 1000, _seekSliderValue);
}
await dbHelper.saveHistory(history);
}
if (event is Map && event['playerRunning'] == false && _playerRunning) {
@ -667,7 +678,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
}
//Set sleep timer
sleepTimer(int mins) {
void sleepTimer(int mins) {
if (_sleepTimerMode == SleepTimerMode.timer) {
_startSleepTimer = true;
_switchValue = 1;
@ -703,7 +714,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
}
//Cancel sleep timer
cancelTimer() {
void cancelTimer() {
if (_sleepTimerMode == SleepTimerMode.timer) {
_stopTimer.cancel();
_timeLeft = 0;

View File

@ -1204,3 +1204,19 @@ class TabIndicator extends CustomPainter {
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
convert: ^2.1.1
crypto: ^2.1.5
device_info: ^0.4.2+8
device_info: ^0.4.2+7
dio: ^3.0.10
dio_cookie_manager: ^1.0.0
extended_nested_scroll_view: ^1.0.1