diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 5c207815..7f3a65e3 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -4,8 +4,6 @@ PODS: - device_info_plus (0.0.1): - Flutter - Flutter (1.0.0) - - network_info_plus (0.0.1): - - Flutter - package_info_plus (0.4.5): - Flutter - path_provider_ios (0.0.1): @@ -14,19 +12,18 @@ PODS: - Flutter - uni_links (0.0.1): - Flutter - - url_launcher (0.0.1): + - url_launcher_ios (0.0.1): - Flutter DEPENDENCIES: - audioplayers (from `.symlinks/plugins/audioplayers/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - Flutter (from `Flutter`) - - network_info_plus (from `.symlinks/plugins/network_info_plus/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`) - uni_links (from `.symlinks/plugins/uni_links/ios`) - - url_launcher (from `.symlinks/plugins/url_launcher/ios`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) EXTERNAL SOURCES: audioplayers: @@ -35,8 +32,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/device_info_plus/ios" Flutter: :path: Flutter - network_info_plus: - :path: ".symlinks/plugins/network_info_plus/ios" package_info_plus: :path: ".symlinks/plugins/package_info_plus/ios" path_provider_ios: @@ -45,19 +40,18 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/shared_preferences_ios/ios" uni_links: :path: ".symlinks/plugins/uni_links/ios" - url_launcher: - :path: ".symlinks/plugins/url_launcher/ios" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: audioplayers: 455322b54050b30ea4b1af7cd9e9d105f74efa8c device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a - network_info_plus: b78876159360f5580608c2cea620d6ceffabd0ad package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5 shared_preferences_ios: aef470a42dc4675a1cdd50e3158b42e3d1232b32 uni_links: d97da20c7701486ba192624d99bffaaffcfc298a - url_launcher: b6e016d912f04be9f5bf6e8e82dc599b7ba59649 + url_launcher_ios: 02f1989d4e14e998335b02b67a7590fa34f971af PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 6bb89b58..61b463d2 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -155,7 +155,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140cf..3db53b6e 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ _ensureInitialized() async { WidgetsFlutterBinding.ensureInitialized(); - await EasyLocalization.ensureInitialized(); - await AudioPlayer.ensureInitialized(); if (kIsLinux || kIsMacOS || kIsWindows) { await WindowManager.instance.ensureInitialized(); @@ -36,13 +30,10 @@ void main() async { await initEnv(); await initLocalDb(); await initConfig(); +} - if (!kReleaseMode) { - AnyInspect anyInspect = AnyInspect.instance; - anyInspect.addPlugin(AnyInspectPluginNetwork()); - anyInspect.addPlugin(AnyInspectPluginSharedPreferences()); - anyInspect.start(); - } +void main() async { + await _ensureInitialized(); runApp( EasyLocalization( @@ -56,7 +47,78 @@ void main() async { path: 'assets/translations', assetLoader: YamlAssetLoader(), fallbackLocale: const Locale(kLanguageEN), - child: const AppNavigator(), + child: const MyApp(), ), ); } + +class MyApp extends StatefulWidget { + const MyApp({ + Key key, + }) : super(key: key); + + @override + _MyAppState createState() => _MyAppState(); +} + +class _MyAppState extends State { + final GlobalKey _navigatorKey = GlobalKey(); + + ThemeMode _themeMode = ThemeMode.system; + + @override + void initState() { + super.initState(); + sharedConfigManager.addListener(_configListen); + _init(); + } + + @override + void dispose() { + sharedConfigManager.removeListener(_configListen); + super.dispose(); + } + + void _configListen() { + _themeMode = sharedConfig.themeMode; + setState(() {}); + } + + void _init() async { + _themeMode = sharedConfig.themeMode; + setState(() {}); + } + + Widget _buildHome(BuildContext context) { + if (kIsAndroid || kIsIOS) { + return const HomePage(); + } + return const DesktopPopupPage(); + } + + @override + Widget build(BuildContext context) { + final virtualWindowFrameBuilder = VirtualWindowFrameInit(); + final botToastBuilder = BotToastInit(); + + return MaterialApp( + debugShowCheckedModeBanner: false, + navigatorKey: _navigatorKey, + theme: lightThemeData, + darkTheme: darkThemeData, + themeMode: _themeMode, + builder: (context, child) { + if (kIsLinux || kIsWindows) { + child = virtualWindowFrameBuilder(context, child); + } + child = botToastBuilder(context, child); + return child; + }, + navigatorObservers: [BotToastNavigatorObserver()], + localizationsDelegates: context.localizationDelegates, + supportedLocales: context.supportedLocales, + locale: context.locale, + home: _buildHome(context), + ); + } +} diff --git a/lib/navigators/app_navigator.dart b/lib/navigators/app_navigator.dart deleted file mode 100644 index 6b8e3ad2..00000000 --- a/lib/navigators/app_navigator.dart +++ /dev/null @@ -1,77 +0,0 @@ -import 'package:bot_toast/bot_toast.dart'; -import 'package:flutter/material.dart'; - -import '../includes.dart'; - -class AppNavigator extends StatefulWidget { - final Widget home; - - const AppNavigator({ - Key key, - this.home, - }) : super(key: key); - - @override - _AppNavigatorState createState() => _AppNavigatorState(); -} - -class _AppNavigatorState extends State { - final GlobalKey _navigatorKey = GlobalKey(); - Config _config = sharedConfigManager.getConfig(); - - @override - void initState() { - sharedConfigManager.addListener(_configListen); - if (widget.home == null) { - R.setNavigatorKey(_navigatorKey); - } - super.initState(); - } - - @override - void dispose() { - sharedConfigManager.removeListener(_configListen); - super.dispose(); - } - - void _configListen() { - _config = sharedConfigManager.getConfig(); - setState(() {}); - } - - bool get isRootPage { - return widget.home == null; - } - - Widget _build(BuildContext context) { - final virtualWindowFrameBuilder = VirtualWindowFrameInit(); - final botToastBuilder = BotToastInit(); - - return MaterialApp( - debugShowCheckedModeBanner: false, - navigatorKey: isRootPage ? _navigatorKey : null, - theme: lightThemeData, - darkTheme: darkThemeData, - themeMode: _config.themeMode, - builder: (context, child) { - if (isRootPage) { - if (kIsLinux || kIsWindows) { - child = virtualWindowFrameBuilder(context, child); - } - child = botToastBuilder(context, child); - } - return child; - }, - navigatorObservers: isRootPage ? [BotToastNavigatorObserver()] : [], - localizationsDelegates: context.localizationDelegates, - supportedLocales: context.supportedLocales, - locale: context.locale, - home: isRootPage ? const DesktopPopupPage() : widget.home, - ); - } - - @override - Widget build(BuildContext context) { - return _build(context); - } -} diff --git a/lib/navigators/fadein_page_route.dart b/lib/navigators/fadein_page_route.dart deleted file mode 100644 index 45ee48c3..00000000 --- a/lib/navigators/fadein_page_route.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:flutter/material.dart'; - -class FadeInPageRoute extends PageRouteBuilder { - FadeInPageRoute({ - @required WidgetBuilder builder, - RouteSettings settings, - bool opaque = false, - }) : super( - pageBuilder: (BuildContext context, Animation animation, - Animation secondaryAnimation) { - return builder(context); - }, - settings: settings, - transitionsBuilder: ( - BuildContext context, - Animation animation, - Animation secondaryAnimation, - Widget child, - ) { - return FadeTransition( - opacity: animation, - child: child, - ); - }, - opaque: opaque, - ); -} diff --git a/lib/navigators/navigators.dart b/lib/navigators/navigators.dart deleted file mode 100644 index 0a7b405a..00000000 --- a/lib/navigators/navigators.dart +++ /dev/null @@ -1,3 +0,0 @@ -// 请按文件名排序放置 -export './app_navigator.dart'; -export './fadein_page_route.dart'; diff --git a/lib/pages/desktop_popup/toolbar_item_settings.dart b/lib/pages/desktop_popup/toolbar_item_settings.dart index 4262ca4a..423c614e 100644 --- a/lib/pages/desktop_popup/toolbar_item_settings.dart +++ b/lib/pages/desktop_popup/toolbar_item_settings.dart @@ -46,15 +46,12 @@ class _ToolbarItemSettingsState extends State { ), clipBehavior: Clip.antiAliasWithSaveLayer, builder: (ctx) { - return SizedBox( - height: 600, - child: AppNavigator( - home: SettingsPage( - onDismiss: () { - Navigator.of(ctx).pop(); - _handleDismiss(); - }, - ), + return ModalBottomSheetWrapped( + child: SettingsPage( + onDismiss: () { + Navigator.of(ctx).pop(); + _handleDismiss(); + }, ), ); }, diff --git a/lib/pages/home/home.dart b/lib/pages/home/home.dart new file mode 100644 index 00000000..397d0850 --- /dev/null +++ b/lib/pages/home/home.dart @@ -0,0 +1,113 @@ +import 'package:fluentui_system_icons/fluentui_system_icons.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../../includes.dart'; + +import 'tab_homepage/tab_homepage.dart'; +import 'tab_me/tab_me.dart'; +import 'tab_vocabulary/tab_vocabulary.dart'; + +const _kHomeTabHomepage = 0; +const _kHomeTabVocabulary = 1; +const _kHomeTabMe = 2; + +class _TabBarItem extends BottomNavigationBarItem { + _TabBarItem({ + Widget icon, + String label, + Widget activeIcon, + }) : super(icon: icon, label: label, activeIcon: activeIcon); +} + +class HomePage extends StatefulWidget { + const HomePage({Key key}) : super(key: key); + + @override + State createState() => _HomePageState(); +} + +class _HomePageState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + + int _selectedIndex = _kHomeTabHomepage; + + @override + void initState() { + super.initState(); + _tabController = TabController( + initialIndex: _selectedIndex, + length: 3, + vsync: this, + ); + } + + Widget _buildBody(BuildContext context) { + return IndexedStack( + index: _selectedIndex, + children: const [ + TabHomepageScene(), + TabVocabularyScene(), + TabMeScene(), + ], + ); + } + + Widget _buildBottomNavigationBar(BuildContext context) { + return Container( + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + blurRadius: 16, + ), + ], + ), + child: CupertinoTabBar( + items: [ + _TabBarItem( + icon: const Icon(FluentIcons.home_20_regular), + activeIcon: const Icon(FluentIcons.home_20_filled), + label: 'Home', + ), + _TabBarItem( + icon: const Icon(FluentIcons.book_20_regular), + activeIcon: const Icon(FluentIcons.book_20_filled), + label: 'Vocabulary', + ), + _TabBarItem( + icon: const Icon(FluentIcons.person_20_regular), + activeIcon: const Icon(FluentIcons.person_20_filled), + label: 'Me', + ), + ], + onTap: (int index) { + setState(() { + _selectedIndex = index; + }); + }, + currentIndex: _selectedIndex, + iconSize: 28, + border: Border( + top: BorderSide( + color: Theme.of(context).dividerColor, + style: BorderStyle.solid, + ), + ), + ), + ); + } + + Widget _build(BuildContext context) { + return Scaffold( + body: _buildBody(context), + bottomNavigationBar: _buildBottomNavigationBar(context), + ); + } + + @override + Widget build(BuildContext context) { + return _build(context); + } +} diff --git a/lib/pages/home/tab_homepage/tab_homepage.dart b/lib/pages/home/tab_homepage/tab_homepage.dart new file mode 100644 index 00000000..2d53d570 --- /dev/null +++ b/lib/pages/home/tab_homepage/tab_homepage.dart @@ -0,0 +1,17 @@ +import 'package:flutter/material.dart'; + +import '../../../includes.dart'; + +class TabHomepageScene extends StatelessWidget { + const TabHomepageScene({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: const CustomAppBar( + title: Text('Home'), + ), + body: Container(), + ); + } +} diff --git a/lib/pages/home/tab_me/tab_me.dart b/lib/pages/home/tab_me/tab_me.dart new file mode 100644 index 00000000..304bf15f --- /dev/null +++ b/lib/pages/home/tab_me/tab_me.dart @@ -0,0 +1,30 @@ +import 'package:fluentui_system_icons/fluentui_system_icons.dart'; +import 'package:flutter/material.dart'; + +import '../../../includes.dart'; + +class TabMeScene extends StatelessWidget { + const TabMeScene({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CustomAppBar( + title: const Text('Me'), + actions: [ + CustomAppBarActionItem( + icon: FluentIcons.settings_20_regular, + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (_) => const SettingsPage(), + ), + ); + }, + ), + ], + ), + body: Container(), + ); + } +} diff --git a/lib/pages/home/tab_vocabulary/tab_vocabulary.dart b/lib/pages/home/tab_vocabulary/tab_vocabulary.dart new file mode 100644 index 00000000..2a95ccbe --- /dev/null +++ b/lib/pages/home/tab_vocabulary/tab_vocabulary.dart @@ -0,0 +1,17 @@ +import 'package:flutter/material.dart'; + +import '../../../includes.dart'; + +class TabVocabularyScene extends StatelessWidget { + const TabVocabularyScene({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: const CustomAppBar( + title: Text('Vocabulary'), + ), + body: Container(), + ); + } +} diff --git a/lib/pages/pages.dart b/lib/pages/pages.dart index c2ff1d44..36f18d52 100644 --- a/lib/pages/pages.dart +++ b/lib/pages/pages.dart @@ -1,5 +1,6 @@ // 请按文件名排序放置 export './desktop_popup/desktop_popup.dart'; +export './home/home.dart'; export './image_viewer/image_viewer.dart'; export './language_chooser/language_chooser.dart'; export './ocr_engine_type_chooser/ocr_engine_type_chooser.dart'; diff --git a/lib/themes/light_theme.dart b/lib/themes/light_theme.dart index 39ccf0c7..bf087481 100644 --- a/lib/themes/light_theme.dart +++ b/lib/themes/light_theme.dart @@ -13,13 +13,13 @@ const _kSuccessColor = _kGreenColor; const _kErrorColor = _kRedColor; const _kWarningColor = _kGoldColor; -final kTextColor = Color(0xff070708); -final kTextColorSecondary = Color(0xff4b4d52); +const kTextColor = Color(0xff070708); +const kTextColorSecondary = Color(0xff4b4d52); const kTextColorWarning = _kGoldColor; const kTextColorDanger = _kRedColor; const kTextColorInverse = Colors.white; -const _kScaffoldBackgroundColor = const Color(0xffF6F8FA); +const _kScaffoldBackgroundColor = Color(0xfff2f3f5); const _kCanvasColor = Colors.white; var lightThemeData = ThemeData( diff --git a/lib/utilities/platform_util.dart b/lib/utilities/platform_util.dart index a77df479..0e755cd0 100644 --- a/lib/utilities/platform_util.dart +++ b/lib/utilities/platform_util.dart @@ -2,6 +2,8 @@ import 'dart:io'; import 'package:flutter/foundation.dart' show kIsWeb; +bool get kIsAndroid => !kIsWeb && Platform.isAndroid; +bool get kIsIOS => !kIsWeb && Platform.isIOS; bool get kIsLinux => !kIsWeb && Platform.isLinux; bool get kIsMacOS => !kIsWeb && Platform.isMacOS; bool get kIsWindows => !kIsWeb && Platform.isWindows; diff --git a/lib/utilities/r.dart b/lib/utilities/r.dart index c58eb4ae..002fea72 100644 --- a/lib/utilities/r.dart +++ b/lib/utilities/r.dart @@ -1,16 +1,4 @@ -import 'package:flutter/material.dart'; - class R { - static GlobalKey _navigatorKey; - - static setNavigatorKey(GlobalKey navigatorKey) { - _navigatorKey = navigatorKey; - } - - static GlobalKey getNavigatorKey() { - return _navigatorKey; - } - static String image(String name) { return 'assets/images/$name'; } diff --git a/lib/widgets/custom_app_bar/custom_app_bar.dart b/lib/widgets/custom_app_bar/custom_app_bar.dart index 3dc89045..9ab7782f 100644 --- a/lib/widgets/custom_app_bar/custom_app_bar.dart +++ b/lib/widgets/custom_app_bar/custom_app_bar.dart @@ -1,3 +1,5 @@ +import 'package:biyi/includes.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import './custom_app_bar_back_button.dart'; @@ -12,55 +14,14 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { final bool automaticallyImplyLeading; final Widget title; final List actions; - final Widget flexibleSpace; - final PreferredSizeWidget bottom; - final double elevation; - final Color shadowColor; - final ShapeBorder shape; - final Color backgroundColor; - final Brightness brightness; - final IconThemeData iconTheme; - final IconThemeData actionsIconTheme; - final TextTheme textTheme; - final bool primary; - final bool centerTitle; - final bool excludeHeaderSemantics; - final double titleSpacing; - final double toolbarOpacity; - final double bottomOpacity; - final double toolbarHeight; - final double leadingWidth; - CustomAppBar({ + const CustomAppBar({ Key key, this.leading, this.automaticallyImplyLeading = true, this.title, this.actions, - this.flexibleSpace, - this.bottom, - this.elevation, - this.shadowColor = const Color(0x10000000), - this.shape, - this.backgroundColor, - this.brightness, - this.iconTheme, - this.actionsIconTheme, - this.textTheme, - this.primary = true, - this.centerTitle, - this.excludeHeaderSemantics = false, - this.titleSpacing = NavigationToolbar.kMiddleSpacing, - this.toolbarOpacity = 1.0, - this.bottomOpacity = 1.0, - this.toolbarHeight, - this.leadingWidth, }) : assert(automaticallyImplyLeading != null), - assert(elevation == null || elevation >= 0.0), - assert(primary != null), - assert(titleSpacing != null), - assert(toolbarOpacity != null), - assert(bottomOpacity != null), super(key: key); @override @@ -74,66 +35,39 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { parentRoute is PageRoute && parentRoute.fullscreenDialog; Widget leading = this.leading; - if (leading == null && this.automaticallyImplyLeading) { - if (hasDrawer) { - // - } else { - if (canPop) + if (leading == null && automaticallyImplyLeading) { + if (!hasDrawer) { + if (canPop) { leading = useCloseButton ? const CustomAppBarCloseButton() : const CustomAppBarBackButton(); + } } } - Widget bottom = this.bottom; - if (bottom == null) { - bottom = PreferredSize( - child: Container( - decoration: BoxDecoration( - border: Border( - top: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.5, - ), - ), - ), - ), - preferredSize: Size.fromHeight(0.5), - ); - } - AppBar appBar = AppBar( leading: leading, automaticallyImplyLeading: automaticallyImplyLeading, title: title, actions: actions, - flexibleSpace: flexibleSpace, - bottom: bottom, - elevation: elevation, - shadowColor: shadowColor, - shape: shape, - backgroundColor: backgroundColor, - brightness: brightness, - iconTheme: iconTheme, - actionsIconTheme: actionsIconTheme, - textTheme: textTheme, - primary: primary, - centerTitle: centerTitle, - excludeHeaderSemantics: excludeHeaderSemantics, - titleSpacing: titleSpacing, - toolbarOpacity: toolbarOpacity, - bottomOpacity: bottomOpacity, - toolbarHeight: toolbarHeight, - leadingWidth: leadingWidth, ); - return appBar; + return Container( + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + blurRadius: 16, + ), + ], + ), + child: appBar, + ); } @override Size get preferredSize { - double height = - toolbarHeight ?? 48 + (bottom?.preferredSize?.height ?? 0.0); - - return Size.fromHeight(height); + return Size.fromHeight( + kIsAndroid ? kToolbarHeight : kMinInteractiveDimensionCupertino, + ); } } diff --git a/lib/widgets/modal_bottom_sheet_wrapped/modal_bottom_sheet_wrapped.dart b/lib/widgets/modal_bottom_sheet_wrapped/modal_bottom_sheet_wrapped.dart new file mode 100644 index 00000000..e3f3cd3a --- /dev/null +++ b/lib/widgets/modal_bottom_sheet_wrapped/modal_bottom_sheet_wrapped.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; + +import '../../includes.dart'; + +class ModalBottomSheetWrapped extends StatefulWidget { + final Widget child; + + const ModalBottomSheetWrapped({ + Key key, + this.child, + }) : super(key: key); + + @override + _ModalBottomSheetWrappedState createState() => + _ModalBottomSheetWrappedState(); +} + +class _ModalBottomSheetWrappedState extends State { + Config _config = sharedConfigManager.getConfig(); + + @override + void initState() { + sharedConfigManager.addListener(_configListen); + super.initState(); + } + + @override + void dispose() { + sharedConfigManager.removeListener(_configListen); + super.dispose(); + } + + void _configListen() { + _config = sharedConfigManager.getConfig(); + setState(() {}); + } + + Widget _build(BuildContext context) { + return MaterialApp( + debugShowCheckedModeBanner: false, + theme: lightThemeData, + darkTheme: darkThemeData, + themeMode: _config.themeMode, + localizationsDelegates: context.localizationDelegates, + supportedLocales: context.supportedLocales, + locale: context.locale, + home: widget.child, + ); + } + + @override + Widget build(BuildContext context) { + return SizedBox( + height: 600, + child: _build(context), + ); + } +} diff --git a/lib/widgets/preference_list/preference_list_item.dart b/lib/widgets/preference_list/preference_list_item.dart index 8b6299b0..e9b5f321 100644 --- a/lib/widgets/preference_list/preference_list_item.dart +++ b/lib/widgets/preference_list/preference_list_item.dart @@ -48,10 +48,10 @@ class PreferenceListItem extends StatelessWidget { return accessoryView; } else { return Padding( - padding: EdgeInsets.only(left: 4), + padding: const EdgeInsets.only(left: 4), child: Icon( FluentIcons.chevron_right_20_regular, - size: 14, + size: 18, color: Theme.of(context).textTheme.caption.color, ), ); diff --git a/lib/widgets/sound_play_button/sound_play_button.dart b/lib/widgets/sound_play_button/sound_play_button.dart index c6bdc812..04c5fe98 100644 --- a/lib/widgets/sound_play_button/sound_play_button.dart +++ b/lib/widgets/sound_play_button/sound_play_button.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; import '../../includes.dart'; -const _kIconSize = 18.0; +const _kIconSize = 16.0; class SoundPlayButton extends StatefulWidget { final String audioUrl; @@ -41,14 +41,15 @@ class _SoundPlayButtonState extends State _playingAnimTimer = Timer.periodic( const Duration(milliseconds: 300), (Timer timer) { - setState(() { - _playingAnimImageIndex = - _playingAnimImageIndex + 1 > 2 ? 0 : _playingAnimImageIndex + 1; - }); + int nextIndex = _playingAnimImageIndex - 1; + if (nextIndex < 0) { + nextIndex = 2; + } + _playingAnimImageIndex = nextIndex; + setState(() {}); }, ); _playingAnimImageIndex = 2; - if (mounted) setState(() {}); } diff --git a/lib/widgets/translation_result_record_view/translation_result_record_view.dart b/lib/widgets/translation_result_record_view/translation_result_record_view.dart index 8b713516..5d635fb8 100644 --- a/lib/widgets/translation_result_record_view/translation_result_record_view.dart +++ b/lib/widgets/translation_result_record_view/translation_result_record_view.dart @@ -3,6 +3,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; +import 'package:page_transition/page_transition.dart'; import '../../includes.dart'; @@ -261,8 +262,9 @@ class TranslationResultRecordView extends StatelessWidget { onPressed: () { Navigator.push( context, - FadeInPageRoute( - builder: (context) => ImageViewerPage( + PageTransition( + type: PageTransitionType.fade, + child: ImageViewerPage( images.map((e) => e.url).toList(), initialIndex: i, ), diff --git a/lib/widgets/widgets.dart b/lib/widgets/widgets.dart index 15140794..ede176e1 100644 --- a/lib/widgets/widgets.dart +++ b/lib/widgets/widgets.dart @@ -6,6 +6,7 @@ export './custom_image/custom_image.dart'; export './language_label/language_label.dart'; export './language_flag_view/language_flag_view.dart'; export './local_db_builder/local_db_builder.dart'; +export './modal_bottom_sheet_wrapped/modal_bottom_sheet_wrapped.dart'; export './ocr_engine_icon/ocr_engine_icon.dart'; export './preference_list/preference_list.dart'; export './record_shortcut_dialog/record_shortcut_dialog.dart'; diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cf0ce79a..2c733cda 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,7 +8,6 @@ import Foundation import audioplayers import device_info_plus_macos import hotkey_manager -import network_info_plus_macos import ocr_engine_builtin import package_info_plus_macos import path_provider_macos @@ -25,7 +24,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioplayersPlugin.register(with: registry.registrar(forPlugin: "AudioplayersPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) HotkeyManagerPlugin.register(with: registry.registrar(forPlugin: "HotkeyManagerPlugin")) - NetworkInfoPlusPlugin.register(with: registry.registrar(forPlugin: "NetworkInfoPlusPlugin")) OcrEngineBuiltinPlugin.register(with: registry.registrar(forPlugin: "OcrEngineBuiltinPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) diff --git a/macos/Podfile.lock b/macos/Podfile.lock index feeb62a7..a9117d0e 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -8,8 +8,6 @@ PODS: - hotkey_manager (0.0.1): - FlutterMacOS - HotKey - - network_info_plus_macos (0.0.1): - - FlutterMacOS - ocr_engine_builtin (0.0.1): - FlutterMacOS - package_info_plus_macos (0.0.1): @@ -38,7 +36,6 @@ DEPENDENCIES: - device_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus_macos/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - hotkey_manager (from `Flutter/ephemeral/.symlinks/plugins/hotkey_manager/macos`) - - network_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/network_info_plus_macos/macos`) - ocr_engine_builtin (from `Flutter/ephemeral/.symlinks/plugins/ocr_engine_builtin/macos`) - package_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos`) - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) @@ -64,8 +61,6 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral hotkey_manager: :path: Flutter/ephemeral/.symlinks/plugins/hotkey_manager/macos - network_info_plus_macos: - :path: Flutter/ephemeral/.symlinks/plugins/network_info_plus_macos/macos ocr_engine_builtin: :path: Flutter/ephemeral/.symlinks/plugins/ocr_engine_builtin/macos package_info_plus_macos: @@ -95,7 +90,6 @@ SPEC CHECKSUMS: FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 HotKey: ad59450195936c10992438c4210f673de5aee43e hotkey_manager: ad673457691f4d39e481be04a61da2ae07d81c62 - network_info_plus_macos: d2b9e6c01c291449b91a584217aa53b113847dbd ocr_engine_builtin: 99c65f8f4a156830ceaf0da86940610fefe50f50 package_info_plus_macos: f010621b07802a241d96d01876d6705f15e77c1c path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 46300052..f19e5980 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -270,7 +270,6 @@ "${BUILT_PRODUCTS_DIR}/audioplayers/audioplayers.framework", "${BUILT_PRODUCTS_DIR}/device_info_plus_macos/device_info_plus_macos.framework", "${BUILT_PRODUCTS_DIR}/hotkey_manager/hotkey_manager.framework", - "${BUILT_PRODUCTS_DIR}/network_info_plus_macos/network_info_plus_macos.framework", "${BUILT_PRODUCTS_DIR}/ocr_engine_builtin/ocr_engine_builtin.framework", "${BUILT_PRODUCTS_DIR}/package_info_plus_macos/package_info_plus_macos.framework", "${BUILT_PRODUCTS_DIR}/path_provider_macos/path_provider_macos.framework", @@ -289,7 +288,6 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/audioplayers.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info_plus_macos.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hotkey_manager.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/network_info_plus_macos.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ocr_engine_builtin.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info_plus_macos.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_macos.framework", diff --git a/pubspec.lock b/pubspec.lock index c215b775..cca15133 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -8,34 +8,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - anyinspect: - dependency: "direct main" - description: - name: anyinspect - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.1" - anyinspect_client: - dependency: transitive - description: - name: anyinspect_client - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.0" - anyinspect_plugin_network: - dependency: "direct main" - description: - name: anyinspect_plugin_network - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.0" - anyinspect_plugin_shared_preferences: - dependency: "direct main" - description: - name: anyinspect_plugin_shared_preferences - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.0" archive: dependency: "direct dev" description: @@ -127,13 +99,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.4" - dbus: - dependency: transitive - description: - name: dbus - url: "https://pub.dartlang.org" - source: hosted - version: "0.5.6" device_info_plus: dependency: "direct main" description: @@ -183,13 +148,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.0.4" - draggable_float_widget: - dependency: transitive - description: - name: draggable_float_widget - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.1" easy_localization: dependency: "direct main" description: @@ -211,13 +169,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.2" - event_bus: - dependency: transitive - description: - name: event_bus - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" fake_async: dependency: transitive description: @@ -371,55 +322,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.6.5" - network_info_plus: - dependency: transitive - description: - name: network_info_plus - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - network_info_plus_linux: - dependency: transitive - description: - name: network_info_plus_linux - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - network_info_plus_macos: - dependency: transitive - description: - name: network_info_plus_macos - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - network_info_plus_platform_interface: - dependency: transitive - description: - name: network_info_plus_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - network_info_plus_web: - dependency: transitive - description: - name: network_info_plus_web - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - network_info_plus_windows: - dependency: transitive - description: - name: network_info_plus_windows - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - nm: - dependency: transitive - description: - name: nm - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.0" ocr_engine_builtin: dependency: transitive description: @@ -483,6 +385,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.4" + page_transition: + dependency: "direct main" + description: + name: page_transition + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" path: dependency: transitive description: @@ -553,13 +462,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.1" petitparser: dependency: transitive description: @@ -681,20 +583,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.3" - shelf: - dependency: transitive - description: - name: shelf - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" sky_engine: dependency: transitive description: flutter @@ -947,13 +835,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" win32: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 919cbe8c..0f202831 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -26,9 +26,6 @@ dependencies: flutter_localizations: sdk: flutter - anyinspect: ^0.1.1 - anyinspect_plugin_network: ^0.1.0 - anyinspect_plugin_shared_preferences: ^0.1.0 audioplayers: ^0.20.1 bot_toast: ^4.0.1 device_info_plus: ^3.1.1 @@ -42,6 +39,7 @@ dependencies: launch_at_startup: ^0.1.1 libwinmedia: ^0.0.7 package_info_plus: ^1.3.0 + page_transition: ^2.0.4 photo_view: ^0.13.0 pro_account: git: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index e63f05c6..f8fb90de 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -21,8 +20,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("HotkeyManagerPlugin")); LibwinmediaPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("LibwinmediaPlugin")); - NetworkInfoPlusWindowsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("NetworkInfoPlusWindowsPlugin")); ScreenCapturerPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ScreenCapturerPlugin")); ScreenRetrieverPluginRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 0c20235e..b7e8e056 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -5,7 +5,6 @@ list(APPEND FLUTTER_PLUGIN_LIST hotkey_manager libwinmedia - network_info_plus_windows screen_capturer screen_retriever screen_text_extractor