diff --git a/analysis_options.yaml b/analysis_options.yaml index 1728767..2b4d802 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -22,6 +22,7 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: + directives_ordering: true # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json index 937882b..8f2a77a 100644 --- a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -1,34 +1,19 @@ { "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - }, { "filename" : "alga@1x.png", "idiom" : "universal", - "scale" : "1x", - "unassigned" : true + "scale" : "1x" }, { "filename" : "alga@2x.png", "idiom" : "universal", - "scale" : "2x", - "unassigned" : true + "scale" : "2x" }, { "filename" : "alga@3x.png", "idiom" : "universal", - "scale" : "3x", - "unassigned" : true + "scale" : "3x" } ], "info" : { diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@1x 1.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@1x 1.png deleted file mode 100644 index 66d9d2f..0000000 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@1x 1.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@1x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@1x.png index 66d9d2f..fb7c47f 100644 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@1x.png and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@1x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@2x 1.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@2x 1.png deleted file mode 100644 index 1dae307..0000000 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@2x 1.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@2x.png index 1dae307..66d9d2f 100644 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@2x.png and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@3x.png index 433156a..c263627 100644 Binary files a/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@3x.png and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@3x.png differ diff --git a/lib/l10n/l10n.dart b/lib/l10n/l10n.dart index 4d4e6a8..2a0914b 100644 --- a/lib/l10n/l10n.dart +++ b/lib/l10n/l10n.dart @@ -3,11 +3,6 @@ import 'package:flutter/material.dart'; import 'generated/app.translation.g.dart'; class S { - static AppLocalizations of(BuildContext context) { - return AppLocalizations.of(context) ?? - lookupAppLocalizations(const Locale('zh')); - } - static List get localizationsDelegates => AppLocalizations.localizationsDelegates; @@ -18,7 +13,8 @@ class S { } extension L10nX on BuildContext { - AppLocalizations get tr => S.of(this); + AppLocalizations get tr => + AppLocalizations.of(this) ?? lookupAppLocalizations(const Locale('zh')); MaterialLocalizations get mtr => MaterialLocalizations.of(this); } diff --git a/lib/models/app_atom.dart b/lib/models/app_atom.dart index 620d391..26638b6 100644 --- a/lib/models/app_atom.dart +++ b/lib/models/app_atom.dart @@ -1,8 +1,9 @@ +import 'package:alga/l10n/l10n.dart'; import 'package:alga/models/app_category.dart'; import 'package:alga/routers/app_router.dart'; import 'package:alga/tools/tools.dart'; import 'package:alga/ui/widgets/svg_asset_icon.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; typedef ContextBuilder = T Function(BuildContext context); diff --git a/lib/models/app_category.dart b/lib/models/app_category.dart index 963e5fc..95074aa 100644 --- a/lib/models/app_category.dart +++ b/lib/models/app_category.dart @@ -1,6 +1,6 @@ -// ignore_for_file: public_member_api_docs, sort_constructors_first -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/l10n/l10n.dart'; import 'package:alga/models/app_atom.dart'; +import 'package:flutter/material.dart'; class AppCategory { AppCategory({ diff --git a/lib/tools/converters/color_converter/color_converter.dart b/lib/tools/converters/color_converter/color_converter.dart index 4d8b3ed..0d49182 100644 --- a/lib/tools/converters/color_converter/color_converter.dart +++ b/lib/tools/converters/color_converter/color_converter.dart @@ -95,7 +95,7 @@ class ColorResultWidget extends StatelessWidget { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ + children: [ AlgaToolbar( title: Text(context.tr.currentColor), ), diff --git a/lib/tools/converters/color_converter/color_view_background_patiner.dart b/lib/tools/converters/color_converter/color_view_background_patiner.dart index bfeb40f..14debff 100644 --- a/lib/tools/converters/color_converter/color_view_background_patiner.dart +++ b/lib/tools/converters/color_converter/color_view_background_patiner.dart @@ -1,4 +1,4 @@ -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; class ColorViewBackgroundPainter extends CustomPainter { final Color lineColor; diff --git a/lib/tools/converters/number_base_converter/number_base.dart b/lib/tools/converters/number_base_converter/number_base.dart new file mode 100644 index 0000000..2aa4326 --- /dev/null +++ b/lib/tools/converters/number_base_converter/number_base.dart @@ -0,0 +1,21 @@ +import 'package:alga/l10n/l10n.dart'; +import 'package:alga/ui/widgets/scaffold/scrollable_scaffold.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +class NumberBasePage extends ConsumerStatefulWidget { + const NumberBasePage({super.key}); + + @override + ConsumerState createState() => _NumberBasePageState(); +} + +class _NumberBasePageState extends ConsumerState { + @override + Widget build(BuildContext context) { + return ScrollableScaffold( + title: Text(context.tr.numberBaseConverter), + children: [], + ); + } +} diff --git a/lib/tools/converters/number_base_converter/number_base_converter_provider.dart b/lib/tools/converters/number_base_converter/number_base_converter_provider.dart index b9f3059..21ae743 100644 --- a/lib/tools/converters/number_base_converter/number_base_converter_provider.dart +++ b/lib/tools/converters/number_base_converter/number_base_converter_provider.dart @@ -57,7 +57,7 @@ class HexController extends NumberBaseController { HexController() : super(16, 15); @override - String title(context) => S.of(context).hexdecimal; + String title(context) => context.tr.hexdecimal; @override List get formatter => [FilteringTextInputFormatter.allow(RegExp(r'[0-9a-fA-F]'))]; @@ -67,7 +67,7 @@ class DecController extends NumberBaseController { DecController() : super(10, 18); @override - String title(context) => S.of(context).decimal; + String title(context) => context.tr.decimal; @override List get formatter => @@ -78,7 +78,7 @@ class OctController extends NumberBaseController { OctController() : super(8, 20); @override - String title(context) => S.of(context).octal; + String title(context) => context.tr.octal; @override List get formatter => @@ -89,7 +89,7 @@ class BinController extends NumberBaseController { BinController() : super(2, 60); @override - String title(context) => S.of(context).binary; + String title(context) => context.tr.binary; @override List get formatter => diff --git a/lib/tools/converters/number_base_converter/number_base_converter_view.dart b/lib/tools/converters/number_base_converter/number_base_converter_view.dart index ebb77fc..3d37c4f 100644 --- a/lib/tools/converters/number_base_converter/number_base_converter_view.dart +++ b/lib/tools/converters/number_base_converter/number_base_converter_view.dart @@ -1,6 +1,12 @@ +import 'package:alga/l10n/l10n.dart'; +import 'package:alga/ui/widgets/tool_view.dart'; +import 'package:alga/utils/clipboard_util.dart'; +import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'number_base.dart'; part './number_base_converter_provider.dart'; @@ -16,8 +22,9 @@ class NumberBaseConverterView extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { + return NumberBasePage(); return ScrollableToolView( - title: Text(S.of(context).numberBaseConverter), + title: Text(context.tr.numberBaseConverter), children: ref.watch(_controllers).map((e) { return ListTile( title: Text(e.title(context)), diff --git a/lib/tools/formatters/json/json_formatter.dart b/lib/tools/formatters/json/json_formatter.dart index 866e510..a8d9b10 100644 --- a/lib/tools/formatters/json/json_formatter.dart +++ b/lib/tools/formatters/json/json_formatter.dart @@ -137,10 +137,10 @@ enum JsonIndentType { String name(BuildContext context) { return switch (this) { - space2 => S.of(context).json2spaces, - space4 => S.of(context).json4spaces, - tab => S.of(context).json1tab, - minified => S.of(context).jsonMinified, + space2 => context.tr.json2spaces, + space4 => context.tr.json4spaces, + tab => context.tr.json1tab, + minified => context.tr.jsonMinified, }; } } diff --git a/lib/tools/generators/hash_generator/hash_gen.provider.dart b/lib/tools/generators/hash_generator/hash_gen.provider.dart index f9a8372..934f6f4 100644 --- a/lib/tools/generators/hash_generator/hash_gen.provider.dart +++ b/lib/tools/generators/hash_generator/hash_gen.provider.dart @@ -1,9 +1,10 @@ import 'dart:convert'; import 'dart:typed_data'; +import 'package:alga/l10n/l10n.dart'; import 'package:alga/tools/generators/hash_generator/hash_gen.dart'; -import 'package:alga/utils/constants/import_helper.dart'; import 'package:convert/convert.dart'; +import 'package:flutter/material.dart'; import 'package:pointycastle/export.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'hash_gen.provider.g.dart'; diff --git a/lib/tools/generators/lorem_ipsum_generator/lorem_ipsum_gen.dart b/lib/tools/generators/lorem_ipsum_generator/lorem_ipsum_gen.dart index ad20a5a..e178ce7 100644 --- a/lib/tools/generators/lorem_ipsum_generator/lorem_ipsum_gen.dart +++ b/lib/tools/generators/lorem_ipsum_generator/lorem_ipsum_gen.dart @@ -46,8 +46,8 @@ class _LoremIpsumGenPageState extends ConsumerState { ), ConfigNumber( leading: const Icon(Icons.numbers), - title: Text(S.of(context).loremLength), - subtitle: Text(S.of(context).loremLengthDes), + title: Text(context.tr.loremLength), + subtitle: Text(context.tr.loremLengthDes), value: useCount, ), ], diff --git a/lib/tools/generators/password_generator/password_gen.dart b/lib/tools/generators/password_generator/password_gen.dart index fa69c58..9573922 100644 --- a/lib/tools/generators/password_generator/password_gen.dart +++ b/lib/tools/generators/password_generator/password_gen.dart @@ -45,27 +45,27 @@ class _PasswordGenPageState extends ConsumerState { title: Text(context.tr.passGenerator), configurations: [ ConfigSwitch( - title: Text(S.of(context).passUppercaseCharacters), + title: Text(context.tr.passUppercaseCharacters), subtitle: const Text('[A-Z]'), value: useUppercase, ), ConfigSwitch( - title: Text(S.of(context).passLowercaseCharacters), + title: Text(context.tr.passLowercaseCharacters), subtitle: const Text('[a-z]'), value: useLowercase, ), ConfigSwitch( - title: Text(S.of(context).passNumbersCharacters), + title: Text(context.tr.passNumbersCharacters), subtitle: const Text('[0-9]'), value: useDigit, ), ConfigSwitch( - title: Text(S.of(context).passSpecialCharacters), + title: Text(context.tr.passSpecialCharacters), subtitle: const Text(r'!@#$%^&*'), value: useSpecial, ), ConfigNumber( - title: Text(S.of(context).passPasswordLength), + title: Text(context.tr.passPasswordLength), value: useCount, min: 4, ), diff --git a/lib/tools/generators/random_file_generator/random_file_generator_view.dart b/lib/tools/generators/random_file_generator/random_file_generator_view.dart index 68ff108..bf28b8d 100644 --- a/lib/tools/generators/random_file_generator/random_file_generator_view.dart +++ b/lib/tools/generators/random_file_generator/random_file_generator_view.dart @@ -1,8 +1,12 @@ import 'dart:io'; import 'dart:isolate'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/ui/widgets/tool_view.dart'; +import 'package:alga/ui/widgets/tool_view_config.dart'; import 'package:file_selector/file_selector.dart' as selector; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; part './random_file_generator_provider.dart'; part './random_file_util.dart'; diff --git a/lib/tools/generators/sass_css_generator/sass2css.dart b/lib/tools/generators/sass_css_generator/sass2css.dart index eced75c..bb217af 100644 --- a/lib/tools/generators/sass_css_generator/sass2css.dart +++ b/lib/tools/generators/sass_css_generator/sass2css.dart @@ -56,7 +56,7 @@ class _Sass2cssPageState extends ConsumerState { configurations: [ ConfigSwitch( leading: const Icon(Icons.compress), - title: Text(S.of(context).compress), + title: Text(context.tr.compress), value: useCompress, ), ConfigMenu( diff --git a/lib/tools/image_tools/qrcode_tool/qrcode.dart b/lib/tools/image_tools/qrcode_tool/qrcode.dart index 66ef0aa..e0f6d17 100644 --- a/lib/tools/image_tools/qrcode_tool/qrcode.dart +++ b/lib/tools/image_tools/qrcode_tool/qrcode.dart @@ -18,8 +18,8 @@ import 'package:flutter/rendering.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:gal/gal.dart'; import 'package:go_router/go_router.dart'; -import 'package:qr_flutter/qr_flutter.dart'; import 'package:path/path.dart' as p; +import 'package:qr_flutter/qr_flutter.dart'; final useErrorLevel = intConfigProvider(const ValueKey('errorLevel'), defaultValue: QrErrorCorrectLevel.L); diff --git a/lib/tools/info/device_info/android_logo.dart b/lib/tools/info/device_info/android_logo.dart index 496ea01..cda7cbf 100644 --- a/lib/tools/info/device_info/android_logo.dart +++ b/lib/tools/info/device_info/android_logo.dart @@ -1,6 +1,7 @@ import 'package:alga/tools/info/device_info/device_info.provider.dart'; import 'package:alga/ui/widgets/svg_asset_icon.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; class AndroidLogo extends ConsumerWidget { diff --git a/lib/tools/info/device_info/device_info.dart b/lib/tools/info/device_info/device_info.dart index 58ffdae..9438267 100644 --- a/lib/tools/info/device_info/device_info.dart +++ b/lib/tools/info/device_info/device_info.dart @@ -1,11 +1,14 @@ import 'dart:io'; +import 'package:alga/l10n/l10n.dart'; import 'package:alga/tools/info/device_info/android_logo.dart'; import 'package:alga/tools/info/device_info/device_info.provider.dart'; import 'package:alga/tools/info/widgets/device_tile.dart'; import 'package:alga/ui/widgets/scaffold/scrollable_scaffold.dart'; import 'package:alga/ui/widgets/toolbar/alga_toolbar.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; class DeviceInfoRoute extends GoRouteData { @override diff --git a/lib/tools/info/device_info/device_info.provider.dart b/lib/tools/info/device_info/device_info.provider.dart index 5f1fa6b..d4c6a4a 100644 --- a/lib/tools/info/device_info/device_info.provider.dart +++ b/lib/tools/info/device_info/device_info.provider.dart @@ -1,9 +1,10 @@ // ignore_for_file: public_member_api_docs, sort_constructors_first import 'dart:io'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/l10n/l10n.dart'; import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'device_info.provider.g.dart'; diff --git a/lib/tools/info/network_info/network_info.provider.dart b/lib/tools/info/network_info/network_info.provider.dart index dad20eb..be1da42 100644 --- a/lib/tools/info/network_info/network_info.provider.dart +++ b/lib/tools/info/network_info/network_info.provider.dart @@ -1,5 +1,5 @@ -import 'package:alga/utils/constants/import_helper.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter/material.dart'; import 'package:network_info_plus/network_info_plus.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; diff --git a/lib/tools/info/widgets/device_tile.dart b/lib/tools/info/widgets/device_tile.dart index 71baef8..352ed8a 100644 --- a/lib/tools/info/widgets/device_tile.dart +++ b/lib/tools/info/widgets/device_tile.dart @@ -1,4 +1,4 @@ -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; class DeviceTile extends StatelessWidget { const DeviceTile({super.key, required this.title, required this.value}); diff --git a/lib/tools/js_tools/quick_js_tool/quick_js.provider.dart b/lib/tools/js_tools/quick_js_tool/quick_js.provider.dart index 5b41545..0f941cb 100644 --- a/lib/tools/js_tools/quick_js_tool/quick_js.provider.dart +++ b/lib/tools/js_tools/quick_js_tool/quick_js.provider.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:flutter_js/flutter_js.dart'; +import 'package:riverpod_annotation/riverpod_annotation.dart'; + part 'quick_js.provider.g.dart'; sealed class JsContent { diff --git a/lib/tools/js_tools/quick_js_tool/quick_js_view.dart b/lib/tools/js_tools/quick_js_tool/quick_js_view.dart index 8b74d6d..40e5c31 100644 --- a/lib/tools/js_tools/quick_js_tool/quick_js_view.dart +++ b/lib/tools/js_tools/quick_js_tool/quick_js_view.dart @@ -1,5 +1,9 @@ +import 'package:alga/l10n/l10n.dart'; import 'package:alga/tools/js_tools/quick_js_tool/quick_js.provider.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/ui/widgets/app_text_field.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; class QuickJsRoute extends GoRouteData { @override diff --git a/lib/ui/alga_view/all_apps/alga_app_item.dart b/lib/ui/alga_view/all_apps/alga_app_item.dart index fac2d62..81158ab 100644 --- a/lib/ui/alga_view/all_apps/alga_app_item.dart +++ b/lib/ui/alga_view/all_apps/alga_app_item.dart @@ -1,7 +1,9 @@ +import 'package:alga/l10n/l10n.dart'; import 'package:alga/models/app_atom.dart'; -import 'package:alga/utils/constants/import_helper.dart'; import 'package:alga/utils/hive_boxes/favorite_box.dart'; import 'package:auto_size_text/auto_size_text.dart'; +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; class AlgaAppItem extends StatelessWidget { const AlgaAppItem(this.item, diff --git a/lib/ui/alga_view/all_apps/alga_app_view.dart b/lib/ui/alga_view/all_apps/alga_app_view.dart index b39f231..104beb8 100644 --- a/lib/ui/alga_view/all_apps/alga_app_view.dart +++ b/lib/ui/alga_view/all_apps/alga_app_view.dart @@ -1,13 +1,17 @@ import 'dart:async'; import 'dart:io'; +import 'package:alga/l10n/l10n.dart'; import 'package:alga/models/app_atom.dart'; import 'package:alga/models/app_category.dart'; import 'package:alga/routers/app_router.dart'; import 'package:alga/ui/global.provider.dart'; import 'package:alga/ui/views/favorite_view.dart'; import 'package:alga/ui/views/settings_view.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/utils/theme_util.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; import 'alga_app_item.dart'; import 'alga_app_view_provider.dart'; @@ -159,7 +163,7 @@ class _AppCategoriesPanelState extends State { controller: ref.watch(appTabControllerProvider(vsync: parentState)), indicatorPadding: const EdgeInsets.only(top: 44, left: 0, right: 0), tabs: [ - Tab(text: S.of(context).allApps), + Tab(text: context.tr.allApps), ...AppCategory.items.map((e) => Tab(text: e.name(context))), ], ); diff --git a/lib/ui/alga_view/all_apps/alga_app_view_provider.dart b/lib/ui/alga_view/all_apps/alga_app_view_provider.dart index 78c2255..b6fd27f 100644 --- a/lib/ui/alga_view/all_apps/alga_app_view_provider.dart +++ b/lib/ui/alga_view/all_apps/alga_app_view_provider.dart @@ -1,5 +1,5 @@ import 'package:alga/models/app_category.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'alga_app_view_provider.g.dart'; diff --git a/lib/ui/alga_view/widgets/alga_panel.dart b/lib/ui/alga_view/widgets/alga_panel.dart index 8d5b45a..c74f7a3 100644 --- a/lib/ui/alga_view/widgets/alga_panel.dart +++ b/lib/ui/alga_view/widgets/alga_panel.dart @@ -1,9 +1,12 @@ +import 'package:alga/l10n/l10n.dart'; import 'package:alga/routers/app_router.dart'; import 'package:alga/ui/alga_view/all_apps/alga_app_view.dart'; import 'package:alga/ui/views/favorite_view.dart'; import 'package:alga/ui/views/settings_view.dart'; import 'package:alga/ui/widgets/alga_logo.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; class AlgaPanel extends ConsumerStatefulWidget { const AlgaPanel({super.key}); diff --git a/lib/ui/views/favorite_view.dart b/lib/ui/views/favorite_view.dart index a9b0146..10f6a15 100644 --- a/lib/ui/views/favorite_view.dart +++ b/lib/ui/views/favorite_view.dart @@ -1,7 +1,9 @@ +import 'package:alga/l10n/l10n.dart'; import 'package:alga/ui/alga_view/all_apps/alga_app_item.dart'; import 'package:alga/ui/widgets/asset_svg.dart'; -import 'package:alga/utils/constants/import_helper.dart'; import 'package:alga/utils/hive_boxes/favorite_box.dart'; +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; class FavoriteRoute extends GoRouteData { @override diff --git a/lib/ui/views/favorite_view.provider.dart b/lib/ui/views/favorite_view.provider.dart deleted file mode 100644 index 80027b6..0000000 --- a/lib/ui/views/favorite_view.provider.dart +++ /dev/null @@ -1,9 +0,0 @@ -// import 'package:alga/models/app_atom.dart'; -// import 'package:riverpod_annotation/riverpod_annotation.dart'; - -// part 'favorite_view.provider.g.dart'; - -// @Riverpod() -// class FavoriteApps extends _$FavoriteApps { -// Map build() {} -// } diff --git a/lib/ui/views/settings_view.dart b/lib/ui/views/settings_view.dart index 66a8590..f2df343 100644 --- a/lib/ui/views/settings_view.dart +++ b/lib/ui/views/settings_view.dart @@ -1,12 +1,16 @@ import 'dart:io'; +import 'package:alga/l10n/l10n.dart'; import 'package:alga/ui/global.provider.dart'; import 'package:alga/ui/widgets/alga_logo.dart'; import 'package:alga/ui/widgets/app_show_menu.dart'; import 'package:alga/ui/widgets/setting_title.dart'; import 'package:alga/ui/widgets/svg_asset_icon.dart'; -import 'package:alga/utils/constants/import_helper.dart'; import 'package:alga/utils/hive_boxes/app_config_box.dart'; +import 'package:alga/utils/theme_util.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; import 'package:url_launcher/url_launcher_string.dart'; class SettingsRoute extends GoRouteData { @@ -29,7 +33,7 @@ class _SettingsViewState extends State { Widget result = CustomScrollView( slivers: [ SliverAppBar.large( - title: Text(S.of(context).settings), + title: Text(context.tr.settings), ), SliverList( delegate: SliverChildListDelegate([ @@ -122,7 +126,7 @@ class _SettingsViewState extends State { SettingTitle(Text(context.tr.about)), ListTile( leading: const SvgAssetIcon('assets/icons/github.svg'), - title: Text(S.of(context).github), + title: Text(context.tr.github), onTap: () { launchUrlString( 'https://github.com/laiiihz/alga', @@ -132,7 +136,7 @@ class _SettingsViewState extends State { ), ListTile( leading: const Icon(Icons.bug_report_rounded), - title: Text(S.of(context).issues), + title: Text(context.tr.issues), onTap: () { launchUrlString( 'https://github.com/laiiihz/alga/issues', diff --git a/lib/ui/views/widgets/expandable_settings_tile.dart b/lib/ui/views/widgets/expandable_settings_tile.dart deleted file mode 100644 index 369cca5..0000000 --- a/lib/ui/views/widgets/expandable_settings_tile.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:alga/utils/constants/import_helper.dart'; - -class ExpandableSettingsTile extends StatefulWidget { - final Widget title; - final Widget leading; - final Widget child; - const ExpandableSettingsTile({ - super.key, - required this.title, - required this.leading, - required this.child, - }); - - @override - State createState() => _ExpandableSettingsTileState(); -} - -class _ExpandableSettingsTileState extends State { - bool _expand = false; - @override - Widget build(BuildContext context) { - return Column( - children: [ - ListTile( - leading: widget.leading, - title: widget.title, - trailing: AnimatedRotation( - turns: _expand ? 0.5 : 0, - duration: const Duration(milliseconds: 400), - child: const Icon(Icons.keyboard_arrow_down), - ), - onTap: () { - setState(() { - _expand = !_expand; - }); - }, - ), - ClipRRect( - borderRadius: const BorderRadius.vertical(bottom: Radius.circular(4)), - child: AnimatedAlign( - alignment: Alignment.topLeft, - duration: const Duration(milliseconds: 400), - curve: Curves.easeInOutCubic, - heightFactor: _expand ? 1 : 0, - child: Material( - color: isDark(context) ? Colors.grey[150] : Colors.grey[30], - child: widget.child, - ), - ), - ), - ], - ); - } -} diff --git a/lib/ui/widgets/alga_logo.dart b/lib/ui/widgets/alga_logo.dart index 9355e94..2fd2126 100644 --- a/lib/ui/widgets/alga_logo.dart +++ b/lib/ui/widgets/alga_logo.dart @@ -1,4 +1,4 @@ -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; class AlgaLogo extends StatelessWidget { diff --git a/lib/ui/widgets/app_progress.dart b/lib/ui/widgets/app_progress.dart index 079581c..5e3a331 100644 --- a/lib/ui/widgets/app_progress.dart +++ b/lib/ui/widgets/app_progress.dart @@ -1,7 +1,7 @@ import 'dart:async'; -import 'package:alga/utils/constants/import_helper.dart'; import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/material.dart'; Future progress(Future Function() runner, {String? message}) async { final cancel = BotToast.showCustomLoading( diff --git a/lib/ui/widgets/app_show_menu.dart b/lib/ui/widgets/app_show_menu.dart index 0de7a53..8d44bda 100644 --- a/lib/ui/widgets/app_show_menu.dart +++ b/lib/ui/widgets/app_show_menu.dart @@ -1,4 +1,4 @@ -import '../../utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; class AppShowMenu extends StatelessWidget { const AppShowMenu({ diff --git a/lib/ui/widgets/asset_svg.dart b/lib/ui/widgets/asset_svg.dart index 0b71288..6ca65a2 100644 --- a/lib/ui/widgets/asset_svg.dart +++ b/lib/ui/widgets/asset_svg.dart @@ -1,4 +1,4 @@ -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; class AssetSvg extends StatelessWidget { diff --git a/lib/ui/widgets/buttons/copy_button.dart b/lib/ui/widgets/buttons/copy_button.dart index 3d82ad3..d12f0b6 100644 --- a/lib/ui/widgets/buttons/copy_button.dart +++ b/lib/ui/widgets/buttons/copy_button.dart @@ -1,5 +1,7 @@ +import 'package:alga/l10n/l10n.dart'; import 'package:alga/ui/widgets/custom_icon_button.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/utils/clipboard_util.dart'; +import 'package:flutter/material.dart'; class CopyButton extends StatelessWidget { const CopyButton(this.onCopy, {super.key, this.icon}); diff --git a/lib/ui/widgets/buttons/refresh_button.dart b/lib/ui/widgets/buttons/refresh_button.dart index 33945fa..88eccd3 100644 --- a/lib/ui/widgets/buttons/refresh_button.dart +++ b/lib/ui/widgets/buttons/refresh_button.dart @@ -1,5 +1,6 @@ +import 'package:alga/l10n/l10n.dart'; import 'package:alga/ui/widgets/custom_icon_button.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; class RefreshButton extends StatelessWidget { const RefreshButton(this.onRefresh, {super.key}); diff --git a/lib/ui/widgets/configurations/configurations.dart b/lib/ui/widgets/configurations/configurations.dart index cdf1d02..823054a 100644 --- a/lib/ui/widgets/configurations/configurations.dart +++ b/lib/ui/widgets/configurations/configurations.dart @@ -1,7 +1,9 @@ import 'package:alga/tools/tools.provider.dart'; import 'package:alga/ui/widgets/app_show_menu.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/ui/widgets/tool_view_config.dart'; +import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; class VisibleConfig extends StatelessWidget { const VisibleConfig({ diff --git a/lib/ui/widgets/custom_icon_button.dart b/lib/ui/widgets/custom_icon_button.dart index 3bf6869..791de26 100644 --- a/lib/ui/widgets/custom_icon_button.dart +++ b/lib/ui/widgets/custom_icon_button.dart @@ -1,4 +1,4 @@ -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; class CustomIconButton extends StatelessWidget { const CustomIconButton({ diff --git a/lib/ui/widgets/error_message_expandable.dart b/lib/ui/widgets/error_message_expandable.dart index a0af339..e9ae222 100644 --- a/lib/ui/widgets/error_message_expandable.dart +++ b/lib/ui/widgets/error_message_expandable.dart @@ -1,4 +1,5 @@ -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/l10n/l10n.dart'; +import 'package:flutter/material.dart'; class ErrorMessageWidget extends StatelessWidget { const ErrorMessageWidget(this.message, {super.key}); diff --git a/lib/ui/widgets/scaffold/scrollable_scaffold.dart b/lib/ui/widgets/scaffold/scrollable_scaffold.dart index 7cc722f..2b98771 100644 --- a/lib/ui/widgets/scaffold/scrollable_scaffold.dart +++ b/lib/ui/widgets/scaffold/scrollable_scaffold.dart @@ -1,6 +1,6 @@ // ignore_for_file: public_member_api_docs, sort_constructors_first -import 'package:alga/utils/constants/import_helper.dart'; import 'package:alga/utils/extension/list_ext.dart'; +import 'package:flutter/material.dart'; /// /// --- AppBar --- diff --git a/lib/ui/widgets/scaffold/tool_actions.dart b/lib/ui/widgets/scaffold/tool_actions.dart index c916c0b..e8ffd93 100644 --- a/lib/ui/widgets/scaffold/tool_actions.dart +++ b/lib/ui/widgets/scaffold/tool_actions.dart @@ -1,4 +1,4 @@ -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:flutter/material.dart'; class ToolActions extends StatelessWidget { const ToolActions({ diff --git a/lib/ui/widgets/scaffold/tool_copy.dart b/lib/ui/widgets/scaffold/tool_copy.dart index 2374ee7..f76fce8 100644 --- a/lib/ui/widgets/scaffold/tool_copy.dart +++ b/lib/ui/widgets/scaffold/tool_copy.dart @@ -1,4 +1,5 @@ -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/l10n/l10n.dart'; +import 'package:flutter/material.dart'; class ToolCopy extends StatelessWidget { const ToolCopy(this.controller, {super.key}) : onlyIcon = false; diff --git a/lib/ui/widgets/scaffold/tool_options.dart b/lib/ui/widgets/scaffold/tool_options.dart index c200dca..3a7ba44 100644 --- a/lib/ui/widgets/scaffold/tool_options.dart +++ b/lib/ui/widgets/scaffold/tool_options.dart @@ -1,5 +1,7 @@ import 'package:alga/ui/widgets/app_show_menu.dart'; -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/ui/widgets/tool_view_config.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; class ToolOptionsEnum extends ConsumerWidget { const ToolOptionsEnum({ diff --git a/lib/ui/widgets/scaffold/tool_paste.dart b/lib/ui/widgets/scaffold/tool_paste.dart deleted file mode 100644 index 8274503..0000000 --- a/lib/ui/widgets/scaffold/tool_paste.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:alga/utils/constants/import_helper.dart'; - -class ToolPaste extends StatelessWidget { - const ToolPaste({super.key}); - - @override - Widget build(BuildContext context) { - return Container(); - } -} diff --git a/lib/ui/widgets/scaffold/tool_scaffold.dart b/lib/ui/widgets/scaffold/tool_scaffold.dart index 8df09e3..671d4ac 100644 --- a/lib/ui/widgets/scaffold/tool_scaffold.dart +++ b/lib/ui/widgets/scaffold/tool_scaffold.dart @@ -1,5 +1,5 @@ -import 'package:alga/utils/constants/import_helper.dart'; import 'package:alga/utils/extension/list_ext.dart'; +import 'package:flutter/material.dart'; @Deprecated('use Scaffold or Scrollable Scaffold') class ToolScaffold extends StatelessWidget { diff --git a/lib/ui/widgets/toolbar/alga_toolbar.dart b/lib/ui/widgets/toolbar/alga_toolbar.dart index c5269fa..9a66bd7 100644 --- a/lib/ui/widgets/toolbar/alga_toolbar.dart +++ b/lib/ui/widgets/toolbar/alga_toolbar.dart @@ -1,4 +1,5 @@ -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/l10n/l10n.dart'; +import 'package:flutter/material.dart'; class AlgaToolbar extends StatelessWidget { const AlgaToolbar({ diff --git a/lib/utils/constants/import_helper.dart b/lib/utils/constants/import_helper.dart deleted file mode 100644 index 21d51b8..0000000 --- a/lib/utils/constants/import_helper.dart +++ /dev/null @@ -1,10 +0,0 @@ -export 'package:alga/l10n/l10n.dart'; -export 'package:alga/ui/widgets/app_text_field.dart'; -export 'package:alga/ui/widgets/tool_view.dart'; -export 'package:alga/ui/widgets/tool_view_config.dart'; -export 'package:alga/utils/clipboard_util.dart'; -export 'package:alga/utils/theme_util.dart'; -export 'package:flutter/material.dart'; -export 'package:flutter_riverpod/flutter_riverpod.dart'; -export 'package:go_router/go_router.dart'; -export 'package:language_textfield/language_textfield.dart'; diff --git a/lib/utils/hive_boxes/app_config_box.dart b/lib/utils/hive_boxes/app_config_box.dart index caed348..145d340 100644 --- a/lib/utils/hive_boxes/app_config_box.dart +++ b/lib/utils/hive_boxes/app_config_box.dart @@ -1,6 +1,7 @@ -import 'package:alga/utils/constants/import_helper.dart'; +import 'package:alga/l10n/l10n.dart'; import 'package:alga/utils/hive_util.dart'; import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; import 'package:hive_flutter/hive_flutter.dart'; class AppConfigBox { @@ -112,11 +113,11 @@ extension ThemeModeX on ThemeMode { String getName(BuildContext context) { switch (this) { case ThemeMode.system: - return S.of(context).followSystem; + return context.tr.followSystem; case ThemeMode.light: - return S.of(context).themeLight; + return context.tr.themeLight; case ThemeMode.dark: - return S.of(context).themeDark; + return context.tr.themeDark; } } } diff --git a/lib/utils/image_util.dart b/lib/utils/image_util.dart index c96347c..c51214c 100644 --- a/lib/utils/image_util.dart +++ b/lib/utils/image_util.dart @@ -1,9 +1,8 @@ import 'dart:io'; -import 'package:flutter/foundation.dart'; - import 'package:blurhash_dart/blurhash_dart.dart'; import 'package:file_selector/file_selector.dart' as selector; +import 'package:flutter/foundation.dart'; import 'package:image/image.dart' as pub_image; import 'package:image_picker/image_picker.dart'; diff --git a/lib/utils/snackbar_util.dart b/lib/utils/snackbar_util.dart index 7c384a8..3dfb3d1 100644 --- a/lib/utils/snackbar_util.dart +++ b/lib/utils/snackbar_util.dart @@ -1,6 +1,5 @@ -import 'package:flutter/material.dart'; - import 'package:alga/l10n/l10n.dart'; +import 'package:flutter/material.dart'; class SnackbarUtil { final BuildContext context; @@ -13,7 +12,7 @@ class SnackbarUtil { content: Text(text), backgroundColor: scheme.secondary, action: SnackBarAction( - label: S.of(context).confirm, + label: context.tr.confirm, onPressed: () { ScaffoldMessenger.of(context).clearSnackBars(); }, @@ -29,7 +28,7 @@ class SnackbarUtil { content: Text(text), backgroundColor: scheme.error, action: SnackBarAction( - label: S.of(context).confirm, + label: context.tr.confirm, onPressed: () { ScaffoldMessenger.of(context).clearSnackBars(); }, @@ -39,14 +38,14 @@ class SnackbarUtil { } copied() { - success(S.of(context).copied); + success(context.tr.copied); } pasted() { - success(S.of(context).pasted); + success(context.tr.pasted); } cleared() { - success(S.of(context).cleared); + success(context.tr.cleared); } } diff --git a/test/widget_test.dart b/test/widget_test.dart index 484c1f0..3a92b08 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -5,12 +5,10 @@ // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. +import 'package:alga/main.dart'; import 'package:flutter/material.dart'; - import 'package:flutter_test/flutter_test.dart'; -import 'package:alga/main.dart'; - void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame.