From bf0cba47bf179aa9eaf7678bac49290c2b07a386 Mon Sep 17 00:00:00 2001 From: timzaak Date: Sat, 12 Aug 2023 20:36:50 +0800 Subject: [PATCH] android ui 1 --- app/lib/main.dart | 13 --------- app/lib/mobile_app.dart | 5 +++- app/lib/page/mobile/join_network_page.dart | 20 +++++++++++++ app/lib/page/mobile/main_page.dart | 28 +++++++++++++++++++ app/lib/page/{ => pc}/login_page.dart | 0 app/lib/page/{ => pc}/welcome_page.dart | 0 app/lib/pc_app.dart | 17 +++++++++-- .../Flutter/GeneratedPluginRegistrant.swift | 2 ++ app/pubspec.lock | 8 ++++++ app/pubspec.yaml | 1 + 10 files changed, 78 insertions(+), 16 deletions(-) create mode 100644 app/lib/page/mobile/join_network_page.dart create mode 100644 app/lib/page/mobile/main_page.dart rename app/lib/page/{ => pc}/login_page.dart (100%) rename app/lib/page/{ => pc}/welcome_page.dart (100%) diff --git a/app/lib/main.dart b/app/lib/main.dart index 4ed94ef..79dc5db 100644 --- a/app/lib/main.dart +++ b/app/lib/main.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:bitsdojo_window/bitsdojo_window.dart'; import 'package:flutter/material.dart'; import 'package:for_net_ui/mobile_app.dart'; import 'package:for_net_ui/pc_app.dart'; @@ -14,16 +13,4 @@ void main() { } } -void pcRun() { - runApp(const PCApp()); - doWhenWindowReady(() { - final win = appWindow; - const initialSize = Size(400, 160); - win.minSize = initialSize; - win.size = initialSize; - win.alignment = Alignment.center; - //win.show(); - //win.hide(); - }); -} diff --git a/app/lib/mobile_app.dart b/app/lib/mobile_app.dart index 4d980c8..7a346be 100644 --- a/app/lib/mobile_app.dart +++ b/app/lib/mobile_app.dart @@ -2,15 +2,18 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:for_net_ui/native/extra_ffi.dart'; import 'package:for_net_ui/native/ffi.dart'; +import 'package:for_net_ui/page/mobile/main_page.dart'; import 'package:path_provider/path_provider.dart'; import 'package:path/path.dart' as p; import 'package:permission_handler/permission_handler.dart'; void mobileRun() { + runApp(MaterialApp( title: 'ForNet', theme: ThemeData.light(useMaterial3: true), - home: const MobileApp(), + //home: const MobileApp(), + home: const MainPage() )); } diff --git a/app/lib/page/mobile/join_network_page.dart b/app/lib/page/mobile/join_network_page.dart new file mode 100644 index 0000000..fc3a1d6 --- /dev/null +++ b/app/lib/page/mobile/join_network_page.dart @@ -0,0 +1,20 @@ + +import 'package:flutter/material.dart'; + +class JoinNetworkPage extends StatelessWidget { + const JoinNetworkPage({super.key}); + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Join Network'), + ), + body: Column(children: [ + ElevatedButton(onPressed: () => {}, child: const Text('Scan QRCode')), + ElevatedButton(onPressed: () => {}, child: const Text('KeyCloak')) + ],), + ); + } +} \ No newline at end of file diff --git a/app/lib/page/mobile/main_page.dart b/app/lib/page/mobile/main_page.dart new file mode 100644 index 0000000..ac4dc55 --- /dev/null +++ b/app/lib/page/mobile/main_page.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; +import 'package:for_net_ui/page/mobile/join_network_page.dart'; + +class MainPage extends StatelessWidget { + const MainPage({super.key}); + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('ForNet'), + leading: IconButton( + icon: const Icon(Icons.add), + onPressed: () async { + await Navigator.push(context, MaterialPageRoute(builder: (_) => const JoinNetworkPage())); + }, + ), + ), + body: Column( + children: [ + ElevatedButton(onPressed: ()=> {}, child: const Text('Hello World!')) + ], + ) + ); + } +} + diff --git a/app/lib/page/login_page.dart b/app/lib/page/pc/login_page.dart similarity index 100% rename from app/lib/page/login_page.dart rename to app/lib/page/pc/login_page.dart diff --git a/app/lib/page/welcome_page.dart b/app/lib/page/pc/welcome_page.dart similarity index 100% rename from app/lib/page/welcome_page.dart rename to app/lib/page/pc/welcome_page.dart diff --git a/app/lib/pc_app.dart b/app/lib/pc_app.dart index 70d6a14..6bbcf5d 100644 --- a/app/lib/pc_app.dart +++ b/app/lib/pc_app.dart @@ -8,8 +8,8 @@ import 'package:bitsdojo_window/bitsdojo_window.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:for_net_ui/native/ffi.dart'; -import 'package:for_net_ui/page/login_page.dart'; -import 'package:for_net_ui/page/welcome_page.dart'; +import 'package:for_net_ui/page/pc/login_page.dart'; +import 'package:for_net_ui/page/pc/welcome_page.dart'; import 'package:launch_at_startup/launch_at_startup.dart'; import 'package:system_tray/system_tray.dart'; import 'package:package_info_plus/package_info_plus.dart'; @@ -29,6 +29,19 @@ class PCApp extends StatefulWidget { bool initSuccess = false; + +void pcRun() { + runApp(const PCApp()); + doWhenWindowReady(() { + final win = appWindow; + const initialSize = Size(400, 160); + win.minSize = initialSize; + win.size = initialSize; + win.alignment = Alignment.center; + //win.show(); + //win.hide(); + }); +} class _PCAppState extends State { final AppWindow _appWindow = AppWindow(); final SystemTray _systemTray = SystemTray(); diff --git a/app/macos/Flutter/GeneratedPluginRegistrant.swift b/app/macos/Flutter/GeneratedPluginRegistrant.swift index 05eb847..cee4614 100644 --- a/app/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/app/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,12 +6,14 @@ import FlutterMacOS import Foundation import bitsdojo_window_macos +import mobile_scanner import package_info_plus import path_provider_foundation import system_tray func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { BitsdojoWindowPlugin.register(with: registry.registrar(forPlugin: "BitsdojoWindowPlugin")) + MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SystemTrayPlugin.register(with: registry.registrar(forPlugin: "SystemTrayPlugin")) diff --git a/app/pubspec.lock b/app/pubspec.lock index 19f678f..87ec062 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -448,6 +448,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" + mobile_scanner: + dependency: "direct main" + description: + name: mobile_scanner + sha256: "2fbc3914fe625e196c64ea8ffc4084cd36781d2be276d4d5923b11af3b5d44ff" + url: "https://pub.dev" + source: hosted + version: "3.4.1" package_config: dependency: transitive description: diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 55cf46a..c182869 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -45,6 +45,7 @@ dependencies: path_provider: ^2.0.15 path: ^1.8.3 permission_handler: ^10.4.3 + mobile_scanner: ^3.4.1 # provider: ^6.0.1 # functional_data: ^1.0.0