Skip to content

Commit

Permalink
Merge pull request #137 from mylxsw/v2.x
Browse files Browse the repository at this point in the history
update
  • Loading branch information
mylxsw authored Feb 15, 2025
2 parents 561510b + beec5c8 commit cfd6657
Show file tree
Hide file tree
Showing 37 changed files with 124 additions and 54 deletions.
Binary file modified android/app/src/main/res/drawable-hdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-mdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions android/app/src/main/res/values-night-v31/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
4 changes: 4 additions & 0 deletions android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Expand Down
19 changes: 19 additions & 0 deletions android/app/src/main/res/values-v31/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
4 changes: 2 additions & 2 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
Expand Down
Binary file modified assets/app-256-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/app-splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/background-creative-island.jpg
Binary file not shown.
Binary file removed assets/background-dark-s1.jpg
Binary file not shown.
Binary file removed assets/background-dark-s3.jpg
Binary file not shown.
Binary file removed assets/background-dark.jpg
Binary file not shown.
Binary file removed assets/background-discovery-dark.jpg
Binary file not shown.
Binary file removed assets/background-light-s1.jpg
Binary file not shown.
Binary file removed assets/background-team.jpg
Binary file not shown.
Binary file removed assets/background.jpg
Binary file not shown.
Binary file modified ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIStatusBarHidden</key>
<false/>
<true/>
</dict>
</plist>
4 changes: 4 additions & 0 deletions lib/helper/platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class PlatformTool {
return isWindows() || isLinux() || isMacOS();
}

static bool isDesktopAndWeb() {
return isDesktop() || isWeb();
}

