Improve real dark theme.

This commit is contained in:
stonegate 2020-07-25 18:32:05 +08:00
parent 7c828f1ee6
commit 403d9a9a4c
9 changed files with 78 additions and 63 deletions

View File

@ -1187,13 +1187,12 @@ class _ControlPanelState extends State<ControlPanel>
data: SliderTheme.of(context).copyWith(
activeTrackColor: Theme.of(context).brightness ==
Brightness.dark
? Colors.black38
? Colors.grey[900]
: Colors.grey[400],
inactiveTrackColor:
Theme.of(context).primaryColorDark,
inactiveTrackColor: context.primaryColorDark,
trackHeight: 20.0,
trackShape: MyRectangularTrackShape(),
thumbColor: Theme.of(context).accentColor,
thumbColor: context.accentColor,
thumbShape: MyRoundSliderThumpShape(
enabledThumbRadius: 10.0,
disabledThumbRadius: 10.0,
@ -1283,13 +1282,17 @@ class _ControlPanelState extends State<ControlPanel>
color: Colors.grey[500]),
Selector<AudioPlayerNotifier, int>(
selector: (_, audio) => audio.rewindSeconds,
builder: (_, seconds, __) => Text('$seconds s',
textAlign: TextAlign.center,
style: GoogleFonts.teko(
textStyle: TextStyle(
color: Colors.grey[500],
fontSize: 20),
))),
builder: (_, seconds, __) => Padding(
padding: const EdgeInsets.only(top: 5.0),
child: Text('$seconds s',
style: GoogleFonts.teko(
textBaseline:
TextBaseline.ideographic,
textStyle: TextStyle(
color: Colors.grey[500],
fontSize: 20),
)),
)),
Container(
margin: EdgeInsets.symmetric(horizontal: 30),
height: 60,
@ -1353,12 +1356,15 @@ class _ControlPanelState extends State<ControlPanel>
Selector<AudioPlayerNotifier, int>(
selector: (_, audio) =>
audio.fastForwardSeconds,
builder: (_, seconds, __) => Text('$seconds s',
style: GoogleFonts.teko(
textStyle: TextStyle(
color: Colors.grey[500],
fontSize: 20),
))),
builder: (_, seconds, __) => Padding(
padding: const EdgeInsets.only(top: 5.0),
child: Text('$seconds s',
style: GoogleFonts.teko(
textStyle: TextStyle(
color: Colors.grey[500],
fontSize: 20),
)),
)),
IconButton(
padding: EdgeInsets.symmetric(horizontal: 10.0),
onPressed:

View File

@ -638,13 +638,13 @@ class ShowEpisode extends StatelessWidget {
backgroundColor:
context.brightness == Brightness.light
? context.primaryColor
: context.scaffoldBackgroundColor,
: context.dialogBackgroundColor,
title: Text(data.item1 != episodes[index]
? s.play
: s.playing),
trailingIcon: Icon(
LineIcons.play_circle_solid,
color: Theme.of(context).accentColor,
color: context.accentColor,
),
onPressed: () {
if (data.item1 != episodes[index])
@ -655,7 +655,7 @@ class ShowEpisode extends StatelessWidget {
backgroundColor: context.brightness ==
Brightness.light
? context.primaryColor
: context.scaffoldBackgroundColor,
: context.dialogBackgroundColor,
title: data.item2.contains(
episodes[index].enclosureUrl)
? Text(s.remove)
@ -688,7 +688,7 @@ class ShowEpisode extends StatelessWidget {
backgroundColor: context.brightness ==
Brightness.light
? context.primaryColor
: context.scaffoldBackgroundColor,
: context.dialogBackgroundColor,
title: isLiked
? Text(s.unlike)
: Text(s.like),
@ -719,7 +719,7 @@ class ShowEpisode extends StatelessWidget {
backgroundColor: context.brightness ==
Brightness.light
? context.primaryColor
: context.scaffoldBackgroundColor,
: context.dialogBackgroundColor,
title: isListened > 0
? Text(s.listened,
style: TextStyle(
@ -755,7 +755,7 @@ class ShowEpisode extends StatelessWidget {
backgroundColor: context.brightness ==
Brightness.light
? context.primaryColor
: context.scaffoldBackgroundColor,
: context.dialogBackgroundColor,
title: isDownloaded
? Text(s.downloaded,
style: TextStyle(

View File

@ -820,7 +820,7 @@ class DBHelper {
var dbClient = await database;
List<EpisodeBrief> episodes = [];
List<Map> list = await dbClient.rawQuery(
"""SELECT E.title, E.enclosure_url, E.enclosure_length, E.is_new,
"""SELECT E.title, E.enclosure_url, E.enclosure_length, E.is_new, E.media_id,
E.milliseconds, P.title as feed_title, E.duration, E.explicit,
P.imagePath, P.primaryColor FROM Episodes E INNER JOIN PodcastLocal P ON E.feed_id = P.id
WHERE is_new = 1 ORDER BY E.milliseconds DESC """,
@ -836,7 +836,8 @@ class DBHelper {
i['duration'],
i['explicit'],
i['imagePath'],
i['is_new']));
i['is_new'],
mediaId: i['media_id']));
}
return episodes;
}
@ -929,7 +930,7 @@ class DBHelper {
if (group.length > 0) {
List<String> s = group.map<String>((e) => "'$e'").toList();
List<Map> list = await dbClient.rawQuery(
"""SELECT E.title, E.enclosure_url, E.enclosure_length, E.is_new,
"""SELECT E.title, E.enclosure_url, E.enclosure_length, E.is_new, E.media_id,
E.milliseconds, P.title as feed_title, E.duration, E.explicit,
P.imagePath, P.primaryColor FROM Episodes E INNER JOIN PodcastLocal P ON E.feed_id = P.id
WHERE P.id in (${s.join(',')}) AND is_new = 1
@ -946,7 +947,8 @@ class DBHelper {
i['duration'],
i['explicit'],
i['imagePath'],
i['is_new']));
i['is_new'],
mediaId: i['media_id']));
}
}
return episodes;

View File

@ -66,9 +66,12 @@ class MyApp extends StatelessWidget {
scaffoldBackgroundColor:
setting.realDark ? Colors.black87 : null,
primaryColor: setting.realDark ? Colors.black : null,
popupMenuTheme: PopupMenuThemeData()
.copyWith(color: setting.realDark ? Colors.black87 : null),
popupMenuTheme: PopupMenuThemeData().copyWith(
color: setting.realDark ? Colors.grey[900] : null),
appBarTheme: AppBarTheme(elevation: 0),
buttonTheme: ButtonThemeData(height: 32),
dialogBackgroundColor:
setting.realDark ? Colors.grey[900] : null,
cursorColor: setting.accentSetColor),
localizationsDelegates: [
S.delegate,

View File

@ -163,7 +163,7 @@ class ThemeSetting extends StatelessWidget {
context,
title: Text.rich(TextSpan(text: s.chooseA, children: [
TextSpan(
text: s.color,
text: ' ${s.color}',
style: TextStyle(
fontWeight: FontWeight.bold,
color: context.accentColor))

View File

@ -348,8 +348,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
.where((event) => event != null)
.listen((event) async {
_current = DateTime.now();
if (event.processingState != AudioProcessingState.none)
_audioState = event.processingState;
_audioState = event.processingState;
_playing = event?.playing;
_currentSpeed = event.speed;
_currentPosition = event.currentPosition.inMilliseconds ?? 0;
@ -422,20 +421,22 @@ class AudioPlayerNotifier extends ChangeNotifier {
}
addToPlaylist(EpisodeBrief episode) async {
if (!_queue.playlist.contains(episode)) {
var episodeNew = await dbHelper.getRssItemWithUrl(episode.enclosureUrl);
if (!_queue.playlist.contains(episodeNew)) {
if (playerRunning) {
await AudioService.addQueueItem(episode.toMediaItem());
await AudioService.addQueueItem(episodeNew.toMediaItem());
}
await _queue.addToPlayList(episode);
await _queue.addToPlayList(episodeNew);
notifyListeners();
}
}
addToPlaylistAt(EpisodeBrief episode, int index) async {
var episodeNew = await dbHelper.getRssItemWithUrl(episode.enclosureUrl);
if (playerRunning) {
await AudioService.addQueueItemAt(episode.toMediaItem(), index);
await AudioService.addQueueItemAt(episodeNew.toMediaItem(), index);
}
await _queue.addToPlayListAt(episode, index);
await _queue.addToPlayListAt(episodeNew, index);
_queueUpdate = !_queueUpdate;
notifyListeners();
}
@ -466,10 +467,11 @@ class AudioPlayerNotifier extends ChangeNotifier {
}
Future<int> delFromPlaylist(EpisodeBrief episode) async {
var episodeNew = await dbHelper.getRssItemWithUrl(episode.enclosureUrl);
if (playerRunning) {
await AudioService.removeQueueItem(episode.toMediaItem());
await AudioService.removeQueueItem(episodeNew.toMediaItem());
}
int index = await _queue.delFromPlaylist(episode);
int index = await _queue.delFromPlaylist(episodeNew);
_queueUpdate = !_queueUpdate;
notifyListeners();
return index;

View File

@ -56,25 +56,26 @@ void callbackDispatcher() {
}
ThemeData lightTheme = ThemeData(
accentColorBrightness: Brightness.dark,
primaryColor: Colors.grey[100],
// accentColor: _accentSetColor,
primaryColorLight: Colors.white,
primaryColorDark: Colors.grey[300],
dialogBackgroundColor: Colors.white,
backgroundColor: Colors.grey[100],
appBarTheme: AppBarTheme(
color: Colors.grey[100],
elevation: 0,
),
textTheme: TextTheme(
bodyText2: TextStyle(fontSize: 15.0, fontWeight: FontWeight.normal),
),
tabBarTheme: TabBarTheme(
labelColor: Colors.black,
unselectedLabelColor: Colors.grey[400],
),
buttonTheme: ButtonThemeData(height: 32));
accentColorBrightness: Brightness.dark,
primaryColor: Colors.grey[100],
// accentColor: _accentSetColor,
primaryColorLight: Colors.white,
primaryColorDark: Colors.grey[300],
dialogBackgroundColor: Colors.white,
backgroundColor: Colors.grey[100],
appBarTheme: AppBarTheme(
color: Colors.grey[100],
elevation: 0,
),
textTheme: TextTheme(
bodyText2: TextStyle(fontSize: 15.0, fontWeight: FontWeight.normal),
),
tabBarTheme: TabBarTheme(
labelColor: Colors.black,
unselectedLabelColor: Colors.grey[400],
),
buttonTheme: ButtonThemeData(height: 32),
);
class SettingState extends ChangeNotifier {
var themeStorage = KeyValueStorage(themesKey);

View File

@ -305,7 +305,7 @@ class EpisodeGrid extends StatelessWidget {
backgroundColor:
context.brightness == Brightness.light
? context.primaryColor
: context.scaffoldBackgroundColor,
: context.dialogBackgroundColor,
title: Text(data.item1 != episodes[index]
? s.play
: s.playing),
@ -322,7 +322,7 @@ class EpisodeGrid extends StatelessWidget {
backgroundColor:
context.brightness == Brightness.light
? context.primaryColor
: context.scaffoldBackgroundColor,
: context.dialogBackgroundColor,
title: data.item2.contains(
episodes[index].enclosureUrl)
? Text(s.remove)
@ -354,7 +354,7 @@ class EpisodeGrid extends StatelessWidget {
backgroundColor:
context.brightness == Brightness.light
? context.primaryColor
: context.scaffoldBackgroundColor,
: context.dialogBackgroundColor,
title: isLiked
? Text(s.unlike)
: Text(s.like),
@ -385,7 +385,7 @@ class EpisodeGrid extends StatelessWidget {
backgroundColor:
context.brightness == Brightness.light
? context.primaryColor
: context.scaffoldBackgroundColor,
: context.dialogBackgroundColor,
title: isListened > 0
? Text(s.listened,
style: TextStyle(
@ -420,7 +420,7 @@ class EpisodeGrid extends StatelessWidget {
backgroundColor:
context.brightness == Brightness.light
? context.primaryColor
: context.scaffoldBackgroundColor,
: context.dialogBackgroundColor,
title: isDownloaded
? Text(s.downloaded,
style: TextStyle(

View File

@ -12,6 +12,7 @@ extension ContextExtension on BuildContext {
Color get scaffoldBackgroundColor => Theme.of(this).scaffoldBackgroundColor;
Color get primaryColorDark => Theme.of(this).primaryColorDark;
Color get textColor => Theme.of(this).textTheme.bodyText1.color;
Color get dialogBackgroundColor => Theme.of(this).dialogBackgroundColor;
Brightness get brightness => Theme.of(this).brightness;
double get width => MediaQuery.of(this).size.width;
double get height => MediaQuery.of(this).size.height;