Skip to content

Commit

Permalink
Merge pull request #155 from LittleLightForDestiny/quickfixes
Browse files Browse the repository at this point in the history
Quickfixes
  • Loading branch information
joaopmarquesini authored Feb 19, 2022
2 parents 6e71060 + f9fddb8 commit 1566486
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 41 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.firebase.crashlytics'

android {
compileSdkVersion 29
compileSdkVersion 31

lintOptions {
disable 'InvalidPackage'
Expand Down
4 changes: 1 addition & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="${applicationName}"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher">
<activity
Expand All @@ -25,9 +26,6 @@
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.debug.obsoleteApi=true
android.enableR8=true
6 changes: 2 additions & 4 deletions lib/pages/objectives/objectives.screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class ObjectivesScreenState extends State<ObjectivesScreen> with ProfileConsumer
right: max(screenPadding.right, 4),
bottom: max(screenPadding.bottom, 4),
top: 4),
itemCount: items.length,
itemCount: objectives.length,
gridDelegate: SliverSimpleGridDelegateWithFixedCrossAxisCount(crossAxisCount: isTablet ? 2 : 1),
itemBuilder: (context, index) => Container(height: 132, child: getItem(context, index)));
}
Expand All @@ -135,9 +135,7 @@ class ObjectivesScreenState extends State<ObjectivesScreen> with ProfileConsumer
TrackedObjective objective = objectives[index];
switch (objective.type) {
case TrackedObjectiveType.Triumph:
return RecordItemWidget(
key: Key("objective_${objective.hash}_objective_${objective.instanceId}_${objective.characterId}"),
hash: objective.hash);
return RecordItemWidget(key: Key("objective_${objective.hash}"), hash: objective.hash);

case TrackedObjectiveType.Item:
if (items[objective] != null) {
Expand Down
11 changes: 11 additions & 0 deletions lib/pages/triumphs/triumphs_root.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class TriumphsRootPageState extends PresentationNodesTabsScaffoldState<TriumphsR
destinySettings.legacyTriumphsRootNode,
destinySettings.legacySealsRootNode,
destinySettings.loreRootNode,
destinySettings.catalystsRootNode
];
final definitions = await manifest.getDefinitions<DestinyPresentationNodeDefinition>(rootNodes + subNodeHashes);
setState(() {
Expand Down Expand Up @@ -142,6 +143,7 @@ class TriumphsRootPageState extends PresentationNodesTabsScaffoldState<TriumphsR
Widget buildTriumphCategories(BuildContext context) {
final triumphsHash = destinySettings.triumphsRootNode;
final legacy = destinySettings.legacyTriumphsRootNode;
final catalystsHash = destinySettings.catalystsRootNode;
return MultiSectionScrollView(
[
if (triumphsHash != null)
Expand All @@ -152,6 +154,15 @@ class TriumphsRootPageState extends PresentationNodesTabsScaffoldState<TriumphsR
pathHashes: [triumphsHash, node.presentationNodeHash],
)),
if (triumphsHash != null) buildSpacer(),
if (catalystsHash != null) buildCategoryTitle(catalystsHash),
if (catalystsHash != null)
buildCategoryList(
catalystsHash,
(node) => onTriumphSelect(
node,
pathHashes: [catalystsHash, node.presentationNodeHash],
)),
if (catalystsHash != null) buildSpacer(),
if (legacy != null) buildCategoryTitle(legacy),
if (legacy != null)
buildCategoryList(
Expand Down
4 changes: 2 additions & 2 deletions lib/services/littlelight/objectives.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class ObjectivesService with StorageConsumer, ProfileConsumer, ManifestConsumer
await _loadTrackedObjectivesFromCache();
}
var dirty = false;
var itemObjectives = _trackedObjectives!.where((o) => o.type == TrackedObjectiveType.Item).toList();
var plugObjectives = _trackedObjectives!.where((o) => o.type == TrackedObjectiveType.Plug).toList();
final itemObjectives = _trackedObjectives!.where((o) => o.type == TrackedObjectiveType.Item).toList();
final plugObjectives = _trackedObjectives!.where((o) => o.type == TrackedObjectiveType.Plug).toList();
for (var o in itemObjectives) {
DestinyItemComponent? item = await findObjectiveItem(o);
if (item == null) {
Expand Down
4 changes: 4 additions & 0 deletions lib/services/profile/destiny_settings.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,8 @@ class DestinySettingsService with StorageConsumer, BungieApiConsumer, ManifestCo
int? get legacySealsRootNode {
return _currentSettings?.destiny2CoreSettings?.legacySealsRootNodeHash;
}

int? get catalystsRootNode {
return _currentSettings?.destiny2CoreSettings?.exoticCatalystsRootNodeHash;
}
}
6 changes: 3 additions & 3 deletions lib/services/storage/membership_storage.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ class MembershipStorage extends StorageBase<MembershipStorageKeys> {

Future<List<String>?> getLoadoutsOrder() async {
try {
final List<String>? json = await getJson(MembershipStorageKeys.loadoutsOrder);
final List<dynamic>? json = await getJson(MembershipStorageKeys.loadoutsOrder);
if (json == null) return null;
return json;
return json.map((s) => "$s").toList();
} catch (e) {
print("can't parse loadouts order");
print(e);
Expand All @@ -101,7 +101,7 @@ class MembershipStorage extends StorageBase<MembershipStorageKeys> {
}

Future<void> saveLoadoutsOrder(List<String> order) async {
await setJson(MembershipStorageKeys.cachedLoadouts, order);
await setJson(MembershipStorageKeys.loadoutsOrder, order);
}

Future<DestinyProfileResponse?> getCachedProfile() async {
Expand Down
25 changes: 14 additions & 11 deletions lib/widgets/dialogs/littlelight.base.dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class LittleLightBaseDialog extends StatelessWidget {
final double maxHeight;

const LittleLightBaseDialog(
{Key? key, this.titleBuilder, this.bodyBuilder, this.actionsBuilder, this.maxWidth = 600, this.maxHeight = 500})
{Key? key, this.titleBuilder, this.bodyBuilder, this.actionsBuilder, this.maxWidth = 600, this.maxHeight = 400})
: super(key: key);

CrossAxisAlignment get crossAxisAlignment => CrossAxisAlignment.stretch;
Expand All @@ -24,13 +24,19 @@ abstract class LittleLightBaseDialog extends StatelessWidget {

@override
Widget build(BuildContext context) {
final padding = getDialogInsetPaddings(context) ?? EdgeInsets.all(0);
final size = MediaQuery.of(context).size;
double maxWidth = this.maxWidth.clamp(0, size.width - padding.left - padding.right);
double maxHeight = this.maxHeight.clamp(0, size.height - padding.top - padding.bottom);
return Dialog(
insetPadding: getDialogInsetPaddings(context),
child: Column(
crossAxisAlignment: crossAxisAlignment,
mainAxisSize: MainAxisSize.min,
children: [buildTitleContainer(context), buildBodyContainer(context), buildActionsContainer(context)],
),
insetPadding: padding,
child: Container(
constraints: BoxConstraints(maxHeight: maxHeight, maxWidth: maxWidth),
child: Column(
crossAxisAlignment: crossAxisAlignment,
mainAxisSize: MainAxisSize.min,
children: [buildTitleContainer(context), buildBodyContainer(context), buildActionsContainer(context)],
)),
);
}

Expand All @@ -50,10 +56,7 @@ abstract class LittleLightBaseDialog extends StatelessWidget {
Widget buildBodyContainer(BuildContext context) {
final body = buildBody(context);
if (body == null) return Container();
return Container(
constraints: BoxConstraints(maxWidth: maxWidth, maxHeight: maxHeight),
padding: EdgeInsets.all(16),
child: body);
return Flexible(child: Container(padding: EdgeInsets.all(16), child: body));
}

Widget buildActionsContainer(BuildContext context) {
Expand Down
5 changes: 3 additions & 2 deletions lib/widgets/dialogs/tags/select_tag.dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ class TagListWidget extends StatelessWidget with ItemNotesConsumer {
@override
Widget build(BuildContext context) {
final tags = context.watch<TagsChangedNotifier>().tags;
return Column(
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: tags.map((t) => buildTag(context, t)).toList(),
);
));
}

Widget buildTag(BuildContext context, ItemNotesTag tag) => Container(
Expand Down
18 changes: 16 additions & 2 deletions lib/widgets/item_sockets/details_item_mods.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:bungie_api/models/destiny_item_socket_category_definition.dart';
import 'package:bungie_api/models/destiny_socket_category_definition.dart';
import 'package:bungie_api/models/destiny_stat_definition.dart';
import 'package:flutter/material.dart';
import 'package:little_light/core/theme/littlelight.theme.dart';
import 'package:little_light/utils/destiny_data.dart';
import 'package:little_light/utils/media_query_helper.dart';
import 'package:little_light/widgets/common/definition_provider.widget.dart';
Expand Down Expand Up @@ -204,6 +205,8 @@ class DetailsItemPerksWidgetState<T extends DetailsItemModsWidget> extends BaseI
var canEquip = controller?.canEquip(socketIndex, plugItemHash);
var selectedSocketIndex = controller.selectedSocketIndex;
bool selected = selectedSocketIndex == socketIndex;
int selectedPlugForSocket = controller.socketSelectedPlugHash(socketIndex);
bool isSelectedForSocket = plugItemHash == selectedPlugForSocket;
return Container(
key: Key("item_mod_$plugItemHash"),
child: AspectRatio(
Expand Down Expand Up @@ -236,10 +239,21 @@ class DetailsItemPerksWidgetState<T extends DetailsItemModsWidget> extends BaseI
child: Container(
color: Colors.black.withOpacity(.5),
),
)
),
if (!isSelectedForSocket)
Positioned(
key: Key('selected_$selectedPlugForSocket'),
child: Container(
color: LittleLightTheme.of(context).onSurfaceLayers.layer3,
padding: EdgeInsets.all(1),
child: ManifestImageWidget<DestinyInventoryItemDefinition>(selectedPlugForSocket)),
bottom: 2,
right: 2,
width: 24,
height: 24)
]),
onPressed: () {
controller.selectSocket(socketIndex, plugItemHash);
controller.selectSocket(socketIndex, selectedPlugForSocket);
},
)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ class ItemDetailsSocketDetailsWidgetState extends BaseSocketDetailsWidgetState<I
Widget buildMod(BuildContext context, int socketIndex, int plugItemHash) {
bool isFavorite = itemNotes.getNotesForItem(plugItemHash, null)?.tags?.contains("favorite") ?? false;
bool isSelected = plugItemHash == controller.selectedPlugHash;
Color borderColor = isSelected ? Theme.of(context).colorScheme.onSurface : Colors.grey.shade300.withOpacity(.5);
Color borderColor =
isSelected ? Theme.of(context).colorScheme.onSurface : Theme.of(context).colorScheme.onSurface.withOpacity(.5);

BorderSide borderSide = BorderSide(color: borderColor, width: 1);
BorderSide borderSide = BorderSide(color: borderColor, width: isSelected ? 3 : 1);
var def = controller.plugDefinitions[plugItemHash];
var energyType = def?.plug?.energyCost?.energyType ?? DestinyEnergyType.Any;
var energyCost = def?.plug?.energyCost?.energyCost ?? 0;
Expand Down

0 comments on commit 1566486

Please sign in to comment.