去除平台判断.
This commit is contained in:
parent
66de669e1d
commit
4a812d1a16
|
|
@ -5,7 +5,7 @@
|
|||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Template</string>
|
||||
<string>Chat</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>template</string>
|
||||
<string>Chat</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<void> 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<ChatApp> {
|
||||
|
||||
|
||||
|
||||
@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: <String, WidgetBuilder>{
|
||||
'/HomePage': (BuildContext context) => const Homepage(),
|
||||
'/HomePage': (BuildContext context) => Homepage(),
|
||||
},
|
||||
|
||||
debugShowMaterialGrid: false,
|
||||
|
|
|
|||
|
|
@ -10,8 +10,14 @@ class Homepage extends StatefulWidget {
|
|||
class _HomepageState extends State<Homepage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Text("你好"),
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("聊天"),
|
||||
),
|
||||
body: Container(
|
||||
child: Text('你好'),
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
@ -23,13 +23,13 @@
|
|||
<!-- iOS meta tags & icons -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="template">
|
||||
<meta name="apple-mobile-web-app-title" content="Chat">
|
||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
|
||||
<title>template</title>
|
||||
<title>Chat</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "template",
|
||||
"short_name": "template",
|
||||
"name": "Chat",
|
||||
"short_name": "Chat",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "#0175C2",
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user