-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ab9298
commit c97f601
Showing
61 changed files
with
2,177 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
description: This file stores settings for Dart & Flutter DevTools. | ||
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states | ||
extensions: | ||
- drift: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export 'cubit/arsenal_cubit.dart'; | ||
export 'widgets/widgets.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'package:bloc/bloc.dart'; | ||
import 'package:collection/collection.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:sentry_flutter/sentry_flutter.dart'; | ||
import 'package:warframestat_repository/warframestat_repository.dart'; | ||
|
||
part 'arsenal_state.dart'; | ||
|
||
class ArsenalCubit extends Cubit<ArsenalState> { | ||
ArsenalCubit(this.repository) : super(ArsenalInitial()); | ||
|
||
final WarframestatRepository repository; | ||
|
||
late List<MasteryProgress> _xpInfo; | ||
|
||
Future<void> updateArsenal(String username, {bool update = false}) async { | ||
try { | ||
emit(ArsenalUpdating()); | ||
await repository.updateArsenalItems(update: update); | ||
|
||
_xpInfo = await repository.syncXpInfo(username); | ||
|
||
emit(ArsenalSuccess(_xpInfo)); | ||
} catch (e, stack) { | ||
debugPrint(e.toString()); | ||
emit(ArsenalFailure()); | ||
|
||
await Sentry.captureException(e, stackTrace: stack); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
part of 'arsenal_cubit.dart'; | ||
|
||
sealed class ArsenalState extends Equatable { | ||
const ArsenalState(); | ||
|
||
@override | ||
List<Object> get props => []; | ||
} | ||
|
||
final class ArsenalInitial extends ArsenalState {} | ||
|
||
final class ArsenalUpdating extends ArsenalState {} | ||
|
||
final class ArsenalSuccess extends ArsenalState { | ||
const ArsenalSuccess(this.xpInfo); | ||
|
||
final List<MasteryProgress> xpInfo; | ||
|
||
List<MasteryProgress> get inProgress { | ||
return xpInfo.where((i) => i.rank < i.maxRank).toList() | ||
..sort((a, b) { | ||
if (a.rank == 0 && b.rank == 0) return 0; | ||
if (a.rank == 0) return 1; | ||
if (b.rank == 0) return -1; | ||
|
||
return a.rank.compareTo(b.rank); | ||
}); | ||
} | ||
|
||
List<MasteryProgress> get warframes => | ||
xpInfo.whereNot((i) => i.item.type.isWeapon).toList(); | ||
|
||
List<MasteryProgress> get weapons => | ||
xpInfo.where((i) => i.item.type.isWeapon).toList(); | ||
|
||
List<MasteryProgress> get primaries => | ||
xpInfo.where((i) => i.item.type.isPrimary).toList(); | ||
|
||
List<MasteryProgress> get secondary => | ||
xpInfo.where((i) => i.item.type.isSecondary).toList(); | ||
|
||
List<MasteryProgress> get melee => | ||
xpInfo.where((i) => i.item.type.isMelee).toList(); | ||
|
||
@override | ||
List<Object> get props => [xpInfo]; | ||
} | ||
|
||
final class ArsenalFailure extends ArsenalState {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:cached_network_image/cached_network_image.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:navis/utils/item_extensions.dart'; | ||
import 'package:navis_ui/navis_ui.dart'; | ||
import 'package:warframestat_repository/warframestat_repository.dart'; | ||
|
||
class ArsenalItemWidget extends StatelessWidget { | ||
const ArsenalItemWidget({super.key, required this.arsenalItem}); | ||
|
||
final MasteryProgress arsenalItem; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AppCard( | ||
child: ListTile( | ||
leading: CachedNetworkImage( | ||
imageUrl: arsenalItem.item.imageUrl, | ||
width: 50, | ||
), | ||
title: Text(arsenalItem.item.name), | ||
subtitle: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text('Rank ${arsenalItem.rank}'), | ||
LinearProgressIndicator( | ||
value: arsenalItem.rank / arsenalItem.maxRank, | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export 'arsenal_item.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:navis/arsenal/arsenal.dart'; | ||
import 'package:navis/home/widgets/section.dart'; | ||
import 'package:navis_ui/navis_ui.dart'; | ||
|
||
class MasteryInProgressSection extends StatelessWidget { | ||
const MasteryInProgressSection({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Section( | ||
title: const Text('Mastery in progress'), | ||
content: BlocBuilder<ArsenalCubit, ArsenalState>( | ||
builder: (context, state) { | ||
const padding = EdgeInsets.symmetric(vertical: 16); | ||
|
||
if (state is ArsenalUpdating) { | ||
return const Padding( | ||
padding: padding, | ||
child: Text('Updating XP info'), | ||
); | ||
} | ||
|
||
if (state is ArsenalFailure) { | ||
return const Padding( | ||
padding: padding, | ||
child: Text('Error updating XP info'), | ||
); | ||
} | ||
|
||
if (state is! ArsenalSuccess) { | ||
return const Padding( | ||
padding: padding, | ||
child: WarframeSpinner(size: 100), | ||
); | ||
} | ||
|
||
return Column( | ||
children: [ | ||
for (final i in state.inProgress.take(5)) | ||
ArsenalItemWidget(arsenalItem: i), | ||
], | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export 'activities_section.dart'; | ||
export 'mastery_section.dart'; | ||
export 'news_section.dart'; |
Oops, something went wrong.