From 24a6846f03eaf68dc3984442d37e9d9c3f4add6a Mon Sep 17 00:00:00 2001 From: Kingtous Date: Sun, 29 May 2022 10:25:36 +0800 Subject: [PATCH] add: desktop password page --- .../lib/desktop/pages/desktop_home_page.dart | 191 +++++++++++++----- .../desktop/pages/desktop_remote_page.dart | 16 ++ 2 files changed, 156 insertions(+), 51 deletions(-) create mode 100644 flutter/lib/desktop/pages/desktop_remote_page.dart diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart index 467f85cc1..ad27a6d3b 100644 --- a/flutter/lib/desktop/pages/desktop_home_page.dart +++ b/flutter/lib/desktop/pages/desktop_home_page.dart @@ -22,6 +22,9 @@ class _DesktopHomePageState extends State { child: buildServerInfo(context), flex: 1, ), + SizedBox( + width: 16.0, + ), Flexible( child: buildServerBoard(context), flex: 4, @@ -35,62 +38,148 @@ class _DesktopHomePageState extends State { buildServerInfo(BuildContext context) { return ChangeNotifierProvider.value( value: FFI.serverModel, - child: Column( - children: [buildIDBoard(context)], - ), - ); - } - - buildServerBoard(BuildContext context) { - return Center( - child: ConnectionPage(key: null), - ); - } - - buildIDBoard(BuildContext context) { - final model = FFI.serverModel; - return Card( - elevation: 0.5, child: Container( - margin: EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.baseline, - textBaseline: TextBaseline.alphabetic, + decoration: BoxDecoration(color: MyTheme.white), + child: Column( children: [ - Container( - width: 4, - height: 70, - decoration: BoxDecoration(color: MyTheme.accent), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - translate("ID"), - style: - TextStyle(fontSize: 18, fontWeight: FontWeight.w500), - ), - TextFormField( - controller: model.serverId, - ), - Text( - translate("Password"), - style: - TextStyle(fontSize: 18, fontWeight: FontWeight.w500), - ), - TextField( - controller: model.serverPasswd, - ) - ], - ), - ), - ), + buildTip(context), + buildIDBoard(context), + buildPasswordBoard(context), ], ), ), ); } + + buildServerBoard(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildControlPanel(context), + buildRecentSession(context), + ConnectionPage() + ], + ); + } + + buildIDBoard(BuildContext context) { + final model = FFI.serverModel; + return Container( + margin: EdgeInsets.symmetric(vertical: 4.0, horizontal: 16.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + children: [ + Container( + width: 3, + height: 70, + decoration: BoxDecoration(color: MyTheme.accent), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + translate("ID"), + style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500), + ), + TextFormField( + controller: model.serverId, + ), + ], + ), + ), + ), + ], + ), + ); + } + + buildPasswordBoard(BuildContext context) { + final model = FFI.serverModel; + return Container( + margin: EdgeInsets.symmetric(vertical: 4.0, horizontal: 16.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + children: [ + Container( + width: 3, + height: 70, + decoration: BoxDecoration(color: MyTheme.accent), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + translate("Password"), + style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500), + ), + TextFormField( + controller: model.serverPasswd, + ), + ], + ), + ), + ), + ], + ), + ); + } + + buildTip(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + translate("Your Desktop"), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ), + SizedBox( + height: 8.0, + ), + Text( + translate("desk_tip"), + overflow: TextOverflow.clip, + style: TextStyle(fontSize: 14), + ) + ], + ), + ); + } + + buildControlPanel(BuildContext context) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), color: MyTheme.white), + padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(translate("Control Remote Desktop")), + Form( + child: Column( + children: [ + TextFormField( + controller: TextEditingController(), + inputFormatters: [], + ) + ], + )) + ], + ), + ); + } + + buildRecentSession(BuildContext context) { + return Center(child: Text("waiting implementation")); + } } diff --git a/flutter/lib/desktop/pages/desktop_remote_page.dart b/flutter/lib/desktop/pages/desktop_remote_page.dart new file mode 100644 index 000000000..748e4cf3c --- /dev/null +++ b/flutter/lib/desktop/pages/desktop_remote_page.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +/// Remote Page, use it in multi window context +class DesktopRemotePage extends StatefulWidget { + const DesktopRemotePage({Key? key}) : super(key: key); + + @override + State createState() => _DesktopRemotePageState(); +} + +class _DesktopRemotePageState extends State { + @override + Widget build(BuildContext context) { + return Container(); + } +}