Skip to content

Commit

Permalink
Fix linter complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasWanke committed Dec 4, 2023
1 parent a985473 commit 3b6a719
Show file tree
Hide file tree
Showing 6 changed files with 710 additions and 36 deletions.
44 changes: 24 additions & 20 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: depend_on_referenced_packages

import 'dart:math';

import 'package:black_hole_flutter/black_hole_flutter.dart';
Expand All @@ -14,27 +16,29 @@ import 'package:flutter_localizations/flutter_localizations.dart';
final logs = LogCollection();
final mediaOverrideState = ValueNotifier(MediaOverrideState());

final supportedLocales = kMaterialSupportedLanguages
.sortedBy((it) => it)
.map((it) => Locale(it))
.toList();
final supportedLocales =
kMaterialSupportedLanguages.sortedBy((it) => it).map(Locale.new).toList();

void main() {
if (kDebugMode) {
DebugOverlay.prependHelper(MediaOverrideDebugHelper(
mediaOverrideState,
// To support overriding locales, this value must be set and should
// contain the same locales as passed to [MaterialApp.supportedLocales],
// [CupertinoApp.supportedLocales] or [WidgetsApp.supportedLocales].
supportedLocales: supportedLocales,
));
DebugOverlay.prependHelper(
MediaOverrideDebugHelper(
mediaOverrideState,
// To support overriding locales, this value must be set and should
// contain the same locales as passed to [MaterialApp.supportedLocales],
// [CupertinoApp.supportedLocales] or [WidgetsApp.supportedLocales].
supportedLocales: supportedLocales,
),
);
DebugOverlay.appendHelper(LogsDebugHelper(logs));
}

runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
// To use the [MediaOverrideDebugHelper], wrap your app in a
Expand All @@ -51,21 +55,23 @@ class MyApp extends StatelessWidget {

// This creates the actual [DebugOverlay] (only in debug mode; not in
// profile oder release mode).
builder: DebugOverlay.builder(showOnShake: true),
builder: DebugOverlay.builder(),

// And the usual customization:
supportedLocales: supportedLocales,
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
localizationsDelegates: GlobalMaterialLocalizations.delegates,
home: HomePage(),
home: const HomePage(),
);
},
);
}
}

class HomePage extends StatelessWidget {
const HomePage({super.key});

static final _random = Random();

@override
Expand All @@ -81,13 +87,13 @@ class HomePage extends StatelessWidget {
Text('Locale: ${context.locale}'),
const SizedBox(height: 16),
TextButton(
onPressed: () => _createLog(),
onPressed: _createLog,
child: const Text('Add log'),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => DebugOverlay.show(),
child: const Text('Show Debug Overlay'),
const ElevatedButton(
onPressed: DebugOverlay.show,
child: Text('Show Debug Overlay'),
),
],
),
Expand All @@ -113,5 +119,3 @@ class HomePage extends StatelessWidget {
logs.add(log);
}
}

// ignore_for_file: unnecessary_lambdas
4 changes: 4 additions & 0 deletions example/linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include "generated_plugin_registrant.h"

#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
}
1 change: 1 addition & 0 deletions example/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down
Loading

0 comments on commit 3b6a719

Please sign in to comment.