diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 2c783bc..6ff3f64 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName - Template + Chat CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -13,7 +13,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - template + Chat CFBundlePackageType APPL CFBundleShortVersionString diff --git a/lib/common/Global.dart b/lib/common/Global.dart index b379b61..9fcb8dd 100644 --- a/lib/common/Global.dart +++ b/lib/common/Global.dart @@ -37,19 +37,22 @@ class Global { NetworkConfig.BASE_URLS = NetworkConfig.BASE_URLS_AI; } - if (Platform.isIOS) { - //ios相关代码 - flatform_name = 'iOS'; - } else if (Platform.isAndroid) { - //android相关代码 - flatform_name = 'Android'; - } - WidgetsFlutterBinding.ensureInitialized(); //不加这个强制横/竖屏会报错 - SystemChrome.setPreferredOrientations([ - // 强制竖屏 - DeviceOrientation.portraitUp, - DeviceOrientation.portraitDown - ]); - Global a = Global.instance; + // if (Platform.isIOS) { + // //ios相关代码 + // flatform_name = 'iOS'; + // } else if (Platform.isAndroid) { + // //android相关代码 + // flatform_name = 'Android'; + // } else if (Platform.isWindows) { + // //android相关代码 + // flatform_name = 'Windows'; + // } + // WidgetsFlutterBinding.ensureInitialized(); //不加这个强制横/竖屏会报错 + // SystemChrome.setPreferredOrientations([ + // // 强制竖屏 + // DeviceOrientation.portraitUp, + // DeviceOrientation.portraitDown + // ]); + // Global a = Global.instance; } } diff --git a/lib/main.dart b/lib/main.dart index ff7c8ee..ae02769 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,10 +1,11 @@ import 'dart:async'; import 'dart:io'; +import 'dart:math'; +import 'package:Chat/tools/HomePage.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; -import 'package:template/tools/HomePage.dart'; import 'common/Global.dart'; @@ -20,7 +21,9 @@ Future main() async { SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } }); - }, (error, stackTrace) {}); + }, (error, stackTrace) { + print("error==$error"); + }); } class ChatApp extends StatefulWidget { @@ -31,22 +34,25 @@ class ChatApp extends StatefulWidget { } class _ChatAppState extends State { + + + @override void initState() { // TODO: implement initState super.initState(); + print("666666"); } @override Widget build(BuildContext context) { return MaterialApp( title: 'AI聊天', - - home: const Homepage(), + home: Homepage(), //注册路由 routes: { - '/HomePage': (BuildContext context) => const Homepage(), + '/HomePage': (BuildContext context) => Homepage(), }, debugShowMaterialGrid: false, diff --git a/lib/tools/HomePage.dart b/lib/tools/HomePage.dart index 8473dee..1eee1ca 100644 --- a/lib/tools/HomePage.dart +++ b/lib/tools/HomePage.dart @@ -10,8 +10,14 @@ class Homepage extends StatefulWidget { class _HomepageState extends State { @override Widget build(BuildContext context) { - return Container( - child: Text("你好"), + return Scaffold( + appBar: AppBar( + title: Text("聊天"), + ), + body: Container( + child: Text('你好'), + ), ); + } } diff --git a/pubspec.yaml b/pubspec.yaml index 2774e47..b88b744 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,4 @@ -name: template +name: Chat description: "A new Flutter project." # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. diff --git a/test/widget_test.dart b/test/widget_test.dart deleted file mode 100644 index 6cf68dc..0000000 --- a/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility in the flutter_test package. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:template/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/web/index.html b/web/index.html index 115bc8e..0f26f2f 100644 --- a/web/index.html +++ b/web/index.html @@ -23,13 +23,13 @@ - + - template + Chat diff --git a/web/manifest.json b/web/manifest.json index f28b193..4a81152 100644 --- a/web/manifest.json +++ b/web/manifest.json @@ -1,6 +1,6 @@ { - "name": "template", - "short_name": "template", + "name": "Chat", + "short_name": "Chat", "start_url": ".", "display": "standalone", "background_color": "#0175C2", diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 4ef9a45..34c6fd7 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -1,10 +1,10 @@ # Project-level configuration. cmake_minimum_required(VERSION 3.14) -project(template LANGUAGES CXX) +project(Chat LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. -set(BINARY_NAME "template") +set(BINARY_NAME "Chat") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index 40e74c9..4cf005f 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -90,12 +90,12 @@ BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "com.example" "\0" - VALUE "FileDescription", "template" "\0" + VALUE "FileDescription", "Chat" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" - VALUE "InternalName", "template" "\0" + VALUE "InternalName", "Chat" "\0" VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" - VALUE "OriginalFilename", "template.exe" "\0" - VALUE "ProductName", "template" "\0" + VALUE "OriginalFilename", "Chat.exe" "\0" + VALUE "ProductName", "Chat" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0" END END diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp index 9b49f66..1a130a3 100644 --- a/windows/runner/main.cpp +++ b/windows/runner/main.cpp @@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, FlutterWindow window(project); Win32Window::Point origin(10, 10); Win32Window::Size size(1280, 720); - if (!window.Create(L"template", origin, size)) { + if (!window.Create(L"Chat", origin, size)) { return EXIT_FAILURE; } window.SetQuitOnClose(true);