static bool isMobile() {
return isIOS() || isAndroid();
}
Expand Down
4 changes: 0 additions & 4 deletions lib/page/chat/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,6 @@ class _HomePageState extends State<HomePage> {
},
),
],
backgroundImage: Image.asset(
customColors.appBarBackgroundImage!,
fit: BoxFit.cover,
),
appBarExtraWidgets: () {
return [
SliverStickyHeader(
Expand Down
8 changes: 4 additions & 4 deletions lib/page/component/chat/chat_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class _ChatInputState extends State<ChatInput> with TickerProviderStateMixin {
void initState() {
super.initState();

if (!PlatformTool.isDesktop()) {
if (!PlatformTool.isDesktopAndWeb()) {
availableCameras().then((cameras) {
setState(() {
hasCamera = cameras.isNotEmpty;
Expand Down Expand Up @@ -142,11 +142,11 @@ class _ChatInputState extends State<ChatInput> with TickerProviderStateMixin {
child: SafeArea(
bottom: false,
child: Container(
margin: PlatformTool.isDesktop() ? const EdgeInsets.all(8) : null,
margin: PlatformTool.isDesktopAndWeb() ? const EdgeInsets.all(8) : null,
padding: const EdgeInsets.only(left: 16, right: 16, top: 8),
decoration: BoxDecoration(
color: customColors.chatInputAreaBackground,
borderRadius: PlatformTool.isDesktop()
borderRadius: PlatformTool.isDesktopAndWeb()
? BorderRadius.circular(CustomSize.radiusValue)
: const BorderRadius.only(
topLeft: Radius.circular(CustomSize.radiusValue * 2),
Expand All @@ -158,7 +158,7 @@ class _ChatInputState extends State<ChatInput> with TickerProviderStateMixin {
offset: const Offset(-1, -1),
blurRadius: CustomSize.radiusValue,
),
if (PlatformTool.isDesktop())
if (PlatformTool.isDesktopAndWeb())
BoxShadow(
color: Colors.black.withOpacity(0.08),
offset: const Offset(-1, -1),
Expand Down
30 changes: 0 additions & 30 deletions lib/page/component/theme/custom_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import 'package:flutter/material.dart';

class CustomColors extends ThemeExtension<CustomColors> {
const CustomColors({
this.appBarBackgroundImage,
this.appBarBackgroundImageForRoom,
this.appBarBackgroundImageForCreativeIsland,
this.appBarBackgroundImageDiscovery,
this.chatRoomBackground,
this.chatRoomReplyBackground,
this.chatRoomReplyBackgroundSecondary,
Expand Down Expand Up @@ -63,11 +59,6 @@ class CustomColors extends ThemeExtension<CustomColors> {
this.settingsSectionBackground,
});

final String? appBarBackgroundImage;
final String? appBarBackgroundImageForRoom;
final String? appBarBackgroundImageForCreativeIsland;
final String? appBarBackgroundImageDiscovery;

final Color? chatRoomBackground;
final Color? chatRoomReplyBackground;
final Color? chatRoomReplyBackgroundSecondary;
Expand Down Expand Up @@ -145,10 +136,6 @@ class CustomColors extends ThemeExtension<CustomColors> {
}

return CustomColors(
appBarBackgroundImage: appBarBackgroundImage,
appBarBackgroundImageForRoom: appBarBackgroundImageForRoom,
appBarBackgroundImageForCreativeIsland: appBarBackgroundImageForCreativeIsland,
appBarBackgroundImageDiscovery: appBarBackgroundImageDiscovery,
chatRoomBackground: Color.lerp(chatRoomBackground, other.chatRoomBackground, t),
chatRoomReplyBackground: Color.lerp(chatRoomReplyBackground, other.chatRoomReplyBackground, t),
chatRoomReplyBackgroundSecondary:
Expand Down Expand Up @@ -209,10 +196,6 @@ class CustomColors extends ThemeExtension<CustomColors> {
}

static const light = CustomColors(
appBarBackgroundImage: 'assets/background.jpg',
appBarBackgroundImageForRoom: 'assets/background-team.jpg',
appBarBackgroundImageForCreativeIsland: 'assets/background-creative-island.jpg',
appBarBackgroundImageDiscovery: 'assets/background-light-s1.jpg',
chatRoomBackground: Color.fromARGB(255, 239, 239, 239),
chatRoomReplyBackground: Colors.transparent,
chatRoomReplyBackgroundSecondary: Color.fromARGB(200, 255, 255, 255),
Expand Down Expand Up @@ -269,10 +252,6 @@ class CustomColors extends ThemeExtension<CustomColors> {
);

static const dark = CustomColors(
appBarBackgroundImage: 'assets/background-dark.jpg',
appBarBackgroundImageForRoom: 'assets/background-discovery-dark.jpg',
appBarBackgroundImageForCreativeIsland: 'assets/background-dark-s3.jpg',
appBarBackgroundImageDiscovery: 'assets/background-dark-s1.jpg',
chatRoomBackground: Color.fromARGB(255, 0, 0, 0),
chatRoomReplyBackground: Colors.transparent,
chatRoomReplyBackgroundSecondary: Color.fromARGB(200, 39, 39, 39),
Expand Down Expand Up @@ -330,10 +309,6 @@ class CustomColors extends ThemeExtension<CustomColors> {

@override
ThemeExtension<CustomColors> copyWith({
String? appBarBackgroundImage,
String? appBarBackgroundImageForRoom,
String? appBarBackgroundImageForCreativeIsland,
String? appBarBackgroundImageDiscovery,
Color? chatRoomBackground,
Color? chatRoomReplyBackground,
Color? chatRoomReplyBackgroundSecondary,
Expand Down Expand Up @@ -389,11 +364,6 @@ class CustomColors extends ThemeExtension<CustomColors> {
Color? settingsSectionBackground,
}) {
return CustomColors(
appBarBackgroundImage: appBarBackgroundImage ?? this.appBarBackgroundImage,
appBarBackgroundImageForRoom: appBarBackgroundImageForRoom ?? this.appBarBackgroundImageForRoom,
appBarBackgroundImageForCreativeIsland:
appBarBackgroundImageForCreativeIsland ?? this.appBarBackgroundImageForCreativeIsland,
appBarBackgroundImageDiscovery: appBarBackgroundImageDiscovery ?? this.appBarBackgroundImageDiscovery,
chatRoomBackground: chatRoomBackground ?? this.chatRoomBackground,
chatRoomReplyBackground: chatRoomReplyBackground ?? this.chatRoomReplyBackground,
chatRoomReplyBackgroundSecondary: chatRoomReplyBackgroundSecondary ?? this.chatRoomReplyBackgroundSecondary,
Expand Down
10 changes: 1 addition & 9 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,6 @@ flutter:
- assets/app-256-transparent.png
- assets/light-dark-auto.png
- assets/openai.png
- assets/background.jpg
- assets/background-dark.jpg
- assets/background-team.jpg
- assets/background-creative-island.jpg
- assets/background-discovery-dark.jpg
- assets/background-dark-s1.jpg
- assets/background-dark-s3.jpg
- assets/background-light-s1.jpg
- assets/transport.png
- assets/weibo.png
- assets/github.png
Expand Down Expand Up @@ -228,7 +220,7 @@ flutter:
flutter_native_splash:
image: assets/app-splash.png
color: "#ffffff"
android_disable_fullscreen: true
fullscreen: true

tobias:
url_scheme: alipay2021004101661425
Expand Down
74 changes: 70 additions & 4 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,81 @@
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer=""></script>
<script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
<link rel="stylesheet" type="text/css" href="splash/style.css">

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<script src="splash/splash.js"></script>

<style id="splash-screen-style">
html {
height: 100%
}

body {
margin: 0;
min-height: 100%;
background-color: #ffffff;
background-size: 100% 100%;
}

.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}

.contain {
display:block;
width:100%; height:100%;
object-fit: contain;
}

.stretch {
display:block;
width:100%; height:100%;
}

.cover {
display:block;
width:100%; height:100%;
object-fit: cover;
}

.bottom {
position: absolute;
bottom: 0;
left: 50%;
-ms-transform: translate(-50%, 0);
transform: translate(-50%, 0);
}

.bottomLeft {
position: absolute;
bottom: 0;
left: 0;
}

.bottomRight {
position: absolute;
bottom: 0;
right: 0;
}
</style>
<script id="splash-screen-script">
function removeSplashFromWeb() {
document.getElementById("splash")?.remove();
document.getElementById("splash-branding")?.remove();
document.body.style.background = "transparent";
}
</script>
</head>
<body> <picture id="splash">
<body>
<picture id="splash">
<source srcset="splash/img/light-1x.png 1x, splash/img/light-2x.png 2x, splash/img/light-3x.png 3x, splash/img/light-4x.png 4x" media="(prefers-color-scheme: light)">
<source srcset="splash/img/dark-1x.png 1x, splash/img/dark-2x.png 2x, splash/img/dark-3x.png 3x, splash/img/dark-4x.png 4x" media="(prefers-color-scheme: dark)">
<img class="center" aria-hidden="true" src="splash/img/light-1x.png" alt="">
</picture>
</picture>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
Expand Down
Binary file modified web/splash/img/dark-1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/splash/img/dark-2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/splash/img/dark-3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/splash/img/dark-4x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/splash/img/light-1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/splash/img/light-2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/splash/img/light-3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/splash/img/light-4x.png

0 comments on commit cfd6657

Please sign in to comment.