Skip to content

Commit

Permalink
Merge pull request #113 from mylxsw/feature/nav-optimize
Browse files Browse the repository at this point in the history
Feature/nav optimize
  • Loading branch information
mylxsw committed Jun 12, 2024
2 parents 4dd7020 + 568af09 commit 66722c4
Show file tree
Hide file tree
Showing 19 changed files with 907 additions and 377 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

Makefile.local
2 changes: 1 addition & 1 deletion docker-build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

VERSION=1.0.13.1
VERSION=1.0.14

rm -fr build/web

Expand Down
2 changes: 1 addition & 1 deletion lib/helper/constant.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

// 客户端应用版本号
const clientVersion = '1.0.14';
const clientVersion = '1.0.15';
// 本地数据库版本号
const databaseVersion = 26;

Expand Down
3 changes: 3 additions & 0 deletions lib/helper/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class ModelAggregate {
tag: e.tag,
avatarUrl: e.avatarUrl,
supportVision: e.supportVision,
tagTextColor: e.tagTextColor,
tagBgColor: e.tagBgColor,
isNew: e.isNew,
),
)
.toList());
Expand Down
13 changes: 13 additions & 0 deletions lib/lang/lang.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ mixin AppLocale {
static const String customHomeModels = 'custom-home-models';
static const String userApiKeys = "user-api-keys";

static const String others = 'others';
static const String recentlyUsed = 'recently-used';
static const String visionTag = 'vision-tag';
static const String newTag = 'new-tag';

static const Map<String, dynamic> zh = {
required: '必填',
systemInfo: '系统信息',
Expand Down Expand Up @@ -398,6 +403,10 @@ mixin AppLocale {
discover: '绘玩',
customHomeModels: '常用模型',
userApiKeys: 'API Keys',
others: '其它',
recentlyUsed: '最近使用',
visionTag: '视觉',
newTag: '新',
};

static const Map<String, dynamic> en = {
Expand Down Expand Up @@ -607,6 +616,10 @@ mixin AppLocale {
discover: 'Discover',
customHomeModels: 'Favorite Models',
userApiKeys: 'API Keys',
others: 'Others',
recentlyUsed: 'Recently Used',
visionTag: 'Vision',
newTag: 'New',
};
}

Expand Down
85 changes: 44 additions & 41 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import 'package:askaide/page/admin/users.dart';
import 'package:askaide/page/balance/web_payment_proxy.dart';
import 'package:askaide/page/balance/web_payment_result.dart';
import 'package:askaide/page/creative_island/draw/artistic_wordart.dart';
import 'package:flutter_phoenix/flutter_phoenix.dart';
import 'package:path/path.dart';

import 'package:askaide/bloc/account_bloc.dart';
Expand Down Expand Up @@ -198,7 +199,7 @@ void main() async {
);

final creativeIslandRepo =
CreativeIslandRepository(CreativeIslandDataProvider(db));
CreativeIslandRepository(CreativeIslandDataProvider(db));

// 聊天状态加载器
final stateManager = MessageStateManager(cacheRepo);
Expand Down Expand Up @@ -247,13 +248,15 @@ void main() async {
);
});

runApp(MyApp(
settingRepo: settingRepo,
chatMsgRepo: chatMsgRepo,
openAIRepo: openAIRepo,
cacheRepo: cacheRepo,
creativeIslandRepo: creativeIslandRepo,
messageStateManager: stateManager,
runApp(Phoenix(
child: MyApp(
settingRepo: settingRepo,
chatMsgRepo: chatMsgRepo,
openAIRepo: openAIRepo,
cacheRepo: cacheRepo,
creativeIslandRepo: creativeIslandRepo,
messageStateManager: stateManager,
),
));
}

Expand Down Expand Up @@ -293,11 +296,11 @@ class MyApp extends StatefulWidget {
var usingGuestMode = settingRepo.boolDefault(settingUsingGuestMode, false);

final openAISelfHosted =
settingRepo.boolDefault(settingOpenAISelfHosted, false);
settingRepo.boolDefault(settingOpenAISelfHosted, false);
final deepAISelfHosted =
settingRepo.boolDefault(settingDeepAISelfHosted, false);
settingRepo.boolDefault(settingDeepAISelfHosted, false);
final stabilityAISelfHosted =
settingRepo.boolDefault(settingStabilityAISelfHosted, false);
settingRepo.boolDefault(settingStabilityAISelfHosted, false);

final shouldLogin = (apiServerToken == null || apiServerToken == '') &&
!usingGuestMode &&
Expand All @@ -316,10 +319,10 @@ class MyApp extends StatefulWidget {
// navigatorKey: _shellNavigatorKey,
//parentNavigatorKey: _rootNavigatorKey,
builder: (
BuildContext context,
GoRouterState state,
StatefulNavigationShell navigationShell,
) {
BuildContext context,
GoRouterState state,
StatefulNavigationShell navigationShell,
) {
return AppScaffold(
settingRepo: settingRepo,
navigationShell: navigationShell,
Expand All @@ -340,10 +343,10 @@ class MyApp extends StatefulWidget {
child: HomePage(
setting: settingRepo,
showInitialDialog:
state.queryParameters['show_initial_dialog'] ==
'true',
state.queryParameters['show_initial_dialog'] ==
'true',
reward:
int.tryParse(state.queryParameters['reward'] ?? '0'),
int.tryParse(state.queryParameters['reward'] ?? '0'),
),
),
),
Expand Down Expand Up @@ -481,7 +484,7 @@ class MyApp extends StatefulWidget {
value: ChatBlocManager().getBloc(
chatAnywhereRoomId,
chatHistoryId:
int.tryParse(state.queryParameters['chat_id'] ?? ''),
int.tryParse(state.queryParameters['chat_id'] ?? ''),
),
),
BlocProvider.value(value: chatRoomBloc),
Expand Down Expand Up @@ -610,7 +613,7 @@ class MyApp extends StatefulWidget {
CreativeIslandBloc(creativeIslandRepo)),
],
child:
UserCenterScreen(settings: context.read<SettingRepository>()),
UserCenterScreen(settings: context.read<SettingRepository>()),
),
),
),
Expand Down Expand Up @@ -1345,7 +1348,7 @@ class _MyAppState extends State<MyApp> {
create: (context) => widget.cacheRepo),
],
child: ChangeNotifierProvider(
create: (context) => AppTheme.instance
create: (context) => AppTheme.get()
..mode = AppTheme.themeModeFormString(
widget.settingRepo.stringDefault(settingThemeMode, 'system')),
builder: (context, _) {
Expand All @@ -1363,25 +1366,25 @@ class _MyAppState extends State<MyApp> {
// TODO 后面要增加一个设置项,允许用户自定义字体大小
return MediaQuery(
data:
MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: BotToastInit()(context, child),
);
},
routerConfig: widget._router,
supportedLocales: widget.localization.supportedLocales,
localizationsDelegates:
widget.localization.localizationsDelegates,
widget.localization.localizationsDelegates,
scrollBehavior:
PlatformTool.isAndroid() || PlatformTool.isIOS()
? null
: const MaterialScrollBehavior().copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
PointerDeviceKind.stylus,
PointerDeviceKind.trackpad,
},
),
PlatformTool.isAndroid() || PlatformTool.isIOS()
? null
: const MaterialScrollBehavior().copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
PointerDeviceKind.stylus,
PointerDeviceKind.trackpad,
},
),
);
},
);
Expand All @@ -1401,10 +1404,10 @@ ThemeData createLightThemeData() {
),
iconButtonTheme: PlatformTool.isMacOS()
? IconButtonThemeData(
style: ButtonStyle(
overlayColor: MaterialStateProperty.all(Colors.transparent),
),
)
style: ButtonStyle(
overlayColor: MaterialStateProperty.all(Colors.transparent),
),
)
: null,
dividerColor: Colors.transparent,
dialogBackgroundColor: Colors.white,
Expand Down Expand Up @@ -1434,10 +1437,10 @@ ThemeData createDarkThemeData() {
),
iconButtonTheme: PlatformTool.isMacOS()
? IconButtonThemeData(
style: ButtonStyle(
overlayColor: MaterialStateProperty.all(Colors.transparent),
),
)
style: ButtonStyle(
overlayColor: MaterialStateProperty.all(Colors.transparent),
),
)
: null,
dividerColor: Colors.transparent,
dialogBackgroundColor: const Color.fromARGB(255, 48, 48, 48),
Expand Down
Loading

0 comments on commit 66722c4

Please sign in to comment.