Update theme data

This commit is contained in:
stonega 2021-10-06 18:47:43 +08:00
parent ad7541d2fc
commit b0d1639138
4 changed files with 88 additions and 74 deletions

View File

@ -75,8 +75,8 @@ class _PlaylistHomeState extends State<PlaylistHome> {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
systemNavigationBarIconBrightness:
Theme.of(context).accentColorBrightness,
statusBarIconBrightness: Theme.of(context).accentColorBrightness,
Theme.of(context).colorScheme.brightness,
statusBarIconBrightness: Theme.of(context).colorScheme.brightness,
systemNavigationBarColor: Theme.of(context).primaryColor,
),
child: WillPopScope(
@ -143,6 +143,9 @@ class _PlaylistHomeState extends State<PlaylistHome> {
playing
? audio.pauseAduio()
: audio.resumeAudio();
} else if (data.item1.isEmpty) {
Fluttertoast.showToast(
msg: 'Playlist is empty');
} else {
context
.read<AudioPlayerNotifier>()

View File

@ -2,7 +2,6 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:file_picker/file_picker.dart';
import '../state/audio_state.dart';
import '../type/episodebrief.dart';

View File

@ -5,6 +5,7 @@ import 'dart:ui';
import 'package:connectivity/connectivity.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
@ -139,7 +140,8 @@ class SettingState extends ChangeNotifier {
ThemeMode get theme => _theme;
ThemeData get lightTheme => ThemeData(
accentColorBrightness: Brightness.dark,
colorScheme: ColorScheme.fromSwatch()
.copyWith(brightness: Brightness.light, secondary: _accentSetColor),
primaryColor: Colors.grey[100],
primaryColorLight: Colors.white,
primaryColorDark: Colors.grey[300],
@ -148,7 +150,9 @@ class SettingState extends ChangeNotifier {
appBarTheme: AppBarTheme(
color: Colors.grey[100],
elevation: 0,
),
titleTextStyle: TextStyle(color: Colors.black),
iconTheme: IconThemeData(color: Colors.black),
systemOverlayStyle: SystemUiOverlayStyle.dark),
textTheme: TextTheme(
bodyText2: TextStyle(fontSize: 15.0, fontWeight: FontWeight.normal),
),
@ -156,25 +160,31 @@ class SettingState extends ChangeNotifier {
labelColor: Colors.black,
unselectedLabelColor: Colors.grey[400],
),
accentColor: _accentSetColor,
textSelectionTheme: TextSelectionThemeData(
cursorColor: _accentSetColor,
textSelectionHandleColor: _accentSetColor,
selectionHandleColor: _accentSetColor,
),
toggleableActiveColor: _accentSetColor,
buttonTheme: ButtonThemeData(
height: 32,
hoverColor: _accentSetColor.withAlpha(70),
splashColor: _accentSetColor.withAlpha(70)));
splashColor: _accentSetColor.withAlpha(70),
),
);
ThemeData get darkTheme => ThemeData.dark().copyWith(
accentColor: _accentSetColor,
colorScheme: ColorScheme.fromSwatch()
.copyWith(brightness: Brightness.dark, secondary: _accentSetColor),
primaryColorDark: Colors.grey[800],
scaffoldBackgroundColor: _realDark ? Colors.black87 : Color(0XFF212121),
primaryColor: _realDark ? Colors.black : Color(0XFF1B1B1B),
popupMenuTheme: PopupMenuThemeData()
.copyWith(color: _realDark ? Colors.grey[900] : null),
appBarTheme: AppBarTheme(elevation: 0),
appBarTheme: AppBarTheme(
elevation: 0, systemOverlayStyle: SystemUiOverlayStyle.light),
buttonTheme: ButtonThemeData(height: 32),
dialogBackgroundColor: _realDark ? Colors.grey[900] : null,
cursorColor: _accentSetColor);
);
set setTheme(ThemeMode mode) {
_theme = mode;
@ -558,8 +568,10 @@ class SettingState extends ChangeNotifier {
.getBool(defaultValue: false);
final deleteAfterPlayed = await KeyValueStorage(deleteAfterPlayedKey)
.getBool(defaultValue: false);
final openPlaylistDefault = await _openPlaylistDefaultStorage.getBool(defaultValue: false);
final openAllPodcastDefault = await _openAllPodcastDefaultStorage.getBool(defaultValue: false);
final openPlaylistDefault =
await _openPlaylistDefaultStorage.getBool(defaultValue: false);
final openAllPodcastDefault =
await _openAllPodcastDefaultStorage.getBool(defaultValue: false);
return SettingsBackup(
theme: theme,

View File

@ -9,7 +9,7 @@ import '../generated/l10n.dart';
extension ContextExtension on BuildContext {
Color get primaryColor => Theme.of(this).primaryColor;
Color get accentColor => Theme.of(this).accentColor;
Color get accentColor => Theme.of(this).colorScheme.secondary;
Color get scaffoldBackgroundColor => Theme.of(this).scaffoldBackgroundColor;
Color get primaryColorDark => Theme.of(this).primaryColorDark;
Color get textColor => Theme.of(this).textTheme.bodyText1.color;