Skip to content

Commit

Permalink
wip: Adjust ui details(part3)
Browse files Browse the repository at this point in the history
  • Loading branch information
lijy91 committed Aug 31, 2024
1 parent 1a5a00e commit c7770fe
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 64 deletions.
70 changes: 35 additions & 35 deletions apps/biyi_app/distribute_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,38 @@ releases:
build_args:
dart-define:
APP_ENV: production
- name: release-macos-zip
package:
platform: macos
target: zip
build_args:
dart-define:
APP_ENV: production
- name: release-linux-deb
package:
platform: linux
target: deb
build_args:
dart-define:
APP_ENV: production
- name: release-windows-exe
package:
platform: windows
target: exe
build_args:
dart-define:
APP_ENV: production
- name: release-windows-msix
package:
platform: windows
target: msix
build_args:
dart-define:
APP_ENV: production
- name: release-windows-zip
package:
platform: windows
target: zip
build_args:
dart-define:
APP_ENV: production
# - name: release-macos-zip
# package:
# platform: macos
# target: zip
# build_args:
# dart-define:
# APP_ENV: production
# - name: release-linux-deb
# package:
# platform: linux
# target: deb
# build_args:
# dart-define:
# APP_ENV: production
# - name: release-windows-exe
# package:
# platform: windows
# target: exe
# build_args:
# dart-define:
# APP_ENV: production
# - name: release-windows-msix
# package:
# platform: windows
# target: msix
# build_args:
# dart-define:
# APP_ENV: production
# - name: release-windows-zip
# package:
# platform: windows
# target: zip
# build_args:
# dart-define:
# APP_ENV: production
5 changes: 3 additions & 2 deletions apps/biyi_app/lib/app/home/toolbar_item_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ class ToolbarItemSettings extends StatefulWidget {

class _ToolbarItemSettingsState extends State<ToolbarItemSettings> {
Future<void> _handleClick() async {
UniPlatform.call<Future<void>>(
await UniPlatform.call<Future<void>>(
desktop: () async {
await windowManager.hide();
await windowManager.setOpacity(0);
},
otherwise: () => Future(() => null),
);
await Future.delayed(Duration.zero);
// ignore: use_build_context_synchronously
context.go(PageId.settingsGeneral);
}
Expand Down
38 changes: 24 additions & 14 deletions apps/biyi_app/lib/app/router_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import 'package:biyi_app/models/translation_target.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart' show DialogRoute;
import 'package:go_router/go_router.dart';
import 'package:reflect_colors/reflect_colors.dart';
import 'package:reflect_ui/reflect_ui.dart';
import 'package:uni_platform/uni_platform.dart';

Expand Down Expand Up @@ -69,7 +70,6 @@ final routerConfig = GoRouter(
path: '/available-ocr-engines',
pageBuilder: (BuildContext context, GoRouterState state) {
return DialogPage(
barrierColor: Colors.black.withOpacity(0.5),
builder: (_) => AvailableOcrEnginesPage(
selectedEngineId: state.uri.queryParameters['selectedEngineId'],
),
Expand All @@ -80,7 +80,6 @@ final routerConfig = GoRouter(
path: '/available-translation-engines',
pageBuilder: (BuildContext context, GoRouterState state) {
return DialogPage(
barrierColor: Colors.black.withOpacity(0.5),
builder: (_) => AvailableTranslationEnginesPage(
selectedEngineId: state.uri.queryParameters['selectedEngineId'],
),
Expand All @@ -100,7 +99,6 @@ final routerConfig = GoRouter(
path: '/record-shortcut',
pageBuilder: (BuildContext context, GoRouterState state) {
return DialogPage(
barrierColor: Colors.black.withOpacity(0.5),
builder: (_) => const RecordShortcutPage(),
);
},
Expand Down Expand Up @@ -273,16 +271,8 @@ final routerConfig = GoRouter(
GoRoute(
path: '/supported-languages',
pageBuilder: (BuildContext context, GoRouterState state) {
bool isDark = Theme.of(context).brightness == Brightness.dark;
return DialogPage(
barrierColor: isDark ? Colors.black38 : Colors.black54,
builder: (_) => Container(
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
border: Border.all(color: Colors.white, width: 1),
),
child: const SupportedLanguagesPage(),
),
builder: (_) => const SupportedLanguagesPage(),
);
},
),
Expand Down Expand Up @@ -314,6 +304,7 @@ class DialogPage<T> extends Page<T> {

@override
Route<T> createRoute(BuildContext context) {
bool isDark = Theme.of(context).brightness == Brightness.dark;
return DialogRoute<T>(
context: context,
settings: this,
Expand All @@ -325,7 +316,26 @@ class DialogPage<T> extends Page<T> {
maxWidth: 480,
maxHeight: 600,
),
child: Card(
child: Container(
padding: EdgeInsets.zero,
decoration: BoxDecoration(
border: Border.all(
color: isDark
? ReflectColors.neutral.shade800
: ReflectColors.neutral.shade200,
width: 1,
),
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: isDark
? Colors.white.withOpacity(0.05)
: Colors.black.withOpacity(0.3),
offset: const Offset(0.0, 0.0),
blurRadius: 20,
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: builder(context),
Expand All @@ -335,7 +345,7 @@ class DialogPage<T> extends Page<T> {
);
},
anchorPoint: anchorPoint,
barrierColor: barrierColor,
barrierColor: barrierColor ?? Colors.black.withOpacity(0.5),
barrierDismissible: barrierDismissible,
barrierLabel: barrierLabel,
useSafeArea: useSafeArea,
Expand Down
1 change: 1 addition & 0 deletions apps/biyi_app/lib/app/settings/layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class _SettingsLayoutState extends State<SettingsLayout> with WindowListener {
]);

await Future<void>.delayed(const Duration(milliseconds: 200));
await windowManager.setOpacity(1);
await windowManager.show();
}

Expand Down
2 changes: 1 addition & 1 deletion apps/biyi_app/lib/app/settings/ocr_engines/new/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class _OcrEnginesNewOrEditPageState extends State<OcrEnginesNewOrEditPage> {
title: _type == null
? Text(LocaleKeys.please_choose.tr())
: Text('ocr_engine.$_type'.tr()),
trailing: const ListTileChevron(),
trailing: widget.editable ? const ListTileChevron() : null,
onTap: widget.editable
? () async {
final newEngineType = await context.push<String?>(
Expand Down
5 changes: 4 additions & 1 deletion apps/biyi_app/lib/app/settings/ocr_engines/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ class _OcrEnginesSettingPageState extends State<OcrEnginesSettingPage> {
SwitchListTile(
value: !item.disabled,
onChanged: (newValue) {
context.watch<Settings>().privateOcrEngine(item.id).update(
context
.read<Settings>() // Linewrap
.proOcrEngine(item.id)
.update(
disabled: !item.disabled,
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:biyi_app/widgets/translation_engine_name/translation_engine_name
import 'package:easy_localization/easy_localization.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';
import 'package:reflect_colors/reflect_colors.dart';
import 'package:reflect_ui/reflect_ui.dart';
import 'package:shortid/shortid.dart';
import 'package:uni_translate_client/uni_translate_client.dart';
Expand Down Expand Up @@ -126,7 +127,7 @@ class _TranslationEnginesNewOrEditPageState
title: _type == null
? Text(LocaleKeys.please_choose.tr())
: Text('engine.$_type'.tr()),
trailing: const ListTileChevron(),
trailing: widget.editable ? const ListTileChevron() : null,
onTap: widget.editable
? () async {
final newEngineType = await context.push<String?>(
Expand Down Expand Up @@ -204,7 +205,7 @@ class _TranslationEnginesNewOrEditPageState
title: Center(
child: Text(
LocaleKeys.delete.tr(),
// style: const TextStyle(color: ReflectColors.red),
style: const TextStyle(color: ReflectColors.red),
),
),
onTap: () async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class _TranslationEnginesSettingPageState
value: !item.disabled,
onChanged: (newValue) {
context
.watch<Settings>() // Linewrap
.read<Settings>() // Linewrap
.proTranslationEngine(item.id)
.update(
disabled: !item.disabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,12 @@ class TranslationEnginesModifier {
settings.translationEngines[index].type = type ?? oldTranslationEngine.type;
settings.translationEngines[index].option =
option ?? oldTranslationEngine.option;
settings.translationEngines[index].supportedScopes =
(supportedScopes ?? oldTranslationEngine.supportedScopes)
.map(
(e) =>
TranslationEngineScope.values.firstWhere((v) => e == v.name),
)
.toList();
if (supportedScopes != null) {
settings.translationEngines[index].supportedScopes =
TranslationEngineScope.values
.where((e) => supportedScopes.contains(e.name))
.toList();
}
settings.translationEngines[index].disabled =
disabled ?? oldTranslationEngine.disabled;

Expand Down
2 changes: 1 addition & 1 deletion apps/biyi_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: biyi_app
description: A convenient translation and dictionary app written in Flutter.
homepage: https://github.com/lijy91/biyi
publish_to: "none"
version: 0.5.0+20
version: 0.5.0+21

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down

0 comments on commit c7770fe

Please sign in to comment.