From df5e178c6cf2acf395d73b2005a0610fada2ed1d Mon Sep 17 00:00:00 2001 From: appflowy Date: Tue, 1 Feb 2022 11:29:11 +0800 Subject: [PATCH] remove unuse codes --- .../menu/widget/app/header/header.dart | 2 +- .../packages/flowy_infra/lib/color.dart | 19 ------ .../lib/flowy_icon_data_icons.dart | 30 ---------- .../packages/flowy_infra/lib/strings.dart | 60 ------------------- .../packages/flowy_infra/lib/theme.dart | 20 ++++++- 5 files changed, 19 insertions(+), 112 deletions(-) delete mode 100644 frontend/app_flowy/packages/flowy_infra/lib/color.dart delete mode 100644 frontend/app_flowy/packages/flowy_infra/lib/flowy_icon_data_icons.dart delete mode 100644 frontend/app_flowy/packages/flowy_infra/lib/strings.dart diff --git a/frontend/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header/header.dart b/frontend/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header/header.dart index 5b959d258b..f3d782f853 100644 --- a/frontend/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header/header.dart +++ b/frontend/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/header/header.dart @@ -2,7 +2,7 @@ import 'package:app_flowy/workspace/domain/edit_action/app_edit.dart'; import 'package:app_flowy/workspace/presentation/widgets/dialogs.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:expandable/expandable.dart'; -import 'package:flowy_infra/flowy_icon_data_icons.dart'; +import 'package:flowy_infra/icon_data.dart'; import 'package:flowy_infra/theme.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; diff --git a/frontend/app_flowy/packages/flowy_infra/lib/color.dart b/frontend/app_flowy/packages/flowy_infra/lib/color.dart deleted file mode 100644 index 68e194aaa7..0000000000 --- a/frontend/app_flowy/packages/flowy_infra/lib/color.dart +++ /dev/null @@ -1,19 +0,0 @@ -import 'package:flutter/cupertino.dart'; - -class ColorUtils { - static Color shiftHsl(Color c, [double amt = 0]) { - var hslc = HSLColor.fromColor(c); - return hslc.withLightness((hslc.lightness + amt).clamp(0.0, 1.0)).toColor(); - } - - static Color parseHex(String value) => Color(int.parse(value.substring(1, 7), radix: 16) + 0xFF000000); - - static Color blend(Color dst, Color src, double opacity) { - return Color.fromARGB( - 255, - (dst.red.toDouble() * (1.0 - opacity) + src.red.toDouble() * opacity).toInt(), - (dst.green.toDouble() * (1.0 - opacity) + src.green.toDouble() * opacity).toInt(), - (dst.blue.toDouble() * (1.0 - opacity) + src.blue.toDouble() * opacity).toInt(), - ); - } -} diff --git a/frontend/app_flowy/packages/flowy_infra/lib/flowy_icon_data_icons.dart b/frontend/app_flowy/packages/flowy_infra/lib/flowy_icon_data_icons.dart deleted file mode 100644 index e6df4c7428..0000000000 --- a/frontend/app_flowy/packages/flowy_infra/lib/flowy_icon_data_icons.dart +++ /dev/null @@ -1,30 +0,0 @@ -/// Flutter icons FlowyIconData -/// Copyright (C) 2021 by original authors @ fluttericon.com, fontello.com -/// This font was generated by FlutterIcon.com, which is derived from Fontello. -/// -/// To use this font, place it in your fonts/ directory and include the -/// following in your pubspec.yaml -/// -/// flutter: -/// fonts: -/// - family: FlowyIconData -/// fonts: -/// - asset: fonts/FlowyIconData.ttf -/// -/// -/// -// ignore_for_file: constant_identifier_names - -import 'package:flutter/widgets.dart'; - -class FlowyIconData { - FlowyIconData._(); - - static const _kFontFam = 'FlowyIconData'; - static const String? _kFontPkg = null; - - static const IconData drop_down_hide = - IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData drop_down_show = - IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); -} diff --git a/frontend/app_flowy/packages/flowy_infra/lib/strings.dart b/frontend/app_flowy/packages/flowy_infra/lib/strings.dart deleted file mode 100644 index 9447d94050..0000000000 --- a/frontend/app_flowy/packages/flowy_infra/lib/strings.dart +++ /dev/null @@ -1,60 +0,0 @@ -// ignore_for_file: non_constant_identifier_names - -class _Strings { - static _Strings instance = _Strings(); - - String TITLE_CONTACTS_PAGE = "Contacts"; - String TITLE_WHATS_HAPPENING = "What's happening this week?"; - String TITLE_ADD_CONTACT = "Add Contact"; - String TITLE_EDIT_CONTACT = "Edit Contact"; - - String BTN_OK = "Ok"; - String BTN_CANCEL = "Cancel"; - String BTN_SIGN_IN = "Sign In"; - String BTN_SIGN_OUT = "Sign Out"; - String BTN_COMPLETE = "Complete"; - String BTN_SAVE = "Save"; - - String LBL_WELCOME = "Welcome!"; - String LBL_NAME_FIRST = "First Name"; - String LBL_NAME_MIDDLE = "Middle Name"; - String LBL_NAME_LAST = "Last Name"; - String LBL_STEP_X = "Step {0}"; - - String ERR_DEVICE_OAUTH_FAILED_TITLE = "Unable to connect to your account."; - String ERR_DEVICE_OAUTH_FAILED_MSG = - "Please make sure you've completed the sign-in process in your browser."; - - String GOOGLE_OAUTH_TITLE = "GOOGLE SIGN-IN"; - String GOOGLE_OAUTH_INSTRUCTIONS_1 = - "In order to import your Google Contacts, you'll need to authorize this application using your web browser."; - String GOOGLE_OAUTH_INSTRUCTIONS_2 = - "Copy this code to your clipboard by clicking the icon or selecting the text:"; - String GOOGLE_OAUTH_INSTRUCTIONS_3 = - "Navigate to the following link in your web browser, and enter the above code:"; - String GOOGLE_OAUTH_INSTRUCTIONS_4 = - "Press the button below when you've completed signup:"; -} - -_Strings get S => _Strings.instance; - -extension AddSupplant on String { - String sup( - [dynamic v0, - dynamic v1, - dynamic v2, - dynamic v3, - dynamic v4, - dynamic v5, - dynamic v6]) { - var _s = this; - if (v0 != null) _s = _s.replaceAll("{0}", "$v0"); - if (v1 != null) _s = _s.replaceAll("{1}", "$v1"); - if (v2 != null) _s = _s.replaceAll("{2}", "$v2"); - if (v3 != null) _s = _s.replaceAll("{3}", "$v3"); - if (v4 != null) _s = _s.replaceAll("{4}", "$v4"); - if (v5 != null) _s = _s.replaceAll("{5}", "$v5"); - if (v6 != null) _s = _s.replaceAll("{6}", "$v6"); - return _s; - } -} diff --git a/frontend/app_flowy/packages/flowy_infra/lib/theme.dart b/frontend/app_flowy/packages/flowy_infra/lib/theme.dart index 7b71e06053..c29cd644ed 100644 --- a/frontend/app_flowy/packages/flowy_infra/lib/theme.dart +++ b/frontend/app_flowy/packages/flowy_infra/lib/theme.dart @@ -1,4 +1,3 @@ -import 'package:flowy_infra/color.dart'; import 'package:flutter/material.dart'; enum ThemeType { @@ -25,7 +24,6 @@ String themeTypeToString(ThemeType ty) { //Color Pallettes const _black = Color(0xff000000); -const _grey = Color(0xff808080); const _white = Color(0xFFFFFFFF); class AppTheme { @@ -185,3 +183,21 @@ class AppTheme { Color shift(Color c, double d) => ColorUtils.shiftHsl(c, d * (isDark ? -1 : 1)); } + +class ColorUtils { + static Color shiftHsl(Color c, [double amt = 0]) { + var hslc = HSLColor.fromColor(c); + return hslc.withLightness((hslc.lightness + amt).clamp(0.0, 1.0)).toColor(); + } + + static Color parseHex(String value) => Color(int.parse(value.substring(1, 7), radix: 16) + 0xFF000000); + + static Color blend(Color dst, Color src, double opacity) { + return Color.fromARGB( + 255, + (dst.red.toDouble() * (1.0 - opacity) + src.red.toDouble() * opacity).toInt(), + (dst.green.toDouble() * (1.0 - opacity) + src.green.toDouble() * opacity).toInt(), + (dst.blue.toDouble() * (1.0 - opacity) + src.blue.toDouble() * opacity).toInt(), + ); + } +}