diff --git a/.gitignore b/.gitignore index db4fcf0..1734bcf 100644 --- a/.gitignore +++ b/.gitignore @@ -26,9 +26,9 @@ migrate_working_dir/ /pubspec.lock **/doc/api/ .dart_tool/ -.flutter-plugins .flutter-plugins-dependencies -build/ +/build/ +/coverage/ # Development Scripts scripts/ diff --git a/.metadata b/.metadata index 9fcba7d..39a37ed 100644 --- a/.metadata +++ b/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: "35c388afb57ef061d06a39b537336c87e0e3d1b1" + revision: "a402d9a4376add5bc2d6b1e33e53edaae58c07f8" channel: "stable" project_type: package diff --git a/example/.gitignore b/example/.gitignore index 79c113f..3820a95 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -27,11 +27,11 @@ migrate_working_dir/ **/doc/api/ **/ios/Flutter/.last_build_id .dart_tool/ -.flutter-plugins .flutter-plugins-dependencies .pub-cache/ .pub/ /build/ +/coverage/ # Symbolication related app.*.symbols diff --git a/example/.metadata b/example/.metadata index 9a674c6..3268d00 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: "35c388afb57ef061d06a39b537336c87e0e3d1b1" + revision: "a402d9a4376add5bc2d6b1e33e53edaae58c07f8" channel: "stable" project_type: app @@ -13,26 +13,26 @@ project_type: app migration: platforms: - platform: root - create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 - base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 + create_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 + base_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 - platform: android - create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 - base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 + create_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 + base_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 - platform: ios - create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 - base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 + create_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 + base_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 - platform: linux - create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 - base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 + create_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 + base_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 - platform: macos - create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 - base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 + create_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 + base_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 - platform: web - create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 - base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 + create_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 + base_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 - platform: windows - create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 - base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1 + create_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 + base_revision: a402d9a4376add5bc2d6b1e33e53edaae58c07f8 # User provided section diff --git a/example/android/app/build.gradle.kts b/example/android/app/build.gradle.kts index 4aef853..c5de75a 100644 --- a/example/android/app/build.gradle.kts +++ b/example/android/app/build.gradle.kts @@ -8,7 +8,7 @@ plugins { android { namespace = "rocks.outdatedguy.internet_connection_checker_plus_example" compileSdk = flutter.compileSdkVersion - ndkVersion = "27.0.12077973" + ndkVersion = flutter.ndkVersion compileOptions { sourceCompatibility = JavaVersion.VERSION_11 diff --git a/example/android/build.gradle.kts b/example/android/build.gradle.kts index 89176ef..dbee657 100644 --- a/example/android/build.gradle.kts +++ b/example/android/build.gradle.kts @@ -5,7 +5,10 @@ allprojects { } } -val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() rootProject.layout.buildDirectory.value(newBuildDir) subprojects { diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index afa1e8e..ac3b479 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip diff --git a/example/android/settings.gradle.kts b/example/android/settings.gradle.kts index 11662c3..fb605bc 100644 --- a/example/android/settings.gradle.kts +++ b/example/android/settings.gradle.kts @@ -1,11 +1,12 @@ pluginManagement { - val flutterSdkPath = run { - val properties = java.util.Properties() - file("local.properties").inputStream().use { properties.load(it) } - val flutterSdkPath = properties.getProperty("flutter.sdk") - require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } - flutterSdkPath - } + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") @@ -18,7 +19,7 @@ pluginManagement { plugins { id("dev.flutter.flutter-plugin-loader") version "1.0.0" - id("com.android.application") version "8.7.0" apply false + id("com.android.application") version "8.9.1" apply false id("org.jetbrains.kotlin.android") version "2.1.0" apply false } diff --git a/example/lib/main.dart b/example/lib/main.dart index 565e221..2d8de27 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -22,6 +22,14 @@ class MyApp extends StatelessWidget { colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), + darkTheme: ThemeData( + brightness: Brightness.dark, + colorScheme: ColorScheme.fromSeed( + brightness: Brightness.dark, + seedColor: Colors.deepPurple, + ), + useMaterial3: true, + ), home: MyHomePage(), ); } @@ -47,20 +55,19 @@ class MyHomePage extends StatelessWidget { body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: - pages.entries.map((entry) { - return Padding( - padding: const EdgeInsets.all(10.0), - child: ElevatedButton( - onPressed: () { - Navigator.of(context).push( - MaterialPageRoute(builder: (context) => entry.value), - ); - }, - child: Text(entry.key), - ), - ); - }).toList(), + children: pages.entries.map((entry) { + return Padding( + padding: const EdgeInsets.all(10.0), + child: ElevatedButton( + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute(builder: (context) => entry.value), + ); + }, + child: Text(entry.key), + ), + ); + }).toList(), ), ), ); diff --git a/example/lib/pages/custom_success_criteria.dart b/example/lib/pages/custom_success_criteria.dart index 74f6878..cdd0c80 100644 --- a/example/lib/pages/custom_success_criteria.dart +++ b/example/lib/pages/custom_success_criteria.dart @@ -66,9 +66,9 @@ class _CustomSuccessCriteriaState extends State { _connectionStatus == null ? const CircularProgressIndicator.adaptive() : Text( - _connectionStatus.toString(), - style: Theme.of(context).textTheme.headlineSmall, - ), + _connectionStatus.toString(), + style: Theme.of(context).textTheme.headlineSmall, + ), ], ), ), diff --git a/example/lib/pages/custom_uris.dart b/example/lib/pages/custom_uris.dart index 551e9c4..e9a0407 100644 --- a/example/lib/pages/custom_uris.dart +++ b/example/lib/pages/custom_uris.dart @@ -76,9 +76,9 @@ class _CustomURIsState extends State { _connectionStatus == null ? const CircularProgressIndicator.adaptive() : Text( - _connectionStatus.toString(), - style: Theme.of(context).textTheme.headlineSmall, - ), + _connectionStatus.toString(), + style: Theme.of(context).textTheme.headlineSmall, + ), ], ), ), diff --git a/example/lib/pages/listen_once.dart b/example/lib/pages/listen_once.dart index 031a553..a102c82 100644 --- a/example/lib/pages/listen_once.dart +++ b/example/lib/pages/listen_once.dart @@ -47,9 +47,9 @@ class _ListenOnceState extends State { _connectionStatus == null ? const CircularProgressIndicator.adaptive() : Text( - _connectionStatus.toString(), - style: Theme.of(context).textTheme.headlineSmall, - ), + _connectionStatus.toString(), + style: Theme.of(context).textTheme.headlineSmall, + ), ], ), ), diff --git a/example/lib/pages/listen_to_stream.dart b/example/lib/pages/listen_to_stream.dart index 6220dd3..4a91667 100644 --- a/example/lib/pages/listen_to_stream.dart +++ b/example/lib/pages/listen_to_stream.dart @@ -56,9 +56,9 @@ class _ListenToStreamState extends State { _connectionStatus == null ? const CircularProgressIndicator.adaptive() : Text( - _connectionStatus.toString(), - style: Theme.of(context).textTheme.headlineSmall, - ), + _connectionStatus.toString(), + style: Theme.of(context).textTheme.headlineSmall, + ), ], ), ), diff --git a/example/linux/runner/my_application.cc b/example/linux/runner/my_application.cc index a0ca7b0..440e8ce 100644 --- a/example/linux/runner/my_application.cc +++ b/example/linux/runner/my_application.cc @@ -14,6 +14,12 @@ struct _MyApplication { G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) +// Called when first Flutter frame received. +static void first_frame_cb(MyApplication* self, FlView *view) +{ + gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view))); +} + // Implements GApplication::activate. static void my_application_activate(GApplication* application) { MyApplication* self = MY_APPLICATION(application); @@ -48,15 +54,23 @@ static void my_application_activate(GApplication* application) { } gtk_window_set_default_size(window, 1280, 720); - gtk_widget_show(GTK_WIDGET(window)); g_autoptr(FlDartProject) project = fl_dart_project_new(); fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); FlView* view = fl_view_new(project); + GdkRGBA background_color; + // Background defaults to black, override it here if necessary, e.g. #00000000 for transparent. + gdk_rgba_parse(&background_color, "#000000"); + fl_view_set_background_color(view, &background_color); gtk_widget_show(GTK_WIDGET(view)); gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + // Show the window when Flutter renders. + // Requires the view to be realized so we can start rendering. + g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb), self); + gtk_widget_realize(GTK_WIDGET(view)); + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); gtk_widget_grab_focus(GTK_WIDGET(view)); diff --git a/example/pubspec.yaml b/example/pubspec.yaml index f58362b..ea9ee57 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ^3.7.0 + sdk: ^3.0.0 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions