From 8d700c41803d35451df466e7340b1e59771a8ad3 Mon Sep 17 00:00:00 2001 From: Patrick Niemeyer Date: Tue, 27 Feb 2024 14:56:10 -0600 Subject: [PATCH 1/2] gai: Fix lines reordred in merge. --- gai-frontend/lib/chat.dart | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gai-frontend/lib/chat.dart b/gai-frontend/lib/chat.dart index cabafdd7a..ec56ef0de 100644 --- a/gai-frontend/lib/chat.dart +++ b/gai-frontend/lib/chat.dart @@ -75,6 +75,16 @@ class _ChatViewState extends State { // Init from user parameters (for web) void _initFromParams() { Map params = Uri.base.queryParameters; + try { + _funder = EthereumAddress.from(params['funder'] ?? ''); + } catch (e) { + _funder = null; + } + try { + _signerKey = BigInt.parse(params['signer'] ?? ''); + } catch (e) { + _signerKey = null; + } String? provider = params['provider']; if (provider != null) { _providers = [provider]; @@ -103,16 +113,6 @@ class _ChatViewState extends State { contract: EthereumAddress.from('0x6dB8381b2B41b74E17F5D4eB82E8d5b04ddA0a82'), ); - try { - _funder = EthereumAddress.from(params['funder'] ?? ''); - } catch (e) { - _funder = null; - } - try { - _signerKey = BigInt.parse(params['signer'] ?? ''); - } catch (e) { - _signerKey = null; - } } void initStateAsync() async { From 347151307b9cea2484ccc6e02ebee40fd7d61a23 Mon Sep 17 00:00:00 2001 From: Patrick Niemeyer Date: Tue, 27 Feb 2024 15:07:35 -0600 Subject: [PATCH 2/2] gai: Cleanup in main --- gai-frontend/lib/main.dart | 102 ++----------------------------------- 1 file changed, 3 insertions(+), 99 deletions(-) diff --git a/gai-frontend/lib/main.dart b/gai-frontend/lib/main.dart index 367387ac2..e76239e81 100644 --- a/gai-frontend/lib/main.dart +++ b/gai-frontend/lib/main.dart @@ -1,26 +1,9 @@ import 'package:flutter/material.dart'; -//import 'guid_orchid/lib/common/app_buttons.dart'; -import 'dart:async'; -import 'dart:isolate'; -import 'package:web_socket_channel/web_socket_channel.dart'; -import 'package:web_socket_channel/status.dart' as status; -import 'package:stream_channel/isolate_channel.dart'; -import 'dart:convert'; - -import 'package:orchid/gui-orchid/lib/orchid/orchid_action_button.dart'; -import 'package:orchid/gui-orchid/lib/orchid/orchid_asset.dart'; -import 'package:orchid/gui-orchid/lib/orchid/orchid_gradients.dart'; -import 'package:orchid/gui-orchid/lib/orchid/orchid_logo.dart'; - +import 'package:orchid/api/preferences/user_preferences.dart'; import 'chat.dart'; -import 'settings.dart'; -import 'app_colors.dart'; - -void main() { -// ReceivePort _providerPort; // = ReceivePort(); -// IsolateChannel _providerChannel = new; -// IsolateChannel _providerChannel = IsolateChannel.connectReceive(); +void main() async { + await UserPreferences.init(); runApp(const MyApp()); } @@ -40,82 +23,3 @@ class MyApp extends StatelessWidget { } } -class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); - final String title; - - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - OrchidAssetImage _orchidAsset = OrchidAssetImage(); - - - @override - Widget build(BuildContext context) { - return MaterialApp( - home: Scaffold( - body: SafeArea( - child: Stack( - children: [ - Container( - padding: const EdgeInsets.all(8.0), - decoration: BoxDecoration( - gradient: OrchidGradients.blackGradientBackground, - ), - ), - Column( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [Center(child: _orchidAsset.logo_outline)], - ), - Container( - child: Center( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - IconButton.filled( - icon: const Icon(Icons.settings), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => const SettingsView()), - ); - }, - ), - ], - ), - const SizedBox(height: 20), - OrchidActionButton( - text: 'Chat', - onPressed: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => const ChatView()), - ); - }, - ), - const SizedBox(height: 40), - OrchidActionButton( - text: 'Txt2Img', - onPressed: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => const ChatView()), - ); - }, - ), - ], - ), - ), - ), - ], - ), - ), - ), - ); - } -}