Skip to content

Commit

Permalink
fix: Null safe future calls
Browse files Browse the repository at this point in the history
Signed-off-by: Ashwin Ramakrishnan <[email protected]>
  • Loading branch information
ashwinkey04 committed Mar 18, 2021
1 parent 2a2cca2 commit 02f3a5d
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 153 deletions.
28 changes: 6 additions & 22 deletions lib/provider/song_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:provider/provider.dart';
import 'package:raag/model/music_model.dart';
import 'package:raag/provider/player_provider.dart';
import 'package:raag/provider/theme.dart';
import 'package:raag/view/playback_controls.dart';

import 'audio_helper.dart';

Expand All @@ -16,43 +15,29 @@ class SongWidget extends StatefulWidget {
_SongWidgetState createState() => _SongWidgetState();
}

class _SongWidgetState extends State<SongWidget> with TickerProviderStateMixin {
@override
void initState() {
super.initState();
playFABController =
AnimationController(vsync: this, duration: Duration(milliseconds: 300));
}

@override
void dispose() {
super.dispose();
playFABController.dispose();
}

class _SongWidgetState extends State<SongWidget> {
@override
Widget build(BuildContext context) {
final screenHeight = MediaQuery.of(context).size.height;
final screenWidth = MediaQuery.of(context).size.width;
final provider = Provider.of<PlayerProvider>(context);

return Column(
children: [
Flexible(
child: ListView.builder(
itemCount: widget.songList.length,
itemCount: widget?.songList?.length,
itemBuilder: (context, songIndex) {
Song song = widget.songList[songIndex];
Song song = widget?.songList[songIndex];
if (song.displayName.contains(".mp3"))
return Column(
children: [
SizedBox(height: 10),
Container(
padding: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Theme.of(context).dividerColor.withOpacity(0.4),
borderRadius: BorderRadius.all(Radius.circular(24))
),
color: Theme.of(context).dividerColor,
borderRadius:
BorderRadius.all(Radius.circular(24))),
child: InkWell(
onTap: () {
if (provider.audioManagerInstance.isPlaying)
Expand Down Expand Up @@ -121,7 +106,6 @@ class _SongWidgetState extends State<SongWidget> with TickerProviderStateMixin {
);
}),
),
PlayBackControls(),
],
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/provider/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class AppTheme {
static final ThemeData darkTheme = ThemeData(
backgroundColor: hex('000000'),
accentColor: hex('809DF5'),
dividerColor: hex('404040'),
dividerColor: hex('1a1a1a'),
scaffoldBackgroundColor: hex('000000'),
appBarTheme: AppBarTheme(
color: hex('000000'),
Expand Down
5 changes: 4 additions & 1 deletion lib/view/home_scaffold.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:raag/provider/settings_provider.dart';
import 'package:raag/view/download_music.dart';
import 'package:raag/view/playback_controls.dart';
import 'package:raag/view/settings.dart';
import 'package:raag/widgets/my_music_list.dart';
import 'package:raag/view/download_music.dart';

class HomeScaffold extends StatelessWidget {
@override
Expand Down Expand Up @@ -57,6 +59,7 @@ class HomeScaffold extends StatelessWidget {
children: [MyMusicList()],
),
),
PlayBackControls()
],
),
);
Expand Down
Loading

0 comments on commit 02f3a5d

Please sign in to comment.