Skip to content

Commit

Permalink
feat: linux icon, filled, text button, platform_app add
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Nov 6, 2022
1 parent b5fc2fa commit 067cf38
Show file tree
Hide file tree
Showing 14 changed files with 459 additions and 50 deletions.
12 changes: 12 additions & 0 deletions .flutter-plugins
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# This is a generated file; do not edit or check into version control.
macos_ui=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/macos_ui-1.7.5/
package_info_plus=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.3+1/
package_info_plus_linux=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus_linux-1.0.5/
package_info_plus_macos=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus_macos-1.3.0/
package_info_plus_web=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus_web-1.0.6/
package_info_plus_windows=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus_windows-2.1.0/
url_launcher=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.1.6/
url_launcher_android=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_android-6.0.21/
url_launcher_ios=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.17/
url_launcher_linux=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-3.0.1/
url_launcher_macos=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-3.0.1/
url_launcher_web=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-2.0.13/
url_launcher_windows=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-3.0.1/
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[],"android":[],"macos":[{"name":"macos_ui","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/macos_ui-1.7.5/","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"macos_ui","dependencies":[]}],"date_created":"2022-10-27 21:16:37.406167","version":"3.3.5"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"package_info_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.3+1/","native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.17/","native_build":true,"dependencies":[]}],"android":[{"name":"package_info_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus-1.4.3+1/","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_android-6.0.21/","native_build":true,"dependencies":[]}],"macos":[{"name":"macos_ui","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/macos_ui-1.7.5/","native_build":true,"dependencies":[]},{"name":"package_info_plus_macos","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus_macos-1.3.0/","native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-3.0.1/","native_build":true,"dependencies":[]}],"linux":[{"name":"package_info_plus_linux","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus_linux-1.0.5/","native_build":false,"dependencies":[]},{"name":"url_launcher_linux","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-3.0.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"package_info_plus_windows","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus_windows-2.1.0/","native_build":false,"dependencies":[]},{"name":"url_launcher_windows","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-3.0.1/","native_build":true,"dependencies":[]}],"web":[{"name":"package_info_plus_web","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/package_info_plus_web-1.0.6/","dependencies":[]},{"name":"url_launcher_web","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-2.0.13/","dependencies":[]}]},"dependencyGraph":[{"name":"macos_ui","dependencies":[]},{"name":"package_info_plus","dependencies":["package_info_plus_linux","package_info_plus_macos","package_info_plus_windows","package_info_plus_web"]},{"name":"package_info_plus_linux","dependencies":[]},{"name":"package_info_plus_macos","dependencies":[]},{"name":"package_info_plus_web","dependencies":[]},{"name":"package_info_plus_windows","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2022-11-04 12:48:05.162500","version":"3.3.5"}
20 changes: 17 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,36 @@ import 'package:flutter/material.dart';
import 'package:platform_ui/platform_ui.dart';

void main() {
platform = TargetPlatform.windows;
platform = TargetPlatform.linux;
runApp(const MyApp());
}

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

@override
State<MyApp> createState() => _MyAppState();
State<MyApp> createState() => MyAppState();

static MyAppState of(context) =>
context.findAncestorStateOfType<MyAppState>()!;
}

class _MyAppState extends State<MyApp> {
class MyAppState extends State<MyApp> {
ThemeMode themeMode = ThemeMode.system;

toggleTheme() {
setState(() {
themeMode =
themeMode == ThemeMode.dark ? ThemeMode.light : ThemeMode.dark;
});
}

@override
Widget build(BuildContext context) {
return PlatformApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
themeMode: themeMode,
home: MyHomePage(
title: 'Flutter Demo Home Page',
onChange: (value) {
Expand Down Expand Up @@ -167,6 +180,7 @@ class _MyHomePageState extends State<MyHomePage> {
setState(() {
checked = value;
});
MyApp.of(context).toggleTheme();
},
activeThumbColor: Colors.red,
activeTrackColor: Colors.red[800],
Expand Down
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
4 changes: 4 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import FlutterMacOS
import Foundation

import macos_ui
import package_info_plus_macos
import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
Loading

0 comments on commit 067cf38

Please sign in to comment.