Skip to content

Commit

Permalink
new themes, keyboard opens when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
o-ifeanyi committed Sep 28, 2020
1 parent f54a4b4 commit 6247ad5
Show file tree
Hide file tree
Showing 15 changed files with 204 additions and 97 deletions.
8 changes: 5 additions & 3 deletions lib/components/circleDisc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ class _CircleDiscState extends State<CircleDisc>
boxShadow: [
BoxShadow(
color: Theme.of(context).splashColor,
offset: Offset(6, 6),
offset: Offset(5, 5),
blurRadius: 10,
spreadRadius: 1.0,
),
BoxShadow(
color: Theme.of(context).backgroundColor,
offset: Offset(-6, -6),
blurRadius: 15,
offset: Offset(-5, -5),
blurRadius: 10,
spreadRadius: 1.0,
),
],
),
Expand Down
19 changes: 10 additions & 9 deletions lib/components/createPlayList.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class _CreatePlayListState extends State<CreatePlayList> {
bool createNew;
String playlistName;
TextEditingController inputFeild = TextEditingController();
FocusNode focusNode = FocusNode();

void createPlaylist() {
if (inputFeild.text != '') {
Expand Down Expand Up @@ -81,18 +82,17 @@ class _CreatePlayListState extends State<CreatePlayList> {
padding: EdgeInsets.all(20),
child: Consumer<PlayListDB>(
builder: (context, playlistDB, child) {
if (createNew) {
// opens keyboard
FocusScope.of(context).requestFocus(focusNode);
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
createNew
? Text(
'New playlist',
style: textStyle,
)
: Text(
'Add to playlist',
style: textStyle,
),
Text(
createNew ? 'New playlist' : 'Add to playlist',
style: textStyle,
),
createNew
? Expanded(
child: Column(
Expand All @@ -102,6 +102,7 @@ class _CreatePlayListState extends State<CreatePlayList> {
children: [
TextField(
controller: inputFeild,
focusNode: focusNode,
keyboardType: TextInputType.name,
textInputAction: TextInputAction.done,
decoration: InputDecoration(
Expand Down
6 changes: 3 additions & 3 deletions lib/components/customButton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class _CustomButtonState extends State<CustomButton>
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: 200),
duration: Duration(milliseconds: 150),
lowerBound: 0.0,
upperBound: 0.3,
);
Expand Down Expand Up @@ -71,13 +71,13 @@ class _CustomButtonState extends State<CustomButton>
boxShadow: <BoxShadow>[
BoxShadow(
color: Theme.of(context).splashColor,
offset: Offset(6, 6),
offset: Offset(5, 5),
blurRadius: 10,
spreadRadius: 1.0,
),
BoxShadow(
color: Theme.of(context).backgroundColor,
offset: Offset(-6, -6),
offset: Offset(-5, -5),
blurRadius: 10,
spreadRadius: 1.0,
),
Expand Down
4 changes: 2 additions & 2 deletions lib/components/customCard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ class CustomCard extends StatelessWidget {
boxShadow: <BoxShadow>[
BoxShadow(
color: Theme.of(context).splashColor,
offset: Offset(6, 6),
offset: Offset(5, 5),
blurRadius: 10,
spreadRadius: 1.0,
),
BoxShadow(
color: Theme.of(context).backgroundColor,
offset: Offset(-6, -6),
offset: Offset(-5, -5),
blurRadius: 10,
spreadRadius: 1.0,
),
Expand Down
8 changes: 7 additions & 1 deletion lib/components/libraryBottomSheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class LibraryBottomSheet extends StatelessWidget {
LibraryBottomSheet(this.playlistName);
final playlistName;
final editingController = TextEditingController();
final focusNode = FocusNode();

@override
Widget build(BuildContext context) {
Expand All @@ -15,6 +16,7 @@ class LibraryBottomSheet extends StatelessWidget {
fontWeight: FontWeight.w400,
);
return Container(
color: Theme.of(context).scaffoldBackgroundColor,
height: Config.yMargin(context, 10),
padding: EdgeInsets.symmetric(horizontal: 20),
child: Consumer<PlayListDB>(
Expand All @@ -29,12 +31,14 @@ class LibraryBottomSheet extends StatelessWidget {
showDialog(
context: context,
builder: (context) {
editingController.text = playlistName;
return AlertDialog(
title: Text(
'Rename playlist',
style: customTextStyle,
),
content: TextField(
focusNode: focusNode,
controller: editingController,
decoration: InputDecoration(
labelText: 'New name',
Expand All @@ -45,7 +49,7 @@ class LibraryBottomSheet extends StatelessWidget {
textColor: Theme.of(context).accentColor,
onPressed: () async {
String newName = editingController.text;
if (newName != '') {
if (newName != '' && newName != playlistName) {
await playlistDB.editPlaylistName(
playlistName, newName);
Navigator.pop(context);
Expand All @@ -60,6 +64,8 @@ class LibraryBottomSheet extends StatelessWidget {
);
},
);
// opens keyboard
FocusScope.of(context).requestFocus(focusNode);
}),
IconButton(
icon: Icon(Icons.delete),
Expand Down
1 change: 1 addition & 0 deletions lib/components/popupButton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class PopUpButton extends StatelessWidget {
fontFamily: 'Acme');

return PopupMenuButton(
color: Theme.of(context).dialogBackgroundColor,
icon: Icon(
Icons.more_vert,
size: Config.xMargin(context, 6),
Expand Down
125 changes: 111 additions & 14 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import 'package:flutter/material.dart';


final List kThemes = [

// light themes


ThemeData(
brightness: Brightness.light,
splashColor: Colors.black.withOpacity(0.2),
Expand All @@ -24,15 +28,18 @@ final List kThemes = [
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6),
overlayColor: Color(0xFFD71D1D).withOpacity(0.1),
activeTrackColor: Color(0xFFD71D1D),
inactiveTrackColor: Colors.black.withOpacity(0.2),
inactiveTrackColor: Colors.black45,
),
),
ThemeData(
brightness: Brightness.light,
splashColor: Colors.black.withOpacity(0.2),
accentColor: Colors.blueAccent,
backgroundColor: Colors.white,
scaffoldBackgroundColor: Colors.grey[100],
splashColor: Color(0xFFAD95A1),
primaryColor: Color(0xFFD71D1D),
cursorColor: Color(0xFFD71D1D),
accentColor: Color(0xFFD71D1D),
dialogBackgroundColor: Color(0xFFF9D7E8),
backgroundColor: Color(0xFFF9D7E8),
scaffoldBackgroundColor: Color(0xFFEBCBDC),
dividerColor: Colors.black45,
fontFamily: 'Acme',
iconTheme: IconThemeData(
Expand All @@ -41,11 +48,60 @@ final List kThemes = [
),
sliderTheme: SliderThemeData(
trackHeight: 1.0,
thumbColor: Colors.blueAccent,
thumbColor: Color(0xFFD71D1D),
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6),
overlayColor: Color(0xFFD71D1D).withOpacity(0.1),
activeTrackColor: Color(0xFFD71D1D),
inactiveTrackColor: Colors.black45,
),
),
ThemeData(
brightness: Brightness.light,
splashColor: Color(0xFF798EAD),
primaryColor: Color(0xFFD71D1D),
cursorColor: Color(0xFFD71D1D),
accentColor: Color(0xFFD71D1D),
backgroundColor: Color(0xFFAECCF9),
dialogBackgroundColor: Color(0xFFAECCF9),
scaffoldBackgroundColor: Color(0xFFA5C1EB),
dividerColor: Colors.black45,
fontFamily: 'Acme',
iconTheme: IconThemeData(
color: Colors.black,
opacity: 0.8,
),
sliderTheme: SliderThemeData(
trackHeight: 1.0,
thumbColor: Color(0xFFD71D1D),
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6),
overlayColor: Color(0xFFD71D1D).withOpacity(0.1),
activeTrackColor: Color(0xFFD71D1D),
inactiveTrackColor: Colors.black45,
),
),


// Dark themes

ThemeData(
brightness: Brightness.dark,
primarySwatch: Colors.indigo,
splashColor: Color(0xFF011025),
accentColor: Colors.deepOrange,
dialogBackgroundColor: Color(0xFF0B2A3D),
primaryColor: Colors.deepOrange,
cursorColor: Colors.deepOrange,
backgroundColor: Color(0xFF0B2A3D),
scaffoldBackgroundColor: Color(0xFF031F32),
dividerColor: Colors.white54,
fontFamily: 'Acme',
sliderTheme: SliderThemeData(
trackHeight: 1.0,
thumbColor: Colors.deepOrange,
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6),
overlayColor: Colors.blueAccent.withOpacity(0.1),
activeTrackColor: Colors.blueAccent,
inactiveTrackColor: Colors.black.withOpacity(0.2),
activeTrackColor: Colors.deepOrange,
inactiveTrackColor: Colors.white54,
),
),
ThemeData(
Expand All @@ -64,14 +120,35 @@ final List kThemes = [
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6),
overlayColor: Colors.pinkAccent.withOpacity(0.1),
activeTrackColor: Colors.pinkAccent,
inactiveTrackColor: Color(0xFF1A1E21),
inactiveTrackColor: Colors.white54,
),
),
ThemeData(
brightness: Brightness.dark,
backgroundColor: Color(0xFF31373D),
splashColor: Color(0xFF1A1E21),
scaffoldBackgroundColor: Color(0xFF282C31),
backgroundColor: Color(0xFF302326),
splashColor: Color(0xFF21181B),
scaffoldBackgroundColor: Color(0xFF2A1E21),
dialogBackgroundColor: Color(0xFF302326),
primaryColor: Colors.deepOrange,
accentColor: Colors.deepOrange,
cursorColor: Colors.deepOrange,
dividerColor: Colors.white54,
fontFamily: 'Acme',
sliderTheme: SliderThemeData(
trackHeight: 1.0,
thumbColor: Colors.deepOrange,
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6),
overlayColor: Colors.pinkAccent.withOpacity(0.1),
activeTrackColor: Colors.deepOrange,
inactiveTrackColor: Colors.white54,
),
),
ThemeData(
brightness: Brightness.dark,
backgroundColor: Color(0xFF213330),
dialogBackgroundColor: Color(0xFF213330),
splashColor: Color(0xFF172321),
scaffoldBackgroundColor: Color(0xFF1C2C29),
primaryColor: Colors.deepOrange,
accentColor: Colors.deepOrange,
cursorColor: Colors.deepOrange,
Expand All @@ -81,9 +158,29 @@ final List kThemes = [
trackHeight: 1.0,
thumbColor: Colors.deepOrange,
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6),
overlayColor: Colors.deepOrange.withOpacity(0.1),
overlayColor: Colors.pinkAccent.withOpacity(0.1),
activeTrackColor: Colors.deepOrange,
inactiveTrackColor: Color(0xFF1A1E21),
inactiveTrackColor: Colors.white54
),
),
ThemeData(
brightness: Brightness.dark,
backgroundColor: Color(0xFF252436),
dialogBackgroundColor: Color(0xFF252436),
splashColor: Color(0xFF181925),
scaffoldBackgroundColor: Color(0xFF1F1F2E),
primaryColor: Colors.pinkAccent,
accentColor: Colors.pinkAccent,
cursorColor: Colors.pinkAccent,
dividerColor: Colors.white54,
fontFamily: 'Acme',
sliderTheme: SliderThemeData(
trackHeight: 1.0,
thumbColor: Colors.pinkAccent,
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6),
overlayColor: Colors.pinkAccent.withOpacity(0.1),
activeTrackColor: Colors.pinkAccent,
inactiveTrackColor: Colors.white54,
),
),
];
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Vibe player',
theme: Provider.of<ProviderClass>(context).getTheme(),
home: SplashScreen(theme),
Expand Down
10 changes: 5 additions & 5 deletions lib/models/Provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class ProviderClass extends ChangeNotifier {

void init() async {
await getAllSongs();
recentActivity();
sortList();
}

void recentActivity() {
List newList1 = allSongs;
newList1.sort((b, a) => a['recentlyAdded'].compareTo(b['recentlyAdded']));
void sortList() {
List newList = List.from(allSongs);
newList.sort((b, a) => a['recentlyAdded'].compareTo(b['recentlyAdded']));
// sort arranged it from old to new hence the reverse
recentlyAdded.addAll(newList1);
recentlyAdded.addAll(newList);
// sort all songs in alphabetical order
allSongs.sort(
(a, b) => a['title'].toLowerCase().compareTo(b['title'].toLowerCase()));
Expand Down
12 changes: 8 additions & 4 deletions lib/models/songController.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ class SongController extends ChangeNotifier {
useArt = value;
if (nowPlaying['path'] != null && useArt) {
await Audiotagger().readArtwork(path: nowPlaying['path']).then((value) {
songArt = value;
}).catchError((e) => print(e));
// not sure if this is a fix yet
// songArt that were blank had lenght less than 20k
value.length < 20000 ? songArt = null : songArt = value;
}).catchError((e) => songArt = null);
}
notifyListeners();
}
Expand All @@ -71,8 +73,10 @@ class SongController extends ChangeNotifier {
timeLeft = '${duration.inMinutes}:${duration.inSeconds % 60}';
if (useArt) {
await Audiotagger().readArtwork(path: nowPlaying['path']).then((value) {
songArt = value;
}).catchError((e) => print(e));
// not sure if this is a fix yet
// songArt that were blank had lenght less than 20k
value.length < 20000 ? songArt = null : songArt = value;
}).catchError((e) => songArt = null);
}
isFavourite = await playListDB.isFavourite(nowPlaying);
playListDB.saveNowPlaying(nowPlaying);
Expand Down
Loading

0 comments on commit 6247ad5

Please sign in to comment.