Skip to content

Commit

Permalink
fixed fps screen null check on nullable values
Browse files Browse the repository at this point in the history
  • Loading branch information
hedihadi committed Nov 9, 2024
1 parent a6bcbf0 commit 8046296
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions zal_app/lib/Screens/FpsScreen/Widgets/fps_screen_pc_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class FpsScreenPcWidget extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final data = ref.watch(fpsComputerDataProvider);
final settings = ref.watch(settingsProvider).value!;
final settings = ref.watch(settingsProvider).value;
final gpu = ref.watch(computerDataProvider).value?.gpu;

if (gpu == null) return Container();
Expand All @@ -56,7 +56,7 @@ class FpsScreenPcWidget extends ConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
if ((settings['showGauges'] ?? true) == true)
if ((settings?['showGauges'] ?? true) == true)
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand Down Expand Up @@ -219,17 +219,17 @@ class FpsScreenPcWidget extends ConsumerWidget {
text: "core speed",
value: "${gpu.coreSpeed.round()}Mhz",
icon: FontAwesomeIcons.gauge,
maxValue: "${data.highestValues['gpu.coreSpeed']!.round()}Mhz"),
maxValue: "${data.highestValues['gpu.coreSpeed']?.round()}Mhz"),
FpsPcStatWidget(
text: "mem speed",
value: "${gpu.memorySpeed.round()}Mhz",
icon: Icons.memory,
maxValue: "${data.highestValues['gpu.memorySpeed']!.round()}Mhz"),
maxValue: "${data.highestValues['gpu.memorySpeed']?.round()}Mhz"),
FpsPcStatWidget(
text: "mem usage",
value: (gpu.dedicatedMemoryUsed * 1000 * 1000).toSize(),
icon: Icons.memory,
maxValue: (data.highestValues['gpu.dedicatedMemoryUsed']! * 1000 * 1000).toSize()),
maxValue: ((data.highestValues['gpu.dedicatedMemoryUsed'] ?? 0) * 1000 * 1000).toSize()),
FpsPcStatWidget(
text: "power",
value: "${gpu.power.round()}W",
Expand Down Expand Up @@ -290,7 +290,7 @@ class FpsScreenPcWidget extends ConsumerWidget {
),
InlineAd(adUnit: Platform.isAndroid ? "ca-app-pub-5545344389727160/5701849781" : "ca-app-pub-5545344389727160/3665863326"),
Visibility(
visible: ((settings['showCpuCores'] ?? true) == true),
visible: ((settings?['showCpuCores'] ?? true) == true),
child: StaggeredGridview(
children: List.generate(
data.computerData.cpu.clocks.length,
Expand Down

0 comments on commit 8046296

Please sign in to comment.