diff --git a/app/build_deb.sh b/app/build_deb.sh index b9f0faa..70285f9 100755 --- a/app/build_deb.sh +++ b/app/build_deb.sh @@ -2,23 +2,57 @@ VERSION=$(dart version.dart) +if [ -e pubspec.yaml.bak ]; then + mv pubspec.yaml.bak pubspec.yaml +fi + flutter clean + +cp pubspec.yaml pubspec.yaml.bak +ln -s /usr/share/fonts/opentype/noto/ noto_fonts + +cat >> pubspec.yaml << EOF + fonts: + - family: NotoSansSC + fonts: + - asset: noto_fonts/NotoSansCJK-Regular.ttc + weight: 400 + - asset: noto_fonts/NotoSansCJK-Bold.ttc + weight: 700 + +EOF + flutter build linux +rm pubspec.yaml +rm noto_fonts +mv pubspec.yaml.bak pubspec.yaml + if [ -e deb_builder ]; then rm -rf deb_builder fi +ARCH="x64" + +if [[ $(uname -m) == aarch64 ]]; then + ARCH="arm64" +fi + mkdir "deb_builder" cp -r debian deb_builder/DEBIAN +chmod -R 755 deb_builder/DEBIAN cp ../LICENSE deb_builder/DEBIAN/copyright echo Version: "$VERSION" >> deb_builder/DEBIAN/control mkdir -p deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/ -cp -r build/linux/x64/release/bundle deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/files +cp -r build/linux/"$ARCH"/release/bundle deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/files + +rm -rf deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/files/data/flutter_assets/noto_fonts/ + +ln -s /usr/share/fonts/opentype/noto/ deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/files/data/flutter_assets/noto_fonts cp -r dde_package_info/* deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/ @@ -32,4 +66,4 @@ sed -i "s/VERSION/$VERSION/g" deb_builder/opt/apps/com.debuggerx.dde-gesture-man dpkg-deb -b deb_builder -mv deb_builder.deb dgm-"$VERSION"_x64.deb +mv deb_builder.deb dgm-"$VERSION"_"$ARCH".deb diff --git a/app/debian/control b/app/debian/control index c43c09c..c2f90a1 100644 --- a/app/debian/control +++ b/app/debian/control @@ -10,4 +10,5 @@ Build-Depends: Homepage: https://github.com/debuggerx01/dde_gesture_manager Package: dde-gesture-manager Architecture: amd64 +Depends: fonts-noto-cjk Description: 专为 DDE 桌面环境打造的触摸板手势管理工具(缩写:dgm),使用 Flutter 构建。 diff --git a/app/lib/constants/constants.dart b/app/lib/constants/constants.dart index 3065250..ab1bd88 100644 --- a/app/lib/constants/constants.dart +++ b/app/lib/constants/constants.dart @@ -21,6 +21,8 @@ const double defaultButtonHeight = 36; const userGestureConfigFilePath = 'deepin/dde-daemon/gesture.json'; +const defaultFontFamily = 'NotoSansSC'; + const deepinLogoutCommands = [ 'dbus-send', '--type=method_call', diff --git a/app/lib/themes/dark.dart b/app/lib/themes/dark.dart index 1d3f280..81b91a0 100644 --- a/app/lib/themes/dark.dart +++ b/app/lib/themes/dark.dart @@ -1,7 +1,13 @@ -import 'package:flutter/material.dart'; import 'package:dde_gesture_manager/constants/constants.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; + +final _darkTheme = ThemeData( + brightness: Brightness.dark, + fontFamily: kIsWeb ? null : defaultFontFamily, +); -var darkTheme = ThemeData.dark().copyWith( +var darkTheme = _darkTheme.copyWith( primaryColor: Colors.grey, scaffoldBackgroundColor: Color(0xff252525), backgroundColor: Color(0xff282828), @@ -9,21 +15,23 @@ var darkTheme = ThemeData.dark().copyWith( color: Color(0xffc0c6d4), ), dividerColor: Color(0xfff3f3f3), - textTheme: ThemeData.dark().textTheme.copyWith( + textTheme: _darkTheme.textTheme.copyWith( headline1: TextStyle( color: Color(0xffc0c6d4), + fontFamilyFallback: kIsWeb ? null : [defaultFontFamily], ), bodyText2: TextStyle( color: Color(0xffc0c6d4), + fontFamilyFallback: kIsWeb ? null : [defaultFontFamily], ), ), - popupMenuTheme: ThemeData.dark().popupMenuTheme.copyWith( + popupMenuTheme: _darkTheme.popupMenuTheme.copyWith( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(defaultBorderRadius), ), ), dialogBackgroundColor: Color(0xff202020), - tooltipTheme: ThemeData.dark().tooltipTheme.copyWith( + tooltipTheme: _darkTheme.tooltipTheme.copyWith( textStyle: TextStyle( color: Colors.grey, ), diff --git a/app/lib/themes/light.dart b/app/lib/themes/light.dart index 5c28a0d..1cb8ef5 100644 --- a/app/lib/themes/light.dart +++ b/app/lib/themes/light.dart @@ -1,7 +1,13 @@ import 'package:dde_gesture_manager/constants/constants.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -var lightTheme = ThemeData.light().copyWith( +final _lightTheme = ThemeData( + brightness: Brightness.light, + fontFamily: kIsWeb ? null : defaultFontFamily, +); + +var lightTheme = _lightTheme.copyWith( primaryColor: Colors.blue, scaffoldBackgroundColor: Color(0xfff8f8f8), backgroundColor: Color(0xffffffff), @@ -9,21 +15,23 @@ var lightTheme = ThemeData.light().copyWith( color: Color(0xff414d68), ), dividerColor: Colors.grey.shade600, - textTheme: ThemeData.light().textTheme.copyWith( + textTheme: _lightTheme.textTheme.copyWith( headline1: TextStyle( color: Color(0xff414d68), + fontFamilyFallback: kIsWeb ? null : [defaultFontFamily], ), bodyText2: TextStyle( color: Color(0xff414d68), + fontFamilyFallback: kIsWeb ? null : [defaultFontFamily], ), ), - popupMenuTheme: ThemeData.dark().popupMenuTheme.copyWith( + popupMenuTheme: _lightTheme.popupMenuTheme.copyWith( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(defaultBorderRadius), ), ), dialogBackgroundColor: Color(0xfffefefe), - tooltipTheme: ThemeData.dark().tooltipTheme.copyWith( + tooltipTheme: _lightTheme.tooltipTheme.copyWith( textStyle: TextStyle( color: Colors.grey.shade600, ),