Skip to content

Commit

Permalink
wip: Use reflect_ui to replace influxui
Browse files Browse the repository at this point in the history
  • Loading branch information
lijy91 committed Aug 17, 2024
1 parent 7652370 commit 770ec49
Show file tree
Hide file tree
Showing 78 changed files with 917 additions and 343 deletions.
10 changes: 5 additions & 5 deletions apps/biyi_app/lib/app/available_ocr_engines/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import 'package:biyi_app/generated/locale_keys.g.dart';
import 'package:biyi_app/services/api_client.dart';
import 'package:biyi_app/states/settings.dart';
import 'package:biyi_app/widgets/customized_app_bar/customized_app_bar.dart';
import 'package:biyi_app/widgets/list_section.dart';
import 'package:biyi_app/widgets/list_tile.dart';
import 'package:biyi_app/widgets/widgets.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:go_router/go_router.dart';
import 'package:harmonic/noprefix/harmonic.dart';
import 'package:influxui/influxui.dart' show Button, ButtonVariant;
import 'package:reflect_ui/reflect_ui.dart';

class AvailableOcrEnginesPage extends StatefulWidget {
const AvailableOcrEnginesPage({
Expand Down Expand Up @@ -50,7 +51,6 @@ class _AvailableOcrEnginesPageState extends State<AvailableOcrEnginesPage> {

Widget _buildBody(BuildContext context) {
return ListView(
padding: const EdgeInsets.symmetric(vertical: 8),
children: [
if (_proOcrEngineList.isNotEmpty)
ListSection(
Expand Down Expand Up @@ -113,9 +113,9 @@ class _AvailableOcrEnginesPageState extends State<AvailableOcrEnginesPage> {
),
actions: [
Button(
label: LocaleKeys.ok.tr(),
variant: ButtonVariant.subtle,
variant: ButtonVariant.filled,
onPressed: _handleClickOk,
child: Text(LocaleKeys.ok.tr()),
),
],
),
Expand Down
11 changes: 6 additions & 5 deletions apps/biyi_app/lib/app/available_translation_engines/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import 'package:biyi_app/generated/locale_keys.g.dart';
import 'package:biyi_app/services/api_client.dart';
import 'package:biyi_app/states/settings.dart';
import 'package:biyi_app/widgets/customized_app_bar/customized_app_bar.dart';
import 'package:biyi_app/widgets/list_section.dart';
import 'package:biyi_app/widgets/list_tile.dart';
import 'package:biyi_app/widgets/widgets.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart';
import 'package:harmonic/noprefix/harmonic.dart';
import 'package:influxui/influxui.dart' show Button, ButtonVariant;
import 'package:reflect_ui/reflect_ui.dart';

class AvailableTranslationEnginesPage extends StatefulWidget {
const AvailableTranslationEnginesPage({
Expand Down Expand Up @@ -53,7 +55,6 @@ class _AvailableTranslationEnginesPageState

Widget _buildBody(BuildContext context) {
return ListView(
padding: const EdgeInsets.symmetric(vertical: 8),
children: [
if (_proEngineList.isNotEmpty)
ListSection(
Expand Down Expand Up @@ -117,9 +118,9 @@ class _AvailableTranslationEnginesPageState
),
actions: [
Button(
label: LocaleKeys.ok.tr(),
variant: ButtonVariant.subtle,
variant: ButtonVariant.filled,
onPressed: _handleClickOk,
child: Text(LocaleKeys.ok.tr()),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion apps/biyi_app/lib/app/home/desktop_popup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:hotkey_manager/hotkey_manager.dart';
import 'package:influxui/influxui.dart';
import 'package:protocol_handler/protocol_handler.dart';
import 'package:provider/provider.dart';
import 'package:reflect_ui/reflect_ui.dart';
import 'package:screen_capturer/screen_capturer.dart';
import 'package:screen_retriever/screen_retriever.dart';
import 'package:screen_text_extractor/screen_text_extractor.dart';
Expand Down
18 changes: 9 additions & 9 deletions apps/biyi_app/lib/app/home/limited_functionality_banner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import 'package:bot_toast/bot_toast.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/gestures.dart';
import 'package:influxui/influxui.dart';
import 'package:influxui/influxui.dart' show Alert, AlertType, ExtendedColors;
import 'package:reflect_ui/reflect_ui.dart' hide Alert;
import 'package:screen_capturer/screen_capturer.dart';
import 'package:screen_text_extractor/screen_text_extractor.dart';
import 'package:url_launcher/url_launcher.dart';
Expand All @@ -25,10 +26,11 @@ class AllowAccessListItem extends StatelessWidget {

@override
Widget build(BuildContext context) {
final textStyle = Theme.of(context).textTheme.bodyMedium?.copyWith(
color: ExtendedColors.yellow.shade600,
height: 24 / 14,
);
final ThemeData themeData = Theme.of(context);
final textStyle = themeData.textTheme.bodyMedium?.copyWith(
color: ExtendedColors.yellow.shade600,
height: 24 / 14,
);
return GappedRow(
gap: 4,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down Expand Up @@ -170,18 +172,16 @@ class LimitedFunctionalityBanner extends StatelessWidget {
},
actions: [
Button(
label: LocaleKeys.app_home_limited_banner_btn_check_again.tr(),
size: ButtonSize.small,
color: ExtendedColors.yellow,
onPressed: onTappedRecheckIsAllowedAllAccess,
child: Text(LocaleKeys.app_home_limited_banner_btn_check_again.tr()),
),
Expanded(child: Container()),
Tooltip(
message: LocaleKeys.app_home_limited_banner_tip_help.tr(),
child: IconButton(
FluentIcons.question_circle_20_regular,
variant: IconButtonVariant.light,
size: ButtonSize.small,
variant: IconButtonVariant.filled,
color: ExtendedColors.yellow,
onPressed: () async {
Uri url = Uri.parse('${sharedEnv.webUrl}/docs');
Expand Down
3 changes: 2 additions & 1 deletion apps/biyi_app/lib/app/home/new_version_found_banner.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'package:biyi_app/generated/locale_keys.g.dart';
import 'package:biyi_app/services/api_client.dart';
import 'package:biyi_app/utils/extended_colors.dart';
import 'package:biyi_app/utils/utils.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/gestures.dart';
import 'package:influxui/influxui.dart';
import 'package:reflect_ui/reflect_ui.dart';
import 'package:url_launcher/url_launcher.dart';

class NewVersionFoundBanner extends StatelessWidget {
Expand Down
3 changes: 2 additions & 1 deletion apps/biyi_app/lib/app/home/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import 'package:biyi_app/app/home/desktop_popup.dart';
import 'package:biyi_app/app/home/tab_homepage.dart';
import 'package:biyi_app/app/home/tab_settings.dart';
import 'package:biyi_app/app/home/tab_vocabulary.dart';
import 'package:biyi_app/utils/extended_colors.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/cupertino.dart';
import 'package:influxui/influxui.dart';
import 'package:reflect_ui/reflect_ui.dart';
import 'package:uni_platform/uni_platform.dart';

const _kHomeTabHomepage = 0;
Expand Down
4 changes: 2 additions & 2 deletions apps/biyi_app/lib/app/home/tab_homepage.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:biyi_app/app/router_config.dart';
import 'package:biyi_app/widgets/customized_app_bar/customized_app_bar.dart';
import 'package:go_router/go_router.dart';
import 'package:influxui/influxui.dart';
import 'package:reflect_ui/reflect_ui.dart';

class TabHomepageScene extends StatefulWidget {
const TabHomepageScene({super.key});
Expand All @@ -16,10 +16,10 @@ class _TabHomepageSceneState extends State<TabHomepageScene> {
mainAxisSize: MainAxisSize.max,
children: [
Button(
label: 'settings/general',
onPressed: () {
context.go(PageId.settingsGeneral);
},
child: const Text('settings/general'),
),
],
);
Expand Down
2 changes: 1 addition & 1 deletion apps/biyi_app/lib/app/home/tab_settings.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:biyi_app/app/settings/page.dart';
import 'package:influxui/influxui.dart';
import 'package:reflect_ui/reflect_ui.dart';

class TabSettingsScene extends StatelessWidget {
const TabSettingsScene({super.key});
Expand Down
2 changes: 1 addition & 1 deletion apps/biyi_app/lib/app/home/tab_vocabulary.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:biyi_app/widgets/customized_app_bar/customized_app_bar.dart';
import 'package:influxui/influxui.dart';
import 'package:reflect_ui/reflect_ui.dart';

class TabVocabularyScene extends StatelessWidget {
const TabVocabularyScene({super.key});
Expand Down
6 changes: 3 additions & 3 deletions apps/biyi_app/lib/app/home/toolbar_item_always_on_top.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:influxui/influxui.dart';
import 'package:reflect_ui/reflect_ui.dart';
import 'package:window_manager/window_manager.dart';

class ToolbarItemAlwaysOnTop extends StatefulWidget {
Expand Down Expand Up @@ -34,9 +34,9 @@ class _ToolbarItemAlwaysOnTopState extends State<ToolbarItemAlwaysOnTop> {
),
child: IconButton(
_isAlwaysOnTop ? FluentIcons.pin_20_filled : FluentIcons.pin_20_regular,
variant: IconButtonVariant.transparent,
variant: IconButtonVariant.filled,
padding: EdgeInsets.zero,
size: IconButtonSize.small,
// size: IconButtonSize.small,
color: _isAlwaysOnTop
? Theme.of(context).primaryColor
: Theme.of(context).iconTheme.color,
Expand Down
7 changes: 4 additions & 3 deletions apps/biyi_app/lib/app/home/toolbar_item_settings.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:biyi_app/app/router_config.dart';
import 'package:biyi_app/utils/extended_colors.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:go_router/go_router.dart';
import 'package:influxui/influxui.dart';
import 'package:reflect_ui/reflect_ui.dart';
import 'package:uni_platform/uni_platform.dart';
import 'package:window_manager/window_manager.dart';

Expand Down Expand Up @@ -31,11 +32,11 @@ class _ToolbarItemSettingsState extends State<ToolbarItemSettings> {
Brightness brightness = Theme.of(context).brightness;
return IconButton(
FluentIcons.settings_20_regular,
variant: IconButtonVariant.transparent,
variant: IconButtonVariant.filled,
color: brightness == Brightness.light
? ExtendedColors.black
: ExtendedColors.gray,
size: IconButtonSize.small,
// size: IconButtonSize.small,
onPressed: _handleClick,
);
}
Expand Down
36 changes: 17 additions & 19 deletions apps/biyi_app/lib/app/home/translation_input_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import 'dart:ui';

import 'package:biyi_app/generated/locale_keys.g.dart';
import 'package:biyi_app/models/settings_base.dart';
import 'package:biyi_app/utils/extended_colors.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:influxui/influxui.dart';
import 'package:reflect_ui/reflect_ui.dart';
import 'package:screen_capturer/screen_capturer.dart';

class TranslationInputView extends StatelessWidget {
Expand Down Expand Up @@ -46,6 +47,7 @@ class TranslationInputView extends StatelessWidget {
final bool isAddedToVocabulary = true;

Widget _buildToolbarItems(BuildContext context) {
final ThemeData themeData = Theme.of(context);
return Row(
children: [
Tooltip(
Expand All @@ -56,23 +58,23 @@ class TranslationInputView extends StatelessWidget {
),
child: IconButton(
FluentIcons.target_20_regular,
variant: IconButtonVariant.subtle,
variant: IconButtonVariant.filled,
iconBuilder: (context, icon) {
return Stack(
alignment: Alignment.center,
children: [
Icon(
icon,
color: translationMode == TranslationMode.auto
? Theme.of(context).primaryColor
: Theme.of(context).iconTheme.color,
? themeData.primaryColor
: themeData.iconTheme.color,
),
if (translationMode == TranslationMode.auto)
Positioned(
bottom: 0,
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
color: themeData.primaryColor,
borderRadius: BorderRadius.circular(2),
),
padding: const EdgeInsets.only(
Expand All @@ -94,7 +96,7 @@ class TranslationInputView extends StatelessWidget {
],
);
},
size: IconButtonSize.small,
// size: IconButtonSize.small,
onPressed: () {
TranslationMode newTranslationMode =
translationMode == TranslationMode.auto
Expand All @@ -107,9 +109,7 @@ class TranslationInputView extends StatelessWidget {
const SizedBox(
width: 8,
height: 20,
child: Divider(
direction: Axis.vertical,
),
child: VerticalDivider(),
),
Tooltip(
message:
Expand All @@ -119,11 +119,11 @@ class TranslationInputView extends StatelessWidget {
iconBuilder: (context, icon) {
return Icon(
icon,
color: Theme.of(context).iconTheme.color,
color: themeData.iconTheme.color,
);
},
variant: IconButtonVariant.subtle,
size: IconButtonSize.small,
variant: IconButtonVariant.filled,
// size: IconButtonSize.small,
onPressed: onClickExtractTextFromScreenCapture,
),
),
Expand All @@ -135,11 +135,11 @@ class TranslationInputView extends StatelessWidget {
iconBuilder: (context, icon) {
return Icon(
icon,
color: Theme.of(context).iconTheme.color,
color: themeData.iconTheme.color,
);
},
variant: IconButtonVariant.subtle,
size: ButtonSize.small,
variant: IconButtonVariant.filled,
// size: ButtonSize.small,
onPressed: onClickExtractTextFromClipboard,
),
),
Expand All @@ -163,19 +163,17 @@ class TranslationInputView extends StatelessWidget {
constraints: const BoxConstraints(minWidth: 56),
child: Button(
variant: ButtonVariant.outlined,
label: LocaleKeys.app_home_btn_clear.tr(),
size: ButtonSize.small,
onPressed: onButtonTappedClear,
child: Text(LocaleKeys.app_home_btn_clear.tr()),
),
),
const SizedBox(width: 10),
ConstrainedBox(
constraints: const BoxConstraints(minWidth: 56),
child: Button(
variant: ButtonVariant.filled,
label: LocaleKeys.app_home_btn_trans.tr(),
size: ButtonSize.small,
onPressed: onButtonTappedTrans,
child: Text(LocaleKeys.app_home_btn_trans.tr()),
),
),
],
Expand Down
5 changes: 3 additions & 2 deletions apps/biyi_app/lib/app/home/translation_results_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:biyi_app/models/models.dart';
import 'package:biyi_app/models/settings_base.dart';
import 'package:biyi_app/utils/language_util.dart';
import 'package:biyi_app/widgets/widgets.dart';
import 'package:influxui/influxui.dart';
import 'package:reflect_ui/reflect_ui.dart';
import 'package:sticky_headers/sticky_headers.dart';

class TranslationResultsView extends StatelessWidget {
Expand Down Expand Up @@ -32,8 +32,9 @@ class TranslationResultsView extends StatelessWidget {
final bool doubleClickCopyResult;

Widget _buildNoMatchingTranslationTarget(BuildContext context) {
ThemeData themeData = Theme.of(context);
return Container(
color: Theme.of(context).scaffoldBackgroundColor,
color: themeData.scaffoldBackgroundColor,
padding: const EdgeInsets.only(
left: 12,
right: 12,
Expand Down
Loading

0 comments on commit 770ec49

Please sign in to comment.