Skip to content

Commit

Permalink
update Avatar, remove readViewCompatibleMode
Browse files Browse the repository at this point in the history
  • Loading branch information
3003h committed Aug 25, 2024
1 parent 8824a61 commit 572e8f4
Show file tree
Hide file tree
Showing 10 changed files with 336 additions and 282 deletions.
14 changes: 13 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,17 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20"
implementation "androidx.startup:startup-runtime:1.1.1"
implementation 'com.google.mlkit:barcode-scanning:17.2.0'
implementation 'com.google.mlkit:barcode-scanning:17.3.0'
}

configurations.configureEach {
resolutionStrategy {
force 'androidx.core:core-ktx:1.6.0'
}
}

ext {
compileSdkVersion = 34
targetSdkVersion = 34
appCompatVersion = "1.7.0"
}
13 changes: 13 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ allprojects {
}
}

// 临时解决 error: resource android:attr/lStar not found
subprojects {
afterEvaluate { project ->
if (project.plugins.hasPlugin("com.android.application") ||
project.plugins.hasPlugin("com.android.library")) {
project.android {
compileSdkVersion 34
buildToolsVersion "34.0.0"
}
}
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
Expand Down
16 changes: 8 additions & 8 deletions lib/common/service/ehsetting_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,9 @@ class EhSettingService extends ProfileService {
bool get showCommentAvatar => _showCommentAvatar.value;
set showCommentAvatar(bool val) => _showCommentAvatar.value = val;

final _boringAvatarsType = BoringAvatarsType.beam.obs;
BoringAvatarsType get boringAvatarsType => _boringAvatarsType.value;
set boringAvatarsType(BoringAvatarsType val) =>
_boringAvatarsType.value = val;
final _boringAvatarsType = BoringAvatarType.beam.obs;
BoringAvatarType get boringAvatarsType => _boringAvatarsType.value;
set boringAvatarsType(BoringAvatarType val) => _boringAvatarsType.value = val;

final _avatarBorderRadiusType = AvatarBorderRadiusType.circle.obs;
AvatarBorderRadiusType get avatarBorderRadiusType =>
Expand Down Expand Up @@ -283,8 +282,9 @@ class EhSettingService extends ProfileService {
}

// readViewCompatibleModes
final _readViewCompatibleMode = true.obs;
bool get readViewCompatibleMode => _readViewCompatibleMode.value;
final _readViewCompatibleMode = false.obs;
// bool get readViewCompatibleMode => _readViewCompatibleMode.value;
bool get readViewCompatibleMode => false;
set readViewCompatibleMode(bool val) => _readViewCompatibleMode.value = val;

// translateSearchHistory
Expand Down Expand Up @@ -507,8 +507,8 @@ class EhSettingService extends ProfileService {

// _boringAvatarsType
boringAvatarsType = EnumToString.fromString(
BoringAvatarsType.values, ehConfig.boringAvatarsType ?? '') ??
BoringAvatarsType.beam;
BoringAvatarType.values, ehConfig.boringAvatarsType ?? '') ??
BoringAvatarType.beam;
everFromEnum(_boringAvatarsType, (String value) {
ehConfig = ehConfig.copyWith(boringAvatarsType: value.oN);
});
Expand Down
9 changes: 6 additions & 3 deletions lib/pages/gallery/view/comment_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,14 @@ class _CommentUser extends StatelessWidget {
: avatarSize / 2;

return _ehSettingService.avatarType == AvatarType.boringAvatar
? BoringAvatars(
? BoringAvatar(
name: _name,
colors: [...ThemeColors.catColorList],
// colors: [...ThemeColors.catColorList],
palette: BoringAvatarPalette(
ThemeColors.catColorList..shuffle(),
),
type: _ehSettingService.boringAvatarsType,
square: true,
// square: true,
)
: TextAvatar(
name: _name,
Expand Down
43 changes: 23 additions & 20 deletions lib/pages/setting/avatar_setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,43 +104,43 @@ class AvatarSettingPage extends StatelessWidget {
.listInsetGrouped(children: [
EhCupertinoListTile(
title:
CupertinoSlidingSegmentedControl<BoringAvatarsType>(
children: <BoringAvatarsType, Widget>{
BoringAvatarsType.beam: _BoringAvatar(
BoringAvatarsType.beam,
CupertinoSlidingSegmentedControl<BoringAvatarType>(
children: <BoringAvatarType, Widget>{
BoringAvatarType.beam: _BoringAvatar(
BoringAvatarType.beam,
borderRadiusType:
_ehSettingService.avatarBorderRadiusType,
),
BoringAvatarsType.bauhaus: _BoringAvatar(
BoringAvatarsType.bauhaus,
BoringAvatarType.bauhaus: _BoringAvatar(
BoringAvatarType.bauhaus,
borderRadiusType:
_ehSettingService.avatarBorderRadiusType,
),
BoringAvatarsType.sunset: _BoringAvatar(
BoringAvatarsType.sunset,
BoringAvatarType.sunset: _BoringAvatar(
BoringAvatarType.sunset,
borderRadiusType:
_ehSettingService.avatarBorderRadiusType,
),
BoringAvatarsType.marble: _BoringAvatar(
BoringAvatarsType.marble,
BoringAvatarType.marble: _BoringAvatar(
BoringAvatarType.marble,
borderRadiusType:
_ehSettingService.avatarBorderRadiusType,
),
BoringAvatarsType.pixel: _BoringAvatar(
BoringAvatarsType.pixel,
BoringAvatarType.pixel: _BoringAvatar(
BoringAvatarType.pixel,
borderRadiusType:
_ehSettingService.avatarBorderRadiusType,
),
BoringAvatarsType.ring: _BoringAvatar(
BoringAvatarsType.ring,
BoringAvatarType.ring: _BoringAvatar(
BoringAvatarType.ring,
borderRadiusType:
_ehSettingService.avatarBorderRadiusType,
),
},
groupValue: _ehSettingService.boringAvatarsType,
onValueChanged: (BoringAvatarsType? value) {
onValueChanged: (BoringAvatarType? value) {
_ehSettingService.boringAvatarsType =
value ?? BoringAvatarsType.beam;
value ?? BoringAvatarType.beam;
},
),
),
Expand Down Expand Up @@ -247,7 +247,7 @@ class _BoringAvatar extends StatelessWidget {
super.key,
});

final BoringAvatarsType type;
final BoringAvatarType type;
final String? name;
final AvatarBorderRadiusType? borderRadiusType;

Expand All @@ -272,12 +272,15 @@ class _BoringAvatar extends StatelessWidget {
child: AnimatedClipRRect(
borderRadius: borderRadius,
duration: const Duration(milliseconds: 300),
child: AnimatedBoringAvatars(
child: AnimatedBoringAvatar(
duration: const Duration(milliseconds: 300),
name: _username,
colors: ThemeColors.catColorList,
// colors: ThemeColors.catColorList,
palette: BoringAvatarPalette(
ThemeColors.catColorList..shuffle(),
),
type: type,
square: true,
// square: true,
),
),
// child: SizedBox.shrink(),
Expand Down
26 changes: 13 additions & 13 deletions lib/pages/setting/read_setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,19 @@ class ReadSettingList extends StatelessWidget {
]),

// 兼容模式
SliverCupertinoListSection.listInsetGrouped(children: [
EhCupertinoListTile(
title: Text(L10n.of(context).read_view_compatible_mode),
trailing: Obx(() {
return CupertinoSwitch(
value: ehSettingService.readViewCompatibleMode,
onChanged: (bool val) {
ehSettingService.readViewCompatibleMode = val;
},
);
}),
),
]),
// SliverCupertinoListSection.listInsetGrouped(children: [
// EhCupertinoListTile(
// title: Text(L10n.of(context).read_view_compatible_mode),
// trailing: Obx(() {
// return CupertinoSwitch(
// value: ehSettingService.readViewCompatibleMode,
// onChanged: (bool val) {
// ehSettingService.readViewCompatibleMode = val;
// },
// );
// }),
// ),
// ]),
]);
}
}
Expand Down
42 changes: 29 additions & 13 deletions lib/pages/tab/controller/splash_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,37 @@ class SplashController extends GetxController {
} else {
// For sharing or opening urls/text coming from outside the app while the app is in the memory
_intentDataStreamSubscription =
ReceiveSharingIntent.getTextStream().listen((String value) {
sharedText = value;
logger.d('getTextStream Shared: $sharedText');
_startHome(sharedText ?? '', replace: false);
}, onError: (err) {
logger.e('getTextStream error: $err');
});
ReceiveSharingIntent.instance.getMediaStream().listen(
(List<SharedMediaFile> value) {
if (value.isEmpty) {
Get.offNamed(EHRoutes.home);
} else {
_parseSharedMediaFile(value.first);
}
},
onError: (err) {
logger.e('getTextStream error: $err');
},
);

// For sharing or opening urls/text coming from outside the app while the app is closed
ReceiveSharingIntent.getInitialText().then((String? value) {
// logger.i('value(closed): $value');
sharedText = value ?? '';
logger.t('Shared: $sharedText');
_startHome(sharedText ?? '');
});
ReceiveSharingIntent.instance.getInitialMedia().then(
(List<SharedMediaFile> value) {
if (value.isEmpty) {
Get.offNamed(EHRoutes.home);
} else {
_parseSharedMediaFile(value.first);
}
},
);
}
}

void _parseSharedMediaFile(SharedMediaFile sharedMediaFile) {
if (sharedMediaFile.type == SharedMediaType.text) {
sharedText = sharedMediaFile.path;
logger.t('Shared: $sharedText');
_startHome(sharedText ?? '');
}
}

Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import firebase_core
import firebase_crashlytics
import flutter_inappwebview_macos
import isar_flutter_libs
import local_auth_darwin
import package_info
import package_info_plus
import path_provider_foundation
Expand All @@ -31,6 +32,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseCrashlyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCrashlyticsPlugin"))
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
IsarFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "IsarFlutterLibsPlugin"))
FLALocalAuthPlugin.register(with: registry.registrar(forPlugin: "FLALocalAuthPlugin"))
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
Expand Down
Loading

0 comments on commit 572e8f4

Please sign in to comment.