Skip to content

Commit

Permalink
[Client] Minor warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Aug 20, 2023
1 parent 6d8191f commit dd5e31f
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 35 deletions.
15 changes: 0 additions & 15 deletions CastIt.Client/lib/infrastructure/castit_hub_client_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ class CastItHubClientServiceImpl implements CastItHubClientService {
case LogLevel.error:
case LogLevel.critical:
_logger.error(runtimeType, message);
break;
}
},
);
Expand Down Expand Up @@ -272,13 +271,11 @@ class CastItHubClientServiceImpl implements CastItHubClientService {
final pls = message as List<dynamic>;
final playlists = pls.map((e) => GetAllPlayListResponseDto.fromJson(e as Map<String, dynamic>)).toList();
playListsChanged.add(playlists);
break;
case _playerSettingsChanged:
_logger.info(runtimeType, '_handleSocketMsg: Settings were loaded');
final settings = ServerAppSettings.fromJson(message as Map<String, dynamic>);
connected.add(null);
settingsChanged.add(settings);
break;
case _playerStatusChanged:
final status = ServerPlayerStatusResponseDto.fromJson(message as Map<String, dynamic>);
if (status.player.isPaused) {
Expand All @@ -296,56 +293,44 @@ class CastItHubClientServiceImpl implements CastItHubClientService {
}
final volume = VolumeLevelChangedResponseDto(isMuted: status.player.isMuted, volumeLevel: status.player.volumeLevel);
volumeLevelChanged.add(volume);
break;
case _playListAdded:
final newPl = GetAllPlayListResponseDto.fromJson(message as Map<String, dynamic>);
playListAdded.add(newPl);
break;
case _playListChanged:
final updatedPl = GetAllPlayListResponseDto.fromJson(message as Map<String, dynamic>);
playListChanged.add(Tuple2(false, updatedPl));
break;
case _playListsChanged:
final playLists = (message as List<dynamic>).map((e) => GetAllPlayListResponseDto.fromJson(e as Map<String, dynamic>)).toList();
playListsChanged.add(playLists);
break;
case _playListDeleted:
final id = message as int;
playListDeleted.add(id);
break;
case _playListBusy:
break;
case _fileAdded:
final file = FileItemResponseDto.fromJson(message as Map<String, dynamic>);
fileAdded.add(file);
break;
case _fileChanged:
final file = FileItemResponseDto.fromJson(message as Map<String, dynamic>);
fileChanged.add(Tuple2(false, file));
break;
case _filesChanged:
final files = (message as List<dynamic>).map((e) => FileItemResponseDto.fromJson(e as Map<String, dynamic>)).toList();
filesChanged.add(files);
break;
case _fileDeleted:
final items = message as List<dynamic>;
final playListId = items.first as int;
final fileId = items.last as int;
fileDeleted.add(Tuple2(playListId, fileId));
break;
case _fileLoading:
_logger.info(runtimeType, '_handleSocketMsg: A file is loading...');
fileLoading.add(null);
break;
case _serverMessage:
final code = message as int;
serverMessageReceived.add(getAppMessageType(code));
break;
case _stoppedPlayback:
case _fileEndReached:
_logger.info(runtimeType, '_handleSocketMsg: File end reached');
fileEndReached.add(null);
break;
case _castDevicesChanged:
break;
case _castDeviceSet:
Expand Down
4 changes: 2 additions & 2 deletions CastIt.Client/lib/infrastructure/logging_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class LoggingServiceImpl implements LoggingService {
void warning(Type type, String msg, [dynamic ex, StackTrace? trace]) {
assert(!msg.isNullEmptyOrWhitespace);
final tag = type.toString();
_logger.w('$tag - ${_formatEx(msg, ex)}', ex, trace);
_logger.w('$tag - ${_formatEx(msg, ex)}', error: ex, stackTrace: trace);

if (kReleaseMode) {
_trackWarning(tag, msg, ex, trace);
Expand All @@ -39,7 +39,7 @@ class LoggingServiceImpl implements LoggingService {
void error(Type type, String msg, [dynamic ex, StackTrace? trace]) {
assert(!msg.isNullEmptyOrWhitespace);
final tag = type.toString();
_logger.e('$tag - ${_formatEx(msg, ex)}', ex, trace);
_logger.e('$tag - ${_formatEx(msg, ex)}', error: ex, stackTrace: trace);

if (kReleaseMode) {
_trackError(tag, msg, ex, trace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class _DesktopTabletScaffoldState extends State<DesktopTabletScaffold> with Sing
Expanded(child: PlayListsPage()),
],
),
const SettingsPage()
const SettingsPage(),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class IntroPageItem extends StatelessWidget {
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
),
const SizedBox(height: 20),
if (extraContent != null) extraContent!
if (extraContent != null) extraContent!,
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ class PlayCoverImg extends StatelessWidget {
loopFile: loopFile,
loopPlayList: loopPlayList,
shufflePlayList: shufflePlayList,
)
),
],
),
)
),
],
);
}
Expand Down Expand Up @@ -157,7 +157,7 @@ class _Top extends StatelessWidget {
color: Colors.white,
),
onPressed: !fileIdIsValid ? null : () => _showFileOptionsModal(context),
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PlayProgressText extends StatelessWidget {
Text(
total,
style: TextStyle(color: isDarkTheme ? Colors.white : Colors.black),
)
),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class PlayedFileVolumeOption extends StatelessWidget {
IconButton(
icon: Icon(isMuted ? Icons.volume_off : Icons.volume_up),
onPressed: () => _setVolume(context, volumeLevel, !isMuted, true),
)
),
],
)
),
],
),
);
Expand Down
2 changes: 0 additions & 2 deletions CastIt.Client/lib/presentation/playlist/playlist_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ class _PlayListPageState extends State<PlayListPage> with SingleTickerProviderSt
setState(() {
isFabVisible = true;
});
break;
case ScrollDirection.reverse:
setState(() {
isFabVisible = false;
});
break;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PlayListContentNotFound extends StatelessWidget {
),
],
),
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class _CardRow extends StatelessWidget {
splashRadius: Styles.mediumButtonSplashRadius,
),
],
)
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ class AboutSettingsCard extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
margin: const EdgeInsets.symmetric(vertical: 10),
child: Image.asset(Styles.appIconPath, width: 70, height: 70),
Image.asset(
Styles.appIconPath,
width: 70,
height: 70,
fit: BoxFit.contain,
),
Text(
i18n.appName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class _ChangeConnectionBottomSheetDialogState extends State<ChangeConnectionBott
i18n.makeSureYouAreConnected,
textAlign: TextAlign.center,
style: theme.textTheme.bodySmall,
)
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class CommonBottomSheet extends StatelessWidget {
ElevatedButton(
onPressed: onOk != null ? () => onOk!() : null,
child: Text(okText ?? s.ok),
)
),
],
)
),
],
),
),
Expand Down

0 comments on commit dd5e31f

Please sign in to comment.