Skip to content

Commit

Permalink
Elevation was not working in the gradient card
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Feb 15, 2021
1 parent 18bdce1 commit 98115c1
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 11 deletions.
5 changes: 5 additions & 0 deletions lib/application/main/main_bloc.dart
Expand Up @@ -9,6 +9,7 @@ import 'package:genshindb/domain/services/genshin_service.dart';
import 'package:genshindb/domain/services/locale_service.dart';
import 'package:genshindb/domain/services/logging_service.dart';
import 'package:genshindb/domain/services/settings_service.dart';
import 'package:genshindb/domain/services/telemetry_service.dart';
import 'package:package_info/package_info.dart';

import '../bloc.dart';
Expand All @@ -22,6 +23,7 @@ class MainBloc extends Bloc<MainEvent, MainState> {
final GenshinService _genshinService;
final SettingsService _settingsService;
final LocaleService _localeService;
final TelemetryService _telemetryService;

final CharactersBloc _charactersBloc;
final WeaponsBloc _weaponsBloc;
Expand All @@ -33,6 +35,7 @@ class MainBloc extends Bloc<MainEvent, MainState> {
this._genshinService,
this._settingsService,
this._localeService,
this._telemetryService,
this._charactersBloc,
this._weaponsBloc,
this._homeBloc,
Expand Down Expand Up @@ -85,6 +88,8 @@ class MainBloc extends Bloc<MainEvent, MainState> {

final packageInfo = await PackageInfo.fromPlatform();
final settings = _settingsService.appSettings;
await _telemetryService.trackInit(settings);

if (init) {
await Future.delayed(const Duration(milliseconds: 600));
}
Expand Down
4 changes: 4 additions & 0 deletions lib/domain/services/telemetry_service.dart
@@ -1,3 +1,5 @@
import 'package:genshindb/domain/models/models.dart';

abstract class TelemetryService {
Future<void> initTelemetry();

Expand Down Expand Up @@ -25,4 +27,6 @@ abstract class TelemetryService {
Future<void> trackCalculatorItemAscMaterialLoaded(String item);

Future<void> trackTierListOpened();

Future<void> trackInit(AppSettings settings);
}
6 changes: 3 additions & 3 deletions lib/infrastructure/device_info_service.dart
Expand Up @@ -13,11 +13,11 @@ class DeviceInfoServiceImpl implements DeviceInfoService {
final deviceInfo = DeviceInfoPlugin();
final androidInfo = await deviceInfo.androidInfo;
_deviceInfo = {
'model': androidInfo.model,
'os': '${androidInfo.version.sdkInt}',
'Model': androidInfo.model,
'OsVersion': '${androidInfo.version.sdkInt}',
};
} catch (ex) {
_deviceInfo = {'model': 'N/A', 'os': 'N/A'};
_deviceInfo = {'Model': 'N/A', 'OsVersion': 'N/A'};
}
}
}
11 changes: 11 additions & 0 deletions lib/infrastructure/telemetry/telemetry_service.dart
@@ -1,3 +1,5 @@
import 'package:enum_to_string/enum_to_string.dart';
import 'package:genshindb/domain/models/models.dart';
import 'package:genshindb/domain/services/device_info_service.dart';
import 'package:genshindb/domain/services/telemetry_service.dart';
import 'package:genshindb/infrastructure/telemetry/flutter_appcenter_bundle.dart';
Expand Down Expand Up @@ -82,4 +84,13 @@ class TelemetryServiceImpl implements TelemetryService {
Future<void> trackTierListOpened() async {
await trackEventAsync('TierList-Opened');
}

@override
Future<void> trackInit(AppSettings settings) async {
await trackEventAsync('Init', {
'Theme': EnumToString.convertToString(settings.appTheme),
'AccentColor': EnumToString.convertToString(settings.accentColor),
'Language': EnumToString.convertToString(settings.appLanguage),
});
}
}
2 changes: 2 additions & 0 deletions lib/main.dart
Expand Up @@ -98,11 +98,13 @@ class MyApp extends StatelessWidget {
final genshinService = getIt<GenshinService>();
final settingsService = getIt<SettingsService>();
final localeService = getIt<LocaleService>();
final telemetryService = getIt<TelemetryService>();
return MainBloc(
loggingService,
genshinService,
settingsService,
localeService,
telemetryService,
ctx.read<CharactersBloc>(),
ctx.read<WeaponsBloc>(),
ctx.read<HomeBloc>(),
Expand Down
5 changes: 4 additions & 1 deletion lib/presentation/artifacts/widgets/artifact_card.dart
Expand Up @@ -20,6 +20,7 @@ class ArtifactCard extends StatelessWidget {
final double imgWidth;
final double imgHeight;
final bool withoutDetails;
final bool withElevation;

const ArtifactCard({
Key key,
Expand All @@ -30,6 +31,7 @@ class ArtifactCard extends StatelessWidget {
@required this.bonus,
this.imgWidth = 140,
this.imgHeight = 120,
this.withElevation = true,
}) : withoutDetails = false,
super(key: key);

Expand All @@ -43,6 +45,7 @@ class ArtifactCard extends StatelessWidget {
imgHeight = 60,
bonus = const [],
withoutDetails = true,
withElevation = false,
super(key: key);

@override
Expand All @@ -52,7 +55,7 @@ class ArtifactCard extends StatelessWidget {
onTap: () => _gotoDetailPage(context),
child: GradientCard(
shape: Styles.mainCardShape,
elevation: Styles.cardTenElevation,
elevation: withElevation ? Styles.cardTenElevation : 0,
gradient: rarity.getRarityGradient(),
child: Padding(
padding: Styles.edgeInsetAll5,
Expand Down
Expand Up @@ -16,8 +16,8 @@ class CharacterAscensionMaterials extends StatelessWidget {
final widgets = images
.map(
(e) => FadeInImage(
height: 20,
width: 20,
height: 25,
width: 25,
placeholder: MemoryImage(kTransparentImage),
image: AssetImage(e),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/shared/gradient_card.dart
Expand Up @@ -33,7 +33,7 @@ class GradientCard extends StatelessWidget {
child: Material(
type: MaterialType.card,
color: Colors.transparent,
shadowColor: shadowColor ?? Colors.transparent,
// shadowColor: shadowColor ?? Colors.transparent,
elevation: elevation ?? 0,
shape: shape ?? const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4))),
clipBehavior: clipBehavior,
Expand Down
3 changes: 1 addition & 2 deletions lib/presentation/shared/styles.dart
Expand Up @@ -11,8 +11,7 @@ class Styles {
topRight: Radius.circular(10),
),
);
static final RoundedRectangleBorder floatingCardShape =
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20));
static final RoundedRectangleBorder floatingCardShape = RoundedRectangleBorder(borderRadius: BorderRadius.circular(20));

static const double cardThreeElevation = 3;
static const double cardTenElevation = 10;
Expand Down
5 changes: 4 additions & 1 deletion lib/presentation/weapons/widgets/weapon_card.dart
Expand Up @@ -28,6 +28,7 @@ class WeaponCard extends StatelessWidget {
final double imgHeight;
final bool withoutDetails;
final bool isInSelectionMode;
final bool withElevation;

const WeaponCard({
Key key,
Expand All @@ -42,6 +43,7 @@ class WeaponCard extends StatelessWidget {
this.imgWidth = 160,
this.imgHeight = 140,
this.isInSelectionMode = false,
this.withElevation = true,
}) : withoutDetails = false,
super(key: key);

Expand All @@ -59,6 +61,7 @@ class WeaponCard extends StatelessWidget {
subStatValue = null,
withoutDetails = true,
isInSelectionMode = false,
withElevation = false,
super(key: key);

@override
Expand All @@ -69,7 +72,7 @@ class WeaponCard extends StatelessWidget {
onTap: () => _gotoWeaponPage(context),
child: GradientCard(
shape: Styles.mainCardShape,
elevation: Styles.cardTenElevation,
elevation: withElevation ? Styles.cardTenElevation : 0,
gradient: rarity.getRarityGradient(),
child: Padding(
padding: Styles.edgeInsetAll5,
Expand Down
7 changes: 7 additions & 0 deletions pubspec.lock
Expand Up @@ -232,6 +232,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
enum_to_string:
dependency: "direct main"
description:
name: enum_to_string
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.14"
fake_async:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Expand Up @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.7+25
version: 1.0.7+26

environment:
sdk: ">=2.10.4 <3.0.0"
Expand All @@ -25,6 +25,7 @@ dependencies:
data_connection_checker: ^0.3.4
device_info: ^1.0.0
dog: ^1.3.1
enum_to_string: ^1.0.14
flutter:
sdk: flutter
flutter_bloc: ^6.1.1
Expand Down

0 comments on commit 98115c1

Please sign in to comment.