Skip to content

Commit

Permalink
sort import
Browse files Browse the repository at this point in the history
  • Loading branch information
laiiihz committed Dec 1, 2023
1 parent c09c721 commit 8ab9cd4
Show file tree
Hide file tree
Showing 58 changed files with 146 additions and 181 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 3 additions & 18 deletions ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -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" : {
Expand Down
Binary file not shown.
Binary file modified ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/LaunchImage.imageset/alga@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 2 additions & 6 deletions lib/l10n/l10n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<LocalizationsDelegate> get localizationsDelegates =>
AppLocalizations.localizationsDelegates;

Expand All @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/models/app_atom.dart
Original file line number Diff line number Diff line change
@@ -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> = T Function(BuildContext context);

Expand Down
4 changes: 2 additions & 2 deletions lib/models/app_category.dart
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/converters/color_converter/color_converter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class ColorResultWidget extends StatelessWidget {
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
children: <Widget>[
AlgaToolbar(
title: Text(context.tr.currentColor),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:alga/utils/constants/import_helper.dart';
import 'package:flutter/material.dart';

class ColorViewBackgroundPainter extends CustomPainter {
final Color lineColor;
Expand Down
21 changes: 21 additions & 0 deletions lib/tools/converters/number_base_converter/number_base.dart
Original file line number Diff line number Diff line change
@@ -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<ConsumerStatefulWidget> createState() => _NumberBasePageState();
}

class _NumberBasePageState extends ConsumerState<NumberBasePage> {
@override
Widget build(BuildContext context) {
return ScrollableScaffold(
title: Text(context.tr.numberBaseConverter),
children: [],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<TextInputFormatter> get formatter =>
[FilteringTextInputFormatter.allow(RegExp(r'[0-9a-fA-F]'))];
Expand All @@ -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<TextInputFormatter> get formatter =>
Expand All @@ -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<TextInputFormatter> get formatter =>
Expand All @@ -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<TextInputFormatter> get formatter =>
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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)),
Expand Down
8 changes: 4 additions & 4 deletions lib/tools/formatters/json/json_formatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/tools/generators/hash_generator/hash_gen.provider.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class _LoremIpsumGenPageState extends ConsumerState<LoremIpsumGenPage> {
),
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,
),
],
Expand Down
10 changes: 5 additions & 5 deletions lib/tools/generators/password_generator/password_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ class _PasswordGenPageState extends ConsumerState<PasswordGenPage> {
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,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/generators/sass_css_generator/sass2css.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class _Sass2cssPageState extends ConsumerState<Sass2cssPage> {
configurations: [
ConfigSwitch(
leading: const Icon(Icons.compress),
title: Text(S.of(context).compress),
title: Text(context.tr.compress),
value: useCompress,
),
ConfigMenu<Syntax>(
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/image_tools/qrcode_tool/qrcode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion lib/tools/info/device_info/android_logo.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion lib/tools/info/device_info/device_info.dart
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion lib/tools/info/device_info/device_info.provider.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/info/network_info/network_info.provider.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion lib/tools/info/widgets/device_tile.dart
Original file line number Diff line number Diff line change
@@ -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});
Expand Down
3 changes: 2 additions & 1 deletion lib/tools/js_tools/quick_js_tool/quick_js.provider.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion lib/tools/js_tools/quick_js_tool/quick_js_view.dart
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/ui/alga_view/all_apps/alga_app_item.dart
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
8 changes: 6 additions & 2 deletions lib/ui/alga_view/all_apps/alga_app_view.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -159,7 +163,7 @@ class _AppCategoriesPanelState extends State<AppCategoriesPanel> {
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))),
],
);
Expand Down
Loading

0 comments on commit 8ab9cd4

Please sign in to comment.